@vidavidorra/create-project 3.0.224 → 3.0.225

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/dist/cli.js CHANGED
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { input, confirm } from '@inquirer/prompts';
3
+ import z from 'zod';
3
4
  import { createProject, options as schema } from './index.js';
4
5
  function validate(value, option) {
5
- const validation = schema.shape[option].safeParse(value);
6
- return validation.success
7
- ? true
8
- : validation.error.errors.map(({ message }) => message).join('\n> ');
6
+ const { success, error } = schema.shape[option].safeParse(value);
7
+ return success ? true : z.prettifyError(error);
9
8
  }
10
9
  const project = await input({
11
10
  message: 'Project name:',
@@ -22,7 +21,7 @@ const options = {
22
21
  }),
23
22
  public: await confirm({
24
23
  message: 'Make package public?',
25
- default: schema.shape.public._def.defaultValue(),
24
+ default: schema.shape.public.def.defaultValue,
26
25
  }),
27
26
  description: await input({
28
27
  message: 'Description:',
@@ -50,7 +49,7 @@ if (options.typescript) {
50
49
  }
51
50
  if (options.testing) {
52
51
  options.reportCodeCoverage = await confirm({
53
- message: 'Report code coverate to Codecov?',
52
+ message: 'Report code coverage to Codecov?',
54
53
  });
55
54
  }
56
55
  options.path = await input({
@@ -6,237 +6,39 @@ declare const schema: z.ZodObject<{
6
6
  on: z.ZodObject<{
7
7
  push: z.ZodObject<{
8
8
  branches: z.ZodTuple<[z.ZodLiteral<"main">, z.ZodLiteral<"beta">, z.ZodLiteral<"renovate/**">], null>;
9
- }, "strip", z.ZodTypeAny, {
10
- branches: ["main", "beta", "renovate/**"];
11
- }, {
12
- branches: ["main", "beta", "renovate/**"];
13
- }>;
9
+ }, z.core.$strip>;
14
10
  pull_request: z.ZodNull;
15
- }, "strip", z.ZodTypeAny, {
16
- push: {
17
- branches: ["main", "beta", "renovate/**"];
18
- };
19
- pull_request: null;
20
- }, {
21
- push: {
22
- branches: ["main", "beta", "renovate/**"];
23
- };
24
- pull_request: null;
25
- }>;
11
+ }, z.core.$strip>;
26
12
  jobs: z.ZodObject<{
27
13
  'lint-commit-messages': z.ZodObject<{
28
14
  uses: z.ZodString;
29
- }, "strip", z.ZodTypeAny, {
30
- uses: string;
31
- }, {
32
- uses: string;
33
- }>;
15
+ }, z.core.$strip>;
34
16
  lint: z.ZodObject<{
35
17
  uses: z.ZodString;
36
- }, "strip", z.ZodTypeAny, {
37
- uses: string;
38
- }, {
39
- uses: string;
40
- }>;
18
+ }, z.core.$strip>;
41
19
  build: z.ZodObject<{
42
20
  uses: z.ZodString;
43
- }, "strip", z.ZodTypeAny, {
44
- uses: string;
45
- }, {
46
- uses: string;
47
- }>;
21
+ }, z.core.$strip>;
48
22
  test: z.ZodObject<{
49
23
  uses: z.ZodString;
50
- }, "strip", z.ZodTypeAny, {
51
- uses: string;
52
- }, {
53
- uses: string;
54
- }>;
24
+ }, z.core.$strip>;
55
25
  'code-coverage': z.ZodObject<{
56
26
  uses: z.ZodString;
57
- } & {
58
27
  needs: z.ZodTuple<[z.ZodLiteral<"lint">, z.ZodLiteral<"build">, z.ZodLiteral<"test">], null>;
59
28
  secrets: z.ZodObject<{
60
29
  codecovToken: z.ZodString;
61
- }, "strip", z.ZodTypeAny, {
62
- codecovToken: string;
63
- }, {
64
- codecovToken: string;
65
- }>;
66
- }, "strip", z.ZodTypeAny, {
67
- uses: string;
68
- needs: ["lint", "build", "test"];
69
- secrets: {
70
- codecovToken: string;
71
- };
72
- }, {
73
- uses: string;
74
- needs: ["lint", "build", "test"];
75
- secrets: {
76
- codecovToken: string;
77
- };
78
- }>;
30
+ }, z.core.$strip>;
31
+ }, z.core.$strip>;
79
32
  release: z.ZodObject<{
80
33
  uses: z.ZodString;
81
- } & {
82
- needs: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"lint-commit-messages">, z.ZodLiteral<"lint">, z.ZodLiteral<"build">, z.ZodLiteral<"test">, z.ZodLiteral<"code-coverage">]>, "many">;
34
+ needs: z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"lint-commit-messages">, z.ZodLiteral<"lint">, z.ZodLiteral<"build">, z.ZodLiteral<"test">, z.ZodLiteral<"code-coverage">]>>;
83
35
  secrets: z.ZodObject<{
84
36
  privateKey: z.ZodString;
85
37
  npmToken: z.ZodString;
86
- }, "strip", z.ZodTypeAny, {
87
- privateKey: string;
88
- npmToken: string;
89
- }, {
90
- privateKey: string;
91
- npmToken: string;
92
- }>;
93
- }, "strip", z.ZodTypeAny, {
94
- uses: string;
95
- needs: ("lint-commit-messages" | "lint" | "build" | "test" | "code-coverage")[];
96
- secrets: {
97
- privateKey: string;
98
- npmToken: string;
99
- };
100
- }, {
101
- uses: string;
102
- needs: ("lint-commit-messages" | "lint" | "build" | "test" | "code-coverage")[];
103
- secrets: {
104
- privateKey: string;
105
- npmToken: string;
106
- };
107
- }>;
108
- }, "strict", z.ZodTypeAny, {
109
- 'lint-commit-messages': {
110
- uses: string;
111
- };
112
- lint: {
113
- uses: string;
114
- };
115
- build: {
116
- uses: string;
117
- };
118
- test: {
119
- uses: string;
120
- };
121
- 'code-coverage': {
122
- uses: string;
123
- needs: ["lint", "build", "test"];
124
- secrets: {
125
- codecovToken: string;
126
- };
127
- };
128
- release: {
129
- uses: string;
130
- needs: ("lint-commit-messages" | "lint" | "build" | "test" | "code-coverage")[];
131
- secrets: {
132
- privateKey: string;
133
- npmToken: string;
134
- };
135
- };
136
- }, {
137
- 'lint-commit-messages': {
138
- uses: string;
139
- };
140
- lint: {
141
- uses: string;
142
- };
143
- build: {
144
- uses: string;
145
- };
146
- test: {
147
- uses: string;
148
- };
149
- 'code-coverage': {
150
- uses: string;
151
- needs: ["lint", "build", "test"];
152
- secrets: {
153
- codecovToken: string;
154
- };
155
- };
156
- release: {
157
- uses: string;
158
- needs: ("lint-commit-messages" | "lint" | "build" | "test" | "code-coverage")[];
159
- secrets: {
160
- privateKey: string;
161
- npmToken: string;
162
- };
163
- };
164
- }>;
165
- }, "strict", z.ZodTypeAny, {
166
- name: "CI/CD";
167
- on: {
168
- push: {
169
- branches: ["main", "beta", "renovate/**"];
170
- };
171
- pull_request: null;
172
- };
173
- jobs: {
174
- 'lint-commit-messages': {
175
- uses: string;
176
- };
177
- lint: {
178
- uses: string;
179
- };
180
- build: {
181
- uses: string;
182
- };
183
- test: {
184
- uses: string;
185
- };
186
- 'code-coverage': {
187
- uses: string;
188
- needs: ["lint", "build", "test"];
189
- secrets: {
190
- codecovToken: string;
191
- };
192
- };
193
- release: {
194
- uses: string;
195
- needs: ("lint-commit-messages" | "lint" | "build" | "test" | "code-coverage")[];
196
- secrets: {
197
- privateKey: string;
198
- npmToken: string;
199
- };
200
- };
201
- };
202
- }, {
203
- name: "CI/CD";
204
- on: {
205
- push: {
206
- branches: ["main", "beta", "renovate/**"];
207
- };
208
- pull_request: null;
209
- };
210
- jobs: {
211
- 'lint-commit-messages': {
212
- uses: string;
213
- };
214
- lint: {
215
- uses: string;
216
- };
217
- build: {
218
- uses: string;
219
- };
220
- test: {
221
- uses: string;
222
- };
223
- 'code-coverage': {
224
- uses: string;
225
- needs: ["lint", "build", "test"];
226
- secrets: {
227
- codecovToken: string;
228
- };
229
- };
230
- release: {
231
- uses: string;
232
- needs: ("lint-commit-messages" | "lint" | "build" | "test" | "code-coverage")[];
233
- secrets: {
234
- privateKey: string;
235
- npmToken: string;
236
- };
237
- };
238
- };
239
- }>;
38
+ }, z.core.$strip>;
39
+ }, z.core.$strip>;
40
+ }, z.core.$strict>;
41
+ }, z.core.$strict>;
240
42
  type Yaml = z.infer<typeof schema>;
