zod-codegen 1.4.0 → 1.4.1

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.
Files changed (30) hide show
  1. package/.github/workflows/ci.yml +17 -17
  2. package/.github/workflows/release.yml +8 -8
  3. package/CHANGELOG.md +11 -0
  4. package/dist/src/services/code-generator.service.d.ts.map +1 -1
  5. package/dist/src/services/code-generator.service.js +3 -3
  6. package/package.json +10 -15
  7. package/src/services/code-generator.service.ts +4 -7
  8. package/tests/unit/code-generator.test.ts +3 -3
  9. package/tests/unit/generator.test.ts +2 -2
  10. package/tsconfig.json +1 -1
  11. package/.claude/settings.local.json +0 -43
  12. package/dist/scripts/update-manifest.d.ts +0 -14
  13. package/dist/scripts/update-manifest.d.ts.map +0 -1
  14. package/dist/scripts/update-manifest.js +0 -31
  15. package/dist/tests/integration/cli.test.d.ts +0 -2
  16. package/dist/tests/integration/cli.test.d.ts.map +0 -1
  17. package/dist/tests/integration/cli.test.js +0 -25
  18. package/dist/tests/unit/code-generator.test.d.ts +0 -2
  19. package/dist/tests/unit/code-generator.test.d.ts.map +0 -1
  20. package/dist/tests/unit/code-generator.test.js +0 -459
  21. package/dist/tests/unit/file-reader.test.d.ts +0 -2
  22. package/dist/tests/unit/file-reader.test.d.ts.map +0 -1
  23. package/dist/tests/unit/file-reader.test.js +0 -110
  24. package/dist/tests/unit/generator.test.d.ts +0 -2
  25. package/dist/tests/unit/generator.test.d.ts.map +0 -1
  26. package/dist/tests/unit/generator.test.js +0 -100
  27. package/dist/tests/unit/naming-convention.test.d.ts +0 -2
  28. package/dist/tests/unit/naming-convention.test.d.ts.map +0 -1
  29. package/dist/tests/unit/naming-convention.test.js +0 -231
  30. package/scripts/republish-versions.sh +0 -94
@@ -29,25 +29,25 @@ jobs:
29
29
  uses: actions/setup-node@v5
30
30
  with:
31
31
  node-version: ${{ matrix.node-version }}
32
- cache: 'yarn'
32
+ cache: 'npm'
33
33
 
34
34
  - name: Install dependencies
35
- run: yarn install --frozen-lockfile
35
+ run: npm ci
36
36
 
37
37
  - name: Run type check
38
- run: yarn type-check
38
+ run: npm run type-check
39
39
 
40
40
  - name: Run linter
41
- run: yarn lint:check
41
+ run: npm run lint:check
42
42
 
43
43
  - name: Run formatter check
44
- run: yarn format:check
44
+ run: npm run format:check
45
45
 
46
46
  - name: Build project
47
- run: yarn build
47
+ run: npm run build
48
48
 
49
49
  - name: Run tests
50
- run: yarn test:coverage
50
+ run: npm run test:coverage
51
51
 
52
52
  - name: Upload coverage to Codecov
53
53
  if: matrix.node-version == '24.11.1' && matrix.os == 'ubuntu-latest'
@@ -70,13 +70,13 @@ jobs:
70
70
  uses: actions/setup-node@v5
71
71
  with:
72
72
  node-version: '24.11.1'
73
- cache: 'yarn'
73
+ cache: 'npm'
74
74
 
75
75
  - name: Install dependencies
76
- run: yarn install --frozen-lockfile
76
+ run: npm ci
77
77
 
78
78
  - name: Run security audit
79
- run: yarn audit --level high
79
+ run: npm audit --audit-level=high
80
80
 
81
81
  build:
82
82
  name: Build & Package
@@ -91,13 +91,13 @@ jobs:
91
91
  uses: actions/setup-node@v5
92
92
  with:
93
93
  node-version: '24.11.1'
94
- cache: 'yarn'
94
+ cache: 'npm'
95
95
 
96
96
  - name: Install dependencies
97
- run: yarn install --frozen-lockfile
97
+ run: npm ci
98
98
 
99
99
  - name: Build project
100
- run: yarn build
100
+ run: npm run build
101
101
 
