From 8b8c418fca4929ed4c7c35a92bffb026b026c2a1 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Fri, 8 Nov 2024 10:04:37 +0000 Subject: [PATCH 01/26] feat: load workspace package tool kit configs --- .../monorepo/src/tasks/workspace-command.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plugins/monorepo/src/tasks/workspace-command.ts diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts new file mode 100644 index 000000000..9d6f24fe4 --- /dev/null +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -0,0 +1,25 @@ +import { Task, TaskRunContext } from '@dotcom-tool-kit/base' +import mapWorkspaces from '@npmcli/map-workspaces' +import fs from 'fs/promises' +import path from 'path' +import { loadConfig } from 'dotcom-tool-kit/lib/config' + +export default class WorkspaceCommand extends Task { + async run({ cwd }: TaskRunContext) { + const pkg = JSON.parse(await fs.readFile(path.join(cwd, 'package.json'), 'utf8')) + + const workspaces = await mapWorkspaces({ cwd, pkg }) + + const configs = Object.fromEntries( + await Promise.all( + Array.from(workspaces, async ([id, packagePath]) => [ + id, + await loadConfig(this.logger, { root: packagePath }) + ]) + ) + ) + + // eslint-disable-next-line no-console + console.log(configs) + } +} From 33ab4331cddf92838d59fee1f82f58e248cc3623 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 24 Apr 2024 17:00:36 +0100 Subject: [PATCH 02/26] feat: run workspace commands in parallel --- .../monorepo/src/tasks/workspace-command.ts | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index 9d6f24fe4..bd42f841d 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -3,23 +3,37 @@ import mapWorkspaces from '@npmcli/map-workspaces' import fs from 'fs/promises' import path from 'path' import { loadConfig } from 'dotcom-tool-kit/lib/config' +import { runTasksFromConfig } from 'dotcom-tool-kit/lib/tasks' +import { ToolKitError } from '@dotcom-tool-kit/error' export default class WorkspaceCommand extends Task { - async run({ cwd }: TaskRunContext) { + async runPackageCommand(packageId: string, packagePath: string, command: string, files?: string[]) { + const config = await loadConfig(this.logger, { root: packagePath }) + + return runTasksFromConfig(this.logger.child({ packageId }), config, [command], files) + } + + async run({ cwd, command, files }: TaskRunContext) { const pkg = JSON.parse(await fs.readFile(path.join(cwd, 'package.json'), 'utf8')) const workspaces = await mapWorkspaces({ cwd, pkg }) - const configs = Object.fromEntries( - await Promise.all( - Array.from(workspaces, async ([id, packagePath]) => [ - id, - await loadConfig(this.logger, { root: packagePath }) - ]) - ) + const packagePromises: Array> = [] + + for (const [id, packagePath] of workspaces) { + packagePromises.push(this.runPackageCommand(id, packagePath, command, files)) + } + + const results = await Promise.allSettled(packagePromises) + const erroredCommands = results.filter( + (result): result is PromiseRejectedResult => result.status === 'rejected' ) - // eslint-disable-next-line no-console - console.log(configs) + if (erroredCommands.length) { + // TODO improve error messages + const error = new ToolKitError(`error running workspace command ${command}`) + error.details = erroredCommands.map((result) => result.reason.toString()).join('\n\n') + throw error + } } } From 23e33aa2595802f2243ac7786283fd027a8eb59c Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 24 Apr 2024 17:29:50 +0100 Subject: [PATCH 03/26] refactor: use map instead of a for loop for runPackageCommand calls --- plugins/monorepo/src/tasks/workspace-command.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index bd42f841d..f2cfddadd 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -18,13 +18,10 @@ export default class WorkspaceCommand extends Task { const workspaces = await mapWorkspaces({ cwd, pkg }) - const packagePromises: Array> = [] - - for (const [id, packagePath] of workspaces) { - packagePromises.push(this.runPackageCommand(id, packagePath, command, files)) - } + const results = await Promise.allSettled( + Array.from(workspaces, ([id, packagePath]) => this.runPackageCommand(id, packagePath, command, files)) + ) - const results = await Promise.allSettled(packagePromises) const erroredCommands = results.filter( (result): result is PromiseRejectedResult => result.status === 'rejected' ) From 7328ff09bf3f0dd93b7713b74af4f32be3462c21 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 24 Apr 2024 17:38:44 +0100 Subject: [PATCH 04/26] feat: allow overriding which command to run in the workspace via a task option --- lib/schemas/src/tasks.ts | 4 +- lib/schemas/src/tasks/workspace-command.ts | 9 + package-lock.json | 443 +++++++++++++++++- plugins/monorepo/package.json | 37 ++ .../monorepo/src/tasks/workspace-command.ts | 9 +- plugins/monorepo/tsconfig.json | 16 + 6 files changed, 508 insertions(+), 10 deletions(-) create mode 100644 lib/schemas/src/tasks/workspace-command.ts create mode 100644 plugins/monorepo/package.json create mode 100644 plugins/monorepo/tsconfig.json diff --git a/lib/schemas/src/tasks.ts b/lib/schemas/src/tasks.ts index d037042c7..70b7a37dc 100644 --- a/lib/schemas/src/tasks.ts +++ b/lib/schemas/src/tasks.ts @@ -13,6 +13,7 @@ import { SmokeTestSchema } from './tasks/n-test' import { CypressSchema } from './tasks/cypress' import { HerokuProductionSchema } from './tasks/heroku-production' import { ServerlessRunSchema } from './tasks/serverless-run' +import { WorkspaceCommandSchema } from './tasks/workspace-command' import { z } from 'zod' export const TaskSchemas = { @@ -39,7 +40,8 @@ export const TaskSchemas = { ServerlessTeardown: z.object({}).describe('Tear down existing serverless functions'), TypeScript: TypeScriptSchema, UploadAssetsToS3: UploadAssetsToS3Schema, - Webpack: WebpackSchema + Webpack: WebpackSchema, + WorkspaceCommand: WorkspaceCommandSchema } export type TaskOptions = InferSchemaOptions diff --git a/lib/schemas/src/tasks/workspace-command.ts b/lib/schemas/src/tasks/workspace-command.ts new file mode 100644 index 000000000..f309844b9 --- /dev/null +++ b/lib/schemas/src/tasks/workspace-command.ts @@ -0,0 +1,9 @@ +import { z } from 'zod' + +export const WorkspaceCommandSchema = z.object({ + command: z.string().optional() +}) + +export type WorkspaceCommandOptions = z.infer + +export const Schema = WorkspaceCommandSchema diff --git a/package-lock.json b/package-lock.json index d43cb2ca7..5c6372d6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6517,6 +6517,10 @@ "resolved": "plugins/mocha", "link": true }, + "node_modules/@dotcom-tool-kit/monorepo": { + "resolved": "plugins/monorepo", + "link": true + }, "node_modules/@dotcom-tool-kit/n-test": { "resolved": "plugins/n-test", "link": true @@ -7464,6 +7468,95 @@ "dev": true, "license": "ISC" }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "license": "ISC", @@ -9155,6 +9248,99 @@ "node": ">= 10" } }, + "node_modules/@npmcli/map-workspaces": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-3.0.6.tgz", + "integrity": "sha512-tkYs0OYnzQm6iIRdfy+LcLBjcKuQCeE5YLb8KnrIlutJfheNaPvPpgoFEyEFgbjzl5PLZ3IA/BWAwRU0eHuQDA==", + "dependencies": { + "@npmcli/name-from-folder": "^2.0.0", + "glob": "^10.2.2", + "minimatch": "^9.0.0", + "read-package-json-fast": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/glob": { + "version": "10.3.12", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", + "integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.6", + "minimatch": "^9.0.1", + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/json-parse-even-better-errors": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", + "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/npm-normalize-package-bin": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", + "integrity": "sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/map-workspaces/node_modules/read-package-json-fast": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz", + "integrity": "sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==", + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/@npmcli/move-file": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", @@ -9168,6 +9354,14 @@ "node": ">=10" } }, + "node_modules/@npmcli/name-from-folder": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-2.0.0.tgz", + "integrity": "sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg==", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/@npmcli/node-gyp": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-1.0.3.tgz", @@ -9474,6 +9668,15 @@ "@octokit/openapi-types": "^11.2.0" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@quarterto/parse-makefile-rules": { "version": "1.1.0" }, @@ -10184,6 +10387,15 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/cacache": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/@types/cacache/-/cacache-17.0.2.tgz", + "integrity": "sha512-IrqHzVX2VRMDQQKa7CtKRnuoCLdRJiLW6hWU+w7i7+AaQ0Ii5bKwJxd5uRK4zBCyrHd3tG6G8zOm2LplxbSfQg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/cacheable-request": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", @@ -10315,9 +10527,10 @@ "license": "MIT" }, "node_modules/@types/minimatch": { - "version": "3.0.5", - "dev": true, - "license": "MIT" + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true }, "node_modules/@types/minimist": { "version": "1.2.2", @@ -10374,6 +10587,46 @@ "@types/ssri": "*" } }, + "node_modules/@types/npmcli__arborist": { + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/@types/npmcli__arborist/-/npmcli__arborist-5.6.6.tgz", + "integrity": "sha512-uJyeAINDxppb8uxDe/r9EqvHrA3huz8RcdOX2IVbiU+cb+NaNATSQ8oyCF1HQ3EMferzrQJ8wmP7/b9Z4BlvNw==", + "dev": true, + "dependencies": { + "@npm/types": "*", + "@types/cacache": "*", + "@types/node": "*", + "@types/npmcli__package-json": "*", + "@types/pacote": "*" + } + }, + "node_modules/@types/npmcli__map-workspaces": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/npmcli__map-workspaces/-/npmcli__map-workspaces-3.0.4.tgz", + "integrity": "sha512-NKs2WY8V24b21xBSmofuQEJX/XHIGaQT5UmiOYzdrmIR7dZh9ED9TDXeV8GcAAH0t12J3kMufbxtsli50Zjm9w==", + "dev": true, + "dependencies": { + "@types/glob": "~8.1.0", + "@types/npmcli__arborist": "*", + "@types/npmcli__package-json": "*" + } + }, + "node_modules/@types/npmcli__map-workspaces/node_modules/@types/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==", + "dev": true, + "dependencies": { + "@types/minimatch": "^5.1.2", + "@types/node": "*" + } + }, + "node_modules/@types/npmcli__package-json": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/npmcli__package-json/-/npmcli__package-json-4.0.4.tgz", + "integrity": "sha512-6QjlFUSHBmZJWuC08bz1ZCx6tm4t+7+OJXAdvM6tL2pI7n6Bh5SIp/YxQvnOLFf8MzCXs2ijyFgrzaiu1UFBGA==", + "dev": true + }, "node_modules/@types/npmlog": { "version": "4.1.4", "dev": true, @@ -14666,8 +14919,7 @@ "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "peer": true + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" }, "node_modules/ecc-jsbn": { "version": "0.1.2", @@ -16362,6 +16614,78 @@ "node": ">=0.10.0" } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/foreground-child/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/foreground-child/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/forever-agent": { "version": "0.6.1", "license": "Apache-2.0", @@ -18424,6 +18748,23 @@ "node": ">=8" } }, + "node_modules/jackspeak": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/java-invoke-local": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/java-invoke-local/-/java-invoke-local-0.0.6.tgz", @@ -24098,6 +24439,37 @@ "version": "1.0.7", "license": "MIT" }, + "node_modules/path-scurry": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", + "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/path-scurry/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/path-type": { "version": "4.0.0", "license": "MIT", @@ -27588,6 +27960,20 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/string.prototype.trim": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", @@ -27663,6 +28049,18 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "4.0.0", "license": "MIT", @@ -30131,6 +30529,23 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "license": "ISC" @@ -31974,7 +32389,23 @@ "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, "plugins/monorepo": { - "extraneous": true + "name": "@dotcom-tool-kit/monorepo", + "version": "0.1.0", + "license": "ISC", + "dependencies": { + "@dotcom-tool-kit/schemas": "2.0.0-beta.0", + "@npmcli/map-workspaces": "^3.0.6" + }, + "devDependencies": { + "@types/npmcli__map-workspaces": "^3.0.4" + }, + "engines": { + "node": "18.x || 20.x", + "npm": "7.x || 8.x || 9.x" + }, + "peerDependencies": { + "dotcom-tool-kit": "4.0.0-beta.5" + } }, "plugins/n-test": { "name": "@dotcom-tool-kit/n-test", diff --git a/plugins/monorepo/package.json b/plugins/monorepo/package.json new file mode 100644 index 000000000..e82e23505 --- /dev/null +++ b/plugins/monorepo/package.json @@ -0,0 +1,37 @@ +{ + "name": "@dotcom-tool-kit/monorepo", + "version": "0.1.0", + "description": "", + "main": "lib", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "FT.com Platforms Team ", + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/financial-times/dotcom-tool-kit.git", + "directory": "plugins/monorepo" + }, + "bugs": "https://github.com/financial-times/dotcom-tool-kit/issues", + "homepage": "https://github.com/financial-times/dotcom-tool-kit/tree/main/plugins/monorepo", + "files": [ + "/lib", + ".toolkitrc.yml" + ], + "engines": { + "node": "18.x || 20.x", + "npm": "7.x || 8.x || 9.x" + }, + "peerDependencies": { + "dotcom-tool-kit": "4.0.0-beta.5" + }, + "dependencies": { + "@dotcom-tool-kit/schemas": "2.0.0-beta.0", + "@npmcli/map-workspaces": "^3.0.6" + }, + "devDependencies": { + "@types/npmcli__map-workspaces": "^3.0.4" + } +} diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index f2cfddadd..b56b896ef 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -5,8 +5,9 @@ import path from 'path' import { loadConfig } from 'dotcom-tool-kit/lib/config' import { runTasksFromConfig } from 'dotcom-tool-kit/lib/tasks' import { ToolKitError } from '@dotcom-tool-kit/error' +import { WorkspaceCommandSchema } from '@dotcom-tool-kit/schemas/lib/tasks/workspace-command' -export default class WorkspaceCommand extends Task { +export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceCommandSchema }> { async runPackageCommand(packageId: string, packagePath: string, command: string, files?: string[]) { const config = await loadConfig(this.logger, { root: packagePath }) @@ -19,7 +20,9 @@ export default class WorkspaceCommand extends Task { const workspaces = await mapWorkspaces({ cwd, pkg }) const results = await Promise.allSettled( - Array.from(workspaces, ([id, packagePath]) => this.runPackageCommand(id, packagePath, command, files)) + Array.from(workspaces, ([id, packagePath]) => + this.runPackageCommand(id, packagePath, this.options.command ?? command, files) + ) ) const erroredCommands = results.filter( @@ -28,7 +31,7 @@ export default class WorkspaceCommand extends Task { if (erroredCommands.length) { // TODO improve error messages - const error = new ToolKitError(`error running workspace command ${command}`) + const error = new ToolKitError(`error running workspace command ${this.options.command ?? command}`) error.details = erroredCommands.map((result) => result.reason.toString()).join('\n\n') throw error } diff --git a/plugins/monorepo/tsconfig.json b/plugins/monorepo/tsconfig.json new file mode 100644 index 000000000..65a97dec3 --- /dev/null +++ b/plugins/monorepo/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.settings.json", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "references": [ + { + "path": "../../lib/base" + }, + { + "path": "../../lib/schemas" + } + ], + "include": ["src/**/*"] +} From 875f6bd749b2f4079c64b69f90a09366a71ce6b1 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Thu, 9 May 2024 09:57:28 +0100 Subject: [PATCH 05/26] build: don't throw in generate-docs when no readme --- scripts/generate-docs.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/generate-docs.js b/scripts/generate-docs.js index 356727a38..51be65c26 100644 --- a/scripts/generate-docs.js +++ b/scripts/generate-docs.js @@ -114,9 +114,9 @@ async function main() { const readmePath = path.join('plugins', plugin, 'readme.md') const generatedOptionsMarkdown = await formatPluginSchemas(plugin) - const originalReadme = await fs.readFile(readmePath, 'utf-8') - try { + const originalReadme = await fs.readFile(readmePath, 'utf-8') + const replacedReadme = replaceBetween( originalReadme, generatedOptionsMarkdown, @@ -127,7 +127,11 @@ async function main() { await fs.writeFile(readmePath, replacedReadme, 'utf-8') console.log(`written ${readmePath}`) } catch (e) { - console.error(`no replacement markers in ${readmePath}`) + if (e.code === 'ENOENT') { + console.error(`${plugin} has no readme`) + } else { + console.error(`no replacement markers in ${readmePath}`) + } } }) ) From e61777582145a2654d3c5d862727e87824efca3b Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Thu, 25 Jul 2024 12:19:17 +0100 Subject: [PATCH 06/26] build: inherit volta config from root --- plugins/monorepo/package.json | 3 +++ scripts/create-plugin.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/plugins/monorepo/package.json b/plugins/monorepo/package.json index e82e23505..6b4aea759 100644 --- a/plugins/monorepo/package.json +++ b/plugins/monorepo/package.json @@ -24,6 +24,9 @@ "node": "18.x || 20.x", "npm": "7.x || 8.x || 9.x" }, + "volta": { + "extends": "../../package.json" + }, "peerDependencies": { "dotcom-tool-kit": "4.0.0-beta.5" }, diff --git a/scripts/create-plugin.js b/scripts/create-plugin.js index f33e804ed..d0339f1a3 100755 --- a/scripts/create-plugin.js +++ b/scripts/create-plugin.js @@ -38,6 +38,9 @@ pkg.engines = { node: '18.x || 20.x', npm: '7.x || 8.x || 9.x' } +pkg.volta = { + extends: '../../package.json' +} pkg.peerDependencies = { 'dotcom-tool-kit': '3.x' } From 9dcf9c8f550a57aa2f861fc4fc620f2d8794f282 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 4 Nov 2024 11:12:44 +0000 Subject: [PATCH 07/26] backstage: update monorepo plugin dependency versions --- package-lock.json | 4 ++-- plugins/monorepo/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5c6372d6d..bab3faa61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32393,7 +32393,7 @@ "version": "0.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/schemas": "2.0.0-beta.0", + "@dotcom-tool-kit/schemas": "^1.1.1", "@npmcli/map-workspaces": "^3.0.6" }, "devDependencies": { @@ -32404,7 +32404,7 @@ "npm": "7.x || 8.x || 9.x" }, "peerDependencies": { - "dotcom-tool-kit": "4.0.0-beta.5" + "dotcom-tool-kit": "4.x" } }, "plugins/n-test": { diff --git a/plugins/monorepo/package.json b/plugins/monorepo/package.json index 6b4aea759..04db19f4f 100644 --- a/plugins/monorepo/package.json +++ b/plugins/monorepo/package.json @@ -28,10 +28,10 @@ "extends": "../../package.json" }, "peerDependencies": { - "dotcom-tool-kit": "4.0.0-beta.5" + "dotcom-tool-kit": "4.x" }, "dependencies": { - "@dotcom-tool-kit/schemas": "2.0.0-beta.0", + "@dotcom-tool-kit/schemas": "^1.1.1", "@npmcli/map-workspaces": "^3.0.6" }, "devDependencies": { From d109a1cc308551906573993715436c98093e38ac Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 4 Nov 2024 11:36:01 +0000 Subject: [PATCH 08/26] docs(monorepo): add readme --- lib/schemas/src/tasks/workspace-command.ts | 59 ++++++++++++++- plugins/monorepo/.toolkitrc.yml | 4 + plugins/monorepo/readme.md | 88 ++++++++++++++++++++++ 3 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 plugins/monorepo/.toolkitrc.yml create mode 100644 plugins/monorepo/readme.md diff --git a/lib/schemas/src/tasks/workspace-command.ts b/lib/schemas/src/tasks/workspace-command.ts index f309844b9..62ab1f37b 100644 --- a/lib/schemas/src/tasks/workspace-command.ts +++ b/lib/schemas/src/tasks/workspace-command.ts @@ -1,8 +1,63 @@ import { z } from 'zod' export const WorkspaceCommandSchema = z.object({ - command: z.string().optional() -}) + command: z.string().optional().describe('A specific command to run instead of the command that ran this task.') +}).describe(`Runs a Tool Kit command in all workspace packages that have that command. By default, runs the command that was used to run this task. + +For example, imagine a monorepo with these \`.toolkitrc.yml\` files: + +
.toolkitrc.yml + +~~~yml +commands: + run:local: WorkspaceCommand + build:local: WorkspaceCommand +~~~ + +
+ +
packages/api/.toolkitrc.yml + +~~~yml +commands: + run:local: Node +~~~ + +
+ +
packages/client/.toolkitrc.yml + +~~~yml +commands: + build:local: TypeScript +~~~ + +
+ +
packages/components/.toolkitrc.yml + +~~~yml +commands: + build:local: Webpack + run:local: + Webpack: + watch: true +~~~ + +
+ +Running \`dotcom-tool-kit run:local\` at the root level will run the \`Node\` task in \`packages/api\` and the \`Webpack\` task in watch mode in \`packages/components\`; running \`dotcom-tool-kit build:local\` will run \`TypeScript\` in \`packages/client\` and \`Webpack\` in \`packages/components\`. + +To run a particular command in the workspace instead of dynamically inferring the command from which was run at root level, set the \`command\` option for the task: + +~~~yml +commands: + build:ci: + WorkspaceCommand: + command: build:local +~~~ + +`) export type WorkspaceCommandOptions = z.infer diff --git a/plugins/monorepo/.toolkitrc.yml b/plugins/monorepo/.toolkitrc.yml new file mode 100644 index 000000000..18ce7c7de --- /dev/null +++ b/plugins/monorepo/.toolkitrc.yml @@ -0,0 +1,4 @@ +version: 2 + +tasks: + WorkspaceCommand: ./lib/tasks/workspace-command.js diff --git a/plugins/monorepo/readme.md b/plugins/monorepo/readme.md new file mode 100644 index 000000000..93c8d1fa8 --- /dev/null +++ b/plugins/monorepo/readme.md @@ -0,0 +1,88 @@ +# @dotcom-tool-kit/monorepo + +Enables Tool Kit to run commands across monorepo workspace packages. + +## Installation + +Install `@dotcom-tool-kit/monorepo` as a `devDependency` in your app: + +```sh +npm install --save-dev @dotcom-tool-kit/monorepo +``` + +Add the plugin to your [Tool Kit configuration](https://github.com/financial-times/dotcom-tool-kit/blob/main/readme.md#configuration): + +```yaml +plugins: + - '@dotcom-tool-kit/monorepo' +``` + + +## Tasks + +### `WorkspaceCommand` + +Runs a Tool Kit command in all workspace packages that have that command. By default, runs the command that was used to run this task. + +For example, imagine a monorepo with these `.toolkitrc.yml` files: + +
.toolkitrc.yml + +~~~yml +commands: + run:local: WorkspaceCommand + build:local: WorkspaceCommand +~~~ + +
+ +
packages/api/.toolkitrc.yml + +~~~yml +commands: + run:local: Node +~~~ + +
+ +
packages/client/.toolkitrc.yml + +~~~yml +commands: + build:local: TypeScript +~~~ + +
+ +
packages/components/.toolkitrc.yml + +~~~yml +commands: + build:local: Webpack + run:local: + Webpack: + watch: true +~~~ + +
+ +Running `dotcom-tool-kit run:local` at the root level will run the `Node` task in `packages/api` and the `Webpack` task in watch mode in `packages/components`; running `dotcom-tool-kit build:local` will run `TypeScript` in `packages/client` and `Webpack` in `packages/components`. + +To run a particular command in the workspace instead of dynamically inferring the command from which was run at root level, set the `command` option for the task: + +~~~yml +commands: + build:ci: + WorkspaceCommand: + command: build:local +~~~ + + +#### Task options + +| Property | Description | Type | +| :-------- | :------------------------------------------------------------------- | :------- | +| `command` | A specific command to run instead of the command that ran this task. | `string` | + +_All properties are optional._ + From 98fb7456cf2a372ab9520cf4c070e377eb34be91 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 4 Nov 2024 11:54:57 +0000 Subject: [PATCH 09/26] docs(monorepo): add high-level workflow explanation --- plugins/monorepo/readme.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugins/monorepo/readme.md b/plugins/monorepo/readme.md index 93c8d1fa8..3f1cb21f8 100644 --- a/plugins/monorepo/readme.md +++ b/plugins/monorepo/readme.md @@ -17,6 +17,28 @@ plugins: - '@dotcom-tool-kit/monorepo' ``` +## Tool Kit monorepo workflows + +Most monorepos won't actually need to use this plugin. + +### When you _don't_ need the plugin + +Some common tooling, such as TypeScript and Jest, are already workspace-aware using configuration such as TypeScript's [project references](https://www.typescriptlang.org/docs/handbook/project-references.html). You can run these at the root level of your monorepo across all packages instead of running them package-by-package via Tool Kit and this plugin. + +In almost all cases that will work better; for example, running Jest separately in workspace packages will produce separate test summaries for each package, instead of one summary for all test suites across your monorepo. + +### When you _do_ need the plugin + +Where tooling isn't monorepo-aware itself, or you have tooling that you only want to run in a subset of your workspace packages, the `@dotcom-tool-kit/monorepo` plugin allows the root-level `.toolkitrc.yml` to run commands from workspace-package-level `.toolkitrc.yml` files. + +With this plugin, each workspace package is an independent Tool Kit root, which installs separate plugins for its own use cases. For example, a monorepo with an `api` package which is deployed to Heroku would install the `@dotcom-tool-kit/heroku` plugin as a dependency of the package, not at the root level, and would then include that plugin in the package `.toolkitrc.yml`. + +The root-level `.toolkitrc.yml` can then use the [`WorkspaceCommand`](#workspacecommand) task to forward commands such as `deploy:production` to just the workspace packages that have that command defined (in this case, the `api` package). + +### Plugin limitations + +- Hooks in workspace packages are not installed, so configuration files like `package.json` in workspace packages can't be managed by Tool Kit. If you have a use case for this, please contact the Platforms team. + ## Tasks From 7fb683d4ea4927cfbf5c4f811b375550b27d8a84 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 4 Nov 2024 12:09:28 +0000 Subject: [PATCH 10/26] docs(monorepo): document plugin vs `npm run --workspaces` considerations --- plugins/monorepo/readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/monorepo/readme.md b/plugins/monorepo/readme.md index 3f1cb21f8..6585f757e 100644 --- a/plugins/monorepo/readme.md +++ b/plugins/monorepo/readme.md @@ -35,6 +35,14 @@ With this plugin, each workspace package is an independent Tool Kit root, which The root-level `.toolkitrc.yml` can then use the [`WorkspaceCommand`](#workspacecommand) task to forward commands such as `deploy:production` to just the workspace packages that have that command defined (in this case, the `api` package). +### `@dotcom-tool-kit/monorepo` vs `npm run --workspaces` + +It's also possible to run `package.json` scripts in workspace packages using `npm run --workspaces`, and you can acheive a similar workflow by adding these commands as `package.json` scripts at the root level. Depending on your use case that may be preferable for your team or project, but be aware of these tradeoffs: + +- If we find there are common monorepo use cases between multiple projects, we can extract the Tool Kit configuration for that into a plugin that can be shared between projects. We can't do that if you're using `package.json` scripts. +- Mixing between `package.json` scripts and Tool Kit tasks would require chaining them with shell syntax in the `package.json` script, which is harder to read and less maintainable than having all the configuration in `.toolkitrc.yml`, and has worse error-handling behaviour. +- Due to a [limitation](#plugin-limitations) in this plugin, `package.json` scripts in workspace packages can't be managed by Tool Kit. Any Tool Kit tasks in workspace packages you'd want to run via `npm run --workspaces` would have to be manually maintained as `package.json` scripts, risking your scripts becoming out of sync with the Tool Kit tasks you expect to be running. + ### Plugin limitations - Hooks in workspace packages are not installed, so configuration files like `package.json` in workspace packages can't be managed by Tool Kit. If you have a use case for this, please contact the Platforms team. From de8ed396233f44de9c721986d44a98470ac5fa4e Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Thu, 7 Nov 2024 15:54:41 +0000 Subject: [PATCH 11/26] build: compile the monorepo plugin --- tsconfig.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tsconfig.json b/tsconfig.json index f214674fd..3a440f206 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -120,6 +120,9 @@ }, { "path": "lib/schemas" + }, + { + "path": "plugins/monorepo" } ] } From 170f67f303d425c1c5cf42d8ae25e81512dddf0c Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 18 Nov 2024 17:09:19 +0000 Subject: [PATCH 12/26] feat(monorepo): add a packageFilter option --- lib/schemas/src/tasks/workspace-command.ts | 3 ++- package-lock.json | 25 ++++++++++++++++++- plugins/monorepo/package.json | 3 ++- .../monorepo/src/tasks/workspace-command.ts | 9 ++++--- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/schemas/src/tasks/workspace-command.ts b/lib/schemas/src/tasks/workspace-command.ts index 62ab1f37b..715157c26 100644 --- a/lib/schemas/src/tasks/workspace-command.ts +++ b/lib/schemas/src/tasks/workspace-command.ts @@ -1,7 +1,8 @@ import { z } from 'zod' export const WorkspaceCommandSchema = z.object({ - command: z.string().optional().describe('A specific command to run instead of the command that ran this task.') + command: z.string().optional().describe('A specific command to run instead of the command that ran this task.'), + packageFilter: z.string().optional().describe('By default, the command will run in every workspace command that has that command assigned to a task. This option is a glob pattern to filter the packages the command will run on. For example, if your workspace has packages in the `plugins` and `lib` folders, set `packageFilter` to `plugins/*` to only run only in the packages in `plugins`.'), }).describe(`Runs a Tool Kit command in all workspace packages that have that command. By default, runs the command that was used to run this task. For example, imagine a monorepo with these \`.toolkitrc.yml\` files: diff --git a/package-lock.json b/package-lock.json index bab3faa61..528951167 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32394,7 +32394,8 @@ "license": "ISC", "dependencies": { "@dotcom-tool-kit/schemas": "^1.1.1", - "@npmcli/map-workspaces": "^3.0.6" + "@npmcli/map-workspaces": "^3.0.6", + "minimatch": "^10.0.1" }, "devDependencies": { "@types/npmcli__map-workspaces": "^3.0.4" @@ -32407,6 +32408,28 @@ "dotcom-tool-kit": "4.x" } }, + "plugins/monorepo/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "plugins/monorepo/node_modules/minimatch": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "plugins/n-test": { "name": "@dotcom-tool-kit/n-test", "version": "4.0.2", diff --git a/plugins/monorepo/package.json b/plugins/monorepo/package.json index 04db19f4f..323611de7 100644 --- a/plugins/monorepo/package.json +++ b/plugins/monorepo/package.json @@ -32,7 +32,8 @@ }, "dependencies": { "@dotcom-tool-kit/schemas": "^1.1.1", - "@npmcli/map-workspaces": "^3.0.6" + "@npmcli/map-workspaces": "^3.0.6", + "minimatch": "^10.0.1" }, "devDependencies": { "@types/npmcli__map-workspaces": "^3.0.4" diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index b56b896ef..fcfeea76c 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -6,6 +6,7 @@ import { loadConfig } from 'dotcom-tool-kit/lib/config' import { runTasksFromConfig } from 'dotcom-tool-kit/lib/tasks' import { ToolKitError } from '@dotcom-tool-kit/error' import { WorkspaceCommandSchema } from '@dotcom-tool-kit/schemas/lib/tasks/workspace-command' +import {minimatch} from 'minimatch' export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceCommandSchema }> { async runPackageCommand(packageId: string, packagePath: string, command: string, files?: string[]) { @@ -20,9 +21,11 @@ export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceComma const workspaces = await mapWorkspaces({ cwd, pkg }) const results = await Promise.allSettled( - Array.from(workspaces, ([id, packagePath]) => - this.runPackageCommand(id, packagePath, this.options.command ?? command, files) - ) + Array.from(workspaces, ([id, packagePath]) => { + if(!this.options.packageFilter || minimatch(packagePath, this.options.packageFilter)) { + return this.runPackageCommand(id, packagePath, this.options.command ?? command, files) + } + }) ) const erroredCommands = results.filter( From 681a250f88ddfdbb5acf1fca800888c5c2df02fa Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 18 Nov 2024 17:09:30 +0000 Subject: [PATCH 13/26] docs: automatically regenerate schema docs --- plugins/monorepo/readme.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/monorepo/readme.md b/plugins/monorepo/readme.md index 6585f757e..085ea7ad3 100644 --- a/plugins/monorepo/readme.md +++ b/plugins/monorepo/readme.md @@ -110,9 +110,10 @@ commands: #### Task options -| Property | Description | Type | -| :-------- | :------------------------------------------------------------------- | :------- | -| `command` | A specific command to run instead of the command that ran this task. | `string` | +| Property | Description | Type | +| :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | +| `command` | A specific command to run instead of the command that ran this task. | `string` | +| `packageFilter` | By default, the command will run in every workspace command that has that command assigned to a task. This option is a glob pattern to filter the packages the command will run on. For example, if your workspace has packages in the `plugins` and `lib` folders, set `packageFilter` to `plugins/*` to only run only in the packages in `plugins`. | `string` | _All properties are optional._ From 27dbe2a834086560f6e289bca2529b9151690190 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Tue, 26 Nov 2024 10:11:43 +0000 Subject: [PATCH 14/26] feat: use an AggregateError for workspace package command errors --- package-lock.json | 7 +++++-- plugins/monorepo/package.json | 7 +++++-- plugins/monorepo/src/tasks/workspace-command.ts | 10 ++++++---- plugins/monorepo/tsconfig.json | 7 ++++++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 528951167..84ff86f62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32393,12 +32393,15 @@ "version": "0.1.0", "license": "ISC", "dependencies": { + "@dotcom-tool-kit/logger": "^4.0.0", "@dotcom-tool-kit/schemas": "^1.1.1", "@npmcli/map-workspaces": "^3.0.6", - "minimatch": "^10.0.1" + "minimatch": "^10.0.1", + "pluralize": "^8.0.0" }, "devDependencies": { - "@types/npmcli__map-workspaces": "^3.0.4" + "@types/npmcli__map-workspaces": "^3.0.4", + "@types/pluralize": "^0.0.33" }, "engines": { "node": "18.x || 20.x", diff --git a/plugins/monorepo/package.json b/plugins/monorepo/package.json index 323611de7..b08e91bd6 100644 --- a/plugins/monorepo/package.json +++ b/plugins/monorepo/package.json @@ -31,11 +31,14 @@ "dotcom-tool-kit": "4.x" }, "dependencies": { + "@dotcom-tool-kit/logger": "^4.0.0", "@dotcom-tool-kit/schemas": "^1.1.1", "@npmcli/map-workspaces": "^3.0.6", - "minimatch": "^10.0.1" + "minimatch": "^10.0.1", + "pluralize": "^8.0.0" }, "devDependencies": { - "@types/npmcli__map-workspaces": "^3.0.4" + "@types/npmcli__map-workspaces": "^3.0.4", + "@types/pluralize": "^0.0.33" } } diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index fcfeea76c..622891d8e 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -7,6 +7,8 @@ import { runTasksFromConfig } from 'dotcom-tool-kit/lib/tasks' import { ToolKitError } from '@dotcom-tool-kit/error' import { WorkspaceCommandSchema } from '@dotcom-tool-kit/schemas/lib/tasks/workspace-command' import {minimatch} from 'minimatch' +import pluralize from 'pluralize' +import { styles } from '@dotcom-tool-kit/logger' export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceCommandSchema }> { async runPackageCommand(packageId: string, packagePath: string, command: string, files?: string[]) { @@ -33,10 +35,10 @@ export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceComma ) if (erroredCommands.length) { - // TODO improve error messages - const error = new ToolKitError(`error running workspace command ${this.options.command ?? command}`) - error.details = erroredCommands.map((result) => result.reason.toString()).join('\n\n') - throw error + throw new AggregateError( + erroredCommands.map(result => result.reason), + `${pluralize('error', erroredCommands.length, true)} running workspace command ${styles.command(this.options.command ?? command)}` + ) } } } diff --git a/plugins/monorepo/tsconfig.json b/plugins/monorepo/tsconfig.json index 65a97dec3..60a7a7627 100644 --- a/plugins/monorepo/tsconfig.json +++ b/plugins/monorepo/tsconfig.json @@ -10,7 +10,12 @@ }, { "path": "../../lib/schemas" + }, + { + "path": "../../lib/logger" } ], - "include": ["src/**/*"] + "include": [ + "src/**/*" + ] } From 0dbd7ea7c54650a71d0f2ce0c63b585990e84e5a Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 27 Nov 2024 10:53:02 +0000 Subject: [PATCH 15/26] feat: pass cwd into init --- core/cli/src/init.ts | 4 +++- lib/base/src/init.ts | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/cli/src/init.ts b/core/cli/src/init.ts index 26b116da0..2296298dc 100644 --- a/core/cli/src/init.ts +++ b/core/cli/src/init.ts @@ -16,5 +16,7 @@ export async function runInit(logger: Logger, config: ValidConfig): Promise init.init())) + await Promise.all(inits.map(async (init) => init.init({ + cwd: config.root + }))) } diff --git a/lib/base/src/init.ts b/lib/base/src/init.ts index 42b99279f..8c2a1d899 100644 --- a/lib/base/src/init.ts +++ b/lib/base/src/init.ts @@ -2,6 +2,10 @@ import type { Logger } from 'winston' import { initSymbol, typeSymbol } from './symbols' import { Base } from './base' +export type InitContext = { + cwd: string +} + export abstract class Init extends Base { logger: Logger @@ -18,7 +22,7 @@ export abstract class Init extends Base { return initSymbol } - abstract init(): Promise + abstract init(context: InitContext): Promise } export type InitConstructor = { From 891ae0158e2830fbf61c0268b5e6ad90a19cae6d Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 27 Nov 2024 11:35:12 +0000 Subject: [PATCH 16/26] fix: run init before printing help --- core/cli/src/help.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/cli/src/help.ts b/core/cli/src/help.ts index 9a4e4711f..3c31cc373 100644 --- a/core/cli/src/help.ts +++ b/core/cli/src/help.ts @@ -5,6 +5,7 @@ import YAML from 'yaml' import $t from 'endent' import { CommandTask, OptionsForTask } from '@dotcom-tool-kit/plugin' import { ValidConfig } from '@dotcom-tool-kit/config' +import { runInit } from './init' const toolKitIntro = s.box( $t` @@ -84,6 +85,8 @@ export default async function showHelp(logger: Logger, commands: string[]): Prom commands = Object.keys(config.commandTasks).sort() } + await runInit(logger, config) + logger.info(toolKitIntro) const definedCommands = commands.filter((command) => config.commandTasks[command]) From 6315513e5bc43ed8f63683ed212fceacc0b4d64b Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 27 Nov 2024 11:37:31 +0000 Subject: [PATCH 17/26] refactor: load workspace configs at init not task run --- plugins/monorepo/.toolkitrc.yml | 3 + .../monorepo/src/load-workspace-configs.ts | 58 +++++++++++++++++++ .../monorepo/src/tasks/workspace-command.ts | 25 ++------ 3 files changed, 67 insertions(+), 19 deletions(-) create mode 100644 plugins/monorepo/src/load-workspace-configs.ts diff --git a/plugins/monorepo/.toolkitrc.yml b/plugins/monorepo/.toolkitrc.yml index 18ce7c7de..43d663a33 100644 --- a/plugins/monorepo/.toolkitrc.yml +++ b/plugins/monorepo/.toolkitrc.yml @@ -1,4 +1,7 @@ version: 2 +init: + - ./lib/load-workspace-configs.js + tasks: WorkspaceCommand: ./lib/tasks/workspace-command.js diff --git a/plugins/monorepo/src/load-workspace-configs.ts b/plugins/monorepo/src/load-workspace-configs.ts new file mode 100644 index 000000000..081bfc198 --- /dev/null +++ b/plugins/monorepo/src/load-workspace-configs.ts @@ -0,0 +1,58 @@ +import { Init, InitContext } from '@dotcom-tool-kit/base' +import path from 'path' +import fs from 'fs/promises' +import { ValidConfig } from '@dotcom-tool-kit/config' +import { loadConfig } from 'dotcom-tool-kit/lib/config' +import mapWorkspaces from '@npmcli/map-workspaces' +import { styles } from '@dotcom-tool-kit/logger' +import pluralize from 'pluralize' + +interface WorkspaceConfig { + packageId: string + root: string + config: ValidConfig +} + +export default class LoadWorkspaceConfigs extends Init { + private static _configs: WorkspaceConfig[] = [] + + static get configs() { + return LoadWorkspaceConfigs._configs + } + + private static set configs(configs: WorkspaceConfig[]) { + LoadWorkspaceConfigs._configs = configs + } + + async init({ cwd }: InitContext) { + const pkg = JSON.parse(await fs.readFile(path.join(cwd, 'package.json'), 'utf8')) + const workspaces = await mapWorkspaces({ cwd, pkg }) + const results = await Promise.allSettled( + Array.from(workspaces, async ([packageId, root]) => ({ + packageId, + root, + config: await loadConfig(this.logger, { root }).catch((error) => { + error.name = `${styles.plugin(packageId)} → ${error.name}` + throw error + }) + })) + ) + + const erroredConfigs = results.filter( + (result): result is PromiseRejectedResult => result.status === 'rejected' + ) + + if (erroredConfigs.length) { + throw new AggregateError( + erroredConfigs.map((result) => result.reason), + `${pluralize('error', erroredConfigs.length, true)} loading ${styles.filepath( + '.toolkitrc.yml' + )} in workspace packages` + ) + } + + LoadWorkspaceConfigs.configs = results + .filter((result): result is PromiseFulfilledResult => result.status === 'fulfilled') + .map((result) => result.value) + } +} diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index 622891d8e..e121fb88f 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -1,31 +1,18 @@ import { Task, TaskRunContext } from '@dotcom-tool-kit/base' -import mapWorkspaces from '@npmcli/map-workspaces' -import fs from 'fs/promises' -import path from 'path' -import { loadConfig } from 'dotcom-tool-kit/lib/config' import { runTasksFromConfig } from 'dotcom-tool-kit/lib/tasks' -import { ToolKitError } from '@dotcom-tool-kit/error' import { WorkspaceCommandSchema } from '@dotcom-tool-kit/schemas/lib/tasks/workspace-command' import {minimatch} from 'minimatch' import pluralize from 'pluralize' import { styles } from '@dotcom-tool-kit/logger' +import LoadWorkspaceConfigs from '../load-workspace-configs' -export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceCommandSchema }> { - async runPackageCommand(packageId: string, packagePath: string, command: string, files?: string[]) { - const config = await loadConfig(this.logger, { root: packagePath }) - - return runTasksFromConfig(this.logger.child({ packageId }), config, [command], files) - } - - async run({ cwd, command, files }: TaskRunContext) { - const pkg = JSON.parse(await fs.readFile(path.join(cwd, 'package.json'), 'utf8')) - - const workspaces = await mapWorkspaces({ cwd, pkg }) +export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceCommandSchema }> { + async run({ command, files }: TaskRunContext) { const results = await Promise.allSettled( - Array.from(workspaces, ([id, packagePath]) => { - if(!this.options.packageFilter || minimatch(packagePath, this.options.packageFilter)) { - return this.runPackageCommand(id, packagePath, this.options.command ?? command, files) + LoadWorkspaceConfigs.configs.map(async ({ config, packageId, root }) => { + if(!this.options.packageFilter || minimatch(root, this.options.packageFilter)) { + await runTasksFromConfig(this.logger.child({ packageId }), config, [command], files) } }) ) From ea7936e7a0606959936548119711df3915cc9075 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 27 Nov 2024 11:41:40 +0000 Subject: [PATCH 18/26] feat: only attempt to run workspace command in packages that have it, and log which packages (instead of logging a bunch of "no task configured for test:local: skipping assignment...") --- plugins/monorepo/src/tasks/workspace-command.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index e121fb88f..fe3fa372e 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -9,8 +9,16 @@ import LoadWorkspaceConfigs from '../load-workspace-configs' export default class WorkspaceCommand extends Task<{ task: typeof WorkspaceCommandSchema }> { async run({ command, files }: TaskRunContext) { + const configsWithCommand = LoadWorkspaceConfigs.configs.filter( + ({config}) => command in config.commandTasks + ) + + this.logger.info(`Running ${styles.command(command)} in: +${configsWithCommand.map(({ packageId }) => `- ${styles.plugin(packageId)}`).join('\n')} +`) + const results = await Promise.allSettled( - LoadWorkspaceConfigs.configs.map(async ({ config, packageId, root }) => { + configsWithCommand.map(async ({ config, packageId, root }) => { if(!this.options.packageFilter || minimatch(root, this.options.packageFilter)) { await runTasksFromConfig(this.logger.child({ packageId }), config, [command], files) } From 10729666397869cd07a8c18596f95a93371aa266 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 27 Nov 2024 11:43:24 +0000 Subject: [PATCH 19/26] feat: print workspace package name in task run errors --- plugins/monorepo/src/tasks/workspace-command.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/monorepo/src/tasks/workspace-command.ts b/plugins/monorepo/src/tasks/workspace-command.ts index fe3fa372e..20e50dd18 100644 --- a/plugins/monorepo/src/tasks/workspace-command.ts +++ b/plugins/monorepo/src/tasks/workspace-command.ts @@ -20,7 +20,12 @@ ${configsWithCommand.map(({ packageId }) => `- ${styles.plugin(packageId)}`).joi const results = await Promise.allSettled( configsWithCommand.map(async ({ config, packageId, root }) => { if(!this.options.packageFilter || minimatch(root, this.options.packageFilter)) { - await runTasksFromConfig(this.logger.child({ packageId }), config, [command], files) + await runTasksFromConfig(this.logger.child({ packageId }), config, [command], files).catch( + error => { + error.name = `${styles.plugin(packageId)} → ${error.name}` + throw error + } + ) } }) ) @@ -32,7 +37,7 @@ ${configsWithCommand.map(({ packageId }) => `- ${styles.plugin(packageId)}`).joi if (erroredCommands.length) { throw new AggregateError( erroredCommands.map(result => result.reason), - `${pluralize('error', erroredCommands.length, true)} running workspace command ${styles.command(this.options.command ?? command)}` + `${pluralize('error', erroredCommands.length, true)} running command ${styles.command(this.options.command ?? command)} in workspace packages` ) } } From b8225b2bbbf2823d9ab4a80d39503e326bdd6f48 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 2 Dec 2024 11:56:14 +0000 Subject: [PATCH 20/26] test: add basic test for LoadWorkspaceConfigs --- plugins/monorepo/jest.config.js | 5 + .../load-workspace-configs.test.ts.snap | 1766 +++++++++++++++++ plugins/monorepo/test/files/a/.toolkitrc.yml | 7 + plugins/monorepo/test/files/a/package.json | 3 + plugins/monorepo/test/files/b/.toolkitrc.yml | 7 + plugins/monorepo/test/files/b/package.json | 3 + plugins/monorepo/test/files/package.json | 6 + .../test/load-workspace-configs.test.ts | 19 + 8 files changed, 1816 insertions(+) create mode 100644 plugins/monorepo/jest.config.js create mode 100644 plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap create mode 100644 plugins/monorepo/test/files/a/.toolkitrc.yml create mode 100644 plugins/monorepo/test/files/a/package.json create mode 100644 plugins/monorepo/test/files/b/.toolkitrc.yml create mode 100644 plugins/monorepo/test/files/b/package.json create mode 100644 plugins/monorepo/test/files/package.json create mode 100644 plugins/monorepo/test/load-workspace-configs.test.ts diff --git a/plugins/monorepo/jest.config.js b/plugins/monorepo/jest.config.js new file mode 100644 index 000000000..2ea38bb31 --- /dev/null +++ b/plugins/monorepo/jest.config.js @@ -0,0 +1,5 @@ +const base = require('../../jest.config.base') + +module.exports = { + ...base.config +} diff --git a/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap b/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap new file mode 100644 index 000000000..466f7f05d --- /dev/null +++ b/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap @@ -0,0 +1,1766 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspace packages 1`] = ` +[ + { + "config": { + "commandTasks": { + "build:ci": { + "id": "build:ci", + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + "tasks": [ + { + "options": { + "envName": "production", + }, + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + "task": "Webpack", + }, + ], + }, + "build:local": { + "id": "build:local", + "plugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "tasks": [ + { + "options": { + "envName": "development", + }, + "plugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "task": "Webpack", + }, + ], + }, + "build:remote": { + "id": "build:remote", + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + "tasks": [ + { + "options": { + "envName": "production", + }, + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + "task": "Webpack", + }, + ], + }, + "run:local": { + "id": "run:local", + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + "tasks": [ + { + "options": { + "envName": "development", + "watch": true, + }, + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + "task": "Webpack", + }, + ], + }, + }, + "hookManagedFiles": Set {}, + "hooks": {}, + "inits": [], + "pluginOptions": { + "app root": { + "forPlugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "options": { + "allowNativeFetch": false, + }, + "plugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + }, + }, + "plugins": { + "@dotcom-tool-kit/webpack": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + "app root": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + }, + "resolutionTrackers": { + "reducedInstallationPlugins": Set {}, + "resolvedPluginOptions": Set { + "@dotcom-tool-kit/webpack", + "app root", + }, + "resolvedPlugins": Set { + "@dotcom-tool-kit/webpack", + "app root", + }, + "substitutedPlugins": Set { + "@dotcom-tool-kit/webpack", + "app root", + }, + }, + "root": "plugins/monorepo/test/files/a", + "taskOptions": {}, + "tasks": { + "Webpack": { + "modulePath": "./lib/tasks/webpack", + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/webpack", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Webpack": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/webpack", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/a", + }, + "rcFile": { + "commands": { + "build:ci": { + "Webpack": { + "envName": "production", + }, + }, + "build:local": { + "Webpack": { + "envName": "development", + }, + }, + "build:remote": { + "Webpack": { + "envName": "production", + }, + }, + "run:local": { + "Webpack": { + "envName": "development", + "watch": true, + }, + }, + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Webpack": "./lib/tasks/webpack", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + }, + }, + }, + }, + "packageId": "@monorepo-plugin-tests/a", + "root": "plugins/monorepo/test/files/a", + }, + { + "config": { + "commandTasks": { + "build:ci": { + "id": "build:ci", + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + "tasks": [ + { + "options": {}, + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + "task": "Babel", + }, + ], + }, + "build:local": { + "id": "build:local", + "plugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "tasks": [ + { + "options": { + "envName": "development", + }, + "plugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "task": "Babel", + }, + ], + }, + "build:remote": { + "id": "build:remote", + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + "tasks": [ + { + "options": {}, + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + "task": "Babel", + }, + ], + }, + }, + "hookManagedFiles": Set {}, + "hooks": {}, + "inits": [], + "pluginOptions": { + "app root": { + "forPlugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "options": { + "allowNativeFetch": false, + }, + "plugin": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + }, + }, + "plugins": { + "@dotcom-tool-kit/babel": { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + "app root": { + "children": [ + { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": [Circular], + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + }, + "resolutionTrackers": { + "reducedInstallationPlugins": Set {}, + "resolvedPluginOptions": Set { + "@dotcom-tool-kit/babel", + "app root", + }, + "resolvedPlugins": Set { + "@dotcom-tool-kit/babel", + "app root", + }, + "substitutedPlugins": Set { + "@dotcom-tool-kit/babel", + "app root", + }, + }, + "root": "plugins/monorepo/test/files/b", + "taskOptions": {}, + "tasks": { + "Babel": { + "modulePath": "./lib/tasks/babel", + "plugin": { + "children": [], + "id": "@dotcom-tool-kit/babel", + "parent": { + "children": [ + [Circular], + ], + "id": "app root", + "parent": undefined, + "rcFile": { + "commands": { + "build:local": [ + { + "Babel": { + "envName": "development", + }, + }, + ], + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [ + "@dotcom-tool-kit/babel", + ], + "tasks": {}, + "version": undefined, + }, + "root": "plugins/monorepo/test/files/b", + }, + "rcFile": { + "commands": { + "build:ci": "Babel", + "build:local": "Babel", + "build:remote": "Babel", + }, + "hooks": undefined, + "init": [], + "installs": {}, + "options": { + "hooks": [], + "plugins": {}, + "tasks": {}, + }, + "plugins": [], + "tasks": { + "Babel": "./lib/tasks/babel", + }, + "version": 2, + }, + "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + }, + }, + }, + }, + "packageId": "@monorepo-plugin-tests/b", + "root": "plugins/monorepo/test/files/b", + }, +] +`; diff --git a/plugins/monorepo/test/files/a/.toolkitrc.yml b/plugins/monorepo/test/files/a/.toolkitrc.yml new file mode 100644 index 000000000..cc65c3b03 --- /dev/null +++ b/plugins/monorepo/test/files/a/.toolkitrc.yml @@ -0,0 +1,7 @@ +plugins: + - @dotcom-tool-kit/webpack + +commands: + build:local: + - Webpack: + envName: development diff --git a/plugins/monorepo/test/files/a/package.json b/plugins/monorepo/test/files/a/package.json new file mode 100644 index 000000000..beed862e3 --- /dev/null +++ b/plugins/monorepo/test/files/a/package.json @@ -0,0 +1,3 @@ +{ + "name": "@monorepo-plugin-tests/a" +} diff --git a/plugins/monorepo/test/files/b/.toolkitrc.yml b/plugins/monorepo/test/files/b/.toolkitrc.yml new file mode 100644 index 000000000..69cceb6d6 --- /dev/null +++ b/plugins/monorepo/test/files/b/.toolkitrc.yml @@ -0,0 +1,7 @@ +plugins: + - @dotcom-tool-kit/babel + +commands: + build:local: + - Babel: + envName: development diff --git a/plugins/monorepo/test/files/b/package.json b/plugins/monorepo/test/files/b/package.json new file mode 100644 index 000000000..695332fd9 --- /dev/null +++ b/plugins/monorepo/test/files/b/package.json @@ -0,0 +1,3 @@ +{ + "name": "@monorepo-plugin-tests/b" +} diff --git a/plugins/monorepo/test/files/package.json b/plugins/monorepo/test/files/package.json new file mode 100644 index 000000000..9fe54da0c --- /dev/null +++ b/plugins/monorepo/test/files/package.json @@ -0,0 +1,6 @@ +{ + "workspaces": [ + "./a", + "./b" + ] +} diff --git a/plugins/monorepo/test/load-workspace-configs.test.ts b/plugins/monorepo/test/load-workspace-configs.test.ts new file mode 100644 index 000000000..44adc7803 --- /dev/null +++ b/plugins/monorepo/test/load-workspace-configs.test.ts @@ -0,0 +1,19 @@ +import path from 'path' +import LoadWorkspaceConfigs from '../src/load-workspace-configs' +import winston, { Logger } from 'winston' + +const logger = winston as unknown as Logger + +describe('LoadWorkspaceConfigs', () => { + it('should load multiple tool kit configs from workspace packages', async () => { + const lwc = new LoadWorkspaceConfigs(logger) + + await expect( + lwc.init({ + cwd: path.relative(process.cwd(), path.resolve(__dirname, './files')) + }) + ).resolves.toBeUndefined() + + expect(LoadWorkspaceConfigs.configs).toMatchSnapshot() + }) +}) From 57fea91cee754772db772ef771c9ae64ceef5af9 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 2 Dec 2024 12:32:52 +0000 Subject: [PATCH 21/26] test: add tests for LoadWorkspaceConfigs failure behaviour --- .../load-workspace-configs.test.ts.snap | 56 +++++++-------- .../test/files/{ => invalid}/a/.toolkitrc.yml | 0 .../test/files/{ => invalid}/a/package.json | 0 .../test/files/invalid/b/.toolkitrc.yml | 4 ++ .../test/files/{ => invalid}/b/package.json | 0 .../test/files/invalid/c/.toolkitrc.yml | 4 ++ .../test/files/invalid/c/package.json | 3 + .../monorepo/test/files/invalid/package.json | 7 ++ .../test/files/successful/a/.toolkitrc.yml | 7 ++ .../test/files/successful/a/package.json | 3 + .../files/{ => successful}/b/.toolkitrc.yml | 0 .../test/files/successful/b/package.json | 3 + .../test/files/{ => successful}/package.json | 0 .../test/load-workspace-configs.test.ts | 69 ++++++++++++++++++- 14 files changed, 127 insertions(+), 29 deletions(-) rename plugins/monorepo/test/files/{ => invalid}/a/.toolkitrc.yml (100%) rename plugins/monorepo/test/files/{ => invalid}/a/package.json (100%) create mode 100644 plugins/monorepo/test/files/invalid/b/.toolkitrc.yml rename plugins/monorepo/test/files/{ => invalid}/b/package.json (100%) create mode 100644 plugins/monorepo/test/files/invalid/c/.toolkitrc.yml create mode 100644 plugins/monorepo/test/files/invalid/c/package.json create mode 100644 plugins/monorepo/test/files/invalid/package.json create mode 100644 plugins/monorepo/test/files/successful/a/.toolkitrc.yml create mode 100644 plugins/monorepo/test/files/successful/a/package.json rename plugins/monorepo/test/files/{ => successful}/b/.toolkitrc.yml (100%) create mode 100644 plugins/monorepo/test/files/successful/b/package.json rename plugins/monorepo/test/files/{ => successful}/package.json (100%) diff --git a/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap b/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap index 466f7f05d..e60dab17d 100644 --- a/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap +++ b/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap @@ -40,7 +40,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -120,7 +120,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -241,7 +241,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "tasks": [ { @@ -321,7 +321,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "task": "Webpack", }, @@ -362,7 +362,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -442,7 +442,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -523,7 +523,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -604,7 +604,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -729,7 +729,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "options": { "allowNativeFetch": false, @@ -807,7 +807,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, }, }, @@ -845,7 +845,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -960,7 +960,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, }, "resolutionTrackers": { @@ -978,7 +978,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "app root", }, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", "taskOptions": {}, "tasks": { "Webpack": { @@ -1016,7 +1016,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, "rcFile": { "commands": { @@ -1062,7 +1062,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, }, "packageId": "@monorepo-plugin-tests/a", - "root": "plugins/monorepo/test/files/a", + "root": "plugins/monorepo/test/files/successful/a", }, { "config": { @@ -1102,7 +1102,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "rcFile": { "commands": { @@ -1162,7 +1162,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "rcFile": { "commands": { @@ -1247,7 +1247,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "tasks": [ { @@ -1309,7 +1309,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "task": "Babel", }, @@ -1350,7 +1350,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "rcFile": { "commands": { @@ -1410,7 +1410,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "rcFile": { "commands": { @@ -1499,7 +1499,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "options": { "allowNativeFetch": false, @@ -1559,7 +1559,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, }, }, @@ -1597,7 +1597,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "rcFile": { "commands": { @@ -1676,7 +1676,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, }, "resolutionTrackers": { @@ -1694,7 +1694,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "app root", }, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", "taskOptions": {}, "tasks": { "Babel": { @@ -1732,7 +1732,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa "tasks": {}, "version": undefined, }, - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, "rcFile": { "commands": { @@ -1760,7 +1760,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, }, "packageId": "@monorepo-plugin-tests/b", - "root": "plugins/monorepo/test/files/b", + "root": "plugins/monorepo/test/files/successful/b", }, ] `; diff --git a/plugins/monorepo/test/files/a/.toolkitrc.yml b/plugins/monorepo/test/files/invalid/a/.toolkitrc.yml similarity index 100% rename from plugins/monorepo/test/files/a/.toolkitrc.yml rename to plugins/monorepo/test/files/invalid/a/.toolkitrc.yml diff --git a/plugins/monorepo/test/files/a/package.json b/plugins/monorepo/test/files/invalid/a/package.json similarity index 100% rename from plugins/monorepo/test/files/a/package.json rename to plugins/monorepo/test/files/invalid/a/package.json diff --git a/plugins/monorepo/test/files/invalid/b/.toolkitrc.yml b/plugins/monorepo/test/files/invalid/b/.toolkitrc.yml new file mode 100644 index 000000000..75dc6be0e --- /dev/null +++ b/plugins/monorepo/test/files/invalid/b/.toolkitrc.yml @@ -0,0 +1,4 @@ +plugins: + - @dotcom-tool-kit/serverless + +# deliberately missing plugin options to fail validation diff --git a/plugins/monorepo/test/files/b/package.json b/plugins/monorepo/test/files/invalid/b/package.json similarity index 100% rename from plugins/monorepo/test/files/b/package.json rename to plugins/monorepo/test/files/invalid/b/package.json diff --git a/plugins/monorepo/test/files/invalid/c/.toolkitrc.yml b/plugins/monorepo/test/files/invalid/c/.toolkitrc.yml new file mode 100644 index 000000000..fad8276d7 --- /dev/null +++ b/plugins/monorepo/test/files/invalid/c/.toolkitrc.yml @@ -0,0 +1,4 @@ +plugins: + - @dotcom-tool-kit/heroku + +# deliberately missing plugin options to fail validation diff --git a/plugins/monorepo/test/files/invalid/c/package.json b/plugins/monorepo/test/files/invalid/c/package.json new file mode 100644 index 000000000..32d72cd2b --- /dev/null +++ b/plugins/monorepo/test/files/invalid/c/package.json @@ -0,0 +1,3 @@ +{ + "name": "@monorepo-plugin-tests/c" +} diff --git a/plugins/monorepo/test/files/invalid/package.json b/plugins/monorepo/test/files/invalid/package.json new file mode 100644 index 000000000..c12dcfa8d --- /dev/null +++ b/plugins/monorepo/test/files/invalid/package.json @@ -0,0 +1,7 @@ +{ + "workspaces": [ + "./a", + "./b", + "./c" + ] +} diff --git a/plugins/monorepo/test/files/successful/a/.toolkitrc.yml b/plugins/monorepo/test/files/successful/a/.toolkitrc.yml new file mode 100644 index 000000000..cc65c3b03 --- /dev/null +++ b/plugins/monorepo/test/files/successful/a/.toolkitrc.yml @@ -0,0 +1,7 @@ +plugins: + - @dotcom-tool-kit/webpack + +commands: + build:local: + - Webpack: + envName: development diff --git a/plugins/monorepo/test/files/successful/a/package.json b/plugins/monorepo/test/files/successful/a/package.json new file mode 100644 index 000000000..beed862e3 --- /dev/null +++ b/plugins/monorepo/test/files/successful/a/package.json @@ -0,0 +1,3 @@ +{ + "name": "@monorepo-plugin-tests/a" +} diff --git a/plugins/monorepo/test/files/b/.toolkitrc.yml b/plugins/monorepo/test/files/successful/b/.toolkitrc.yml similarity index 100% rename from plugins/monorepo/test/files/b/.toolkitrc.yml rename to plugins/monorepo/test/files/successful/b/.toolkitrc.yml diff --git a/plugins/monorepo/test/files/successful/b/package.json b/plugins/monorepo/test/files/successful/b/package.json new file mode 100644 index 000000000..695332fd9 --- /dev/null +++ b/plugins/monorepo/test/files/successful/b/package.json @@ -0,0 +1,3 @@ +{ + "name": "@monorepo-plugin-tests/b" +} diff --git a/plugins/monorepo/test/files/package.json b/plugins/monorepo/test/files/successful/package.json similarity index 100% rename from plugins/monorepo/test/files/package.json rename to plugins/monorepo/test/files/successful/package.json diff --git a/plugins/monorepo/test/load-workspace-configs.test.ts b/plugins/monorepo/test/load-workspace-configs.test.ts index 44adc7803..cfe41117b 100644 --- a/plugins/monorepo/test/load-workspace-configs.test.ts +++ b/plugins/monorepo/test/load-workspace-configs.test.ts @@ -4,16 +4,83 @@ import winston, { Logger } from 'winston' const logger = winston as unknown as Logger +expect.addSnapshotSerializer({ + test(value) { + return value instanceof Error && value.name === 'AggregateError' + }, + + serialize(val, config, indentation, depth, refs, printer) { + return `AggregateError ${printer(val.message, config, indentation, depth, refs)} ${printer( + { errors: val.errors }, + config, + indentation, + depth, + refs + )}` + } +}) + +expect.addSnapshotSerializer({ + test(value) { + return value instanceof Error && value.constructor.name === 'ToolKitError' + }, + + serialize(val, config, indentation, depth, refs, printer) { + return `${val.name} ${printer(val.message, config, indentation, depth, refs)} ${printer( + { details: val.details }, + config, + indentation, + depth, + refs + )}` + } +}) + describe('LoadWorkspaceConfigs', () => { + beforeEach(() => { + // clear the singleton before each test + LoadWorkspaceConfigs['configs'] = [] + }) + it('should load multiple tool kit configs from workspace packages', async () => { const lwc = new LoadWorkspaceConfigs(logger) await expect( lwc.init({ - cwd: path.relative(process.cwd(), path.resolve(__dirname, './files')) + cwd: path.relative(process.cwd(), path.resolve(__dirname, './files/successful')) }) ).resolves.toBeUndefined() expect(LoadWorkspaceConfigs.configs).toMatchSnapshot() }) + + it('should report all config load failures as an AggregateError', async () => { + const lwc = new LoadWorkspaceConfigs(logger) + + await expect( + lwc.init({ + cwd: path.relative(process.cwd(), path.resolve(__dirname, './files/invalid')) + }) + ).rejects.toMatchInlineSnapshot(` + AggregateError "2 errors loading .toolkitrc.yml in workspace packages" { + "errors": [ + @monorepo-plugin-tests/b → ToolKitError "There are options in your .toolkitrc.yml that aren't what Tool Kit expected." { + "details": "Please update the options so that they are the expected types. +  !  2 issues in @dotcom-tool-kit/serverless: + - Required at "awsAccountId" + - Required at "systemCode" + + You can refer to the README for the plugin for examples and descriptions of the options used.", + }, + @monorepo-plugin-tests/c → ToolKitError "There are options in your .toolkitrc.yml that aren't what Tool Kit expected." { + "details": "Please update the options so that they are the expected types. +  !  1 issue in @dotcom-tool-kit/heroku: + - Required at "pipeline" + + You can refer to the README for the plugin for examples and descriptions of the options used.", + }, + ], + } + `) + }) }) From fdc19ef7d6953baca2164824774e58e7a9e3ad16 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 2 Dec 2024 14:54:46 +0000 Subject: [PATCH 22/26] fix(typescript): resolve tsc path from cwd --- plugins/typescript/src/tasks/typescript.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/typescript/src/tasks/typescript.ts b/plugins/typescript/src/tasks/typescript.ts index 9834e2a7d..ff93d43f1 100644 --- a/plugins/typescript/src/tasks/typescript.ts +++ b/plugins/typescript/src/tasks/typescript.ts @@ -3,10 +3,9 @@ import { Task, TaskRunContext } from '@dotcom-tool-kit/base' import type { TypeScriptSchema } from '@dotcom-tool-kit/schemas/lib/tasks/typescript' import { fork } from 'child_process' -const tscPath = require.resolve('typescript/bin/tsc') - export default class TypeScript extends Task<{ task: typeof TypeScriptSchema }> { - async run({cwd}: TaskRunContext): Promise { + async run({ cwd }: TaskRunContext): Promise { + const tscPath = require.resolve('typescript/bin/tsc', { paths: [cwd] }) const args = [] // TODO:KB:20240408 refactor this From 81ebda7f9046bb3a04e7f0c08e0aa8a26ba72844 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 2 Dec 2024 15:27:16 +0000 Subject: [PATCH 23/26] fix: prevent running nodemon in non-root directories --- plugins/nodemon/src/tasks/nodemon.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/plugins/nodemon/src/tasks/nodemon.ts b/plugins/nodemon/src/tasks/nodemon.ts index 9a901c4b8..5d1869c22 100644 --- a/plugins/nodemon/src/tasks/nodemon.ts +++ b/plugins/nodemon/src/tasks/nodemon.ts @@ -1,4 +1,4 @@ -import { hookFork } from '@dotcom-tool-kit/logger' +import { hookFork, styles } from '@dotcom-tool-kit/logger' import { Task, TaskRunContext } from '@dotcom-tool-kit/base' import { NodemonSchema } from '@dotcom-tool-kit/schemas/lib/tasks/nodemon' import { writeState } from '@dotcom-tool-kit/state' @@ -7,15 +7,28 @@ import getPort from 'get-port' import nodemon from 'nodemon' import { Readable } from 'stream' import { shouldDisableNativeFetch } from 'dotcom-tool-kit' +import { ToolKitError } from '@dotcom-tool-kit/error' export default class Nodemon extends Task<{ task: typeof NodemonSchema }> { - async run({ config }: TaskRunContext): Promise { + async run({ config, cwd }: TaskRunContext): Promise { const { entry, configPath, useDoppler, ports } = this.options + if (cwd !== process.cwd()) { + const error = new ToolKitError('the Nodemon task does not support monorepos') + error.details = `Nodemon's support for running in specific directories changes the global environment, so it's not supported for use in monorepos. Use the ${styles.task( + 'Node' + )} task with ${styles.code('watch: true')} instead.` + throw error + } + let dopplerEnv = {} if (useDoppler) { - const doppler = new DopplerEnvVars(this.logger, 'dev', config.pluginOptions['@dotcom-tool-kit/doppler']?.options) + const doppler = new DopplerEnvVars( + this.logger, + 'dev', + config.pluginOptions['@dotcom-tool-kit/doppler']?.options + ) dopplerEnv = await doppler.get() } From 50b1606d18177990aa5b0ae3464cf06dc710568d Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 2 Dec 2024 17:27:46 +0000 Subject: [PATCH 24/26] test(monorepo): strip ansi in snapshots --- package-lock.json | 7 +++++++ plugins/monorepo/package.json | 1 + .../test/load-workspace-configs.test.ts | 19 +++++++++++-------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84ff86f62..35fcc511d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9683,6 +9683,12 @@ "node_modules/@quarterto/strip-ansi": { "version": "1.2.0" }, + "node_modules/@relmify/jest-serializer-strip-ansi": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@relmify/jest-serializer-strip-ansi/-/jest-serializer-strip-ansi-1.0.2.tgz", + "integrity": "sha512-cJv6weXt7Bk0PEpWNtw0UGOddIbEvNLPlbYb+594xxe5WXs3SSA29tCK57Vg6q46wHEpY1kOCmgQhE8EcIXPKw==", + "dev": true + }, "node_modules/@serverless/dashboard-plugin": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/@serverless/dashboard-plugin/-/dashboard-plugin-6.2.3.tgz", @@ -32400,6 +32406,7 @@ "pluralize": "^8.0.0" }, "devDependencies": { + "@relmify/jest-serializer-strip-ansi": "^1.0.2", "@types/npmcli__map-workspaces": "^3.0.4", "@types/pluralize": "^0.0.33" }, diff --git a/plugins/monorepo/package.json b/plugins/monorepo/package.json index b08e91bd6..6a5a1a5ff 100644 --- a/plugins/monorepo/package.json +++ b/plugins/monorepo/package.json @@ -38,6 +38,7 @@ "pluralize": "^8.0.0" }, "devDependencies": { + "@relmify/jest-serializer-strip-ansi": "^1.0.2", "@types/npmcli__map-workspaces": "^3.0.4", "@types/pluralize": "^0.0.33" } diff --git a/plugins/monorepo/test/load-workspace-configs.test.ts b/plugins/monorepo/test/load-workspace-configs.test.ts index cfe41117b..9b0d037f7 100644 --- a/plugins/monorepo/test/load-workspace-configs.test.ts +++ b/plugins/monorepo/test/load-workspace-configs.test.ts @@ -1,9 +1,12 @@ import path from 'path' import LoadWorkspaceConfigs from '../src/load-workspace-configs' import winston, { Logger } from 'winston' +import { stripAnsi } from '@relmify/jest-serializer-strip-ansi' const logger = winston as unknown as Logger +expect.addSnapshotSerializer(stripAnsi) + expect.addSnapshotSerializer({ test(value) { return value instanceof Error && value.name === 'AggregateError' @@ -26,13 +29,13 @@ expect.addSnapshotSerializer({ }, serialize(val, config, indentation, depth, refs, printer) { - return `${val.name} ${printer(val.message, config, indentation, depth, refs)} ${printer( - { details: val.details }, + return `${printer(val.name, config, indentation, depth, refs)} ${printer( + val.message, config, indentation, depth, refs - )}` + )} ${printer({ details: val.details }, config, indentation, depth, refs)}` } }) @@ -62,19 +65,19 @@ describe('LoadWorkspaceConfigs', () => { cwd: path.relative(process.cwd(), path.resolve(__dirname, './files/invalid')) }) ).rejects.toMatchInlineSnapshot(` - AggregateError "2 errors loading .toolkitrc.yml in workspace packages" { + AggregateError "2 errors loading .toolkitrc.yml in workspace packages" { "errors": [ - @monorepo-plugin-tests/b → ToolKitError "There are options in your .toolkitrc.yml that aren't what Tool Kit expected." { + "@monorepo-plugin-tests/b → ToolKitError" "There are options in your .toolkitrc.yml that aren't what Tool Kit expected." { "details": "Please update the options so that they are the expected types. -  !  2 issues in @dotcom-tool-kit/serverless: + ! 2 issues in @dotcom-tool-kit/serverless: - Required at "awsAccountId" - Required at "systemCode" You can refer to the README for the plugin for examples and descriptions of the options used.", }, - @monorepo-plugin-tests/c → ToolKitError "There are options in your .toolkitrc.yml that aren't what Tool Kit expected." { + "@monorepo-plugin-tests/c → ToolKitError" "There are options in your .toolkitrc.yml that aren't what Tool Kit expected." { "details": "Please update the options so that they are the expected types. -  !  1 issue in @dotcom-tool-kit/heroku: + ! 1 issue in @dotcom-tool-kit/heroku: - Required at "pipeline" You can refer to the README for the plugin for examples and descriptions of the options used.", From 3aacc4911c82d912681af46522fdc333f5eb82d7 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 2 Dec 2024 17:57:28 +0000 Subject: [PATCH 25/26] test: relative paths in snapshots (again) --- .../load-workspace-configs.test.ts.snap | 48 +++++++++---------- .../test/load-workspace-configs.test.ts | 10 ++++ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap b/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap index e60dab17d..f030469bd 100644 --- a/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap +++ b/plugins/monorepo/test/__snapshots__/load-workspace-configs.test.ts.snap @@ -80,7 +80,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, "tasks": [ { @@ -160,7 +160,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, "task": "Webpack", }, @@ -212,7 +212,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, ], "id": "app root", @@ -292,7 +292,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, ], "id": "app root", @@ -402,7 +402,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, "tasks": [ { @@ -482,7 +482,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, "task": "Webpack", }, @@ -563,7 +563,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, "tasks": [ { @@ -644,7 +644,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, "task": "Webpack", }, @@ -700,7 +700,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, ], "id": "app root", @@ -778,7 +778,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, ], "id": "app root", @@ -885,7 +885,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, "app root": { "children": [ @@ -931,7 +931,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, ], "id": "app root", @@ -1056,7 +1056,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/webpack", + "root": "plugins/webpack", }, }, }, @@ -1124,7 +1124,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, "tasks": [ { @@ -1184,7 +1184,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, "task": "Babel", }, @@ -1218,7 +1218,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, ], "id": "app root", @@ -1280,7 +1280,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, ], "id": "app root", @@ -1372,7 +1372,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, "tasks": [ { @@ -1432,7 +1432,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, "task": "Babel", }, @@ -1470,7 +1470,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, ], "id": "app root", @@ -1530,7 +1530,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, ], "id": "app root", @@ -1619,7 +1619,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, "app root": { "children": [ @@ -1647,7 +1647,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, ], "id": "app root", @@ -1754,7 +1754,7 @@ exports[`LoadWorkspaceConfigs should load multiple tool kit configs from workspa }, "version": 2, }, - "root": "/Users/kara.brightwell/Code/financial-times/dotcom-tool-kit/plugins/babel", + "root": "plugins/babel", }, }, }, diff --git a/plugins/monorepo/test/load-workspace-configs.test.ts b/plugins/monorepo/test/load-workspace-configs.test.ts index 9b0d037f7..375be3533 100644 --- a/plugins/monorepo/test/load-workspace-configs.test.ts +++ b/plugins/monorepo/test/load-workspace-configs.test.ts @@ -5,6 +5,16 @@ import { stripAnsi } from '@relmify/jest-serializer-strip-ansi' const logger = winston as unknown as Logger +// force resolveRoot to return relative paths for machine-agnostic snapshots +jest.mock('../../../core/cli/lib/plugin/resolve-root', () => { + const { resolveRoot } = jest.requireActual('../../../core/cli/lib/plugin/resolve-root') + return { + resolveRoot(id: string, root: string) { + return path.relative(process.cwd(), resolveRoot(id, root)) + } + } +}) + expect.addSnapshotSerializer(stripAnsi) expect.addSnapshotSerializer({ From 4d706d1d2594871b1cceade4a931ae8597ec9585 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 9 Dec 2024 15:29:42 +0000 Subject: [PATCH 26/26] backstage: update package-lock.json --- package-lock.json | 308 +++++++++++++++++++++++----------------------- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/package-lock.json b/package-lock.json index 35fcc511d..ced9d98af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,17 +50,17 @@ }, "core/cli": { "name": "dotcom-tool-kit", - "version": "4.0.6", + "version": "4.1.0", "license": "MIT", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/config": "^1.0.2", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/config": "^1.0.3", "@dotcom-tool-kit/conflict": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "@dotcom-tool-kit/plugin": "^1.0.0", "@dotcom-tool-kit/state": "^4.0.0", - "@dotcom-tool-kit/validated": "^1.0.0", + "@dotcom-tool-kit/validated": "^1.0.1", "@dotcom-tool-kit/wait-for-ok": "^4.0.0", "endent": "^2.1.0", "lodash": "^4.17.21", @@ -142,16 +142,16 @@ }, "core/create": { "name": "@dotcom-tool-kit/create", - "version": "4.0.6", + "version": "4.1.0", "license": "ISC", "dependencies": { "@aws-sdk/client-iam": "^3.282.0", "@aws-sdk/client-sts": "^3.282.0", - "@dotcom-tool-kit/doppler": "^2.0.2", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/doppler": "^2.0.3", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "@dotcom-tool-kit/plugin": "^1.0.0", - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@octokit/rest": "^19.0.5", "@quarterto/parse-makefile-rules": "^1.1.0", "cli-highlight": "^2.1.11", @@ -178,7 +178,7 @@ "@types/node-fetch": "^2.6.2", "@types/pacote": "^11.1.3", "@types/prompts": "^2.0.14", - "dotcom-tool-kit": "^4.0.6", + "dotcom-tool-kit": "^4.1.0", "type-fest": "^3.13.1" }, "engines": { @@ -1112,17 +1112,17 @@ }, "lib/base": { "name": "@dotcom-tool-kit/base", - "version": "1.0.0", + "version": "1.1.0", "license": "ISC", "dependencies": { "@dotcom-tool-kit/conflict": "^1.0.0", - "@dotcom-tool-kit/validated": "^1.0.0", + "@dotcom-tool-kit/validated": "^1.0.1", "semver": "^7.5.4", "winston": "^3.11.0" }, "devDependencies": { - "@dotcom-tool-kit/config": "^1.0.2", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/config": "^1.0.3", + "@dotcom-tool-kit/logger": "^4.0.1", "@dotcom-tool-kit/plugin": "^1.0.0", "type-fest": "^4.29.1", "winston": "^3.11.0", @@ -1212,13 +1212,13 @@ }, "lib/config": { "name": "@dotcom-tool-kit/config", - "version": "1.0.2", + "version": "1.0.3", "license": "ISC", "dependencies": { "@dotcom-tool-kit/conflict": "^1.0.0", "@dotcom-tool-kit/plugin": "^1.0.0", - "@dotcom-tool-kit/schemas": "^1.1.1", - "@dotcom-tool-kit/validated": "^1.0.0" + "@dotcom-tool-kit/schemas": "^1.2.0", + "@dotcom-tool-kit/validated": "^1.0.1" } }, "lib/conflict": { @@ -1231,15 +1231,15 @@ }, "lib/doppler": { "name": "@dotcom-tool-kit/doppler", - "version": "2.0.2", + "version": "2.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "spawk": "^1.8.1", "winston": "^3.5.1" }, @@ -1255,7 +1255,7 @@ }, "lib/error": { "name": "@dotcom-tool-kit/error", - "version": "4.0.0", + "version": "4.0.1", "license": "ISC", "dependencies": { "tslib": "^2.3.1" @@ -1272,11 +1272,11 @@ }, "lib/logger": { "name": "@dotcom-tool-kit/logger", - "version": "4.0.0", + "version": "4.0.1", "license": "ISC", "dependencies": { "@apaleslimghost/boxen": "^5.1.3", - "@dotcom-tool-kit/error": "^4.0.0", + "@dotcom-tool-kit/error": "^4.0.1", "ansi-regex": "^5.0.1", "triple-beam": "^1.3.0", "tslib": "^2.3.1", @@ -1338,10 +1338,10 @@ }, "lib/schemas": { "name": "@dotcom-tool-kit/schemas", - "version": "1.1.1", + "version": "1.2.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/logger": "^4.0.0" + "@dotcom-tool-kit/logger": "^4.0.1" }, "devDependencies": { "prompts": "^2.4.2", @@ -1436,10 +1436,10 @@ }, "lib/validated": { "name": "@dotcom-tool-kit/validated", - "version": "1.0.0", + "version": "1.0.1", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/error": "^4.0.0" + "@dotcom-tool-kit/error": "^4.0.1" } }, "lib/vault": { @@ -30903,18 +30903,18 @@ }, "plugins/babel": { "name": "@dotcom-tool-kit/babel", - "version": "4.0.2", + "version": "4.1.0", "license": "MIT", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "fast-glob": "^3.2.11", "tslib": "^2.3.1" }, "devDependencies": { "@babel/preset-env": "^7.16.11", - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "winston": "^3.5.1" }, @@ -30950,13 +30950,13 @@ }, "plugins/backend-heroku-app": { "name": "@dotcom-tool-kit/backend-heroku-app", - "version": "4.0.2", + "version": "4.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/circleci-deploy": "^4.0.2", - "@dotcom-tool-kit/heroku": "^4.0.2", - "@dotcom-tool-kit/node": "^4.0.2", - "@dotcom-tool-kit/npm": "^4.0.2" + "@dotcom-tool-kit/circleci-deploy": "^4.0.3", + "@dotcom-tool-kit/heroku": "^4.0.3", + "@dotcom-tool-kit/node": "^4.1.0", + "@dotcom-tool-kit/npm": "^4.1.0" }, "engines": { "node": "18.x || 20.x", @@ -30968,13 +30968,13 @@ }, "plugins/backend-serverless-app": { "name": "@dotcom-tool-kit/backend-serverless-app", - "version": "4.0.2", + "version": "4.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/circleci-deploy": "^4.0.2", - "@dotcom-tool-kit/node": "^4.0.2", - "@dotcom-tool-kit/npm": "^4.0.2", - "@dotcom-tool-kit/serverless": "^3.0.2" + "@dotcom-tool-kit/circleci-deploy": "^4.0.3", + "@dotcom-tool-kit/node": "^4.1.0", + "@dotcom-tool-kit/npm": "^4.1.0", + "@dotcom-tool-kit/serverless": "^3.1.0" }, "engines": { "node": "18.x || 20.x", @@ -30986,13 +30986,13 @@ }, "plugins/circleci": { "name": "@dotcom-tool-kit/circleci", - "version": "7.0.2", + "version": "7.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", + "@dotcom-tool-kit/base": "^1.1.0", "@dotcom-tool-kit/conflict": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "@dotcom-tool-kit/state": "^4.0.0", "jest-diff": "^29.5.0", "lodash": "^4.17.21", @@ -31002,7 +31002,7 @@ }, "devDependencies": { "@dotcom-tool-kit/plugin": "^1.0.0", - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "@types/jest": "^27.4.0", "@types/js-yaml": "^4.0.3", @@ -31021,10 +31021,10 @@ }, "plugins/circleci-deploy": { "name": "@dotcom-tool-kit/circleci-deploy", - "version": "4.0.2", + "version": "4.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/circleci": "^7.0.2", + "@dotcom-tool-kit/circleci": "^7.1.0", "tslib": "^2.3.1" }, "devDependencies": { @@ -31063,11 +31063,11 @@ }, "plugins/circleci-npm": { "name": "@dotcom-tool-kit/circleci-npm", - "version": "6.0.3", + "version": "6.0.4", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/circleci": "^7.0.2", - "@dotcom-tool-kit/npm": "^4.0.2", + "@dotcom-tool-kit/circleci": "^7.1.0", + "@dotcom-tool-kit/npm": "^4.1.0", "tslib": "^2.3.1" }, "engines": { @@ -31184,11 +31184,11 @@ }, "plugins/commitlint": { "name": "@dotcom-tool-kit/commitlint", - "version": "1.0.0", + "version": "1.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/logger": "^4.0.0" + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/logger": "^4.0.1" }, "engines": { "node": "18.x || 20.x", @@ -31898,11 +31898,11 @@ }, "plugins/component": { "name": "@dotcom-tool-kit/component", - "version": "5.0.3", + "version": "5.0.4", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/circleci-npm": "^6.0.3", - "@dotcom-tool-kit/npm": "^4.0.2" + "@dotcom-tool-kit/circleci-npm": "^6.0.4", + "@dotcom-tool-kit/npm": "^4.1.0" }, "engines": { "node": "18.x || 20.x", @@ -31914,17 +31914,17 @@ }, "plugins/cypress": { "name": "@dotcom-tool-kit/cypress", - "version": "5.0.2", + "version": "5.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/doppler": "^2.0.2", - "@dotcom-tool-kit/logger": "^4.0.0", - "@dotcom-tool-kit/package-json-hook": "^5.0.2", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/doppler": "^2.0.3", + "@dotcom-tool-kit/logger": "^4.0.1", + "@dotcom-tool-kit/package-json-hook": "^5.0.3", "@dotcom-tool-kit/state": "^4.0.0" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1" + "@dotcom-tool-kit/schemas": "^1.2.0" }, "engines": { "node": "18.x || 20.x", @@ -31937,16 +31937,16 @@ "plugins/doppler": {}, "plugins/eslint": { "name": "@dotcom-tool-kit/eslint", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "@types/eslint": "^7.2.13", "@types/temp": "^0.9.4", @@ -32162,12 +32162,12 @@ }, "plugins/frontend-app": { "name": "@dotcom-tool-kit/frontend-app", - "version": "4.0.2", + "version": "4.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/backend-heroku-app": "^4.0.2", - "@dotcom-tool-kit/upload-assets-to-s3": "^4.0.2", - "@dotcom-tool-kit/webpack": "^4.0.2" + "@dotcom-tool-kit/backend-heroku-app": "^4.0.3", + "@dotcom-tool-kit/upload-assets-to-s3": "^4.1.0", + "@dotcom-tool-kit/webpack": "^4.1.0" }, "engines": { "node": "18.x || 20.x", @@ -32179,15 +32179,15 @@ }, "plugins/heroku": { "name": "@dotcom-tool-kit/heroku", - "version": "4.0.2", + "version": "4.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/doppler": "^2.0.2", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", - "@dotcom-tool-kit/npm": "^4.0.2", - "@dotcom-tool-kit/package-json-hook": "^5.0.2", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/doppler": "^2.0.3", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", + "@dotcom-tool-kit/npm": "^4.1.0", + "@dotcom-tool-kit/package-json-hook": "^5.0.3", "@dotcom-tool-kit/state": "^4.0.0", "@dotcom-tool-kit/wait-for-ok": "^4.0.0", "@octokit/request": "^5.6.0", @@ -32198,7 +32198,7 @@ "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@types/financial-times__package-json": "^1.9.0", "@types/p-retry": "^3.0.1", "winston": "^3.5.1" @@ -32218,10 +32218,10 @@ }, "plugins/husky-npm": { "name": "@dotcom-tool-kit/husky-npm", - "version": "5.0.2", + "version": "5.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/package-json-hook": "^5.0.2", + "@dotcom-tool-kit/package-json-hook": "^5.0.3", "tslib": "^2.3.1" }, "engines": { @@ -32240,15 +32240,15 @@ }, "plugins/jest": { "name": "@dotcom-tool-kit/jest", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/logger": "^4.0.1", "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "winston": "^3.5.1" }, "engines": { @@ -32267,12 +32267,12 @@ }, "plugins/lint-staged": { "name": "@dotcom-tool-kit/lint-staged", - "version": "5.0.2", + "version": "5.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", - "@dotcom-tool-kit/package-json-hook": "^5.0.2", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/logger": "^4.0.1", + "@dotcom-tool-kit/package-json-hook": "^5.0.3", "lint-staged": "^11.2.3", "tslib": "^2.3.1" }, @@ -32286,12 +32286,12 @@ }, "plugins/lint-staged-npm": { "name": "@dotcom-tool-kit/lint-staged-npm", - "version": "4.0.2", + "version": "4.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/husky-npm": "^5.0.2", - "@dotcom-tool-kit/lint-staged": "^5.0.2", - "@dotcom-tool-kit/package-json-hook": "^5.0.2", + "@dotcom-tool-kit/husky-npm": "^5.0.3", + "@dotcom-tool-kit/lint-staged": "^5.1.0", + "@dotcom-tool-kit/package-json-hook": "^5.0.3", "tslib": "^2.3.1" }, "engines": { @@ -32364,17 +32364,17 @@ }, "plugins/mocha": { "name": "@dotcom-tool-kit/mocha", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "glob": "^7.1.7", "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "@types/glob": "^7.1.3", "@types/mocha": "^8.2.2", @@ -32442,17 +32442,17 @@ }, "plugins/n-test": { "name": "@dotcom-tool-kit/n-test", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/logger": "^4.0.1", "@dotcom-tool-kit/state": "^4.0.0", "@financial-times/n-test": "^6.1.0-beta.1", "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "@types/jest": "^27.4.0", "winston": "^3.5.1" @@ -32564,19 +32564,19 @@ }, "plugins/next-router": { "name": "@dotcom-tool-kit/next-router", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/doppler": "^2.0.2", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/doppler": "^2.0.3", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "@dotcom-tool-kit/state": "^4.0.0", "ft-next-router": "^3.0.0", "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1" + "@dotcom-tool-kit/schemas": "^1.2.0" }, "engines": { "node": "18.x || 20.x", @@ -32698,19 +32698,19 @@ }, "plugins/node": { "name": "@dotcom-tool-kit/node", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/doppler": "^2.0.2", - "@dotcom-tool-kit/error": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/doppler": "^2.0.3", + "@dotcom-tool-kit/error": "^4.0.1", "@dotcom-tool-kit/state": "^4.0.0", "get-port": "^5.1.1", "tslib": "^2.3.1", "wait-port": "^0.2.9" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1" + "@dotcom-tool-kit/schemas": "^1.2.0" }, "engines": { "node": "18.x || 20.x", @@ -32727,18 +32727,18 @@ }, "plugins/nodemon": { "name": "@dotcom-tool-kit/nodemon", - "version": "4.0.2", + "version": "4.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/doppler": "^2.0.2", - "@dotcom-tool-kit/error": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/doppler": "^2.0.3", + "@dotcom-tool-kit/error": "^4.0.1", "@dotcom-tool-kit/state": "^4.0.0", "get-port": "^5.1.1", "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@types/nodemon": "^1.19.1" }, "engines": { @@ -32757,12 +32757,12 @@ }, "plugins/npm": { "name": "@dotcom-tool-kit/npm", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/package-json-hook": "^5.0.2", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/package-json-hook": "^5.0.3", "@dotcom-tool-kit/state": "^4.0.0", "libnpmpack": "^3.1.0", "libnpmpublish": "^5.0.1", @@ -32994,10 +32994,10 @@ }, "plugins/package-json-hook": { "name": "@dotcom-tool-kit/package-json-hook", - "version": "5.0.2", + "version": "5.0.3", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", + "@dotcom-tool-kit/base": "^1.1.0", "@dotcom-tool-kit/conflict": "^1.0.0", "@dotcom-tool-kit/plugin": "^1.0.0", "@financial-times/package-json": "^3.0.0", @@ -33005,7 +33005,7 @@ "tslib": "^2.3.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "@types/lodash": "^4.14.185", "winston": "^3.5.1", @@ -33029,13 +33029,13 @@ }, "plugins/prettier": { "name": "@dotcom-tool-kit/prettier", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", - "@dotcom-tool-kit/package-json-hook": "^5.0.2", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", + "@dotcom-tool-kit/package-json-hook": "^5.0.3", "fast-glob": "^3.2.7", "hook-std": "^2.0.0", "prettier": "^2.2.1", @@ -33085,19 +33085,19 @@ }, "plugins/serverless": { "name": "@dotcom-tool-kit/serverless", - "version": "3.0.2", + "version": "3.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/doppler": "^2.0.2", - "@dotcom-tool-kit/error": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/doppler": "^2.0.3", + "@dotcom-tool-kit/error": "^4.0.1", "@dotcom-tool-kit/state": "^4.0.0", "get-port": "^5.1.1", "tslib": "^2.3.1", "wait-port": "^0.2.9" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1" + "@dotcom-tool-kit/schemas": "^1.2.0" }, "engines": { "node": "18.x || 20.x", @@ -33115,14 +33115,14 @@ }, "plugins/typescript": { "name": "@dotcom-tool-kit/typescript", - "version": "3.0.2", + "version": "3.1.0", "license": "ISC", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/logger": "^4.0.0" + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/logger": "^4.0.1" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^29.3.1", "typescript": "^4.9.4", "winston": "^3.8.2" @@ -33337,20 +33337,20 @@ }, "plugins/upload-assets-to-s3": { "name": "@dotcom-tool-kit/upload-assets-to-s3", - "version": "4.0.2", + "version": "4.1.0", "license": "ISC", "dependencies": { "@aws-sdk/client-s3": "^3.256.0", - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "glob": "^7.1.6", "mime": "^2.5.2", "tslib": "^2.3.1" }, "devDependencies": { "@aws-sdk/types": "^3.13.1", - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "@types/glob": "^7.1.3", "@types/jest": "^27.4.0", @@ -33372,17 +33372,17 @@ }, "plugins/webpack": { "name": "@dotcom-tool-kit/webpack", - "version": "4.0.2", + "version": "4.1.0", "license": "MIT", "dependencies": { - "@dotcom-tool-kit/base": "^1.0.0", - "@dotcom-tool-kit/error": "^4.0.0", - "@dotcom-tool-kit/logger": "^4.0.0", + "@dotcom-tool-kit/base": "^1.1.0", + "@dotcom-tool-kit/error": "^4.0.1", + "@dotcom-tool-kit/logger": "^4.0.1", "tslib": "^2.3.1", "webpack-cli": "^4.6.0" }, "devDependencies": { - "@dotcom-tool-kit/schemas": "^1.1.1", + "@dotcom-tool-kit/schemas": "^1.2.0", "@jest/globals": "^27.4.6", "ts-node": "^10.0.0", "webpack": "^4.42.1",