241
43
  declare class CiCd extends File {
242
44
  protected readonly _yaml: Yaml;
@@ -7,8 +7,7 @@ const job = (action) => z.object({
7
7
  .startsWith(`vidavidorra/.github/.github/workflows/${action}@`)
8
8
  .regex(/.*?@[\da-f]{6,64}$/),
9
9
  });
10
- const schema = z
11
- .object({
10
+ const schema = z.strictObject({
12
11
  name: z.literal('CI/CD'),
13
12
  on: z.object({
14
13
  push: z.object({
@@ -21,8 +20,7 @@ const schema = z
21
20
  // eslint-disable-next-line @typescript-eslint/naming-convention
22
21
  pull_request: z.null(),
23
22
  }),
24
- jobs: z
25
- .object({
23
+ jobs: z.strictObject({
26
24
  'lint-commit-messages': job('lint-commit-messages.yml'),
27
25
  lint: job('node-lint.yml'),
28
26
  build: job('node-build.yml'),
@@ -50,10 +48,8 @@ const schema = z
50
48
  npmToken: z.string(),
51
49
  }),
52
50
  }),
53
- })
54
- .strict(),
55
- })
56
- .strict();
51
+ }),
52
+ });
57
53
  class CiCd extends File {
58
54
  _yaml;
59
55
  constructor(path, options) {
@@ -13,7 +13,6 @@ declare class File {
13
13
  get options(): {
14
14
  project: string;
15
15
  package: string;
16
- path: string;
17
16
  public: boolean;
18
17
  description: string;
19
18
  author: string;
@@ -22,6 +21,7 @@ declare class File {
22
21
  reportCodeCoverage: boolean;
23
22
  githubOwner: string;
24
23
  githubRepository: string;
24
+ path: string;
25
25
  dryRun: boolean;
26
26
  } & FileOptions;
27
27
  get content(): string;
@@ -5,26 +5,16 @@ declare const schema: z.ZodObject<{
5
5
  name: z.ZodString;
6
6
  version: z.ZodString;
7
7
  description: z.ZodString;
8
- keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
8
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
9
  private: z.ZodOptional<z.ZodBoolean>;
10
- homepage: z.ZodString;
10
+ homepage: z.ZodURL;
11
11
  bugs: z.ZodObject<{
12
- url: z.ZodString;
13
- }, "strict", z.ZodTypeAny, {
14
- url: string;
15
- }, {
16
- url: string;
17
- }>;
12
+ url: z.ZodURL;
13
+ }, z.core.$strict>;
18
14
  repository: z.ZodObject<{
19
15
  type: z.ZodLiteral<"git">;
20
- url: z.ZodString;
21
- }, "strict", z.ZodTypeAny, {
22
- type: "git";
23
- url: string;
24
- }, {
25
- type: "git";
26
- url: string;
27
- }>;
16
+ url: z.ZodURL;
17
+ }, z.core.$strict>;
28
18
  license: z.ZodLiteral<"GPL-3.0-or-later">;
29
19
  author: z.ZodString;
30
20
  type: z.ZodLiteral<"module">;
@@ -40,25 +30,7 @@ declare const schema: z.ZodObject<{
40
30
  postinstall: z.ZodOptional<z.ZodString>;
41
31
  prepare: z.ZodLiteral<"husky .github/husky">;
42
32
  test: z.ZodString;
43
- }, "strict", z.ZodTypeAny, {
44
- format: string;
45
- lint: "npm run format:check && xo";
46
- build: string;
47
- test: string;
48
- 'format:check': string;
49
- 'lint:fix': "npm run format && xo --fix";
50
- prepare: "husky .github/husky";
51
- postinstall?: string | undefined;
52
- }, {
53
- format: string;
54
- lint: "npm run format:check && xo";
55
- build: string;
56
- test: string;
57
- 'format:check': string;
58
- 'lint:fix': "npm run format && xo --fix";
59
- prepare: "husky .github/husky";
60
- postinstall?: string | undefined;
61
- }>;
33
+ }, z.core.$strict>;
62
34
  commitlint: z.ZodRecord<z.ZodString, z.ZodUnknown>;
63
35
  xo: z.ZodRecord<z.ZodString, z.ZodUnknown>;
64
36
  prettier: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -69,122 +41,21 @@ declare const schema: z.ZodObject<{
69
41
  devDependencies: z.ZodRecord<z.ZodString, z.ZodString>;
70
42
  engines: z.ZodObject<{
71
43
  node: z.ZodLiteral<">=20">;
72
- }, "strict", z.ZodTypeAny, {
73
- node: ">=20";
74
- }, {
75
- node: ">=20";
76
- }>;
44
+ }, z.core.$strict>;
77
45
  publishConfig: z.ZodOptional<z.ZodObject<{
78
46
  access: z.ZodLiteral<"public">;
79
- }, "strict", z.ZodTypeAny, {
80
- access: "public";
81
- }, {
82
- access: "public";
83
- }>>;
47
+ }, z.core.$strict>>;
84
48
  overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
85
- }, "strict", z.ZodTypeAny, {
86
- type: "module";
87
- description: string;
88
- author: string;
89
- name: string;
90
- release: Record<string, unknown>;
91
- version: string;
92
- homepage: string;
93
- bugs: {
94
- url: string;
95
- };
96
- repository: {
97
- type: "git";
98
- url: string;
99
- };
100
- license: "GPL-3.0-or-later";
101
- prettier: Record<string, unknown>;
102
- scripts: {
103
- format: string;
104
- lint: "npm run format:check && xo";
105
- build: string;
106
- test: string;
107
- 'format:check': string;
108
- 'lint:fix': "npm run format && xo --fix";
109
- prepare: "husky .github/husky";
110
- postinstall?: string | undefined;
111
- };
112
- commitlint: Record<string, unknown>;
113
- xo: Record<string, unknown>;
114
- devDependencies: Record<string, string>;
115
- engines: {
116
- node: ">=20";
117
- };
118
- files?: ["./dist/**/!(*.test).{js,d.ts,cjs}", ...string[]] | undefined;
119
- ava?: Record<string, unknown> | undefined;
120
- keywords?: string[] | undefined;
121
- private?: boolean | undefined;
122
- exports?: string | undefined;
123
- bin?: Record<string, unknown> | undefined;
124
- c8?: Record<string, unknown> | undefined;
125
- dependencies?: Record<string, string> | undefined;
126
- publishConfig?: {
127
- access: "public";
128
- } | undefined;
129
- overrides?: Record<string, unknown> | undefined;
130
- }, {
131
- type: "module";
132
- description: string;
133
- author: string;
134
- name: string;
135
- release: Record<string, unknown>;
136
- version: string;
137
- homepage: string;
138
- bugs: {
139
- url: string;
140
- };
141
- repository: {
142
- type: "git";
143
- url: string;
144
- };
145
- license: "GPL-3.0-or-later";
146
- prettier: Record<string, unknown>;
147
- scripts: {
148
- format: string;
149
- lint: "npm run format:check && xo";
150
- build: string;
151
- test: string;
152
- 'format:check': string;
153
- 'lint:fix': "npm run format && xo --fix";
154
- prepare: "husky .github/husky";
155
- postinstall?: string | undefined;
156
- };
157
- commitlint: Record<string, unknown>;
158
- xo: Record<string, unknown>;
159
- devDependencies: Record<string, string>;
160
- engines: {
161
- node: ">=20";
162
- };
163
- files?: ["./dist/**/!(*.test).{js,d.ts,cjs}", ...string[]] | undefined;
164
- ava?: Record<string, unknown> | undefined;
165
- keywords?: string[] | undefined;
166
- private?: boolean | undefined;
167
- exports?: string | undefined;
168
- bin?: Record<string, unknown> | undefined;
169
- c8?: Record<string, unknown> | undefined;
170
- dependencies?: Record<string, string> | undefined;
171
- publishConfig?: {
172
- access: "public";
173
- } | undefined;
174
- overrides?: Record<string, unknown> | undefined;
175
- }>;
49
+ }, z.core.$strict>;
176
50
  type PackageJson = z.infer<typeof schema>;
