Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade TS #35

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/orange-cobras-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@nornir/core": minor
"@nornir/rest": minor
---

update to ts 5.5
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
version: 9.7.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-demand-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
version: 9.7.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
version: 9.7.0
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.2.0
version: 9.7.0
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"plop": "^3.1.2",
"scripts": "workspace:^",
"syncpack": "^9.8.4",
"ts-patch": "^3.1.1",
"ts-patch": "^3.2.1",
"turbo": "^1.9.2",
"typescript": "5.4.2"
"typescript": "^5.5.4"
},
"engines": {
"node": ">=18.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"author": "John Conley",
"devDependencies": {
"@jest/globals": "^29.5.0",
"@nrfcloud/ts-json-schema-transformer": "^1.4.2",
"@nrfcloud/ts-json-schema-transformer": "^2.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.15.11",
"esbuild": "^0.17.18",
"eslint": "^8.45.0",
"jest": "^29.5.0",
"ts-patch": "^3.1.1",
"typescript": "5.4.2"
"ts-patch": "^3.2.1",
"typescript": "^5.5.4"
},
"engines": {
"node": ">=18.0.0",
Expand Down
13 changes: 8 additions & 5 deletions packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"nornir-oas": "./dist/cli/cli.js"
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^11.5.4",
"@apidevtools/json-schema-ref-parser": "^11.7.0",
"@nornir/core": "workspace:^",
"@nrfcloud/ts-json-schema-transformer": "^1.4.2",
"@nrfcloud/ts-json-schema-transformer": "^2.0.0",
"@types/aws-lambda": "^8.10.115",
"ajv": "^8.16.0",
"atlassian-openapi": "^1.0.18",
Expand All @@ -21,7 +21,7 @@
"openapi-types": "^12.1.0",
"trouter": "^3.2.1",
"ts-is-present": "^1.2.2",
"ts-json-schema-generator": "1.5.1",
"ts-json-schema-generator": "^2.4.0-next.2",
"ts-morph": "^23.0.0",
"tsutils": "^3.21.0",
"yargs": "^17.7.2"
Expand All @@ -36,8 +36,11 @@
"@types/yargs": "^17.0.32",
"eslint": "^8.45.0",
"jest": "^29.5.0",
"ts-patch": "^3.1.1",
"typescript": "5.4.2"
"ts-patch": "^3.2.1",
"typescript": "^5.5.4"
},
"peerDependencies": {
"typescript": "^5.5.4"
},
"engines": {
"node": ">=18.0.0",
Expand Down
9 changes: 7 additions & 2 deletions packages/rest/src/transform/project.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Options as AJVBaseOptions } from "ajv";
import {
BaseType,
CompletedConfig,
Config,
createParser,
NodeParser,
ReferenceType,
SchemaGenerator,
StringType,
SubNodeParser,
Expand Down Expand Up @@ -49,16 +49,21 @@
loopEnum: 20,
} satisfies Options;

export const SCHEMA_DEFAULTS = {
expose: "export",
jsDoc: "extended",
sortProps: true,
strictTuples: false,
encodeRefs: false,
additionalProperties: false,
topRef: false,
discriminatorType: "open-api",
skipTypeCheck: true,
extraTags: [],
functions: "fail",
markdownDescription: false,
minify: true,
} satisfies Config;

Check warning on line 66 in packages/rest/src/transform/project.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

export type Options = AJVOptions & SchemaConfig;

Expand Down Expand Up @@ -104,7 +109,7 @@
}
}

export function getSchemaNodeParser(program: ts.Program, config: Config): NodeParser {
export function getSchemaNodeParser(program: ts.Program, config: CompletedConfig): NodeParser {

Check warning on line 112 in packages/rest/src/transform/project.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 112 in packages/rest/src/transform/project.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
return createParser(program as unknown as Parameters<typeof createParser>[0], config, prs => {
prs.addNodeParser(new TemplateExpressionNodeParser());
prs.addNodeParser(new UndefinedIdentifierParser());
Expand Down
6 changes: 3 additions & 3 deletions packages/rest/src/transform/transform.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import {
BaseType,
createFormatter,
createParser,

Check warning on line 4 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Lint Back-end code

'createParser' is defined but never used. Allowed unused vars must match /^_/u
Definition,
SchemaGenerator,
StringType,

Check warning on line 7 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Lint Back-end code

'StringType' is defined but never used. Allowed unused vars must match /^_/u
SubNodeParser,

Check warning on line 8 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Lint Back-end code

'SubNodeParser' is defined but never used. Allowed unused vars must match /^_/u
SubTypeFormatter,
UndefinedType,
} from "ts-json-schema-generator";
import ts from "typescript";
import {
AJV_DEFAULTS,
AJVOptions,

Check warning on line 15 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Lint Back-end code

'AJVOptions' is defined but never used. Allowed unused vars must match /^_/u
getSchemaNodeParser,
Options,
Project,
SCHEMA_DEFAULTS,
SchemaConfig,

Check warning on line 20 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Lint Back-end code

'SchemaConfig' is defined but never used. Allowed unused vars must match /^_/u
} from "./project.js";
import { FileTransformer } from "./transformers/file-transformer.js";

Expand Down Expand Up @@ -51,24 +51,24 @@
encodeRefs,
} = options ?? {};

const schemaConfig = {
...SCHEMA_DEFAULTS,
jsDoc: jsDoc ?? SCHEMA_DEFAULTS.jsDoc,
strictTuples: strictTuples ?? SCHEMA_DEFAULTS.strictTuples,
encodeRefs: encodeRefs ?? SCHEMA_DEFAULTS.encodeRefs,
additionalProperties: additionalProperties ?? SCHEMA_DEFAULTS.additionalProperties,
sortProps: sortProps ?? SCHEMA_DEFAULTS.sortProps,
expose,
} satisfies SchemaConfig;
expose: expose ?? SCHEMA_DEFAULTS.expose,

Check warning on line 61 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 61 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
} as const;

Check warning on line 62 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

const validationConfig = {
...AJV_DEFAULTS,
loopRequired: loopRequired ?? AJV_DEFAULTS.loopRequired,
loopEnum: loopEnum ?? AJV_DEFAULTS.loopEnum,
removeAdditional: removeAdditional ?? AJV_DEFAULTS.removeAdditional,
useDefaults: useDefaults ?? AJV_DEFAULTS.useDefaults,
allErrors: allErrors ?? AJV_DEFAULTS.allErrors,
} satisfies AJVOptions;
} as const;

Check warning on line 71 in packages/rest/src/transform/transform.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

const nodeParser = getSchemaNodeParser(program, schemaConfig);
const typeFormatter = createFormatter({
Expand Down
6 changes: 3 additions & 3 deletions packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@nrfcloud/ts-json-schema-transformer": "^1.4.2",
"@nrfcloud/ts-json-schema-transformer": "^2.0.0",
"@types/aws-lambda": "^8.10.115",
"@types/jest": "^29.4.0",
"@types/node": "^18.15.11",
"esbuild": "^0.17.18",
"eslint": "^8.45.0",
"jest": "^29.5.0",
"ts-patch": "^3.1.1",
"typescript": "5.4.2"
"ts-patch": "^3.2.1",
"typescript": "^5.5.4"
},
"engines": {
"node": ">=18.0.0",
Expand Down
Loading
Loading