Skip to content

Commit 9121267

Browse files
feat: update zod to 3.25 and explicitly import zod/v3
1 parent 9bebdfe commit 9121267

80 files changed

Lines changed: 127 additions & 528 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/cli/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"@types/pluralize": "^0.0.33",
2727
"globby": "^10.0.2",
2828
"type-fest": "^4.41.0",
29-
"winston": "^3.17.0",
30-
"zod": "^3.24.4"
29+
"winston": "^3.17.0"
3130
},
3231
"dependencies": {
3332
"@dotcom-tool-kit/base": "^1.3.0",
@@ -47,7 +46,8 @@
4746
"pretty-format": "^29.7.0",
4847
"tslib": "^2.8.1",
4948
"yaml": "^2.8.0",
50-
"zod-validation-error": "^3.4.1"
49+
"zod": "^3.25.76",
50+
"zod-validation-error": "^3.5.2"
5151
},
5252
"engines": {
5353
"node": "18.x || 20.x || 22.x"

core/cli/src/messages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import type {
77
OptionsForPlugin,
88
OptionsForTask
99
} from '@dotcom-tool-kit/plugin'
10-
import type { z } from 'zod'
11-
import { fromZodError } from 'zod-validation-error'
10+
import type { z } from 'zod/v3'
11+
import { fromZodError } from 'zod-validation-error/v3'
1212
import type { Conflict } from '@dotcom-tool-kit/conflict'
1313
import pluralize from 'pluralize'
1414
import { ToolKitError } from '@dotcom-tool-kit/error'

core/cli/src/plugin/entry-point.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Base } from '@dotcom-tool-kit/base'
44
import type { EntryPoint } from '@dotcom-tool-kit/plugin'
55
import { Validated, invalid, valid } from '@dotcom-tool-kit/validated'
66
import { __importDefault } from 'tslib'
7-
import type * as z from 'zod'
7+
import type * as z from 'zod/v3'
88
import { indentReasons } from '../messages'
99
import type { ReadonlyDeep } from 'type-fest'
1010

core/cli/src/plugin/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { type PluginOptions, PluginSchemas, legacyPluginOptions } from '@dotcom-
99
import { invalid, reduceValidated, valid, Validated } from '@dotcom-tool-kit/validated'
1010

1111
import type { Logger } from 'winston'
12-
import * as z from 'zod'
12+
import * as z from 'zod/v3'
1313
import { styles } from '@dotcom-tool-kit/logger'
1414

1515
import { toolKitIfDefinedIdent, toolKitOptionIdent } from '../rc-file'

core/cli/src/plugin/reduce-installations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { groupBy } from 'lodash'
22
import type { Logger } from 'winston'
3-
import * as z from 'zod'
3+
import * as z from 'zod/v3'
44

55
import type { HookClass, HookInstallation } from '@dotcom-tool-kit/base'
66
import type { ValidConfig } from '@dotcom-tool-kit/config'

core/create/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"simple-git": "^3.27.0",
3333
"tslib": "^2.8.1",
3434
"yaml": "^2.8.0",
35-
"zod": "^3.24.4"
35+
"zod": "^3.25.76"
3636
},
3737
"repository": {
3838
"type": "git",

core/create/src/prompts/oidc.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import path from 'path'
1313
import prompt from 'prompts'
1414
import { simpleGit } from 'simple-git'
1515
import YAML from 'yaml'
16-
import { z } from 'zod'
16+
import { z } from 'zod/v3'
1717

1818
// git mode indicating an object blob is a file
1919
const FILE_MODE = '100644' as const
@@ -254,7 +254,11 @@ export default async function oidcPrompt({ toolKitConfig }: OidcParams): Promise
254254
// store path using the same logic we used to use to infer the name
255255
// from Tool Kit vault plugin options. Pass in the options that were
256256
// selected during the options prompt.
257-
const dopplerProjectName = new DopplerEnvVars(winstonLogger, 'prod', toolKitConfig.options.plugins['@dotcom-tool-kit/doppler']).options.project
257+
const dopplerProjectName = new DopplerEnvVars(
258+
winstonLogger,
259+
'prod',
260+
toolKitConfig.options.plugins['@dotcom-tool-kit/doppler']
261+
).options.project
258262
const ssmAction = 'ssm:GetParameter'
259263
const ssmResource = `arn:aws:ssm:eu-west-1:\${AWS::AccountId}:parameter/${dopplerProjectName}/*`
260264
winstonLogger.info(

core/create/src/prompts/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import YAML from 'yaml'
77
import type Logger from 'komatsu'
88
import partition from 'lodash/partition'
99
import prompt from 'prompts'
10-
import { z } from 'zod'
10+
import { z } from 'zod/v3'
1111
import type { BizOpsSystem } from '../bizOps'
1212

1313
interface OptionSettings {

docs/developing-tool-kit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ This lets different plugins define the same abstractly labelled hooks with diffe
148148
Plugins can define options that a user can configure in their repo's `.toolkitrc.yml`. We use the [`zod` library](https://zod.dev) to specify the schema, which allows us to define what we expect the options to look like and use this specification to validate the options we receive as well as generate TypeScript types for them. Options are defined within plugins. For tasks and hooks you should export the `zod` schema in the same file as you export your `Task` or `Hook` class as a `schema` object. For plugin options you should define the `zod` schema in a separate file, export it as the default object, and add the path to your `.toolkitrc.yml` with the top-level `optionsSchema` option.
149149

150150
```typescript
151-
import { z } from 'zod'
151+
import { z } from 'zod/v3'
152152

153153
const ESLintSchema = z.object({
154154
files: z.string().array().default(['**/*.js']),

docs/extending-tool-kit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ options:
178178
Additionally, we can define an options schema to ensure that the options passed to task are as we expect them to be, with the correct names and correct types. We use [`zod`](https://zod.dev/) to define our schemas. For plugin options, you should export your schema as the default object in a separate file and specify its path as a top-level `optionsSchema` option in your `.toolkitrc.yml`. For tasks and hooks, you should export your schema as a `schema` object in the same file as you export your task/hook. We could define a `zod` schema for the Rollup task like so:
179179

180180
```js
181-
const z = require('zod')
181+
const z = require('zod/v3')
182182
183183
const RollupSchema = z.object({ configPath: z.string() })
184184
module.exports.schema = RollupSchema

0 commit comments

Comments
 (0)