177
51
  declare class Package extends File {
178
52
  protected readonly _fullPackage: Required<PackageJson>;
179
53
  protected readonly _package: PackageJson;
180
54
  constructor(path: string, options: Options);
181
55
  get package(): {
182
- type: "module";
183
- description: string;
184
- author: string;
185
56
  name: string;
186
- release: Record<string, unknown>;
187
57
  version: string;
58
+ description: string;
188
59
  homepage: string;
189
60
  bugs: {
190
61
  url: string;
@@ -194,29 +65,32 @@ declare class Package extends File {
194
65
  url: string;
195
66
  };
196
67
  license: "GPL-3.0-or-later";
197
- prettier: Record<string, unknown>;
68
+ author: string;
69
+ type: "module";
198
70
  scripts: {
199
- format: string;
200
- lint: "npm run format:check && xo";
201
71
  build: string;
202
- test: string;
72
+ format: string;
203
73
  'format:check': string;
74
+ lint: "npm run format:check && xo";
204
75
  'lint:fix': "npm run format && xo --fix";
205
76
  prepare: "husky .github/husky";
77
+ test: string;
206
78
  postinstall?: string | undefined;
207
79
  };
208
80
  commitlint: Record<string, unknown>;
209
81
  xo: Record<string, unknown>;
82
+ prettier: Record<string, unknown>;
83
+ release: Record<string, unknown>;
210
84
  devDependencies: Record<string, string>;
211
85
  engines: {
212
86
  node: ">=20";
213
87
  };
214
- files?: ["./dist/**/!(*.test).{js,d.ts,cjs}", ...string[]] | undefined;
215
- ava?: Record<string, unknown> | undefined;
216
88
  keywords?: string[] | undefined;
217
89
  private?: boolean | undefined;
218
90
  exports?: string | undefined;
219
91
  bin?: Record<string, unknown> | undefined;
92
+ files?: ["./dist/**/!(*.test).{js,d.ts,cjs}", ...string[]] | undefined;
93
+ ava?: Record<string, unknown> | undefined;
220
94
  c8?: Record<string, unknown> | undefined;
221
95
  dependencies?: Record<string, string> | undefined;
222
96
  publishConfig?: {
@@ -1,36 +1,25 @@
1
1
  import { z } from 'zod';
2
2
  import { sortPackageJson } from 'sort-package-json';
3
3
  import { File } from './file.js';
4
- const schema = z
5
- .object({
4
+ const schema = z.strictObject({
6
5
  name: z.string().min(1),
7
6
  version: z.string().min('0.0.0'.length),
8
7
  description: z.string(),
9
8
  keywords: z.array(z.string()).min(1).optional(),
10
9
  private: z.boolean().optional(),
11
- homepage: z.string().url(),
12
- bugs: z
13
- .object({
14
- url: z.string().url(),
15
- })
16
- .strict(),
17
- repository: z
18
- .object({
19
- type: z.literal('git'),
20
- url: z.string().url(),
21
- })
22
- .strict(),
10
+ homepage: z.url(),
11
+ bugs: z.strictObject({ url: z.url() }),
12
+ repository: z.strictObject({ type: z.literal('git'), url: z.url() }),
23
13
  license: z.literal('GPL-3.0-or-later'),
24
14
  author: z.string().min(1),
25
15
  type: z.literal('module'),
26
16
  exports: z.string().min(1).optional(),
27
- bin: z.record(z.unknown()).optional(),
17
+ bin: z.record(z.string(), z.unknown()).optional(),
28
18
  files: z
29
19
  .tuple([z.literal('./dist/**/!(*.test).{js,d.ts,cjs}')])
30
20
  .rest(z.string().min(1))
31
21
  .optional(),
32
- scripts: z
33
- .object({
22
+ scripts: z.strictObject({
34
23
  build: z.string().min(1),
35
24
  format: z.string().startsWith('prettier'),
36
25
  // eslint-disable-next-line @typescript-eslint/naming-convention
@@ -41,24 +30,19 @@ const schema = z
41
30
  postinstall: z.string().optional(),
42
31
  prepare: z.literal('husky .github/husky'),
43
32
  test: z.string().min(1),
44
- })
45
- .strict(),
46
- commitlint: z.record(z.unknown()),
47
- xo: z.record(z.unknown()),
48
- prettier: z.record(z.unknown()),
49
- release: z.record(z.unknown()),
50
- ava: z.record(z.unknown()).optional(),
51
- c8: z.record(z.unknown()).optional(),
52
- dependencies: z.record(z.string()).optional(),
53
- devDependencies: z.record(z.string()),
54
- engines: z.object({ node: z.literal('>=20') }).strict(),
55
- publishConfig: z
56
- .object({ access: z.literal('public') })
57
- .strict()
58
- .optional(),
59
- overrides: z.record(z.unknown()).optional(),
60
- })
61
- .strict();
33
+ }),
34
+ commitlint: z.record(z.string(), z.unknown()),
35
+ xo: z.record(z.string(), z.unknown()),
36
+ prettier: z.record(z.string(), z.unknown()),
37
+ release: z.record(z.string(), z.unknown()),
38
+ ava: z.record(z.string(), z.unknown()).optional(),
39
+ c8: z.record(z.string(), z.unknown()).optional(),
40
+ dependencies: z.record(z.string(), z.string()).optional(),
41
+ devDependencies: z.record(z.string(), z.string()),
42
+ engines: z.strictObject({ node: z.literal('>=20') }),
43
+ publishConfig: z.strictObject({ access: z.literal('public') }).optional(),
44
+ overrides: z.record(z.string(), z.unknown()).optional(),
45
+ });
62
46
  class Package extends File {
63
47
  _fullPackage;
64
48
  _package;
@@ -4,36 +4,17 @@ import { File } from './file.js';
4
4
  declare const schema: z.ZodObject<{
5
5
  compilerOptions: z.ZodObject<{
6
6
  allowJs: z.ZodOptional<z.ZodBoolean>;
7
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
8
- allowJs: z.ZodOptional<z.ZodBoolean>;
9
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
10
- allowJs: z.ZodOptional<z.ZodBoolean>;
11
- }, z.ZodTypeAny, "passthrough">>;
12
- include: z.ZodArray<z.ZodString, "many">;
13
- }, "strict", z.ZodTypeAny, {
14
- compilerOptions: {
15
- allowJs?: boolean | undefined;
16
- } & {
17
- [k: string]: unknown;
18
- };
19
- include: string[];
20
- }, {
21
- compilerOptions: {
22
- allowJs?: boolean | undefined;
23
- } & {
24
- [k: string]: unknown;
25
- };
26
- include: string[];
27
- }>;
7
+ }, z.core.$loose>;
8
+ include: z.ZodArray<z.ZodString>;
9
+ }, z.core.$strict>;
28
10
  type TsConfigJson = z.infer<typeof schema>;
29
11
  declare class TsConfig extends File {
30
12
  protected readonly _tsConfig: TsConfigJson;
31
13
  constructor(path: string, options: Options);
32
14
  get tsConfig(): {
33
15
  compilerOptions: {
16
+ [x: string]: unknown;
34
17
  allowJs?: boolean | undefined;
35
- } & {
36
- [k: string]: unknown;
37
18
  };
38
19
  include: string[];
39
20
  };
@@ -1,15 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import { File } from './file.js';
3
- const schema = z
4
- .object({
5
- compilerOptions: z
6
- .object({
7
- allowJs: z.boolean().optional(),
8
- })
9
- .passthrough(),
3
+ const schema = z.strictObject({
4
+ compilerOptions: z.looseObject({ allowJs: z.boolean().optional() }),
10
5
  include: z.array(z.string()).min(1),
11
- })
12
- .strict();
6
+ });
13
7
  class TsConfig extends File {
14
8
  _tsConfig;
15
9
  constructor(path, options) {
package/dist/options.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  declare const schema: z.ZodObject<{
3
3
  project: z.ZodString;
4
- package: z.ZodEffects<z.ZodString, string, string>;
4
+ package: z.ZodString;
5
5
  public: z.ZodDefault<z.ZodBoolean>;
6
6
  description: z.ZodString;
7
7
  author: z.ZodString;
@@ -10,35 +10,9 @@ declare const schema: z.ZodObject<{
10
10
  reportCodeCoverage: z.ZodDefault<z.ZodBoolean>;
11
11
  githubOwner: z.ZodString;
12
12
  githubRepository: z.ZodString;
13
- path: z.ZodEffects<z.ZodString, string, string>;
13
+ path: z.ZodString;
14
14
  dryRun: z.ZodDefault<z.ZodBoolean>;
15
- }, "strict", z.ZodTypeAny, {
16
- project: string;
17
- package: string;
18
- path: string;
19
- public: boolean;
20
- description: string;
21
- author: string;
22
- typescript: boolean;
23
- testing: boolean;
24
- reportCodeCoverage: boolean;
25
- githubOwner: string;
26
- githubRepository: string;
27
- dryRun: boolean;
28
- }, {
29
- project: string;
30
- package: string;
31
- path: string;
32
- description: string;
33
- author: string;
34
- typescript: boolean;
35
- githubOwner: string;
36
- githubRepository: string;
37
- public?: boolean | undefined;
38
- testing?: boolean | undefined;
39
- reportCodeCoverage?: boolean | undefined;
40
- dryRun?: boolean | undefined;
41
- }>;
15
+ }, z.core.$strict>;
42
16
  type OptionsInput = z.input<typeof schema>;
43
17
  type Options = z.infer<typeof schema>;
44
18
  export { schema, schema as options, type Options, type OptionsInput };
package/dist/options.js CHANGED
@@ -1,14 +1,17 @@
1
1
  import fs from 'node:fs';
2
2
  import { z } from 'zod';
3
3
  import validatePackageName from 'validate-npm-package-name';
4
- const schema = z
5
- .object({
4
+ const schema = z.strictObject({
6
5
  project: z.string().min(1),
7
- package: z.string().superRefine((value, context) => {
8
- const { validForNewPackages, errors, warnings } = validatePackageName(value);
6
+ package: z.string().check((context) => {
7
+ const { validForNewPackages, errors, warnings } = validatePackageName(context.value);
9
8
  if (!validForNewPackages) {
10
9
  for (const message of [...(errors ?? []), ...(warnings ?? [])]) {
11
- context.addIssue({ code: z.ZodIssueCode.custom, message });
10
+ context.issues.push({
11
+ code: 'custom',
12
+ message,
13
+ input: context.value,
14
+ });
12
15
  }
13
16
  }
14
17
  }),
@@ -23,30 +26,31 @@ const schema = z
23
26
  path: z
24
27
  .string()
25
28
  .min(1)
26
- .superRefine((value, context) => {
27
- const exists = fs.existsSync(value);
29
+ .check((context) => {
30
+ const exists = fs.existsSync(context.value);
28
31
  if (exists) {
29
- if (!fs.statSync(value).isDirectory()) {
30
- context.addIssue({
31
- code: z.ZodIssueCode.custom,
32
+ if (!fs.statSync(context.value).isDirectory()) {
33
+ context.issues.push({
34
+ code: 'custom',
32
35
  message: 'Expected an empty directory, received a file.',
36
+ input: context.value,
33
37
  });
34
38
  return z.NEVER;
35
39
  }
36
- const { files } = fs.statfsSync(value);
40
+ const { files } = fs.statfsSync(context.value);
37
41
  if (files !== 0) {
38
- context.addIssue({
39
- code: z.ZodIssueCode.custom,
42
+ context.issues.push({
43
+ code: 'custom',
40
44
  message: [
41
45
  'Expected an empty directory, received a directory with',
42
46
  `${files} file${files === 1 ? '' : 's'}.`,
43
47
  ].join(' '),
48
+ input: context.value,
44
49
  });
45
50
  }
46
51
  }
47
52
  }),
48
53
  dryRun: z.boolean().default(false),
49
- })
50
- .strict();
54
+ });
51
55
  export { schema, schema as options };
52
56
  //# sourceMappingURL=options.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidavidorra/create-project",
3
- "version": "3.0.224",
3
+ "version": "3.0.225",
4
4
  "private": false,
5
5
  "description": "Interactively create a GitHub project",
6
6
  "keywords": [
@@ -206,7 +206,7 @@
206
206
  "typescript": "5.8.3",
207
207
  "validate-npm-package-name": "6.0.1",
208
208
  "yaml": "2.8.0",
209
- "zod": "3.25.76"
209
+ "zod": "4.0.5"
210
210
  },
211
211
  "devDependencies": {
212
212
  "@ava/typescript": "6.0.0",