Skip to content

Commit

Permalink
Merge pull request #35 from jfrconley/joco/upgrade-ts
Browse files Browse the repository at this point in the history
Upgrade TS
  • Loading branch information
jfrconley authored Aug 14, 2024
2 parents 26c1031 + 75c7a2e commit 411b711
Show file tree
Hide file tree
Showing 12 changed files with 4,530 additions and 3,578 deletions.
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 @@ -58,6 +58,11 @@ export const SCHEMA_DEFAULTS = {
additionalProperties: false,
topRef: false,
discriminatorType: "open-api",
skipTypeCheck: true,
extraTags: [],
functions: "fail",
markdownDescription: false,
minify: true,
} satisfies Config;

export type Options = AJVOptions & SchemaConfig;
Expand Down Expand Up @@ -104,7 +109,7 @@ export class NornirParserThrow implements SubNodeParser {
}
}

export function getSchemaNodeParser(program: ts.Program, config: Config): NodeParser {
export function getSchemaNodeParser(program: ts.Program, config: CompletedConfig): NodeParser {
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
Expand Up @@ -58,8 +58,8 @@ export function transform(program: ts.Program, options?: Options): ts.Transforme
encodeRefs: encodeRefs ?? SCHEMA_DEFAULTS.encodeRefs,
additionalProperties: additionalProperties ?? SCHEMA_DEFAULTS.additionalProperties,
sortProps: sortProps ?? SCHEMA_DEFAULTS.sortProps,
expose,
} satisfies SchemaConfig;
expose: expose ?? SCHEMA_DEFAULTS.expose,
} as const;

const validationConfig = {
...AJV_DEFAULTS,
Expand All @@ -68,7 +68,7 @@ export function transform(program: ts.Program, options?: Options): ts.Transforme
removeAdditional: removeAdditional ?? AJV_DEFAULTS.removeAdditional,
useDefaults: useDefaults ?? AJV_DEFAULTS.useDefaults,
allErrors: allErrors ?? AJV_DEFAULTS.allErrors,
} satisfies AJVOptions;
} as const;

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

0 comments on commit 411b711

Please sign in to comment.