102
102
  - name: Test CLI
103
103
  run: |
@@ -129,15 +129,15 @@ jobs:
129
129
  uses: actions/setup-node@v5
130
130
  with:
131
131
  node-version: '24.11.1'
132
- cache: 'yarn'
132
+ cache: 'npm'
133
133
 
134
134
  - name: Install dependencies
135
- run: yarn install --frozen-lockfile
135
+ run: npm ci
136
136
 
137
137
  - name: Build project
138
- run: yarn build
138
+ run: npm run build
139
139
 
140
140
  - name: Preview semantic-release
141
141
  env:
142
142
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143
- run: yarn release:dry
143
+ run: npm run release:dry
@@ -29,26 +29,26 @@ jobs:
29
29
  uses: actions/setup-node@v5
30
30
  with:
31
31
  node-version: '24.11.1'
32
- cache: 'yarn'
32
+ cache: 'npm'
33
33
  registry-url: 'https://registry.npmjs.org'
34
34
 
35
35
  - name: Install dependencies
36
- run: yarn install --frozen-lockfile
36
+ run: npm ci
37
37
 
38
38
  - name: Run type check
39
- run: yarn type-check
39
+ run: npm run type-check
40
40
 
41
41
  - name: Run linter check
42
- run: yarn lint:check
42
+ run: npm run lint:check
43
43
 
44
44
  - name: Run formatter check
45
- run: yarn format:check
45
+ run: npm run format:check
46
46
 
47
47
  - name: Run tests with coverage
48
- run: yarn test:coverage
48
+ run: npm run test:coverage
49
49
 
50
50
  - name: Build project
51
- run: yarn build
51
+ run: npm run build
52
52
 
53
53
  - name: Test CLI functionality
54
54
  run: |
