zod-codegen 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +14 -14
- package/.github/workflows/release.yml +3 -3
- package/.nvmrc +1 -1
- package/CHANGELOG.md +29 -0
- package/dist/src/assets/manifest.json +2 -2
- package/dist/src/generator.js +3 -3
- package/dist/src/http/fetch-client.js +0 -1
- package/dist/src/services/code-generator.service.js +549 -58
- package/dist/src/services/file-reader.service.js +27 -14
- package/dist/src/services/import-builder.service.js +4 -11
- package/dist/src/services/type-builder.service.js +16 -9
- package/dist/src/types/openapi.js +6 -6
- package/dist/tests/unit/generator.test.js +1 -0
- package/eslint.config.mjs +18 -0
- package/package.json +25 -25
- package/src/assets/manifest.json +2 -2
- package/src/generator.ts +3 -3
- package/src/http/fetch-client.ts +4 -4
- package/src/services/code-generator.service.ts +1212 -88
- package/src/services/file-reader.service.ts +26 -13
- package/src/services/import-builder.service.ts +8 -11
- package/src/services/type-builder.service.ts +19 -12
- package/src/types/openapi.ts +6 -6
- package/tsconfig.json +4 -4
- package/scripts/update-manifest.js +0 -31
package/.github/workflows/ci.yml
CHANGED
|
@@ -16,17 +16,17 @@ jobs:
|
|
|
16
16
|
runs-on: ${{ matrix.os }}
|
|
17
17
|
strategy:
|
|
18
18
|
matrix:
|
|
19
|
-
node-version: [
|
|
19
|
+
node-version: ['24.11.1']
|
|
20
20
|
os: [ubuntu-latest]
|
|
21
21
|
|
|
22
22
|
steps:
|
|
23
23
|
- name: Checkout code
|
|
24
|
-
uses: actions/checkout@
|
|
24
|
+
uses: actions/checkout@v5
|
|
25
25
|
with:
|
|
26
26
|
fetch-depth: 0
|
|
27
27
|
|
|
28
28
|
- name: Setup Node.js ${{ matrix.node-version }}
|
|
29
|
-
uses: actions/setup-node@
|
|
29
|
+
uses: actions/setup-node@v5
|
|
30
30
|
with:
|
|
31
31
|
node-version: ${{ matrix.node-version }}
|
|
32
32
|
cache: 'npm'
|
|
@@ -50,8 +50,8 @@ jobs:
|
|
|
50
50
|
run: npm run test:coverage
|
|
51
51
|
|
|
52
52
|
- name: Upload coverage to Codecov
|
|
53
|
-
if: matrix.node-version ==
|
|
54
|
-
uses: codecov/codecov-action@
|
|
53
|
+
if: matrix.node-version == '24.11.1' && matrix.os == 'ubuntu-latest'
|
|
54
|
+
uses: codecov/codecov-action@v5
|
|
55
55
|
with:
|
|
56
56
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
57
57
|
file: ./coverage/lcov.info
|
|
@@ -64,12 +64,12 @@ jobs:
|
|
|
64
64
|
|
|
65
65
|
steps:
|
|
66
66
|
- name: Checkout code
|
|
67
|
-
uses: actions/checkout@
|
|
67
|
+
uses: actions/checkout@v5
|
|
68
68
|
|
|
69
69
|
- name: Setup Node.js
|
|
70
|
-
uses: actions/setup-node@
|
|
70
|
+
uses: actions/setup-node@v5
|
|
71
71
|
with:
|
|
72
|
-
node-version:
|
|
72
|
+
node-version: '24.11.1'
|
|
73
73
|
cache: 'npm'
|
|
74
74
|
|
|
75
75
|
- name: Install dependencies
|
|
@@ -85,12 +85,12 @@ jobs:
|
|
|
85
85
|
|
|
86
86
|
steps:
|
|
87
87
|
- name: Checkout code
|
|
88
|
-
uses: actions/checkout@
|
|
88
|
+
uses: actions/checkout@v5
|
|
89
89
|
|
|
90
90
|
- name: Setup Node.js
|
|
91
|
-
uses: actions/setup-node@
|
|
91
|
+
uses: actions/setup-node@v5
|
|
92
92
|
with:
|
|
93
|
-
node-version:
|
|
93
|
+
node-version: '24.11.1'
|
|
94
94
|
cache: 'npm'
|
|
95
95
|
|
|
96
96
|
- name: Install dependencies
|
|
@@ -121,14 +121,14 @@ jobs:
|
|
|
121
121
|
|
|
122
122
|
steps:
|
|
123
123
|
- name: Checkout code
|
|
124
|
-
uses: actions/checkout@
|
|
124
|
+
uses: actions/checkout@v5
|
|
125
125
|
with:
|
|
126
126
|
fetch-depth: 0
|
|
127
127
|
|
|
128
128
|
- name: Setup Node.js
|
|
129
|
-
uses: actions/setup-node@
|
|
129
|
+
uses: actions/setup-node@v5
|
|
130
130
|
with:
|
|
131
|
-
node-version:
|
|
131
|
+
node-version: '24.11.1'
|
|
132
132
|
cache: 'npm'
|
|
133
133
|
|
|
134
134
|
- name: Install dependencies
|
|
@@ -20,15 +20,15 @@ jobs:
|
|
|
20
20
|
|
|
21
21
|
steps:
|
|
22
22
|
- name: Checkout code
|
|
23
|
-
uses: actions/checkout@
|
|
23
|
+
uses: actions/checkout@v5
|
|
24
24
|
with:
|
|
25
25
|
fetch-depth: 0
|
|
26
26
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
27
27
|
|
|
28
28
|
- name: Setup Node.js
|
|
29
|
-
uses: actions/setup-node@
|
|
29
|
+
uses: actions/setup-node@v5
|
|
30
30
|
with:
|
|
31
|
-
node-version:
|
|
31
|
+
node-version: '24.11.1'
|
|
32
32
|
cache: 'npm'
|
|
33
33
|
registry-url: 'https://registry.npmjs.org'
|
|
34
34
|
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
24.11.1
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## <small>1.0.2 (2025-11-12)</small>
|
|
2
|
+
|
|
3
|
+
- Merge pull request #25 from julienandreu/refactor/modernize-typescript-strict-mode ([9614fbd](https://github.com/julienandreu/zod-codegen/commit/9614fbd)), closes [#25](https://github.com/julienandreu/zod-codegen/issues/25)
|
|
4
|
+
- chore: update package-lock.json and pin Node.js to 24.11.1 in CI ([b165b43](https://github.com/julienandreu/zod-codegen/commit/b165b43))
|
|
5
|
+
- ci: update workflows to use Node.js 24 only ([1b56ad8](https://github.com/julienandreu/zod-codegen/commit/1b56ad8))
|
|
6
|
+
- refactor: modernize TypeScript to strict mode and fix all linting errors ([0dc2911](https://github.com/julienandreu/zod-codegen/commit/0dc2911))
|
|
7
|
+
|
|
8
|
+
## <small>1.0.1 (2025-09-16)</small>
|
|
9
|
+
|
|
10
|
+
- Merge pull request #10 from julienandreu/dependabot/npm_and_yarn/eslint-config-prettier-10.1.8 ([d9b786c](https://github.com/julienandreu/zod-codegen/commit/d9b786c)), closes [#10](https://github.com/julienandreu/zod-codegen/issues/10)
|
|
11
|
+
- Merge pull request #11 from julienandreu/dependabot/npm_and_yarn/types/node-24.5.0 ([aef6e88](https://github.com/julienandreu/zod-codegen/commit/aef6e88)), closes [#11](https://github.com/julienandreu/zod-codegen/issues/11)
|
|
12
|
+
- Merge pull request #3 from julienandreu/dependabot/github_actions/actions/setup-node-5 ([62282bc](https://github.com/julienandreu/zod-codegen/commit/62282bc)), closes [#3](https://github.com/julienandreu/zod-codegen/issues/3)
|
|
13
|
+
- Merge pull request #4 from julienandreu/dependabot/github_actions/actions/checkout-5 ([979b29e](https://github.com/julienandreu/zod-codegen/commit/979b29e)), closes [#4](https://github.com/julienandreu/zod-codegen/issues/4)
|
|
14
|
+
- Merge pull request #5 from julienandreu/dependabot/github_actions/codecov/codecov-action-5 ([dddb7b0](https://github.com/julienandreu/zod-codegen/commit/dddb7b0)), closes [#5](https://github.com/julienandreu/zod-codegen/issues/5)
|
|
15
|
+
- Merge pull request #6 from julienandreu/dependabot/npm_and_yarn/dev-dependencies-77ad94e918 ([596b00f](https://github.com/julienandreu/zod-codegen/commit/596b00f)), closes [#6](https://github.com/julienandreu/zod-codegen/issues/6)
|
|
16
|
+
- Merge pull request #7 from julienandreu/dependabot/npm_and_yarn/zod-4.1.8 ([39eecb4](https://github.com/julienandreu/zod-codegen/commit/39eecb4)), closes [#7](https://github.com/julienandreu/zod-codegen/issues/7)
|
|
17
|
+
- Merge pull request #8 from julienandreu/dependabot/npm_and_yarn/apidevtools/swagger-parser-12.0.0 ([3507359](https://github.com/julienandreu/zod-codegen/commit/3507359)), closes [#8](https://github.com/julienandreu/zod-codegen/issues/8)
|
|
18
|
+
- Merge pull request #9 from julienandreu/dependabot/npm_and_yarn/undici-7.16.0 ([84d7c4a](https://github.com/julienandreu/zod-codegen/commit/84d7c4a)), closes [#9](https://github.com/julienandreu/zod-codegen/issues/9)
|
|
19
|
+
- fix: use z.url() and z.email() instead of substring types ([4ea5902](https://github.com/julienandreu/zod-codegen/commit/4ea5902))
|
|
20
|
+
- chore(deps-dev): bump @types/node from 22.18.3 to 24.5.0 ([33e823c](https://github.com/julienandreu/zod-codegen/commit/33e823c))
|
|
21
|
+
- chore(deps-dev): bump eslint-config-prettier from 9.1.0 to 10.1.8 ([79dc367](https://github.com/julienandreu/zod-codegen/commit/79dc367))
|
|
22
|
+
- chore(deps-dev): bump typescript-eslint in the dev-dependencies group ([907712a](https://github.com/julienandreu/zod-codegen/commit/907712a))
|
|
23
|
+
- chore(deps): bump @apidevtools/swagger-parser from 10.1.0 to 12.0.0 ([9abfbbe](https://github.com/julienandreu/zod-codegen/commit/9abfbbe))
|
|
24
|
+
- chore(deps): bump undici from 6.21.3 to 7.16.0 ([43c579b](https://github.com/julienandreu/zod-codegen/commit/43c579b))
|
|
25
|
+
- chore(deps): bump zod from 3.25.76 to 4.1.8 ([5b7e047](https://github.com/julienandreu/zod-codegen/commit/5b7e047))
|
|
26
|
+
- ci(deps): bump actions/checkout from 4 to 5 ([3f141f7](https://github.com/julienandreu/zod-codegen/commit/3f141f7))
|
|
27
|
+
- ci(deps): bump actions/setup-node from 4 to 5 ([cc4a331](https://github.com/julienandreu/zod-codegen/commit/cc4a331))
|
|
28
|
+
- ci(deps): bump codecov/codecov-action from 4 to 5 ([c0a4ea5](https://github.com/julienandreu/zod-codegen/commit/c0a4ea5))
|
|
29
|
+
|
|
1
30
|
## 1.0.0 (2025-09-16)
|
|
2
31
|
|
|
3
32
|
- chore: fix husky deprecation warnings and improve ci/cd ([fe24d72](https://github.com/julienandreu/zod-codegen/commit/fe24d72))
|
package/dist/src/generator.js
CHANGED
|
@@ -23,7 +23,7 @@ export class Generator {
|
|
|
23
23
|
}
|
|
24
24
|
async run() {
|
|
25
25
|
try {
|
|
26
|
-
const rawSource = this.readFile();
|
|
26
|
+
const rawSource = await this.readFile();
|
|
27
27
|
const openApiSpec = this.parseFile(rawSource);
|
|
28
28
|
const generatedCode = this.generateCode(openApiSpec);
|
|
29
29
|
this.writeFile(generatedCode);
|
|
@@ -40,8 +40,8 @@ export class Generator {
|
|
|
40
40
|
return Promise.resolve(1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
readFile() {
|
|
44
|
-
return this.fileReader.readFile(this.inputPath);
|
|
43
|
+
async readFile() {
|
|
44
|
+
return await this.fileReader.readFile(this.inputPath);
|
|
45
45
|
}
|
|
46
46
|
parseFile(source) {
|
|
47
47
|
return this.fileParser.parse(source);
|