@@ -62,4 +62,4 @@ jobs:
62
62
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63
63
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
64
64
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
65
- run: yarn release
65
+ run: npm run release
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## <small>1.4.1 (2025-12-08)</small>
2
+
3
+ - Merge branch 'refactor/build-config-and-class-exports' of github.com:julienandreu/zod-codegen into r ([bdd9bc5](https://github.com/julienandreu/zod-codegen/commit/bdd9bc5))
4
+ - Merge pull request #41 from julienandreu/dependabot/npm_and_yarn/tar-7.5.2 ([192cd47](https://github.com/julienandreu/zod-codegen/commit/192cd47)), closes [#41](https://github.com/julienandreu/zod-codegen/issues/41)
5
+ - Merge pull request #43 from julienandreu/refactor/build-config-and-class-exports ([61de21b](https://github.com/julienandreu/zod-codegen/commit/61de21b)), closes [#43](https://github.com/julienandreu/zod-codegen/issues/43)
6
+ - refactor: improve build configuration and class exports ([060f714](https://github.com/julienandreu/zod-codegen/commit/060f714))
7
+ - refactor: improve build configuration and class exports ([b8771ad](https://github.com/julienandreu/zod-codegen/commit/b8771ad))
8
+ - refactor: remove tsconfig.build.json and use tsconfig.json directly ([407c46a](https://github.com/julienandreu/zod-codegen/commit/407c46a))
9
+ - chore: restore yarn.lock for yarn 4 with corepack ([a93f018](https://github.com/julienandreu/zod-codegen/commit/a93f018))
10
+ - chore(deps): bump tar from 7.5.1 to 7.5.2 ([b867dce](https://github.com/julienandreu/zod-codegen/commit/b867dce))
11
+
1
12
  ## 1.4.0 (2025-12-01)
2
13
 
3
14
  - Merge pull request #40 from julienandreu/feat/naming-conventions-and-improvements ([d7c8146](https://github.com/julienandreu/zod-codegen/commit/d7c8146)), closes [#40](https://github.com/julienandreu/zod-codegen/issues/40)
@@ -1 +1 @@
1
- {"version":3,"file":"code-generator.service.d.ts","sourceRoot":"","sources":["../../../src/services/code-generator.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EAAmB,eAAe,EAAgB,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAWpE,qBAAa,8BAA+B,YAAW,aAAa,EAAE,aAAa;IACjF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsC;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwC;IACtE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwD;IAChF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA+B;IAChE,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAuC;gBAEpE,OAAO,GAAE,gBAAqB;IAK1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGpB;IAEH,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM;IAMvC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,UAAO,GAAG,EAAE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G;IACH,OAAO,CAAC,iBAAiB;IAuFzB,OAAO,CAAC,WAAW;IA0CnB,OAAO,CAAC,aAAa;IAmjBrB,OAAO,CAAC,iBAAiB;IAuCzB,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,oBAAoB;IAyE5B,OAAO,CAAC,8BAA8B;IActC,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,yBAAyB;IA8BjC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,eAAe;CAuCxB"}
@@ -86,7 +86,7 @@ export class TypeScriptCodeGeneratorService {
86
86
  buildClientClass(openapi, schemas) {
87
87
  const clientName = this.generateClientName(openapi.info.title);
88
88
  const methods = this.buildClientMethods(openapi, schemas);
89
- return ts.factory.createClassDeclaration([ts.factory.createToken(ts.SyntaxKind.ExportKeyword)], ts.factory.createIdentifier(clientName), undefined, undefined, [
89
+ return ts.factory.createClassDeclaration([ts.factory.createToken(ts.SyntaxKind.ExportKeyword), ts.factory.createToken(ts.SyntaxKind.DefaultKeyword)], ts.factory.createIdentifier(clientName), undefined, undefined, [
90
90
  this.typeBuilder.createProperty('#baseUrl', 'string', true),
91
91
  this.buildConstructor(openapi),
92
92
  this.buildGetBaseRequestOptionsMethod(),
@@ -132,7 +132,7 @@ export class TypeScriptCodeGeneratorService {
132
132
  ]), ts.factory.createBlock([ts.factory.createReturnStatement(ts.factory.createObjectLiteralExpression([], false))], true));
133
133
  }
134
134
  buildHttpRequestMethod() {
135
- return ts.factory.createMethodDeclaration([ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)], undefined, ts.factory.createPrivateIdentifier('#makeRequest'), undefined, [this.typeBuilder.createGenericType('T')], [
135
+ return ts.factory.createMethodDeclaration([ts.factory.createToken(ts.SyntaxKind.ProtectedKeyword), ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)], undefined, ts.factory.createIdentifier('makeRequest'), undefined, [this.typeBuilder.createGenericType('T')], [
136
136
  this.typeBuilder.createParameter('method', 'string'),
137
137
  this.typeBuilder.createParameter('path', 'string'),
138
138
  this.typeBuilder.createParameter('options', '{params?: Record<string, string | number | boolean>; data?: unknown; contentType?: string; headers?: Record<string, string>}', ts.factory.createObjectLiteralExpression([], false), false),
@@ -331,7 +331,7 @@ export class TypeScriptCodeGeneratorService {
331
331
  }
332
332
  const optionsExpression = ts.factory.createObjectLiteralExpression(optionsProps, false);
333
333
  // Call makeRequest
334
- const makeRequestCall = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createThis(), ts.factory.createPrivateIdentifier('#makeRequest')), undefined, [ts.factory.createStringLiteral(method.toUpperCase(), true), pathExpression, optionsExpression]);
334
+ const makeRequestCall = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createThis(), ts.factory.createIdentifier('makeRequest')), undefined, [ts.factory.createStringLiteral(method.toUpperCase(), true), pathExpression, optionsExpression]);
335
335
  // Add Zod validation if we have a response schema
336
336
  if (responseSchema) {
337
337
  const validateCall = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(responseSchema, ts.factory.createIdentifier('parse')), undefined, [ts.factory.createAwaitExpression(makeRequestCall)]);
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "author": "Julien Andreu <julienandreu@me.com>",
3
- "bin": {
4
- "zod-codegen": "dist/src/cli.js"
5
- },
3
+ "bin": "dist/src/cli.js",
6
4
  "bugs": {
7
5
  "url": "https://github.com/julienandreu/zod-codegen/issues"
8
6
  },
@@ -46,6 +44,7 @@
46
44
  "@types/node": "^24.10.1",
47
45
  "@types/yargs": "^17.0.35",
48
46
  "@vitest/coverage-v8": "^4.0.14",
47
+ "cross-env": "^10.1.0",
49
48
  "eslint": "^9.39.1",
50
49
  "eslint-config-prettier": "^10.1.8",
51
50
  "husky": "^9.1.7",
@@ -54,8 +53,7 @@
54
53
  "ts-node": "^10.9.2",
55
54
  "typescript-eslint": "^8.46.4",
56
55
  "undici": "^7.16.0",
57
- "vitest": "^4.0.14",
58
- "yarn-audit-fix": "^10.1.1"
56
+ "vitest": "^4.0.14"
59
57
  },
60
58
  "optionalDependencies": {
61
59
  "undici": "^7.16.0"
@@ -88,15 +86,12 @@
88
86
  "tar": "^7.5.2",
89
87
  "yargs": "^18.0.0"
90
88
  },
91
- "resolutions": {
92
- "yargs": "^18.0.0"
93
- },
94
89
  "scripts": {
95
- "audit:fix": "yarn-audit-fix",
96
- "build": "rm -rf dist && tsc --project tsconfig.json && cp -r src/assets dist/src/ && chmod +x ./dist/src/cli.js",
97
- "build:native": "rm -rf dist && npx tsgo --project tsconfig.json && cp -r src/assets dist/src/ && chmod +x ./dist/src/cli.js",
90
+ "audit:fix": "npm audit fix",
91
+ "build": "NODE_OPTIONS='--no-deprecation' sh -c 'rm -rf dist && tsc --project tsconfig.json && cp -r src/assets dist/src/ && chmod +x ./dist/src/cli.js'",
92
+ "build:native": "rm -rf dist && NODE_OPTIONS='--no-deprecation' npx tsgo --project tsconfig.json && cp -r src/assets dist/src/ && chmod +x ./dist/src/cli.js",
98
93
  "build:watch": "tsc --project tsconfig.json --watch",
99
- "dev": "yarn build && node ./dist/src/cli.js --input ./samples/swagger-petstore.yaml --output ./examples/petstore && yarn format && yarn lint",
94
+ "dev": "npm run build && node ./dist/src/cli.js --input ./samples/swagger-petstore.yaml --output ./examples/petstore && npm run format && npm run lint",
100
95
  "lint": "eslint src --fix",
101
96
  "lint:check": "eslint src",
102
97
  "format": "prettier src --write --log-level error",
@@ -108,12 +103,12 @@
108
103
  "test:ui": "vitest --ui",
109
104
  "manifest:update": "ts-node scripts/update-manifest.ts",
110
105
  "prepare": "husky",
111
- "prepublishOnly": "yarn build && yarn test && yarn lint:check && yarn type-check",
106
+ "prepublishOnly": "npm run build && npm run test && npm run lint:check && npm run type-check",
112
107
  "clean": "rm -rf dist coverage node_modules/.cache",
113
- "validate": "yarn type-check && yarn lint:check && yarn format:check && yarn test",
108
+ "validate": "npm run type-check && npm run lint:check && npm run format:check && npm run test",
114
109
  "validate:examples": "tsc -p ./tsconfig.examples.json --noEmit",
115
110
  "release": "semantic-release",
116
111
  "release:dry": "semantic-release --dry-run"
117
112
  },
118
- "version": "1.4.0"
113
+ "version": "1.4.1"
119
114
  }
@@ -136,7 +136,7 @@ export class TypeScriptCodeGeneratorService implements CodeGenerator, SchemaBuil
136
136
  const methods = this.buildClientMethods(openapi, schemas);
137
137
 
138
138
  return ts.factory.createClassDeclaration(
139
- [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
139
+ [ts.factory.createToken(ts.SyntaxKind.ExportKeyword), ts.factory.createToken(ts.SyntaxKind.DefaultKeyword)],
140
140
  ts.factory.createIdentifier(clientName),
141
141
  undefined,
142
142
  undefined,
@@ -275,9 +275,9 @@ export class TypeScriptCodeGeneratorService implements CodeGenerator, SchemaBuil
275
275
 
276
276
  private buildHttpRequestMethod(): ts.MethodDeclaration {
277
277
  return ts.factory.createMethodDeclaration(
278
- [ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)],
278
+ [ts.factory.createToken(ts.SyntaxKind.ProtectedKeyword), ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)],
279
279
  undefined,
280
- ts.factory.createPrivateIdentifier('#makeRequest'),
280
+ ts.factory.createIdentifier('makeRequest'),
281
281
  undefined,
282
282
  [this.typeBuilder.createGenericType('T')],
283
283
  [
@@ -1002,10 +1002,7 @@ export class TypeScriptCodeGeneratorService implements CodeGenerator, SchemaBuil
1002
1002
 
1003
1003
  // Call makeRequest
1004
1004
  const makeRequestCall = ts.factory.createCallExpression(
1005
- ts.factory.createPropertyAccessExpression(
1006
- ts.factory.createThis(),
1007
- ts.factory.createPrivateIdentifier('#makeRequest'),
1008
- ),
1005
+ ts.factory.createPropertyAccessExpression(ts.factory.createThis(), ts.factory.createIdentifier('makeRequest')),
1009
1006
  undefined,
1010
1007
  [ts.factory.createStringLiteral(method.toUpperCase(), true), pathExpression, optionsExpression],
1011
1008
  );
@@ -212,7 +212,7 @@ describe('TypeScriptCodeGeneratorService', () => {
212
212
  expect(code).toBeTruthy();
213
213
  expect(typeof code).toBe('string');
214
214
  expect(code).toMatch(/import\s*{\s*z\s*}\s*from\s*['"]zod['"]/);
215
- expect(code).toContain('export class');
215
+ expect(code).toContain('export default class');
216
216
  });
217
217
 
218
218
  it('should generate schemas for component schemas', () => {
@@ -275,7 +275,7 @@ describe('TypeScriptCodeGeneratorService', () => {
275
275
 
276
276
  const code = generator.generate(spec);
277
277
  expect(code).toContain('async getUsers');
278
- expect(code).toContain('#makeRequest');
278
+ expect(code).toContain('makeRequest');
279
279
  });
280
280
 
281
281
  it('should generate getBaseRequestOptions method', () => {
@@ -408,7 +408,7 @@ describe('TypeScriptCodeGeneratorService', () => {
408
408
  expect(code).not.toContain('ExecutionMode: z.enum');
409
409
  });
410
410
 
411
- it('should merge baseOptions with request-specific options in #makeRequest', () => {
411
+ it('should merge baseOptions with request-specific options in makeRequest', () => {
412
412
  const spec: OpenApiSpecType = {
413
413
  openapi: '3.0.0',
414
414
  info: {
@@ -68,7 +68,7 @@ describe('Generator', () => {
68
68
  // Verify file contains expected content
69
69
  const content = readFileSync(outputFile, 'utf-8');
70
70
  expect(content).toMatch(/import\s*{\s*z\s*}\s*from\s*['"]zod['"]/);
71
- expect(content).toContain('export class');
71
+ expect(content).toContain('export default class');
72
72
  expect(content).toContain('getBaseRequestOptions');
73
73
  });
74
74
 
@@ -109,7 +109,7 @@ describe('Generator', () => {
109
109
  expect(content).toMatch(/import\s*{\s*z\s*}\s*from\s*['"]zod['"]/);
110
110
  expect(content).toContain('export const');
111
111
  expect(content).toContain('protected getBaseRequestOptions');
112
- expect(content).toContain('async #makeRequest');
112
+ expect(content).toContain('protected async makeRequest');
113
113
  });
114
114
 
115
115
  it('should include header comments in generated file', async () => {
package/tsconfig.json CHANGED
@@ -41,6 +41,6 @@
41
41
  "useUnknownInCatchVariables": true,
42
42
  "verbatimModuleSyntax": true
43
43
  },
44
- "exclude": ["node_modules", "dist", "build", "examples/**/*.ts"],
44
+ "exclude": ["node_modules", "dist", "build", "examples/**/*.ts", "tests/**/*.ts", "scripts/**/*.ts"],
45
45
  "include": ["src/**/*.ts", "scripts/**/*.ts", "tests/**/*.ts", "vitest.config.ts"]
46
46
  }
@@ -1,43 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm install:*)",
5
- "Bash(npm uninstall:*)",
6
- "Bash(npm run type-check:*)",
7
- "Bash(npm run build:*)",
8
- "Bash(./dist/src/cli.js --help)",
9
- "Bash(./dist/src/cli.js --version)",
10
- "Bash(npm run dev:*)",
11
- "Bash(node:*)",
12
- "Bash(npm run lint)",
13
- "Bash(npx husky init:*)",
14
- "Bash(chmod:*)",
15
- "Bash(npm run validate:*)",
16
- "Bash(npm run format:*)",
17
- "Bash(npm run test:*)",
18
- "Bash(npm test)",
19
- "Bash(npm audit:*)",
20
- "Bash(npx depcheck:*)",
21
- "Bash(npm outdated)",
22
- "Bash(npm update:*)",
23
- "WebSearch",
24
- "Bash(find:*)",
25
- "Bash(npx zod-codegen:*)",
26
- "Bash(DEBUG=1 node ./dist/src/cli.js --input ./samples/openapi.json --output ./test-generated)",
27
- "Bash(rm:*)",
28
- "Bash(npm outdated:*)",
29
- "Bash(npm view:*)",
30
- "Bash(git tag:*)",
31
- "Bash(npm run release:*)",
32
- "Bash(git log:*)",
33
- "Bash(npx commitlint:*)",
34
- "Bash(git rev-list:*)",
35
- "Bash(./fix-commit-messages.sh:*)",
36
- "Bash(git add:*)",
37
- "Bash(git commit:*)",
38
- "Bash(FILTER_BRANCH_SQUELCH_WARNING=1 ./fix-commit-messages.sh)"
39
- ],
40
- "deny": [],
41
- "ask": []
42
- }
43
- }
@@ -1,14 +0,0 @@
1
- interface PackageJson {
2
- name: string;
3
- version: string;
4
- description: string;
5
- }
6
- /**
7
- * Type guard for the package.json object
8
- *
9
- * @param input Unknown input
10
- * @returns true if the input is an event object
11
- */
12
- export declare function isPackageJson(input: unknown): input is PackageJson;
13
- export {};
14
- //# sourceMappingURL=update-manifest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-manifest.d.ts","sourceRoot":"","sources":["../../scripts/update-manifest.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAclE"}
@@ -1,31 +0,0 @@
1
- import { readFileSync, writeFileSync } from 'fs';
2
- import { resolve } from 'path';
3
- import { z } from 'zod';
4
- /**
5
- * Type guard for the package.json object
6
- *
7
- * @param input Unknown input
8
- * @returns true if the input is an event object
9
- */
10
- export function isPackageJson(input) {
11
- const event = z
12
- .object({
13
- name: z.string(),
14
- version: z.string(),
15
- description: z.string(),
16
- })
17
- .strict()
18
- .catchall(z.any())
19
- .required();
20
- const { success } = event.safeParse(input);
21
- return success;
22
- }
23
- const sourcePath = resolve(__dirname, '..', 'package.json');
24
- const data = JSON.parse(readFileSync(sourcePath, 'utf8'));
25
- if (!isPackageJson(data)) {
26
- process.exit(1);
27
- }
28
- const { name, version, description } = data;
29
- const targetPath = resolve(__dirname, '..', 'src', 'assets', 'manifest.json');
30
- writeFileSync(targetPath, JSON.stringify({ name, version, description }, null, 2));
31
- process.exit(0);
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cli.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.test.d.ts","sourceRoot":"","sources":["../../../tests/integration/cli.test.ts"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { execSync } from 'node:child_process';
3
- import { resolve } from 'node:path';
4
- describe('CLI Integration', () => {
5
- describe('--help', () => {
6
- it('should display help information', () => {
7
- const result = execSync('npm run build && node ./dist/src/cli.js --help', {
8
- encoding: 'utf-8',
9
- cwd: resolve(__dirname, '../..'),
10
- });
11
- expect(result).toContain('Usage:');
12
- expect(result).toContain('--input');
13
- expect(result).toContain('--output');
14
- });
15
- });
16
- describe('--version', () => {
17
- it('should display version information', () => {
18
- const result = execSync('npm run build && node ./dist/src/cli.js --version', {
19
- encoding: 'utf-8',
20
- cwd: resolve(__dirname, '../..'),
21
- });
22
- expect(result).toMatch(/\d+\.\d+\.\d+/);
23
- });
24
- });
25
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=code-generator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-generator.test.d.ts","sourceRoot":"","sources":["../../../tests/unit/code-generator.test.ts"],"names":[],"mappings":""}