From 8286a8dfcaf8d8700a8f0ee7c895bcc4ba9d0371 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 10:05:00 +0100 Subject: [PATCH 01/21] Convert build-package to Typescript --- code/package.json | 2 +- .../{build-package.js => build-package.ts} | 64 ++++++++++--------- 2 files changed, 35 insertions(+), 31 deletions(-) rename scripts/{build-package.js => build-package.ts} (74%) diff --git a/code/package.json b/code/package.json index 2b996643bff9..685378e820cf 100644 --- a/code/package.json +++ b/code/package.json @@ -26,7 +26,7 @@ }, "scripts": { "await-serve-storybooks": "wait-on http://localhost:8001", - "build": "NODE_ENV=production node ../scripts/build-package.js", + "build": "NODE_ENV=production ts-node --swc --esm ../scripts/build-package.ts", "changelog": "pr-log --sloppy --cherry-pick", "changelog:next": "pr-log --sloppy --since-prerelease", "check": "NODE_ENV=production node ../scripts/check-package.js", diff --git a/scripts/build-package.js b/scripts/build-package.ts similarity index 74% rename from scripts/build-package.js rename to scripts/build-package.ts index c76af11b8a09..ab7a4be048af 100644 --- a/scripts/build-package.js +++ b/scripts/build-package.ts @@ -1,39 +1,41 @@ #!/usr/bin/env node /* eslint-disable global-require */ -const { resolve, join, posix, sep } = require('path'); -const { readJSON } = require('fs-extra'); - -async function getWorkspaces(includePrivate = true) { - const { execaCommand } = await import('execa'); - const { stdout } = await execaCommand(`yarn workspaces list --json --no-private`, { - cwd: join(__dirname, '..', 'code'), - shell: true, - }); - return JSON.parse(`[${stdout.split('\n').join(',')}]`); -} +import { resolve, posix, sep } from 'path'; +import { readJSON } from 'fs-extra'; +import prompts from 'prompts'; +import program from 'commander'; +import chalk from 'chalk'; +import { getWorkspaces } from './utils/workspace'; +import { execaCommand } from './utils/exec'; async function run() { - const prompts = require('prompts'); - const program = require('commander'); - const chalk = require('chalk'); - const packages = await getWorkspaces(); const packageTasks = packages - .map((package) => { + .map((pkg) => { return { - ...package, - suffix: package.name.replace('@storybook/', ''), + ...pkg, + suffix: pkg.name.replace('@storybook/', ''), defaultValue: false, - helpText: `build only the ${package.name} package`, + helpText: `build only the ${pkg.name} package`, }; }) .reduce((acc, next) => { acc[next.name] = next; return acc; - }, {}); + }, {} as Record); - const tasks = { + const tasks: Record< + string, + { + name: string; + defaultValue: boolean; + suffix: string; + helpText: string; + value?: any; + location?: string; + } + > = { watch: { name: `watch`, defaultValue: false, @@ -92,6 +94,7 @@ async function run() { name: 'todo', min: 1, hint: 'You can also run directly with package name like `yarn build core`, or `yarn build --all` for all packages!', + // @ts-expect-error @types incomplete optionsPerPage: require('window-size').height - 3, // 3 lines for extra info choices: packages.map(({ name: key }) => ({ value: key, @@ -99,7 +102,7 @@ async function run() { selected: (tasks[key] && tasks[key].defaultValue) || false, })), }, - ]).then(({ watch, prod, todo }) => { + ]).then(({ watch, prod, todo }: { watch: boolean; prod: boolean; todo: Array }) => { watchMode = watch; prodMode = prod; return todo?.map((key) => tasks[key]); @@ -119,9 +122,8 @@ async function run() { .join(sep); const cwd = resolve(__dirname, '..', 'code', v.location); - const { execaCommand } = await import('execa'); const tsNode = require.resolve('ts-node/dist/bin'); - const sub = execaCommand( + const sub = await execaCommand( `node ${tsNode} ${commmand}${watchMode ? ' --watch' : ''}${prodMode ? ' --optimized' : ''}`, { cwd, @@ -134,16 +136,18 @@ async function run() { } ); - sub.stdout.on('data', (data) => { - process.stdout.write(`${chalk.cyan(v.name)}:\n${data}`); - }); - sub.stderr.on('data', (data) => { - process.stderr.write(`${chalk.red(v.name)}:\n${data}`); - }); + if (sub.stdout) { + process.stdout.write(`${chalk.cyan(v.name)}:\n${sub.stdout}`); + } + + if (sub.stderr) { + process.stderr.write(`${chalk.red(v.name)}:\n${sub.stderr}`); + } }); } run().catch((e) => { + // eslint-disable-next-line no-console console.log(e); process.exit(1); }); From b7ef8c560f5e45fce519fd9602ae3e5579495881 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 10:58:02 +0100 Subject: [PATCH 02/21] Use esbuild as esm loader for node --- code/.eslintrc.js | 2 +- code/addons/a11y/package.json | 4 +- code/addons/actions/package.json | 4 +- code/addons/backgrounds/package.json | 4 +- code/addons/controls/package.json | 4 +- code/addons/docs/package.json | 4 +- code/addons/essentials/package.json | 4 +- code/addons/gfm/package.json | 4 +- code/addons/highlight/package.json | 4 +- code/addons/interactions/package.json | 4 +- code/addons/jest/package.json | 4 +- code/addons/links/package.json | 4 +- code/addons/measure/package.json | 4 +- code/addons/outline/package.json | 4 +- code/addons/storyshots-core/package.json | 4 +- code/addons/storyshots-puppeteer/package.json | 4 +- code/addons/storysource/package.json | 4 +- code/addons/themes/package.json | 4 +- code/addons/toolbars/package.json | 4 +- code/addons/viewport/package.json | 4 +- code/builders/builder-manager/package.json | 4 +- code/builders/builder-vite/package.json | 4 +- code/builders/builder-webpack5/package.json | 4 +- code/deprecated/addons/package.json | 4 +- .../channel-postmessage/package.json | 4 +- .../deprecated/channel-websocket/package.json | 4 +- code/deprecated/client-api/package.json | 4 +- code/deprecated/core-client/package.json | 4 +- code/deprecated/manager-api-shim/package.json | 4 +- code/deprecated/preview-web/package.json | 4 +- code/deprecated/store/package.json | 4 +- code/frameworks/angular/package.json | 4 +- code/frameworks/ember/package.json | 4 +- code/frameworks/html-vite/package.json | 4 +- code/frameworks/html-webpack5/package.json | 4 +- code/frameworks/nextjs/package.json | 4 +- code/frameworks/preact-vite/package.json | 4 +- code/frameworks/preact-webpack5/package.json | 4 +- code/frameworks/react-vite/package.json | 4 +- code/frameworks/react-webpack5/package.json | 4 +- code/frameworks/server-webpack5/package.json | 4 +- code/frameworks/svelte-vite/package.json | 4 +- code/frameworks/svelte-webpack5/package.json | 4 +- code/frameworks/sveltekit/package.json | 4 +- code/frameworks/vue-vite/package.json | 4 +- code/frameworks/vue-webpack5/package.json | 4 +- code/frameworks/vue3-vite/package.json | 4 +- code/frameworks/vue3-webpack5/package.json | 4 +- .../web-components-vite/package.json | 4 +- .../web-components-webpack5/package.json | 4 +- code/lib/channels/package.json | 4 +- code/lib/cli/package.json | 4 +- code/lib/client-logger/package.json | 4 +- code/lib/codemod/package.json | 4 +- code/lib/core-common/package.json | 4 +- code/lib/core-events/package.json | 4 +- code/lib/core-server/package.json | 4 +- code/lib/core-webpack/package.json | 4 +- code/lib/csf-plugin/package.json | 4 +- code/lib/csf-tools/package.json | 4 +- code/lib/docs-tools/package.json | 4 +- code/lib/instrumenter/package.json | 4 +- code/lib/manager-api/package.json | 4 +- code/lib/node-logger/package.json | 4 +- code/lib/postinstall/package.json | 4 +- code/lib/preview-api/package.json | 4 +- code/lib/preview/package.json | 4 +- code/lib/react-dom-shim/package.json | 4 +- code/lib/router/package.json | 4 +- code/lib/source-loader/package.json | 4 +- code/lib/telemetry/package.json | 4 +- code/lib/test/package.json | 4 +- code/lib/theming/package.json | 4 +- code/lib/types/package.json | 4 +- code/package.json | 2 +- code/presets/create-react-app/package.json | 4 +- code/presets/html-webpack/package.json | 4 +- code/presets/preact-webpack/package.json | 4 +- code/presets/react-webpack/package.json | 4 +- code/presets/server-webpack/package.json | 4 +- code/presets/svelte-webpack/package.json | 4 +- code/presets/vue-webpack/package.json | 4 +- code/presets/vue3-webpack/package.json | 4 +- .../web-components-webpack/package.json | 4 +- code/prettier.config.js | 2 +- code/renderers/html/package.json | 4 +- code/renderers/preact/package.json | 4 +- code/renderers/react/package.json | 4 +- code/renderers/server/package.json | 4 +- code/renderers/svelte/package.json | 2 +- code/renderers/vue/package.json | 2 +- code/renderers/vue3/package.json | 2 +- code/renderers/web-components/package.json | 4 +- code/ui/blocks/package.json | 4 +- code/ui/components/package.json | 4 +- code/ui/manager/package.json | 4 +- scripts/.babelrc.js | 2 +- scripts/{.eslintrc.js => .eslintrc.cjs} | 0 scripts/build-package.ts | 11 ++--- ...dependencies.js => check-dependencies.cjs} | 0 .../{check-package.js => check-package.cjs} | 0 scripts/{jest.config.js => jest.config.cjs} | 0 scripts/package.json | 47 ++++++++++--------- scripts/prepare/bundle.ts | 2 - scripts/prepare/check-scripts.ts | 4 +- scripts/prepare/check.ts | 4 +- ...prettier.config.js => prettier.config.cjs} | 0 scripts/release/publish.ts | 10 +--- scripts/tasks/bench.ts | 8 ++-- scripts/tasks/dev.ts | 2 +- scripts/tasks/sandbox.ts | 12 +++-- scripts/tasks/serve.ts | 2 +- scripts/tsconfig.json | 8 ++-- scripts/utils/exec.ts | 15 ++---- scripts/yarn.lock | 28 +++++++---- 115 files changed, 259 insertions(+), 268 deletions(-) rename scripts/{.eslintrc.js => .eslintrc.cjs} (100%) rename scripts/{check-dependencies.js => check-dependencies.cjs} (100%) rename scripts/{check-package.js => check-package.cjs} (100%) rename scripts/{jest.config.js => jest.config.cjs} (100%) rename scripts/{prettier.config.js => prettier.config.cjs} (100%) diff --git a/code/.eslintrc.js b/code/.eslintrc.js index e967113bb8eb..efc6cd34e3c8 100644 --- a/code/.eslintrc.js +++ b/code/.eslintrc.js @@ -4,7 +4,7 @@ const scriptPath = path.join(__dirname, '..', 'scripts'); module.exports = { root: true, - extends: [path.join(scriptPath, '.eslintrc.js')], + extends: [path.join(scriptPath, '.eslintrc.cjs')], parserOptions: { tsconfigRootDir: __dirname, project: ['./tsconfig.json'], diff --git a/code/addons/a11y/package.json b/code/addons/a11y/package.json index 2b635b2abff9..fccfdda1b68a 100644 --- a/code/addons/a11y/package.json +++ b/code/addons/a11y/package.json @@ -60,8 +60,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addon-highlight": "workspace:*", diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index adbd0ac5ad7d..448dcdb90afe 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -77,8 +77,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/backgrounds/package.json b/code/addons/backgrounds/package.json index 1738199adcf7..38699d6a5aa2 100644 --- a/code/addons/backgrounds/package.json +++ b/code/addons/backgrounds/package.json @@ -73,8 +73,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/controls/package.json b/code/addons/controls/package.json index b3992f0705a1..fc4d7665b532 100644 --- a/code/addons/controls/package.json +++ b/code/addons/controls/package.json @@ -65,8 +65,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/blocks": "workspace:*", diff --git a/code/addons/docs/package.json b/code/addons/docs/package.json index a75135fde197..dbf13c914474 100644 --- a/code/addons/docs/package.json +++ b/code/addons/docs/package.json @@ -94,8 +94,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@jest/transform": "^29.3.1", diff --git a/code/addons/essentials/package.json b/code/addons/essentials/package.json index ef565711cb10..a810921632a4 100644 --- a/code/addons/essentials/package.json +++ b/code/addons/essentials/package.json @@ -116,8 +116,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addon-actions": "workspace:*", diff --git a/code/addons/gfm/package.json b/code/addons/gfm/package.json index d5fa5f53336f..750014b2a300 100644 --- a/code/addons/gfm/package.json +++ b/code/addons/gfm/package.json @@ -48,8 +48,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/node-logger": "workspace:*", diff --git a/code/addons/highlight/package.json b/code/addons/highlight/package.json index d6e8dd72260d..d5a3798a03cb 100644 --- a/code/addons/highlight/package.json +++ b/code/addons/highlight/package.json @@ -58,8 +58,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-events": "workspace:*", diff --git a/code/addons/interactions/package.json b/code/addons/interactions/package.json index 1006df6c8208..bcfe77ee9b39 100644 --- a/code/addons/interactions/package.json +++ b/code/addons/interactions/package.json @@ -69,8 +69,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/jest/package.json b/code/addons/jest/package.json index d5437afd9088..7b5e909e34dc 100644 --- a/code/addons/jest/package.json +++ b/code/addons/jest/package.json @@ -67,8 +67,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/links/package.json b/code/addons/links/package.json index ce5b0f9955d2..0ffc87920017 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -77,8 +77,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/measure/package.json b/code/addons/measure/package.json index aab6e01731bb..9a2de4173286 100644 --- a/code/addons/measure/package.json +++ b/code/addons/measure/package.json @@ -72,8 +72,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/outline/package.json b/code/addons/outline/package.json index 0dbe11877145..d520458bc6f5 100644 --- a/code/addons/outline/package.json +++ b/code/addons/outline/package.json @@ -75,8 +75,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/storyshots-core/package.json b/code/addons/storyshots-core/package.json index d3b70029f54f..6db842c9754f 100644 --- a/code/addons/storyshots-core/package.json +++ b/code/addons/storyshots-core/package.json @@ -33,8 +33,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/tsc.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@jest/transform": "^29.3.1", diff --git a/code/addons/storyshots-puppeteer/package.json b/code/addons/storyshots-puppeteer/package.json index bd97205d275e..c19d88a6a9e6 100644 --- a/code/addons/storyshots-puppeteer/package.json +++ b/code/addons/storyshots-puppeteer/package.json @@ -32,8 +32,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/tsc.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@axe-core/puppeteer": "^4.2.0", diff --git a/code/addons/storysource/package.json b/code/addons/storysource/package.json index 02fb9f3e1a5a..53bff4fb96bb 100644 --- a/code/addons/storysource/package.json +++ b/code/addons/storysource/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/themes/package.json b/code/addons/themes/package.json index 3e0f448d784f..dc4187502154 100644 --- a/code/addons/themes/package.json +++ b/code/addons/themes/package.json @@ -70,8 +70,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/toolbars/package.json b/code/addons/toolbars/package.json index d9c00c78607e..86e88e18b6a6 100644 --- a/code/addons/toolbars/package.json +++ b/code/addons/toolbars/package.json @@ -65,8 +65,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/viewport/package.json b/code/addons/viewport/package.json index 44da576cbd96..daec078a7bcb 100644 --- a/code/addons/viewport/package.json +++ b/code/addons/viewport/package.json @@ -70,8 +70,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/builders/builder-manager/package.json b/code/builders/builder-manager/package.json index 40ba65622445..1592368bd9f5 100644 --- a/code/builders/builder-manager/package.json +++ b/code/builders/builder-manager/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@fal-works/esbuild-plugin-global-externals": "^2.1.2", diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index e1e9203449fc..1fe79c77e95f 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/builders/builder-webpack5/package.json b/code/builders/builder-webpack5/package.json index d0a5affdbb26..f7a6ae2a50ad 100644 --- a/code/builders/builder-webpack5/package.json +++ b/code/builders/builder-webpack5/package.json @@ -52,8 +52,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/core": "^7.23.2", diff --git a/code/deprecated/addons/package.json b/code/deprecated/addons/package.json index a53096886a12..5c03086792bc 100644 --- a/code/deprecated/addons/package.json +++ b/code/deprecated/addons/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/manager-api": "workspace:*", diff --git a/code/deprecated/channel-postmessage/package.json b/code/deprecated/channel-postmessage/package.json index 5c7575c2ca9a..1d25d3d36dec 100644 --- a/code/deprecated/channel-postmessage/package.json +++ b/code/deprecated/channel-postmessage/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/deprecated/channel-websocket/package.json b/code/deprecated/channel-websocket/package.json index 867b016f8ecd..4915fca744cf 100644 --- a/code/deprecated/channel-websocket/package.json +++ b/code/deprecated/channel-websocket/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/facade.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/deprecated/client-api/package.json b/code/deprecated/client-api/package.json index a03910376b14..e2039ae389d5 100644 --- a/code/deprecated/client-api/package.json +++ b/code/deprecated/client-api/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/facade.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/core-client/package.json b/code/deprecated/core-client/package.json index 00584a31ff5a..161a0d50f631 100644 --- a/code/deprecated/core-client/package.json +++ b/code/deprecated/core-client/package.json @@ -31,8 +31,8 @@ "module": "dist/entry.mjs", "types": "dist/entry.d.ts", "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/facade.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/manager-api-shim/package.json b/code/deprecated/manager-api-shim/package.json index 56401af1b7b4..2cd019ed8435 100644 --- a/code/deprecated/manager-api-shim/package.json +++ b/code/deprecated/manager-api-shim/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/facade.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/preview-web/package.json b/code/deprecated/preview-web/package.json index 24439508961a..61f82e70a08a 100644 --- a/code/deprecated/preview-web/package.json +++ b/code/deprecated/preview-web/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/facade.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/store/package.json b/code/deprecated/store/package.json index b04a829ae6fb..86c24e69b7aa 100644 --- a/code/deprecated/store/package.json +++ b/code/deprecated/store/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/facade.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index f53ac7a94f51..057073ce695f 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -33,8 +33,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/node_modules/.bin/tsc", - "prep": "../../../scripts/prepare/tsc.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/node_modules/.bin/tsc", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/ember/package.json b/code/frameworks/ember/package.json index 25d8f77bb1a9..6284c395a111 100644 --- a/code/frameworks/ember/package.json +++ b/code/frameworks/ember/package.json @@ -28,8 +28,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/tsc.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/html-vite/package.json b/code/frameworks/html-vite/package.json index cfb5d6869a79..06f2f179562f 100644 --- a/code/frameworks/html-vite/package.json +++ b/code/frameworks/html-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "workspace:*", diff --git a/code/frameworks/html-webpack5/package.json b/code/frameworks/html-webpack5/package.json index dd6af1693421..32cff7f1610c 100644 --- a/code/frameworks/html-webpack5/package.json +++ b/code/frameworks/html-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index 373f512b4efa..a69063b7b170 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -70,8 +70,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/core": "^7.23.2", diff --git a/code/frameworks/preact-vite/package.json b/code/frameworks/preact-vite/package.json index d13d3bca0b54..50d16adb8310 100644 --- a/code/frameworks/preact-vite/package.json +++ b/code/frameworks/preact-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@preact/preset-vite": "^2.0.0", diff --git a/code/frameworks/preact-webpack5/package.json b/code/frameworks/preact-webpack5/package.json index 134df1698462..6bef39303437 100644 --- a/code/frameworks/preact-webpack5/package.json +++ b/code/frameworks/preact-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/react-vite/package.json b/code/frameworks/react-vite/package.json index c9e069cc4bcc..c8663a71e09c 100644 --- a/code/frameworks/react-vite/package.json +++ b/code/frameworks/react-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0", diff --git a/code/frameworks/react-webpack5/package.json b/code/frameworks/react-webpack5/package.json index e27ba5be6755..a56b5fd6d1c5 100644 --- a/code/frameworks/react-webpack5/package.json +++ b/code/frameworks/react-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/server-webpack5/package.json b/code/frameworks/server-webpack5/package.json index 47f3fce958c0..f263c7b6b097 100644 --- a/code/frameworks/server-webpack5/package.json +++ b/code/frameworks/server-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/svelte-vite/package.json b/code/frameworks/svelte-vite/package.json index 567fdd790508..8d447e1bb565 100644 --- a/code/frameworks/svelte-vite/package.json +++ b/code/frameworks/svelte-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/svelte-webpack5/package.json b/code/frameworks/svelte-webpack5/package.json index d54a3393f846..9325d8342d99 100644 --- a/code/frameworks/svelte-webpack5/package.json +++ b/code/frameworks/svelte-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/sveltekit/package.json b/code/frameworks/sveltekit/package.json index 1c0424652bce..3218d87b59b6 100644 --- a/code/frameworks/sveltekit/package.json +++ b/code/frameworks/sveltekit/package.json @@ -46,8 +46,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/vue-vite/package.json b/code/frameworks/vue-vite/package.json index f3d056f67188..2bc4ada4b5e0 100644 --- a/code/frameworks/vue-vite/package.json +++ b/code/frameworks/vue-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/vue-webpack5/package.json b/code/frameworks/vue-webpack5/package.json index 95a29fae038a..6bffbe8a9fa0 100644 --- a/code/frameworks/vue-webpack5/package.json +++ b/code/frameworks/vue-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/vue3-vite/package.json b/code/frameworks/vue3-vite/package.json index 1b39f568b920..145a44fef1cb 100644 --- a/code/frameworks/vue3-vite/package.json +++ b/code/frameworks/vue3-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/vue3-webpack5/package.json b/code/frameworks/vue3-webpack5/package.json index f7f27f144a77..6809fff34e71 100644 --- a/code/frameworks/vue3-webpack5/package.json +++ b/code/frameworks/vue3-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/web-components-vite/package.json b/code/frameworks/web-components-vite/package.json index 85000c5d71a5..e544462fcd26 100644 --- a/code/frameworks/web-components-vite/package.json +++ b/code/frameworks/web-components-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/web-components-webpack5/package.json b/code/frameworks/web-components-webpack5/package.json index 21244cdbc78d..bf8be03c47c9 100644 --- a/code/frameworks/web-components-webpack5/package.json +++ b/code/frameworks/web-components-webpack5/package.json @@ -46,8 +46,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/preset-env": "^7.23.2", diff --git a/code/lib/channels/package.json b/code/lib/channels/package.json index 220bc00dcc29..1f9b12dadd00 100644 --- a/code/lib/channels/package.json +++ b/code/lib/channels/package.json @@ -65,8 +65,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/cli/package.json b/code/lib/cli/package.json index 9a74701a677e..91028341aa34 100644 --- a/code/lib/cli/package.json +++ b/code/lib/cli/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts", + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts", "test": "jest test/**/*.test.js" }, "dependencies": { diff --git a/code/lib/client-logger/package.json b/code/lib/client-logger/package.json index 5ad527fa292f..3384e0244b91 100644 --- a/code/lib/client-logger/package.json +++ b/code/lib/client-logger/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/global": "^5.0.0" diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 096604690c64..f1802439a3cd 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -48,8 +48,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/core": "^7.23.2", diff --git a/code/lib/core-common/package.json b/code/lib/core-common/package.json index a8c1af9f443f..bcb3fcb8d938 100644 --- a/code/lib/core-common/package.json +++ b/code/lib/core-common/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-events": "workspace:*", diff --git a/code/lib/core-events/package.json b/code/lib/core-events/package.json index d80846973c8e..c7fa8ec8d708 100644 --- a/code/lib/core-events/package.json +++ b/code/lib/core-events/package.json @@ -74,8 +74,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "ts-dedent": "^2.0.0" diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index e24ec0d82bf4..c785a5b83511 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -56,8 +56,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@aw-web-design/x-default-browser": "1.4.126", diff --git a/code/lib/core-webpack/package.json b/code/lib/core-webpack/package.json index 96bdfb086bb1..41bcb84edc34 100644 --- a/code/lib/core-webpack/package.json +++ b/code/lib/core-webpack/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-common": "workspace:*", diff --git a/code/lib/csf-plugin/package.json b/code/lib/csf-plugin/package.json index c5fa16545163..3f9f3fe2e3b3 100644 --- a/code/lib/csf-plugin/package.json +++ b/code/lib/csf-plugin/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/csf-tools": "workspace:*", diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index d6192a65472c..e0f9dbad3a03 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -38,8 +38,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/generator": "^7.23.0", diff --git a/code/lib/docs-tools/package.json b/code/lib/docs-tools/package.json index b017a4651ce0..28192afce433 100644 --- a/code/lib/docs-tools/package.json +++ b/code/lib/docs-tools/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-common": "workspace:*", diff --git a/code/lib/instrumenter/package.json b/code/lib/instrumenter/package.json index 8c885530380f..175493fa5a4b 100644 --- a/code/lib/instrumenter/package.json +++ b/code/lib/instrumenter/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index 801c9616d145..22a0f6167a12 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/node-logger/package.json b/code/lib/node-logger/package.json index de31ffedac48..92fd77b3688f 100644 --- a/code/lib/node-logger/package.json +++ b/code/lib/node-logger/package.json @@ -38,8 +38,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "devDependencies": { "@types/npmlog": "^4.1.2", diff --git a/code/lib/postinstall/package.json b/code/lib/postinstall/package.json index 1be31fad2e25..4fa15f7afccc 100644 --- a/code/lib/postinstall/package.json +++ b/code/lib/postinstall/package.json @@ -41,8 +41,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "devDependencies": { "jest": "^29.7.0", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 7cc8235a4742..965eeb0b0e18 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -64,8 +64,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/preview/package.json b/code/lib/preview/package.json index cc2e06b83b5f..fe3ded7634f7 100644 --- a/code/lib/preview/package.json +++ b/code/lib/preview/package.json @@ -52,8 +52,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/esm-bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/esm-bundle.ts" }, "devDependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/react-dom-shim/package.json b/code/lib/react-dom-shim/package.json index 0b9905b221e8..3f2b4241fa72 100644 --- a/code/lib/react-dom-shim/package.json +++ b/code/lib/react-dom-shim/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "devDependencies": { "@storybook/types": "workspace:*", diff --git a/code/lib/router/package.json b/code/lib/router/package.json index 70f3a92a95b6..8c15e8e98282 100644 --- a/code/lib/router/package.json +++ b/code/lib/router/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/source-loader/package.json b/code/lib/source-loader/package.json index 4066cd709554..7c068ccec9a3 100644 --- a/code/lib/source-loader/package.json +++ b/code/lib/source-loader/package.json @@ -41,8 +41,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/csf": "^0.1.0", diff --git a/code/lib/telemetry/package.json b/code/lib/telemetry/package.json index f65f5d5c20eb..40d3997e6681 100644 --- a/code/lib/telemetry/package.json +++ b/code/lib/telemetry/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/test/package.json b/code/lib/test/package.json index 1de2a016ba9d..042346075788 100644 --- a/code/lib/test/package.json +++ b/code/lib/test/package.json @@ -39,8 +39,8 @@ "*.d.ts" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/theming/package.json b/code/lib/theming/package.json index 2d64c60cf941..16bafcbb62ae 100644 --- a/code/lib/theming/package.json +++ b/code/lib/theming/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@emotion/use-insertion-effect-with-fallbacks": "^1.0.0", diff --git a/code/lib/types/package.json b/code/lib/types/package.json index 808579cc9bde..ca2c2ef76dac 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/package.json b/code/package.json index 685378e820cf..45e62b2406f9 100644 --- a/code/package.json +++ b/code/package.json @@ -26,7 +26,7 @@ }, "scripts": { "await-serve-storybooks": "wait-on http://localhost:8001", - "build": "NODE_ENV=production ts-node --swc --esm ../scripts/build-package.ts", + "build": "NODE_ENV=production yarn --cwd ../scripts build-package", "changelog": "pr-log --sloppy --cherry-pick", "changelog:next": "pr-log --sloppy --since-prerelease", "check": "NODE_ENV=production node ../scripts/check-package.js", diff --git a/code/presets/create-react-app/package.json b/code/presets/create-react-app/package.json index 6d223fe4b967..8732edf88e34 100644 --- a/code/presets/create-react-app/package.json +++ b/code/presets/create-react-app/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1", diff --git a/code/presets/html-webpack/package.json b/code/presets/html-webpack/package.json index f7eae3cde5a3..9edf6171d742 100644 --- a/code/presets/html-webpack/package.json +++ b/code/presets/html-webpack/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/preact-webpack/package.json b/code/presets/preact-webpack/package.json index 42619ff78004..9343e882fd8f 100644 --- a/code/presets/preact-webpack/package.json +++ b/code/presets/preact-webpack/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/plugin-transform-react-jsx": "^7.22.15", diff --git a/code/presets/react-webpack/package.json b/code/presets/react-webpack/package.json index 2eb5e07a103a..2d584621d5c4 100644 --- a/code/presets/react-webpack/package.json +++ b/code/presets/react-webpack/package.json @@ -60,8 +60,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/preset-flow": "^7.22.15", diff --git a/code/presets/server-webpack/package.json b/code/presets/server-webpack/package.json index fc97f71a8da7..34082bf790e2 100644 --- a/code/presets/server-webpack/package.json +++ b/code/presets/server-webpack/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-server": "workspace:*", diff --git a/code/presets/svelte-webpack/package.json b/code/presets/svelte-webpack/package.json index dddd9b9981c9..cde249ff6bb8 100644 --- a/code/presets/svelte-webpack/package.json +++ b/code/presets/svelte-webpack/package.json @@ -60,8 +60,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/vue-webpack/package.json b/code/presets/vue-webpack/package.json index fb9eb4538218..b1842cb352ae 100644 --- a/code/presets/vue-webpack/package.json +++ b/code/presets/vue-webpack/package.json @@ -55,8 +55,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/vue3-webpack/package.json b/code/presets/vue3-webpack/package.json index 5a9b3474c8f7..a1ba38ce467d 100644 --- a/code/presets/vue3-webpack/package.json +++ b/code/presets/vue3-webpack/package.json @@ -55,8 +55,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/web-components-webpack/package.json b/code/presets/web-components-webpack/package.json index 2b152f658feb..3ace8758cc22 100644 --- a/code/presets/web-components-webpack/package.json +++ b/code/presets/web-components-webpack/package.json @@ -48,8 +48,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/plugin-syntax-dynamic-import": "^7.8.3", diff --git a/code/prettier.config.js b/code/prettier.config.js index 574656f01614..4c8f0237382a 100644 --- a/code/prettier.config.js +++ b/code/prettier.config.js @@ -1 +1 @@ -module.exports = require('../scripts/prettier.config'); +module.exports = require('../scripts/prettier.config.cjs'); diff --git a/code/renderers/html/package.json b/code/renderers/html/package.json index 9dec7bb0745e..7c27f74a9216 100644 --- a/code/renderers/html/package.json +++ b/code/renderers/html/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/preact/package.json b/code/renderers/preact/package.json index 9d5330d468eb..a8373cb48d71 100644 --- a/code/renderers/preact/package.json +++ b/code/renderers/preact/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/react/package.json b/code/renderers/react/package.json index 08c29dd01229..e0372f1fb22e 100644 --- a/code/renderers/react/package.json +++ b/code/renderers/react/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index 47d9cced041e..c744c7c1a74e 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -42,8 +42,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/svelte/package.json b/code/renderers/svelte/package.json index 99a84af9c552..e33d158cc63c 100644 --- a/code/renderers/svelte/package.json +++ b/code/renderers/svelte/package.json @@ -48,7 +48,7 @@ ], "scripts": { "check": "svelte-check", - "prep": "../../../scripts/prepare/bundle.ts" + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/renderers/vue/package.json b/code/renderers/vue/package.json index e9b16f82f4ae..d4a4df663f25 100644 --- a/code/renderers/vue/package.json +++ b/code/renderers/vue/package.json @@ -44,7 +44,7 @@ ], "scripts": { "check": "vue-tsc --noEmit", - "prep": "../../../scripts/prepare/bundle.ts" + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/renderers/vue3/package.json b/code/renderers/vue3/package.json index 3ea92f413b5f..1180bad9d65d 100644 --- a/code/renderers/vue3/package.json +++ b/code/renderers/vue3/package.json @@ -44,7 +44,7 @@ ], "scripts": { "check": "vue-tsc --noEmit", - "prep": "../../../scripts/prepare/bundle.ts" + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/web-components/package.json b/code/renderers/web-components/package.json index 6ac0d96131dd..b3edd6f79b38 100644 --- a/code/renderers/web-components/package.json +++ b/code/renderers/web-components/package.json @@ -46,8 +46,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index 91b854c8521c..eea82f3056e8 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/ui/components/package.json b/code/ui/components/package.json index 92973bfacc56..98d9bf32701e 100644 --- a/code/ui/components/package.json +++ b/code/ui/components/package.json @@ -55,8 +55,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@radix-ui/react-select": "^1.2.2", diff --git a/code/ui/manager/package.json b/code/ui/manager/package.json index 6e46aecaee31..3b168cd74c99 100644 --- a/code/ui/manager/package.json +++ b/code/ui/manager/package.json @@ -47,8 +47,8 @@ "!src/**/*" ], "scripts": { - "check": "../../../scripts/prepare/check.ts", - "prep": "../../../scripts/prepare/esm-bundle.ts" + "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", + "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/esm-bundle.ts" }, "devDependencies": { "@fal-works/esbuild-plugin-global-externals": "^2.1.2", diff --git a/scripts/.babelrc.js b/scripts/.babelrc.js index 31016fd42625..c5d2be1935f6 100644 --- a/scripts/.babelrc.js +++ b/scripts/.babelrc.js @@ -1,4 +1,4 @@ -module.exports = { +export default { compact: false, presets: [ '@babel/preset-typescript', diff --git a/scripts/.eslintrc.js b/scripts/.eslintrc.cjs similarity index 100% rename from scripts/.eslintrc.js rename to scripts/.eslintrc.cjs diff --git a/scripts/build-package.ts b/scripts/build-package.ts index ab7a4be048af..b63195b188ae 100644 --- a/scripts/build-package.ts +++ b/scripts/build-package.ts @@ -1,11 +1,9 @@ -#!/usr/bin/env node - -/* eslint-disable global-require */ import { resolve, posix, sep } from 'path'; import { readJSON } from 'fs-extra'; import prompts from 'prompts'; import program from 'commander'; import chalk from 'chalk'; +import windowSize from 'window-size'; import { getWorkspaces } from './utils/workspace'; import { execaCommand } from './utils/exec'; @@ -95,7 +93,7 @@ async function run() { min: 1, hint: 'You can also run directly with package name like `yarn build core`, or `yarn build --all` for all packages!', // @ts-expect-error @types incomplete - optionsPerPage: require('window-size').height - 3, // 3 lines for extra info + optionsPerPage: windowSize.height - 3, // 3 lines for extra info choices: packages.map(({ name: key }) => ({ value: key, title: tasks[key].name || key, @@ -117,14 +115,13 @@ async function run() { } selection?.filter(Boolean).forEach(async (v) => { - const commmand = (await readJSON(resolve(v.location, 'package.json'))).scripts.prep + const commmand = (await readJSON(resolve('../code', v.location, 'package.json'))).scripts.prep .split(posix.sep) .join(sep); const cwd = resolve(__dirname, '..', 'code', v.location); - const tsNode = require.resolve('ts-node/dist/bin'); const sub = await execaCommand( - `node ${tsNode} ${commmand}${watchMode ? ' --watch' : ''}${prodMode ? ' --optimized' : ''}`, + `${commmand}${watchMode ? ' --watch' : ''}${prodMode ? ' --optimized' : ''}`, { cwd, buffer: false, diff --git a/scripts/check-dependencies.js b/scripts/check-dependencies.cjs similarity index 100% rename from scripts/check-dependencies.js rename to scripts/check-dependencies.cjs diff --git a/scripts/check-package.js b/scripts/check-package.cjs similarity index 100% rename from scripts/check-package.js rename to scripts/check-package.cjs diff --git a/scripts/jest.config.js b/scripts/jest.config.cjs similarity index 100% rename from scripts/jest.config.js rename to scripts/jest.config.cjs diff --git a/scripts/package.json b/scripts/package.json index b428f9b9f228..01a8ea31618c 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -2,35 +2,37 @@ "name": "@storybook/scripts", "version": "7.0.0-alpha.16", "private": true, + "type": "module", "scripts": { - "check": "./prepare/check-scripts.ts", + "build-package": "node --loader esbuild-register/loader -r esbuild-register ./build-package.ts", + "check": "node --loader esbuild-register/loader -r esbuild-register ./prepare/check-scripts.ts", "docs:prettier:check": "cd ../docs && prettier --check ./snippets", "docs:prettier:write": "cd ../docs && prettier --write ./snippets", - "get-report-message": "ts-node --swc ./get-report-message.ts", - "get-template": "ts-node --swc ./get-template.ts", + "get-report-message": "node --loader esbuild-register/loader -r esbuild-register ./get-report-message.ts", + "get-template": "node --loader esbuild-register/loader -r esbuild-register ./get-template.ts", "lint": "yarn lint:js && yarn lint:md", "lint:js": "yarn lint:js:cmd . --quiet", "lint:js:cmd": "cross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives", "lint:package": "sort-package-json", - "release:cancel-preparation-runs": "ts-node --swc ./release/cancel-preparation-runs.ts", - "release:ensure-next-ahead": "ts-node --swc ./release/ensure-next-ahead.ts", - "release:generate-pr-description": "ts-node --swc ./release/generate-pr-description.ts", - "release:get-changelog-from-file": "ts-node --swc ./release/get-changelog-from-file.ts", - "release:get-current-version": "ts-node --swc ./release/get-current-version.ts", - "release:get-version-changelog": "ts-node --swc ./release/get-version-changelog.ts", - "release:is-pr-frozen": "ts-node --swc ./release/is-pr-frozen.ts", - "release:is-prerelease": "ts-node --swc ./release/is-prerelease.ts", - "release:is-version-published": "ts-node --swc ./release/is-version-published.ts", - "release:label-patches": "ts-node --swc ./release/label-patches.ts", - "release:pick-patches": "ts-node --swc ./release/pick-patches.ts", - "release:publish": "ts-node --swc ./release/publish.ts", - "release:unreleased-changes-exists": "ts-node --swc ./release/unreleased-changes-exists.ts", - "release:version": "ts-node --swc ./release/version.ts", - "release:write-changelog": "ts-node --swc ./release/write-changelog.ts", - "strict-ts": "node --require esbuild-register ./strict-ts.ts", - "task": "ts-node --swc ./task.ts", + "release:cancel-preparation-runs": "node --loader esbuild-register/loader -r esbuild-register ./release/cancel-preparation-runs.ts", + "release:ensure-next-ahead": "node --loader esbuild-register/loader -r esbuild-register ./release/ensure-next-ahead.ts", + "release:generate-pr-description": "node --loader esbuild-register/loader -r esbuild-register ./release/generate-pr-description.ts", + "release:get-changelog-from-file": "node --loader esbuild-register/loader -r esbuild-register ./release/get-changelog-from-file.ts", + "release:get-current-version": "node --loader esbuild-register/loader -r esbuild-register ./release/get-current-version.ts", + "release:get-version-changelog": "node --loader esbuild-register/loader -r esbuild-register ./release/get-version-changelog.ts", + "release:is-pr-frozen": "node --loader esbuild-register/loader -r esbuild-register ./release/is-pr-frozen.ts", + "release:is-prerelease": "node --loader esbuild-register/loader -r esbuild-register ./release/is-prerelease.ts", + "release:is-version-published": "node --loader esbuild-register/loader -r esbuild-register ./release/is-version-published.ts", + "release:label-patches": "node --loader esbuild-register/loader -r esbuild-register ./release/label-patches.ts", + "release:pick-patches": "node --loader esbuild-register/loader -r esbuild-register ./release/pick-patches.ts", + "release:publish": "node --loader esbuild-register/loader -r esbuild-register ./release/publish.ts", + "release:unreleased-changes-exists": "node --loader esbuild-register/loader -r esbuild-register ./release/unreleased-changes-exists.ts", + "release:version": "node --loader esbuild-register/loader -r esbuild-register ./release/version.ts", + "release:write-changelog": "node --loader esbuild-register/loader -r esbuild-register ./release/write-changelog.ts", + "strict-ts": "node --loader esbuild-register/loader -r esbuild-register ./strict-ts.ts", + "task": "node --loader esbuild-register/loader -r esbuild-register ./task.ts", "test": "jest --config ./jest.config.js", - "upgrade": "ts-node --swc ./task.ts", + "upgrade": "node --loader esbuild-register/loader -r esbuild-register ./task.ts", "upload-bench": "ts-node ./upload-bench.ts" }, "husky": { @@ -104,6 +106,7 @@ "@types/serve-static": "^1.13.8", "@types/uuid": "^9.0.1", "@types/wait-on": "^5.3.1", + "@types/window-size": "^1.1.3", "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/experimental-utils": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", @@ -186,7 +189,7 @@ "ts-node": "^10.9.1", "tsup": "^6.7.0", "type-fest": "~2.19", - "typescript": "5.1.6", + "typescript": "5.2.2", "util": "^0.12.4", "uuid": "^9.0.0", "wait-on": "^7.0.1", diff --git a/scripts/prepare/bundle.ts b/scripts/prepare/bundle.ts index 1228e445a034..e71d2b1a2da6 100755 --- a/scripts/prepare/bundle.ts +++ b/scripts/prepare/bundle.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env ../../node_modules/.bin/ts-node - import * as fs from 'fs-extra'; import path, { dirname, join, relative } from 'path'; import type { Options } from 'tsup'; diff --git a/scripts/prepare/check-scripts.ts b/scripts/prepare/check-scripts.ts index 86418acd93ba..261c070c1ca6 100755 --- a/scripts/prepare/check-scripts.ts +++ b/scripts/prepare/check-scripts.ts @@ -1,7 +1,5 @@ -#!/usr/bin/env ./node_modules/.bin/ts-node-script - import { join } from 'path'; -import * as ts from 'typescript'; +import ts from 'typescript'; const run = async ({ cwd }: { cwd: string }) => { const { options, fileNames } = getTSFilesAndConfig('tsconfig.json'); diff --git a/scripts/prepare/check.ts b/scripts/prepare/check.ts index d200e921ea0b..fe75515f95b1 100755 --- a/scripts/prepare/check.ts +++ b/scripts/prepare/check.ts @@ -1,8 +1,6 @@ -#!/usr/bin/env ../../node_modules/.bin/ts-node-script - import { join } from 'path'; import fs from 'fs-extra'; -import * as ts from 'typescript'; +import ts from 'typescript'; const run = async ({ cwd }: { cwd: string }) => { const { diff --git a/scripts/prettier.config.js b/scripts/prettier.config.cjs similarity index 100% rename from scripts/prettier.config.js rename to scripts/prettier.config.cjs diff --git a/scripts/release/publish.ts b/scripts/release/publish.ts index eeb8ab2f9349..52f72d5fc64d 100644 --- a/scripts/release/publish.ts +++ b/scripts/release/publish.ts @@ -7,6 +7,7 @@ import { z } from 'zod'; import { readJson } from 'fs-extra'; import fetch from 'node-fetch'; import dedent from 'ts-dedent'; +import pRetry from 'p-retry'; import { execaCommand } from '../utils/exec'; program @@ -134,15 +135,6 @@ const publishAllPackages = async ({ return; } - // Note this is to fool `ts-node` into not turning the `import()` into a `require()`. - // See: https://github.com/TypeStrong/ts-node/discussions/1290 - // prettier-ignore - const pRetry = ( - // eslint-disable-next-line @typescript-eslint/no-implied-eval - (await new Function('specifier', 'return import(specifier)')( - 'p-retry' - )) as typeof import('p-retry') - ).default; /** * 'yarn npm publish' will fail if just one package fails to publish. * But it will continue through with all the other packages, and --tolerate-republish makes it okay to publish the same version again. diff --git a/scripts/tasks/bench.ts b/scripts/tasks/bench.ts index 25325e1090e0..071bbd84ff4d 100644 --- a/scripts/tasks/bench.ts +++ b/scripts/tasks/bench.ts @@ -1,11 +1,11 @@ +import prettyBytes from 'pretty-bytes'; +import prettyTime from 'pretty-ms'; + import type { Task } from '../task'; import { PORT as devPort, dev } from './dev'; import { PORT as servePort, serve } from './serve'; -// eslint-disable-next-line @typescript-eslint/no-implied-eval -const dynamicImport = new Function('specifier', 'return import(specifier)'); - export const bench: Task = { description: 'Run benchmarks against a sandbox in dev mode', dependsOn: ['build'], @@ -19,8 +19,6 @@ export const bench: Task = { const { disableDocs } = options; const { browse } = await import('../bench/browse'); const { saveBench, loadBench } = await import('../bench/utils'); - const { default: prettyBytes } = await dynamicImport('pretty-bytes'); - const { default: prettyTime } = await dynamicImport('pretty-ms'); const devController = await dev.run(details, { ...options, debug: false }); if (!devController) { diff --git a/scripts/tasks/dev.ts b/scripts/tasks/dev.ts index 92e885f52078..138bb912cef8 100644 --- a/scripts/tasks/dev.ts +++ b/scripts/tasks/dev.ts @@ -1,4 +1,5 @@ import detectFreePort from 'detect-port'; +import waitOn from 'wait-on'; import type { Task } from '../task'; import { exec } from '../utils/exec'; @@ -18,7 +19,6 @@ export const dev: Task = { async run({ sandboxDir, selectedTask }, { dryRun, debug }) { const controller = new AbortController(); const devCommand = `yarn storybook --port ${PORT}${selectedTask === 'dev' ? '' : ' --ci'}`; - const { default: waitOn } = await import('wait-on'); const start = now(); exec( diff --git a/scripts/tasks/sandbox.ts b/scripts/tasks/sandbox.ts index 58e7d92fe421..bf3e0bbae07f 100644 --- a/scripts/tasks/sandbox.ts +++ b/scripts/tasks/sandbox.ts @@ -5,6 +5,14 @@ import { promisify } from 'util'; import dirSize from 'fast-folder-size'; import type { Task } from '../task'; import { now, saveBench } from '../bench/utils'; +import { + create, + install, + addStories, + extendMain, + init, + addExtraDependencies, +} from './sandbox-parts'; const logger = console; @@ -55,10 +63,6 @@ export const sandbox: Task = { await remove(details.sandboxDir); } - const { create, install, addStories, extendMain, init, addExtraDependencies } = await import( - './sandbox-parts' - ); - let startTime = now(); await create(details, options); const createTime = now() - startTime; diff --git a/scripts/tasks/serve.ts b/scripts/tasks/serve.ts index f5e637f33bb9..2b3a5cc8c4b9 100644 --- a/scripts/tasks/serve.ts +++ b/scripts/tasks/serve.ts @@ -1,4 +1,5 @@ import detectFreePort from 'detect-port'; +import waitOn from 'wait-on'; import type { Task } from '../task'; import { exec } from '../utils/exec'; @@ -26,7 +27,6 @@ export const serve: Task = { throw err; } }); - const { default: waitOn } = await import('wait-on'); await waitOn({ resources: [`http://localhost:${PORT}`], interval: 16 }); return controller; diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index c82e14a95108..0817a4342434 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -5,15 +5,15 @@ "incremental": false, "noImplicitAny": true, "jsx": "react", - "moduleResolution": "Node", - "target": "ES2020", - "module": "CommonJS", + "moduleResolution": "bundler", + "target": "es2022", + "module": "ES2022", "skipLibCheck": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "isolatedModules": true, "strictBindCallApply": true, - "lib": ["dom", "esnext"], + "lib": ["dom", "es2023"], "types": ["node", "jest"], "strict": true, "strictNullChecks": false, diff --git a/scripts/utils/exec.ts b/scripts/utils/exec.ts index 74a886189420..4dec95e814fc 100644 --- a/scripts/utils/exec.ts +++ b/scripts/utils/exec.ts @@ -1,6 +1,7 @@ /* eslint-disable no-await-in-loop, no-restricted-syntax */ import type { ExecaChildProcess, Options } from 'execa'; import chalk from 'chalk'; +import { execa } from 'execa'; const logger = console; @@ -12,21 +13,14 @@ type StepOptions = { signal?: AbortSignal; }; -// Note this is to fool `ts-node` into not turning the `import()` into a `require()`. -// See: https://github.com/TypeStrong/ts-node/discussions/1290 -// eslint-disable-next-line @typescript-eslint/no-implied-eval -const dynamicImport = new Function('specifier', 'return import(specifier)'); -export const getExeca = async () => (await dynamicImport('execa')) as typeof import('execa'); - // Reimplementation of `execaCommand` to use `getExeca` export const execaCommand = async ( command: string, options: Options = {} ): Promise> => { - const execa = await getExeca(); // We await here because execaCommand returns a promise, but that's not what the user expects // eslint-disable-next-line @typescript-eslint/return-await - return await execa.execaCommand(command, { + return await execa(command, { cleanup: true, ...options, }); @@ -37,7 +31,6 @@ export const exec = async ( options: Options = {}, { startMessage, errorMessage, dryRun, debug, signal }: StepOptions = {} ): Promise => { - const execa = await getExeca(); logger.info(); if (startMessage) logger.info(startMessage); @@ -57,12 +50,12 @@ export const exec = async ( try { if (typeof command === 'string') { logger.debug(`> ${command}`); - currentChild = execa.execaCommand(command, { ...defaultOptions, ...options }); + currentChild = execa(command, { ...defaultOptions, ...options }); await currentChild; } else { for (const subcommand of command) { logger.debug(`> ${subcommand}`); - currentChild = execa.execaCommand(subcommand, { ...defaultOptions, ...options }); + currentChild = execa(subcommand, { ...defaultOptions, ...options }); await currentChild; } } diff --git a/scripts/yarn.lock b/scripts/yarn.lock index 411298c2d9b9..961917e09071 100644 --- a/scripts/yarn.lock +++ b/scripts/yarn.lock @@ -3138,6 +3138,7 @@ __metadata: "@types/serve-static": "npm:^1.13.8" "@types/uuid": "npm:^9.0.1" "@types/wait-on": "npm:^5.3.1" + "@types/window-size": "npm:^1.1.3" "@typescript-eslint/eslint-plugin": "npm:^5.45.0" "@typescript-eslint/experimental-utils": "npm:^5.45.0" "@typescript-eslint/parser": "npm:^5.45.0" @@ -3222,7 +3223,7 @@ __metadata: ts-node: "npm:^10.9.1" tsup: "npm:^6.7.0" type-fest: "npm:~2.19" - typescript: "npm:5.1.6" + typescript: "npm:5.2.2" util: "npm:^0.12.4" uuid: "npm:^9.0.0" verdaccio: "npm:^5.19.1" @@ -4089,6 +4090,15 @@ __metadata: languageName: node linkType: hard +"@types/window-size@npm:^1.1.3": + version: 1.1.3 + resolution: "@types/window-size@npm:1.1.3" + dependencies: + "@types/node": "npm:*" + checksum: 0ec54d81fd160a6ba50136a8fab4d682cf790723e7a6f758cfb1bc08fddc29e0443fbe1817894cc438cb1b4bf57e1edb7e768114221a0bd1682438e25aa7d8c8 + languageName: node + linkType: hard + "@types/yargs-parser@npm:*": version: 21.0.0 resolution: "@types/yargs-parser@npm:21.0.0" @@ -16521,23 +16531,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.1.6": - version: 5.1.6 - resolution: "typescript@npm:5.1.6" +"typescript@npm:5.2.2": + version: 5.2.2 + resolution: "typescript@npm:5.2.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 45ac28e2df8365fd28dac42f5d62edfe69a7203d5ec646732cadc04065331f34f9078f81f150fde42ed9754eed6fa3b06a8f3523c40b821e557b727f1992e025 + checksum: 91ae3e6193d0ddb8656d4c418a033f0f75dec5e077ebbc2bd6d76439b93f35683936ee1bdc0e9cf94ec76863aa49f27159b5788219b50e1cd0cd6d110aa34b07 languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.1.6#optional!builtin": - version: 5.1.6 - resolution: "typescript@patch:typescript@npm%3A5.1.6#optional!builtin::version=5.1.6&hash=5da071" +"typescript@patch:typescript@npm%3A5.2.2#optional!builtin": + version: 5.2.2 + resolution: "typescript@patch:typescript@npm%3A5.2.2#optional!builtin::version=5.2.2&hash=f3b441" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: c2bded58ab897a8341fdbb0c1d92ea2362f498cfffebdc8a529d03e15ea2454142dfbf122dabbd9a5cb79b7123790d27def16e11844887d20636226773ed329a + checksum: 062c1cee1990e6b9419ce8a55162b8dc917eb87f807e4de0327dbc1c2fa4e5f61bc0dd4e034d38ff541d1ed0479b53bcee8e4de3a4075c51a1724eb6216cb6f5 languageName: node linkType: hard From c436354d4f965f6d5fc2fd21961059016084167f Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 12:01:35 +0100 Subject: [PATCH 03/21] Convert require commonjs expressions to esm equivalents --- scripts/combine-compodoc.ts | 4 +++- scripts/dangerfile.ts | 11 ++++++----- scripts/event-log-checker.ts | 4 +++- scripts/get-report-message.ts | 4 +++- scripts/get-template.ts | 4 +++- scripts/release/cancel-preparation-runs.ts | 4 +++- scripts/release/ensure-next-ahead.ts | 4 +++- scripts/release/generate-pr-description.ts | 4 +++- scripts/release/get-changelog-from-file.ts | 4 +++- scripts/release/get-current-version.ts | 4 +++- scripts/release/get-version-changelog.ts | 4 +++- scripts/release/is-pr-frozen.ts | 4 +++- scripts/release/is-prerelease.ts | 4 +++- scripts/release/is-version-published.ts | 4 +++- scripts/release/label-patches.ts | 4 +++- scripts/release/pick-patches.ts | 4 +++- scripts/release/publish.ts | 4 +++- scripts/release/unreleased-changes-exists.ts | 4 +++- scripts/release/version.ts | 4 +++- scripts/release/write-changelog.ts | 4 +++- scripts/sandbox/generate.ts | 4 +++- scripts/sandbox/utils/git.ts | 2 +- scripts/tasks/install.ts | 4 ++-- scripts/tasks/sandbox-parts.ts | 4 +++- scripts/utils/cli-step.ts | 2 ++ scripts/utils/{cli-utils.js => cli-utils.ts} | 20 ++++++++------------ scripts/utils/concurrency.ts | 4 +--- 27 files changed, 83 insertions(+), 44 deletions(-) rename scripts/utils/{cli-utils.js => cli-utils.ts} (76%) diff --git a/scripts/combine-compodoc.ts b/scripts/combine-compodoc.ts index f09f85bb9870..0a4472edb7bc 100755 --- a/scripts/combine-compodoc.ts +++ b/scripts/combine-compodoc.ts @@ -6,6 +6,7 @@ import { join, resolve } from 'path'; import { realpath, readFile, writeFile, lstat } from 'fs-extra'; import { globSync } from 'glob'; import { directory } from 'tempy'; +import url from 'url'; import { execaCommand } from './utils/exec'; const logger = console; @@ -67,7 +68,8 @@ async function run(cwd: string) { await writeFile(join(cwd, 'documentation.json'), JSON.stringify(documentation)); } -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { run(resolve(process.argv[2])) .then(() => process.exit(0)) .catch((err) => { diff --git a/scripts/dangerfile.ts b/scripts/dangerfile.ts index 754686981c80..bd9bb6494602 100644 --- a/scripts/dangerfile.ts +++ b/scripts/dangerfile.ts @@ -2,13 +2,14 @@ import { fail, danger } from 'danger'; import { execSync } from 'child_process'; -execSync('npm install lodash'); +import flatten from 'lodash/flatten.js'; +import intersection from 'lodash/intersection.js'; +import isEmpty from 'lodash/isEmpty.js'; + +import pkg from '../code/package.json'; -const flatten = require('lodash/flatten.js'); -const intersection = require('lodash/intersection.js'); -const isEmpty = require('lodash/isEmpty.js'); +execSync('npm install lodash'); -const pkg = require('../code/package.json'); // eslint-disable-line import/newline-after-import const prLogConfig = pkg['pr-log']; const Versions = { diff --git a/scripts/event-log-checker.ts b/scripts/event-log-checker.ts index e1f6d82bd533..4f418bffde9e 100644 --- a/scripts/event-log-checker.ts +++ b/scripts/event-log-checker.ts @@ -2,6 +2,7 @@ import chalk from 'chalk'; import assert from 'assert'; import fetch from 'node-fetch'; +import url from 'url'; import { allTemplates } from '../code/lib/cli/src/sandbox-templates'; import versions from '../code/lib/cli/src/versions'; import { oneWayHash } from '../code/lib/telemetry/src/one-way-hash'; @@ -114,7 +115,8 @@ async function run() { export {}; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { run() .then(() => process.exit(0)) .catch((err) => { diff --git a/scripts/get-report-message.ts b/scripts/get-report-message.ts index 47b24cfba47b..170938cbde0a 100644 --- a/scripts/get-report-message.ts +++ b/scripts/get-report-message.ts @@ -1,6 +1,7 @@ /* eslint-disable no-console */ import { readJson } from 'fs-extra'; import { join } from 'path'; +import url from 'url'; import { CODE_DIRECTORY } from './utils/constants'; import { execaCommand } from './utils/exec'; @@ -63,7 +64,8 @@ async function run() { console.log(`${title}${body}${footer}`.replace(/\n/g, '\\n')); } -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { run().catch((err) => { console.error(err); process.exit(1); diff --git a/scripts/get-template.ts b/scripts/get-template.ts index c56418f7a0b4..5c4b43ad0cb2 100644 --- a/scripts/get-template.ts +++ b/scripts/get-template.ts @@ -4,6 +4,7 @@ import { program } from 'commander'; import dedent from 'ts-dedent'; import chalk from 'chalk'; import yaml from 'yaml'; +import url from 'url'; import { allTemplates, templatesByCadence, @@ -179,7 +180,8 @@ async function run({ cadence, task, check }: RunOptions) { ); } -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { program .description('Retrieve the template to run for a given cadence and task') .option('--cadence ', 'Which cadence you want to run the script for') diff --git a/scripts/release/cancel-preparation-runs.ts b/scripts/release/cancel-preparation-runs.ts index 630bfb4847b3..9253f12041c5 100644 --- a/scripts/release/cancel-preparation-runs.ts +++ b/scripts/release/cancel-preparation-runs.ts @@ -6,6 +6,7 @@ import chalk from 'chalk'; import program from 'commander'; import dedent from 'ts-dedent'; +import url from 'url'; import { githubRestClient } from './utils/github-client'; program @@ -99,7 +100,8 @@ export const run = async () => { } }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { run().catch((err) => { console.error(err); // this is non-critical work, so we don't want to fail the CI build if this fails diff --git a/scripts/release/ensure-next-ahead.ts b/scripts/release/ensure-next-ahead.ts index 1aa32bfd932c..2deae1bee36e 100644 --- a/scripts/release/ensure-next-ahead.ts +++ b/scripts/release/ensure-next-ahead.ts @@ -14,6 +14,7 @@ import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; import { readJson } from 'fs-extra'; +import url from 'url'; import { run as bumpVersion } from './version'; import { git } from './utils/git-client'; @@ -92,7 +93,8 @@ export const run = async (options: unknown) => { ); }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/generate-pr-description.ts b/scripts/release/generate-pr-description.ts index d437e8dc87bc..a62c586db867 100644 --- a/scripts/release/generate-pr-description.ts +++ b/scripts/release/generate-pr-description.ts @@ -5,6 +5,7 @@ import { z } from 'zod'; import dedent from 'ts-dedent'; import semver from 'semver'; import { setOutput } from '@actions/core'; +import url from 'url'; import type { Change } from './utils/get-changes'; import { getChanges, LABELS_BY_IMPORTANCE, RELEASED_LABELS } from './utils/get-changes'; import { getCurrentVersion } from './get-current-version'; @@ -295,7 +296,8 @@ export const run = async (rawOptions: unknown) => { } }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/get-changelog-from-file.ts b/scripts/release/get-changelog-from-file.ts index e01efe959032..7a5ea3ecaddd 100644 --- a/scripts/release/get-changelog-from-file.ts +++ b/scripts/release/get-changelog-from-file.ts @@ -6,6 +6,7 @@ import { readFile } from 'fs-extra'; import path from 'path'; import semver from 'semver'; import dedent from 'ts-dedent'; +import url from 'url'; import { getCurrentVersion } from './get-current-version'; program @@ -54,7 +55,8 @@ export const getChangelogFromFile = async (args: { return result; }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); getChangelogFromFile({ version: parsed.args[0], diff --git a/scripts/release/get-current-version.ts b/scripts/release/get-current-version.ts index 413c101640b6..df91678f9c44 100644 --- a/scripts/release/get-current-version.ts +++ b/scripts/release/get-current-version.ts @@ -3,6 +3,7 @@ import chalk from 'chalk'; import { setOutput } from '@actions/core'; import path from 'path'; import { readJson } from 'fs-extra'; +import url from 'url'; const CODE_DIR_PATH = path.join(__dirname, '..', '..', 'code'); const CODE_PACKAGE_JSON_PATH = path.join(CODE_DIR_PATH, 'package.json'); @@ -17,7 +18,8 @@ export const getCurrentVersion = async () => { return version; }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { getCurrentVersion().catch((err) => { console.error(err); process.exit(1); diff --git a/scripts/release/get-version-changelog.ts b/scripts/release/get-version-changelog.ts index 3ece5480236d..c70ec902bb0d 100644 --- a/scripts/release/get-version-changelog.ts +++ b/scripts/release/get-version-changelog.ts @@ -2,6 +2,7 @@ import { setOutput } from '@actions/core'; import chalk from 'chalk'; import { program } from 'commander'; +import url from 'url'; import { getCurrentVersion } from './get-current-version'; import { getChanges } from './utils/get-changes'; @@ -26,7 +27,8 @@ export const getVersionChangelog = async (args: { version?: string; verbose?: bo return changelogText; }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); getVersionChangelog({ version: parsed.args[0], verbose: parsed.opts().verbose }).catch((err) => { console.error(err); diff --git a/scripts/release/is-pr-frozen.ts b/scripts/release/is-pr-frozen.ts index e81610a451b9..d2e774b82cb7 100644 --- a/scripts/release/is-pr-frozen.ts +++ b/scripts/release/is-pr-frozen.ts @@ -4,6 +4,7 @@ import program from 'commander'; import { setOutput } from '@actions/core'; import path from 'path'; import { readJson } from 'fs-extra'; +import url from 'url'; import { getPullInfoFromCommit } from './utils/get-github-info'; import { git } from './utils/git-client'; @@ -98,7 +99,8 @@ export const run = async (options: unknown) => { return isFrozen; }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/is-prerelease.ts b/scripts/release/is-prerelease.ts index 25722c098cd6..ab9606073de6 100644 --- a/scripts/release/is-prerelease.ts +++ b/scripts/release/is-prerelease.ts @@ -3,6 +3,7 @@ import chalk from 'chalk'; import program from 'commander'; import { setOutput } from '@actions/core'; import semver from 'semver'; +import url from 'url'; import { getCurrentVersion } from './get-current-version'; program @@ -38,7 +39,8 @@ export const isPrerelease = async (args: { version?: string; verbose?: boolean } return result; }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); isPrerelease({ version: parsed.args[0], diff --git a/scripts/release/is-version-published.ts b/scripts/release/is-version-published.ts index b5acd8c90ab7..a0b97d1a155c 100644 --- a/scripts/release/is-version-published.ts +++ b/scripts/release/is-version-published.ts @@ -3,6 +3,7 @@ import chalk from 'chalk'; import program from 'commander'; import { setOutput } from '@actions/core'; import fetch from 'node-fetch'; +import url from 'url'; import { getCurrentVersion } from './get-current-version'; program @@ -77,7 +78,8 @@ export const run = async (args: unknown[], options: unknown) => { return isAlreadyPublished; }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); run(parsed.args, parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/label-patches.ts b/scripts/release/label-patches.ts index 1e9305b9806c..a23fbfe07a3e 100644 --- a/scripts/release/label-patches.ts +++ b/scripts/release/label-patches.ts @@ -1,6 +1,7 @@ import program from 'commander'; import { v4 as uuidv4 } from 'uuid'; import ora from 'ora'; +import url from 'url'; import { getLabelIds, githubGraphQlClient, getUnpickedPRs } from './utils/github-client'; import { getPullInfoFromCommits, getRepo } from './utils/get-changes'; import { getLatestTag, git } from './utils/git-client'; @@ -93,7 +94,8 @@ export const run = async (options: unknown) => { } }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const options = program.parse().opts(); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/pick-patches.ts b/scripts/release/pick-patches.ts index 9d3169d78c8a..cfaaf9693771 100644 --- a/scripts/release/pick-patches.ts +++ b/scripts/release/pick-patches.ts @@ -5,6 +5,7 @@ import chalk from 'chalk'; import ora from 'ora'; import { setOutput } from '@actions/core'; import invariant from 'tiny-invariant'; +import url from 'url'; import { git } from './utils/git-client'; import { getUnpickedPRs } from './utils/github-client'; @@ -85,7 +86,8 @@ export const run = async (_: unknown) => { } }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const options = program.parse(process.argv); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/publish.ts b/scripts/release/publish.ts index 52f72d5fc64d..82b01c552e9b 100644 --- a/scripts/release/publish.ts +++ b/scripts/release/publish.ts @@ -8,6 +8,7 @@ import { readJson } from 'fs-extra'; import fetch from 'node-fetch'; import dedent from 'ts-dedent'; import pRetry from 'p-retry'; +import url from 'url'; import { execaCommand } from '../utils/exec'; program @@ -189,7 +190,8 @@ export const run = async (options: unknown) => { ); }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/unreleased-changes-exists.ts b/scripts/release/unreleased-changes-exists.ts index 59adedbdbb0e..c0cd5260d59b 100644 --- a/scripts/release/unreleased-changes-exists.ts +++ b/scripts/release/unreleased-changes-exists.ts @@ -4,6 +4,7 @@ import program from 'commander'; import { z } from 'zod'; import { setOutput } from '@actions/core'; import { intersection } from 'lodash'; +import url from 'url'; import type { Change } from './utils/get-changes'; import { RELEASED_LABELS, getChanges } from './utils/get-changes'; import { getCurrentVersion } from './get-current-version'; @@ -77,7 +78,8 @@ ${chalk.blue(changesToRelease.map(({ title, pull }) => ` #${pull}: ${title}`).j return { changesToRelease, hasChangesToRelease }; }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/version.ts b/scripts/release/version.ts index 3b34d288a8c7..da9e7894d050 100644 --- a/scripts/release/version.ts +++ b/scripts/release/version.ts @@ -6,6 +6,7 @@ import path from 'path'; import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; +import url from 'url'; import type { Workspace } from '../utils/workspace'; import { getWorkspaces } from '../utils/workspace'; import { execaCommand } from '../utils/exec'; @@ -293,7 +294,8 @@ export const run = async (options: unknown) => { } }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const options = program.parse().opts(); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/write-changelog.ts b/scripts/release/write-changelog.ts index 41bc9b72bd36..a353309b65af 100644 --- a/scripts/release/write-changelog.ts +++ b/scripts/release/write-changelog.ts @@ -5,6 +5,7 @@ import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; import { readFile, writeFile, writeJson } from 'fs-extra'; +import url from 'url'; import { getChanges } from './utils/get-changes'; program @@ -132,7 +133,8 @@ export const run = async (args: unknown[], options: unknown) => { console.log(`✅ Wrote Changelog to file`); }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { const parsed = program.parse(); run(parsed.args, parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index 22a4eccf4d14..229df395bbb3 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -6,6 +6,7 @@ import prettyTime from 'pretty-hrtime'; import { copy, emptyDir, ensureDir, move, remove, rename, writeFile } from 'fs-extra'; import { program } from 'commander'; import { directory } from 'tempy'; +import url from 'url'; import { execaCommand } from '../utils/exec'; import type { OptionValues } from '../utils/options'; @@ -250,7 +251,8 @@ export const generate = async ({ await runGenerators(generatorConfigs, localRegistry, debug); }; -if (require.main === module) { +const modulePath = url.fileURLToPath(import.meta.url); +if (process.argv[1] === modulePath) { program .description('Generate sandboxes from a set of possible templates') .option('--templates [templates...]', 'Space-delimited list of templates to include') diff --git a/scripts/sandbox/utils/git.ts b/scripts/sandbox/utils/git.ts index 84fe02f25cdb..dea378eae921 100644 --- a/scripts/sandbox/utils/git.ts +++ b/scripts/sandbox/utils/git.ts @@ -5,7 +5,7 @@ import { execaCommand } from '../../utils/exec'; // eslint-disable-next-line import/no-cycle import { logger } from '../publish'; -const { version: storybookVersion } = require('../../../code/package.json'); +import { version as storybookVersion } from '../../../code/package.json'; const getTheLastCommitHashThatUpdatedTheSandboxRepo = async (branch: string) => { const owner = 'storybookjs'; diff --git a/scripts/tasks/install.ts b/scripts/tasks/install.ts index 653eda568381..e78130ab514f 100644 --- a/scripts/tasks/install.ts +++ b/scripts/tasks/install.ts @@ -1,6 +1,7 @@ import { pathExists, remove } from 'fs-extra'; import { join } from 'path'; import type { Task } from '../task'; +import { checkDependencies } from '../utils/cli-utils'; export const install: Task = { description: 'Install the dependencies of the monorepo', @@ -8,8 +9,7 @@ export const install: Task = { return pathExists(join(codeDir, 'node_modules')); }, async run({ codeDir }) { - // eslint-disable-next-line global-require - await require('../utils/cli-utils').checkDependencies(); + await checkDependencies(); // these are webpack4 types, we we should never use await remove(join(codeDir, 'node_modules', '@types', 'webpack')); diff --git a/scripts/tasks/sandbox-parts.ts b/scripts/tasks/sandbox-parts.ts index 393169b244f8..f64c13c61fbc 100644 --- a/scripts/tasks/sandbox-parts.ts +++ b/scripts/tasks/sandbox-parts.ts @@ -12,8 +12,9 @@ import { writeJson, } from 'fs-extra'; import { join, resolve, sep } from 'path'; - +import { createRequire } from 'module'; import slash from 'slash'; + import type { Task } from '../task'; import { executeCLIStep, steps } from '../utils/cli-step'; import { @@ -167,6 +168,7 @@ export const init: Task['run'] = async ( // loader for such files. NOTE this isn't necessary for Vite, as far as we know. function addEsbuildLoaderToStories(mainConfig: ConfigFile) { // NOTE: the test regexp here will apply whether the path is symlink-preserved or otherwise + const require = createRequire(import.meta.url); const esbuildLoaderPath = require.resolve('../../code/node_modules/esbuild-loader'); const storiesMdxLoaderPath = require.resolve( '../../code/node_modules/@storybook/mdx2-csf/loader' diff --git a/scripts/utils/cli-step.ts b/scripts/utils/cli-step.ts index d990597619f3..9e736f30b2a4 100644 --- a/scripts/utils/cli-step.ts +++ b/scripts/utils/cli-step.ts @@ -1,7 +1,9 @@ +import { createRequire } from 'module'; import type { OptionSpecifier, OptionValues } from './options'; import { createOptions, getCommand } from './options'; import { exec } from './exec'; +const require = createRequire(import.meta.url); const cliExecutable = require.resolve('../../code/lib/cli/bin/index.js'); export type CLIStep = { diff --git a/scripts/utils/cli-utils.js b/scripts/utils/cli-utils.ts similarity index 76% rename from scripts/utils/cli-utils.js rename to scripts/utils/cli-utils.ts index ba52d9338875..c37f2a950d74 100644 --- a/scripts/utils/cli-utils.js +++ b/scripts/utils/cli-utils.ts @@ -1,14 +1,14 @@ -const { spawn } = require('child_process'); -const { join } = require('path'); -const { existsSync } = require('fs'); +import { spawn } from 'child_process'; +import { join } from 'path'; +import { existsSync } from 'fs'; const logger = console; -const checkDependencies = async () => { +export const checkDependencies = async () => { const scriptsPath = join(__dirname, '..'); const codePath = join(__dirname, '..', '..', 'code'); - const tasks = []; + const tasks: Array = []; if (!existsSync(join(scriptsPath, 'node_modules'))) { tasks.push( @@ -35,8 +35,8 @@ const checkDependencies = async () => { await Promise.all( tasks.map( (t) => - new Promise((res, rej) => { - t.on('exit', (code) => { + new Promise((res, rej) => { + t.on('exit', (code: number) => { if (code !== 0) { rej(); } else { @@ -51,12 +51,8 @@ const checkDependencies = async () => { }); // give the filesystem some time - await new Promise((res, rej) => { + await new Promise((res) => { setTimeout(res, 1000); }); } }; - -module.exports = { - checkDependencies, -}; diff --git a/scripts/utils/concurrency.ts b/scripts/utils/concurrency.ts index ab49dc41e8f5..781c7c0d6787 100644 --- a/scripts/utils/concurrency.ts +++ b/scripts/utils/concurrency.ts @@ -1,9 +1,7 @@ -const os = require('os'); +import os from 'os'; /** * The maximum number of concurrent tasks we want to have on some CLI and CI tasks. * The amount of CPUS minus one, arbitrary limited to 15 to not overload CI executors. - * @type {number} */ export const maxConcurrentTasks = Math.min(Math.max(1, os.cpus().length - 1), 15); - From 946d8630ecce1579f8fafbd9af4ba9c77ce37d78 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 12:20:50 +0100 Subject: [PATCH 04/21] Fix babel and eslint --- scripts/{.babelrc.js => .babelrc.cjs} | 2 +- scripts/.eslintignore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename scripts/{.babelrc.js => .babelrc.cjs} (93%) diff --git a/scripts/.babelrc.js b/scripts/.babelrc.cjs similarity index 93% rename from scripts/.babelrc.js rename to scripts/.babelrc.cjs index c5d2be1935f6..31016fd42625 100644 --- a/scripts/.babelrc.js +++ b/scripts/.babelrc.cjs @@ -1,4 +1,4 @@ -export default { +module.exports = { compact: false, presets: [ '@babel/preset-typescript', diff --git a/scripts/.eslintignore b/scripts/.eslintignore index db97fa57090f..9224e493860f 100644 --- a/scripts/.eslintignore +++ b/scripts/.eslintignore @@ -21,6 +21,6 @@ ember-output !.babelrc.js !.eslintrc.js !.eslintrc-markdown.js -!.jest.config.js +!.jest.config.cjs !.storybook From 3c806e093cf048ce339134859fa7771aaac29ec2 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 12:20:58 +0100 Subject: [PATCH 05/21] Fix tests --- scripts/jest.config.cjs | 22 ++++++- scripts/package.json | 6 +- scripts/yarn.lock | 143 ++++++++++++++++++++++++++-------------- 3 files changed, 117 insertions(+), 54 deletions(-) diff --git a/scripts/jest.config.cjs b/scripts/jest.config.cjs index f053ebf7976e..571d0ab11232 100644 --- a/scripts/jest.config.cjs +++ b/scripts/jest.config.cjs @@ -1 +1,21 @@ -module.exports = {}; +module.exports = { + transform: { + '^.+\\.(t|j)sx?$': [ + '@swc/jest', + { + jsc: { + parser: { + syntax: 'typescript', + tsx: false, + decorators: false, + dynamicImport: false, + }, + experimental: { + plugins: [['jest_workaround', {}]], + }, + }, + }, + ], + }, + transformIgnorePatterns: [], +}; diff --git a/scripts/package.json b/scripts/package.json index 01a8ea31618c..d1bd6e17fe99 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -31,7 +31,7 @@ "release:write-changelog": "node --loader esbuild-register/loader -r esbuild-register ./release/write-changelog.ts", "strict-ts": "node --loader esbuild-register/loader -r esbuild-register ./strict-ts.ts", "task": "node --loader esbuild-register/loader -r esbuild-register ./task.ts", - "test": "jest --config ./jest.config.js", + "test": "jest --config ./jest.config.cjs", "upgrade": "node --loader esbuild-register/loader -r esbuild-register ./task.ts", "upload-bench": "ts-node ./upload-bench.ts" }, @@ -81,7 +81,8 @@ "@storybook/jest": "next", "@storybook/linter-config": "^3.1.2", "@storybook/testing-library": "next", - "@swc/core": "1.3.82", + "@swc/core": "^1.3.95", + "@swc/jest": "^0.2.29", "@testing-library/dom": "^9.3.0", "@testing-library/jest-dom": "^5.11.9", "@testing-library/react": "^14.0.0", @@ -149,6 +150,7 @@ "jest-os-detection": "^1.3.1", "jest-serializer-html": "^7.1.0", "jest-watch-typeahead": "^2.2.1", + "jest_workaround": "^0.79.19", "json5": "^2.2.3", "junit-xml": "^1.2.0", "lint-staged": "^10.5.4", diff --git a/scripts/yarn.lock b/scripts/yarn.lock index 961917e09071..fc179744fad1 100644 --- a/scripts/yarn.lock +++ b/scripts/yarn.lock @@ -2170,6 +2170,15 @@ __metadata: languageName: node linkType: hard +"@jest/create-cache-key-function@npm:^27.4.2": + version: 27.5.1 + resolution: "@jest/create-cache-key-function@npm:27.5.1" + dependencies: + "@jest/types": "npm:^27.5.1" + checksum: 1890ac93fad852e0a98c31de1e5f2c548974aefd36e838d27b70834dda1654a153ed6a52258447ebacfd47463e9bdb83750631bee827797c7b9973c083998a96 + languageName: node + linkType: hard + "@jest/environment@npm:^29.7.0": version: 29.7.0 resolution: "@jest/environment@npm:29.7.0" @@ -3113,7 +3122,8 @@ __metadata: "@storybook/jest": "npm:next" "@storybook/linter-config": "npm:^3.1.2" "@storybook/testing-library": "npm:next" - "@swc/core": "npm:1.3.82" + "@swc/core": "npm:^1.3.95" + "@swc/jest": "npm:^0.2.29" "@testing-library/dom": "npm:^9.3.0" "@testing-library/jest-dom": "npm:^5.11.9" "@testing-library/react": "npm:^14.0.0" @@ -3182,6 +3192,7 @@ __metadata: jest-os-detection: "npm:^1.3.1" jest-serializer-html: "npm:^7.1.0" jest-watch-typeahead: "npm:^2.2.1" + jest_workaround: "npm:^0.79.19" json5: "npm:^2.2.3" junit-xml: "npm:^1.2.0" lint-staged: "npm:^10.5.4" @@ -3262,91 +3273,92 @@ __metadata: languageName: node linkType: hard -"@swc/core-darwin-arm64@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-darwin-arm64@npm:1.3.82" +"@swc/core-darwin-arm64@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-darwin-arm64@npm:1.3.95" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@swc/core-darwin-x64@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-darwin-x64@npm:1.3.82" +"@swc/core-darwin-x64@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-darwin-x64@npm:1.3.95" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@swc/core-linux-arm-gnueabihf@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-linux-arm-gnueabihf@npm:1.3.82" +"@swc/core-linux-arm-gnueabihf@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-linux-arm-gnueabihf@npm:1.3.95" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@swc/core-linux-arm64-gnu@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-linux-arm64-gnu@npm:1.3.82" +"@swc/core-linux-arm64-gnu@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-linux-arm64-gnu@npm:1.3.95" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-arm64-musl@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-linux-arm64-musl@npm:1.3.82" +"@swc/core-linux-arm64-musl@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-linux-arm64-musl@npm:1.3.95" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@swc/core-linux-x64-gnu@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-linux-x64-gnu@npm:1.3.82" +"@swc/core-linux-x64-gnu@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-linux-x64-gnu@npm:1.3.95" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-x64-musl@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-linux-x64-musl@npm:1.3.82" +"@swc/core-linux-x64-musl@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-linux-x64-musl@npm:1.3.95" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@swc/core-win32-arm64-msvc@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-win32-arm64-msvc@npm:1.3.82" +"@swc/core-win32-arm64-msvc@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-win32-arm64-msvc@npm:1.3.95" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@swc/core-win32-ia32-msvc@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-win32-ia32-msvc@npm:1.3.82" +"@swc/core-win32-ia32-msvc@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-win32-ia32-msvc@npm:1.3.95" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@swc/core-win32-x64-msvc@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core-win32-x64-msvc@npm:1.3.82" +"@swc/core-win32-x64-msvc@npm:1.3.95": + version: 1.3.95 + resolution: "@swc/core-win32-x64-msvc@npm:1.3.95" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@swc/core@npm:1.3.82": - version: 1.3.82 - resolution: "@swc/core@npm:1.3.82" +"@swc/core@npm:^1.3.95": + version: 1.3.95 + resolution: "@swc/core@npm:1.3.95" dependencies: - "@swc/core-darwin-arm64": "npm:1.3.82" - "@swc/core-darwin-x64": "npm:1.3.82" - "@swc/core-linux-arm-gnueabihf": "npm:1.3.82" - "@swc/core-linux-arm64-gnu": "npm:1.3.82" - "@swc/core-linux-arm64-musl": "npm:1.3.82" - "@swc/core-linux-x64-gnu": "npm:1.3.82" - "@swc/core-linux-x64-musl": "npm:1.3.82" - "@swc/core-win32-arm64-msvc": "npm:1.3.82" - "@swc/core-win32-ia32-msvc": "npm:1.3.82" - "@swc/core-win32-x64-msvc": "npm:1.3.82" - "@swc/types": "npm:^0.1.4" + "@swc/core-darwin-arm64": "npm:1.3.95" + "@swc/core-darwin-x64": "npm:1.3.95" + "@swc/core-linux-arm-gnueabihf": "npm:1.3.95" + "@swc/core-linux-arm64-gnu": "npm:1.3.95" + "@swc/core-linux-arm64-musl": "npm:1.3.95" + "@swc/core-linux-x64-gnu": "npm:1.3.95" + "@swc/core-linux-x64-musl": "npm:1.3.95" + "@swc/core-win32-arm64-msvc": "npm:1.3.95" + "@swc/core-win32-ia32-msvc": "npm:1.3.95" + "@swc/core-win32-x64-msvc": "npm:1.3.95" + "@swc/counter": "npm:^0.1.1" + "@swc/types": "npm:^0.1.5" peerDependencies: "@swc/helpers": ^0.5.0 dependenciesMeta: @@ -3373,14 +3385,33 @@ __metadata: peerDependenciesMeta: "@swc/helpers": optional: true - checksum: cee1f56e969074fe9e23fe51348d7da0c921949f5845e57030824d0e32d09fcefc647371c982e82836cc72c27c5fc5370c6aaff4f8f1c527d1c39c5ab6203e17 + checksum: f0386b7cc1288d97ef3636fff06c1798914e453b574934778d6c90019acf6893bf566c805369ab74b7c7b559243de37e3fe8bb2bbe9b1ac3214a0575cc4f7335 languageName: node linkType: hard -"@swc/types@npm:^0.1.4": - version: 0.1.4 - resolution: "@swc/types@npm:0.1.4" - checksum: f506cb23a08c604c6343c51f47e399d2c59f2e4a7df0689849284915a9f726ca65ce86d5358b5ed88c6ba1fce135a25614b1adda1beedf570a24c230466d6a46 +"@swc/counter@npm:^0.1.1": + version: 0.1.2 + resolution: "@swc/counter@npm:0.1.2" + checksum: 18be012107d4ba1f79776c48d83391ca2159103d7d31a59ff52fcc8024db51b71c5f46714a9fb73981739bc8a38dc6f385a046b71cc08f6043f3c47f5c409eab + languageName: node + linkType: hard + +"@swc/jest@npm:^0.2.29": + version: 0.2.29 + resolution: "@swc/jest@npm:0.2.29" + dependencies: + "@jest/create-cache-key-function": "npm:^27.4.2" + jsonc-parser: "npm:^3.2.0" + peerDependencies: + "@swc/core": "*" + checksum: 10f34341f9bc8003cec44f91a88b531ba44094aad97b2f8410fb2f94db9eb3b8fc7f6d14ba867eb9c1dc6ba29cc46058244b8280d673a7c681062fe0dc73c3f0 + languageName: node + linkType: hard + +"@swc/types@npm:^0.1.5": + version: 0.1.5 + resolution: "@swc/types@npm:0.1.5" + checksum: b35f93fe896a2240f6f10544e408f9648c2bd4bcff9bd8d022d9a6942d31cf859f86119fb0bbb04a12eefa1f6a6745ffc7d18f3a490d76d7b6a074a7c9608144 languageName: node linkType: hard @@ -10799,6 +10830,16 @@ __metadata: languageName: node linkType: hard +"jest_workaround@npm:^0.79.19": + version: 0.79.19 + resolution: "jest_workaround@npm:0.79.19" + peerDependencies: + "@swc/core": ^1.3.68 + "@swc/jest": ^0.2.26 + checksum: 387ce514e7ef60129891a4647e5431f1e4179bde70de100d50fa4acc8a4f3c072db9cf65c8a7d971ab11437ace78aa77959c65cdb2e55e718c971905c55e62fd + languageName: node + linkType: hard + "jju@npm:^1.4.0": version: 1.4.0 resolution: "jju@npm:1.4.0" @@ -11005,7 +11046,7 @@ __metadata: languageName: node linkType: hard -"jsonc-parser@npm:3.2.0, jsonc-parser@npm:^3.0.0": +"jsonc-parser@npm:3.2.0, jsonc-parser@npm:^3.0.0, jsonc-parser@npm:^3.2.0": version: 3.2.0 resolution: "jsonc-parser@npm:3.2.0" checksum: 5a12d4d04dad381852476872a29dcee03a57439574e4181d91dca71904fcdcc5e8e4706c0a68a2c61ad9810e1e1c5806b5100d52d3e727b78f5cdc595401045b From e22f3b9cc31315d965d8372eedd2a6df63438886 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 12:28:03 +0100 Subject: [PATCH 06/21] Fix generate-sandbox script --- scripts/tasks/sandbox.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/tasks/sandbox.ts b/scripts/tasks/sandbox.ts index bf3e0bbae07f..58e7d92fe421 100644 --- a/scripts/tasks/sandbox.ts +++ b/scripts/tasks/sandbox.ts @@ -5,14 +5,6 @@ import { promisify } from 'util'; import dirSize from 'fast-folder-size'; import type { Task } from '../task'; import { now, saveBench } from '../bench/utils'; -import { - create, - install, - addStories, - extendMain, - init, - addExtraDependencies, -} from './sandbox-parts'; const logger = console; @@ -63,6 +55,10 @@ export const sandbox: Task = { await remove(details.sandboxDir); } + const { create, install, addStories, extendMain, init, addExtraDependencies } = await import( + './sandbox-parts' + ); + let startTime = now(); await create(details, options); const createTime = now() - startTime; From baa57e0fb9beb5bcc0ee009fe7126bf5608dc275 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 12:38:36 +0100 Subject: [PATCH 07/21] Remove ts-node in scripts --- .circleci/config.yml | 5 +- scripts/package.json | 3 +- scripts/prepare/esm-bundle.ts | 2 - scripts/prepare/facade.ts | 5 +- scripts/prepare/tsc.ts | 2 - scripts/tasks/sandbox-parts.ts | 3 +- scripts/tsconfig.json | 9 +-- scripts/yarn.lock | 134 +-------------------------------- 8 files changed, 10 insertions(+), 153 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b7266a42c698..77b6e334b250 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -322,7 +322,7 @@ jobs: at: . - run: name: Starting Event Collector - command: yarn ts-node ./event-log-collector.ts + command: node --loader esbuild-register/loader -r esbuild-register ./event-log-collector.ts working_directory: scripts background: true - run: @@ -330,7 +330,7 @@ jobs: command: yarn task --task build --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build) --no-link --start-from=never --junit - run: name: Verifying Telemetry - command: yarn ts-node ./event-log-checker build $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build) + command: node --loader esbuild-register/loader -r esbuild-register ./event-log-checker build $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build) working_directory: scripts - report-workflow-on-failure: template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task build) @@ -640,4 +640,3 @@ workflows: # parallelism: 4 # requires: # - create-sandboxes - diff --git a/scripts/package.json b/scripts/package.json index d1bd6e17fe99..3d316aac3671 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -33,7 +33,7 @@ "task": "node --loader esbuild-register/loader -r esbuild-register ./task.ts", "test": "jest --config ./jest.config.cjs", "upgrade": "node --loader esbuild-register/loader -r esbuild-register ./task.ts", - "upload-bench": "ts-node ./upload-bench.ts" + "upload-bench": "node --loader esbuild-register/loader -r esbuild-register ./upload-bench.ts" }, "husky": { "hooks": { @@ -188,7 +188,6 @@ "tiny-invariant": "^1.3.1", "trash": "^7.0.0", "ts-dedent": "^2.0.0", - "ts-node": "^10.9.1", "tsup": "^6.7.0", "type-fest": "~2.19", "typescript": "5.2.2", diff --git a/scripts/prepare/esm-bundle.ts b/scripts/prepare/esm-bundle.ts index e75ddc75b679..6ec3e434e4e9 100755 --- a/scripts/prepare/esm-bundle.ts +++ b/scripts/prepare/esm-bundle.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env ../../node_modules/.bin/ts-node - import * as fs from 'fs-extra'; import path, { dirname, join, relative } from 'path'; import type { Options } from 'tsup'; diff --git a/scripts/prepare/facade.ts b/scripts/prepare/facade.ts index d43d47ef89a1..c5d6b793ea68 100755 --- a/scripts/prepare/facade.ts +++ b/scripts/prepare/facade.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env ../../node_modules/.bin/ts-node - import { join, parse } from 'path'; import fs from 'fs-extra'; import dedent from 'ts-dedent'; @@ -18,10 +16,9 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { } = await fs.readJson(join(cwd, 'package.json')); const optimized = hasFlag(flags, 'optimized'); - const tsnodePath = join(__dirname, '..', 'node_modules', '.bin', 'ts-node'); if (pre) { - await exec(`${tsnodePath} ${pre}`, { cwd }); + await exec(`node --loader esbuild-register/loader -r esbuild-register ${pre}`, { cwd }); } await Promise.all([ diff --git a/scripts/prepare/tsc.ts b/scripts/prepare/tsc.ts index cc248979ef70..62179c5b29ec 100755 --- a/scripts/prepare/tsc.ts +++ b/scripts/prepare/tsc.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env ../../node_modules/.bin/ts-node - import { join } from 'path'; import fs, { move } from 'fs-extra'; import * as ts from 'typescript'; diff --git a/scripts/tasks/sandbox-parts.ts b/scripts/tasks/sandbox-parts.ts index f64c13c61fbc..81c137200e8a 100644 --- a/scripts/tasks/sandbox-parts.ts +++ b/scripts/tasks/sandbox-parts.ts @@ -581,7 +581,8 @@ async function prepareAngularSandbox(cwd: string) { packageJson.scripts = { ...packageJson.scripts, - 'docs:json': 'DIR=$PWD; cd ../../scripts; yarn ts-node combine-compodoc $DIR', + 'docs:json': + 'DIR=$PWD; cd ../../scripts; node --loader esbuild-register/loader -r esbuild-register combine-compodoc $DIR', storybook: `yarn docs:json && ${packageJson.scripts.storybook}`, 'build-storybook': `yarn docs:json && ${packageJson.scripts['build-storybook']}`, }; diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 0817a4342434..9f5821bab723 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -25,12 +25,5 @@ "resolveJsonModule": true }, "exclude": ["dist", "**/dist", "node_modules", "**/node_modules"], - "include": ["./**/*", "./.eslintrc.js"], - "ts-node": { - "transpileOnly": true, - "files": true, - "compilerOptions": { - "types": ["node"] - } - } + "include": ["./**/*", "./.eslintrc.js"] } diff --git a/scripts/yarn.lock b/scripts/yarn.lock index fc179744fad1..ccef5c76b802 100644 --- a/scripts/yarn.lock +++ b/scripts/yarn.lock @@ -1680,15 +1680,6 @@ __metadata: languageName: node linkType: hard -"@cspotcode/source-map-support@npm:^0.8.0": - version: 0.8.1 - resolution: "@cspotcode/source-map-support@npm:0.8.1" - dependencies: - "@jridgewell/trace-mapping": "npm:0.3.9" - checksum: 05c5368c13b662ee4c122c7bfbe5dc0b613416672a829f3e78bc49a357a197e0218d6e74e7c66cfcd04e15a179acab080bd3c69658c9fbefd0e1ccd950a07fc6 - languageName: node - linkType: hard - "@emotion/css-prettifier@npm:^1.1.3": version: 1.1.3 resolution: "@emotion/css-prettifier@npm:1.1.3" @@ -2387,7 +2378,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:^3.0.3, @jridgewell/resolve-uri@npm:^3.1.0": +"@jridgewell/resolve-uri@npm:^3.1.0": version: 3.1.1 resolution: "@jridgewell/resolve-uri@npm:3.1.1" checksum: 0dbc9e29bc640bbbdc5b9876d2859c69042bfcf1423c1e6421bcca53e826660bff4e41c7d4bcb8dbea696404231a6f902f76ba41835d049e20f2dd6cffb713bf @@ -2408,16 +2399,6 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:0.3.9": - version: 0.3.9 - resolution: "@jridgewell/trace-mapping@npm:0.3.9" - dependencies: - "@jridgewell/resolve-uri": "npm:^3.0.3" - "@jridgewell/sourcemap-codec": "npm:^1.4.10" - checksum: fa425b606d7c7ee5bfa6a31a7b050dd5814b4082f318e0e4190f991902181b4330f43f4805db1dd4f2433fd0ed9cc7a7b9c2683f1deeab1df1b0a98b1e24055b - languageName: node - linkType: hard - "@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.19 resolution: "@jridgewell/trace-mapping@npm:0.3.19" @@ -3231,7 +3212,6 @@ __metadata: trash: "npm:^7.0.0" ts-dedent: "npm:^2.0.0" ts-loader: "npm:^9.4.2" - ts-node: "npm:^10.9.1" tsup: "npm:^6.7.0" type-fest: "npm:~2.19" typescript: "npm:5.2.2" @@ -3494,34 +3474,6 @@ __metadata: languageName: node linkType: hard -"@tsconfig/node10@npm:^1.0.7": - version: 1.0.9 - resolution: "@tsconfig/node10@npm:1.0.9" - checksum: c176a2c1e1b16be120c328300ea910df15fb9a5277010116d26818272341a11483c5a80059389d04edacf6fd2d03d4687ad3660870fdd1cc0b7109e160adb220 - languageName: node - linkType: hard - -"@tsconfig/node12@npm:^1.0.7": - version: 1.0.11 - resolution: "@tsconfig/node12@npm:1.0.11" - checksum: dddca2b553e2bee1308a056705103fc8304e42bb2d2cbd797b84403a223b25c78f2c683ec3e24a095e82cd435387c877239bffcb15a590ba817cd3f6b9a99fd9 - languageName: node - linkType: hard - -"@tsconfig/node14@npm:^1.0.0": - version: 1.0.3 - resolution: "@tsconfig/node14@npm:1.0.3" - checksum: 67c1316d065fdaa32525bc9449ff82c197c4c19092b9663b23213c8cbbf8d88b6ed6a17898e0cbc2711950fbfaf40388938c1c748a2ee89f7234fc9e7fe2bf44 - languageName: node - linkType: hard - -"@tsconfig/node16@npm:^1.0.2": - version: 1.0.4 - resolution: "@tsconfig/node16@npm:1.0.4" - checksum: 05f8f2734e266fb1839eb1d57290df1664fe2aa3b0fdd685a9035806daa635f7519bf6d5d9b33f6e69dd545b8c46bd6e2b5c79acb2b1f146e885f7f11a42a5bb - languageName: node - linkType: hard - "@types/aria-query@npm:^5.0.1": version: 5.0.1 resolution: "@types/aria-query@npm:5.0.1" @@ -4606,7 +4558,7 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:^8.0.2, acorn-walk@npm:^8.1.1": +"acorn-walk@npm:^8.0.2": version: 8.2.0 resolution: "acorn-walk@npm:8.2.0" checksum: dbe92f5b2452c93e960c5594e666dd1fae141b965ff2cb4a1e1d0381e3e4db4274c5ce4ffa3d681a86ca2a8d4e29d5efc0670a08e23fd2800051ea387df56ca2 @@ -4622,7 +4574,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.1.0, acorn@npm:^8.4.1, acorn@npm:^8.8.1, acorn@npm:^8.9.0": +"acorn@npm:^8.1.0, acorn@npm:^8.8.1, acorn@npm:^8.9.0": version: 8.10.0 resolution: "acorn@npm:8.10.0" bin: @@ -4855,13 +4807,6 @@ __metadata: languageName: node linkType: hard -"arg@npm:^4.1.0": - version: 4.1.3 - resolution: "arg@npm:4.1.3" - checksum: 070ff801a9d236a6caa647507bdcc7034530604844d64408149a26b9e87c2f97650055c0f049abd1efc024b334635c01f29e0b632b371ac3f26130f4cf65997a - languageName: node - linkType: hard - "argparse@npm:^1.0.7": version: 1.0.10 resolution: "argparse@npm:1.0.10" @@ -6308,13 +6253,6 @@ __metadata: languageName: node linkType: hard -"create-require@npm:^1.1.0": - version: 1.1.1 - resolution: "create-require@npm:1.1.1" - checksum: 157cbc59b2430ae9a90034a5f3a1b398b6738bf510f713edc4d4e45e169bc514d3d99dd34d8d01ca7ae7830b5b8b537e46ae8f3c8f932371b0875c0151d7ec91 - languageName: node - linkType: hard - "cross-env@npm:^7.0.3": version: 7.0.3 resolution: "cross-env@npm:7.0.3" @@ -6830,13 +6768,6 @@ __metadata: languageName: node linkType: hard -"diff@npm:^4.0.1": - version: 4.0.2 - resolution: "diff@npm:4.0.2" - checksum: 81b91f9d39c4eaca068eb0c1eb0e4afbdc5bb2941d197f513dd596b820b956fef43485876226d65d497bebc15666aa2aa82c679e84f65d5f2bfbf14ee46e32c1 - languageName: node - linkType: hard - "diff@npm:^5.0.0": version: 5.1.0 resolution: "diff@npm:5.1.0" @@ -11697,13 +11628,6 @@ __metadata: languageName: node linkType: hard -"make-error@npm:^1.1.1": - version: 1.3.6 - resolution: "make-error@npm:1.3.6" - checksum: 171e458d86854c6b3fc46610cfacf0b45149ba043782558c6875d9f42f222124384ad0b468c92e996d815a8a2003817a710c0a160e49c1c394626f76fa45396f - languageName: node - linkType: hard - "make-fetch-happen@npm:^11.0.3": version: 11.1.1 resolution: "make-fetch-happen@npm:11.1.1" @@ -16326,44 +16250,6 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:^10.9.1": - version: 10.9.1 - resolution: "ts-node@npm:10.9.1" - dependencies: - "@cspotcode/source-map-support": "npm:^0.8.0" - "@tsconfig/node10": "npm:^1.0.7" - "@tsconfig/node12": "npm:^1.0.7" - "@tsconfig/node14": "npm:^1.0.0" - "@tsconfig/node16": "npm:^1.0.2" - acorn: "npm:^8.4.1" - acorn-walk: "npm:^8.1.1" - arg: "npm:^4.1.0" - create-require: "npm:^1.1.0" - diff: "npm:^4.0.1" - make-error: "npm:^1.1.1" - v8-compile-cache-lib: "npm:^3.0.1" - yn: "npm:3.1.1" - peerDependencies: - "@swc/core": ">=1.2.50" - "@swc/wasm": ">=1.2.50" - "@types/node": "*" - typescript: ">=2.7" - peerDependenciesMeta: - "@swc/core": - optional: true - "@swc/wasm": - optional: true - bin: - ts-node: dist/bin.js - ts-node-cwd: dist/bin-cwd.js - ts-node-esm: dist/bin-esm.js - ts-node-script: dist/bin-script.js - ts-node-transpile-only: dist/bin-transpile.js - ts-script: dist/bin-script-deprecated.js - checksum: 95187932fb83f3901e22546bd2feeac7d2feb4f412f42ac3a595f049a23e8dcf70516dffb51866391228ea2dbcfaea039e250fb2bb334d48a86ab2b6aea0ae2d - languageName: node - linkType: hard - "tsconfig-paths@npm:^3.14.2": version: 3.14.2 resolution: "tsconfig-paths@npm:3.14.2" @@ -17179,13 +17065,6 @@ __metadata: languageName: node linkType: hard -"v8-compile-cache-lib@npm:^3.0.1": - version: 3.0.1 - resolution: "v8-compile-cache-lib@npm:3.0.1" - checksum: bdc36fb8095d3b41df197f5fb6f11e3a26adf4059df3213e3baa93810d8f0cc76f9a74aaefc18b73e91fe7e19154ed6f134eda6fded2e0f1c8d2272ed2d2d391 - languageName: node - linkType: hard - "v8-compile-cache@npm:2.3.0": version: 2.3.0 resolution: "v8-compile-cache@npm:2.3.0" @@ -17944,13 +17823,6 @@ __metadata: languageName: node linkType: hard -"yn@npm:3.1.1": - version: 3.1.1 - resolution: "yn@npm:3.1.1" - checksum: 0732468dd7622ed8a274f640f191f3eaf1f39d5349a1b72836df484998d7d9807fbea094e2f5486d6b0cd2414aad5775972df0e68f8604db89a239f0f4bf7443 - languageName: node - linkType: hard - "yocto-queue@npm:^0.1.0": version: 0.1.0 resolution: "yocto-queue@npm:0.1.0" From 50a7d47121cbecdf475944bac720b576dc9e0400 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 13:41:03 +0100 Subject: [PATCH 08/21] Fix check script --- code/package.json | 8 +-- .../{check-package.cjs => check-package.ts} | 57 ++++++++++--------- scripts/package.json | 4 ++ 3 files changed, 37 insertions(+), 32 deletions(-) rename scripts/{check-package.cjs => check-package.ts} (70%) diff --git a/code/package.json b/code/package.json index 45e62b2406f9..c20521acc1fa 100644 --- a/code/package.json +++ b/code/package.json @@ -29,10 +29,10 @@ "build": "NODE_ENV=production yarn --cwd ../scripts build-package", "changelog": "pr-log --sloppy --cherry-pick", "changelog:next": "pr-log --sloppy --since-prerelease", - "check": "NODE_ENV=production node ../scripts/check-package.js", + "check": "NODE_ENV=production yarn --cwd ../scripts check-package", "ci-tests": "yarn task --task check --no-link --start-from=install && yarn lint && yarn test && cd ../scripts && yarn test", "danger": "danger", - "generate-sandboxes": "ts-node --swc ../scripts/sandbox/generate.ts", + "generate-sandboxes": "yarn --cwd ../scripts generate-sandboxes", "github-release": "github-release-from-changelog", "lint": "yarn lint:js && yarn lint:md", "lint:ejs": "ejslint **/*.ejs", @@ -41,8 +41,8 @@ "lint:md": "../scripts/node_modules/.bin/remark -q .", "lint:other": "prettier --write '**/*.{css,html,json,md,yml}'", "lint:package": "sort-package-json", - "local-registry": "ts-node --swc --project=../scripts/tsconfig.json ../scripts/run-registry.ts", - "publish-sandboxes": "ts-node --swc ../scripts/sandbox/publish.ts", + "local-registry": "yarn --cwd ../scripts local-registry", + "publish-sandboxes": "yarn --cwd ../scripts publish", "storybook:blocks": "STORYBOOK_BLOCKS_ONLY=true yarn storybook:ui", "storybook:blocks:build": "STORYBOOK_BLOCKS_ONLY=true yarn storybook:ui:build", "storybook:blocks:chromatic": "STORYBOOK_BLOCKS_ONLY=true yarn storybook:ui:chromatic --project-token=${CHROMATIC_TOKEN_STORYBOOK_BLOCKS:-MISSING_PROJECT_TOKEN}", diff --git a/scripts/check-package.cjs b/scripts/check-package.ts similarity index 70% rename from scripts/check-package.cjs rename to scripts/check-package.ts index 7fc8bc88f198..6248ad54797a 100644 --- a/scripts/check-package.cjs +++ b/scripts/check-package.ts @@ -1,38 +1,39 @@ -#!/usr/bin/env node - -/* eslint-disable global-require */ -const { resolve } = require('path'); -const { readJSON } = require('fs-extra'); - -const getStorybookPackages = async () => { - const workspaceJSON = await readJSON(resolve(__dirname, '..', 'code', 'workspace.json')); - return Object.entries(workspaceJSON.projects).map(([k, v]) => ({ - location: v.root, - name: k, - })); -}; +import { resolve } from 'path'; +import { readJSON } from 'fs-extra'; +import prompts from 'prompts'; +import program from 'commander'; +import chalk from 'chalk'; +import windowSize from 'window-size'; +import { execaCommand } from 'execa'; +import { getWorkspaces } from './utils/workspace'; async function run() { - const prompts = require('prompts'); - const program = require('commander'); - const chalk = require('chalk'); - - const packages = await getStorybookPackages(); + const packages = await getWorkspaces(); const packageTasks = packages - .map((package) => { + .map((pkg) => { return { - ...package, - suffix: package.name.replace('@storybook/', ''), + ...pkg, + suffix: pkg.name.replace('@storybook/', ''), defaultValue: false, - helpText: `check only the ${package.name} package`, + helpText: `check only the ${pkg.name} package`, }; }) .reduce((acc, next) => { acc[next.name] = next; return acc; - }, {}); + }, {} as Record); - const tasks = { + const tasks: Record< + string, + { + name: string; + defaultValue: boolean; + suffix: string; + helpText: string; + value?: any; + location?: string; + } + > = { watch: { name: `watch`, defaultValue: false, @@ -76,14 +77,15 @@ async function run() { name: 'todo', min: 1, hint: 'You can also run directly with package name like `yarn check core`, or `yarn check --all` for all packages!', - optionsPerPage: require('window-size').height - 3, // 3 lines for extra info + // @ts-expect-error @types incomplete + optionsPerPage: windowSize.height - 3, // 3 lines for extra info choices: packages.map(({ name: key }) => ({ value: key, title: tasks[key].name || key, selected: (tasks[key] && tasks[key].defaultValue) || false, })), }, - ]).then(({ mode, todo }) => { + ]).then(({ mode, todo }: { mode: boolean; todo: Array }) => { watchMode = mode; return todo?.map((key) => tasks[key]); }); @@ -96,9 +98,8 @@ async function run() { } selection?.filter(Boolean).forEach(async (v) => { - const commmand = (await readJSON(resolve(v.location, 'package.json'))).scripts.check; + const commmand = (await readJSON(resolve('../code', v.location, 'package.json'))).scripts.check; const cwd = resolve(__dirname, '..', 'code', v.location); - const { execaCommand } = await import('execa'); const sub = execaCommand(`${commmand}${watchMode ? ' --watch' : ''}`, { cwd, buffer: false, diff --git a/scripts/package.json b/scripts/package.json index 3d316aac3671..390c3ef0b141 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -6,14 +6,18 @@ "scripts": { "build-package": "node --loader esbuild-register/loader -r esbuild-register ./build-package.ts", "check": "node --loader esbuild-register/loader -r esbuild-register ./prepare/check-scripts.ts", + "check-package": "node --loader esbuild-register/loader -r esbuild-register ./check-package.ts", "docs:prettier:check": "cd ../docs && prettier --check ./snippets", "docs:prettier:write": "cd ../docs && prettier --write ./snippets", + "generate-sandboxes": "node --loader esbuild-register/loader -r esbuild-register ./sandbox/generate.ts", "get-report-message": "node --loader esbuild-register/loader -r esbuild-register ./get-report-message.ts", "get-template": "node --loader esbuild-register/loader -r esbuild-register ./get-template.ts", "lint": "yarn lint:js && yarn lint:md", "lint:js": "yarn lint:js:cmd . --quiet", "lint:js:cmd": "cross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives", "lint:package": "sort-package-json", + "local-registry": "node --loader esbuild-register/loader -r esbuild-register ./run-registry.ts", + "publish": "node --loader esbuild-register/loader -r esbuild-register ./sandbox/publish.ts", "release:cancel-preparation-runs": "node --loader esbuild-register/loader -r esbuild-register ./release/cancel-preparation-runs.ts", "release:ensure-next-ahead": "node --loader esbuild-register/loader -r esbuild-register ./release/ensure-next-ahead.ts", "release:generate-pr-description": "node --loader esbuild-register/loader -r esbuild-register ./release/generate-pr-description.ts", From c74b562aed2ad105276b956f49ba5a77e14184fe Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 3 Nov 2023 13:43:10 +0100 Subject: [PATCH 09/21] Fix run-registry script --- scripts/run-registry.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/run-registry.ts b/scripts/run-registry.ts index 8a7017b34fa1..71ae3dd334de 100755 --- a/scripts/run-registry.ts +++ b/scripts/run-registry.ts @@ -89,7 +89,10 @@ const publish = async (packages: { name: string; location: string }[], url: stri ); const tarballFilename = `${name.replace('@', '').replace('/', '-')}.tgz`; - const command = `cd ${location} && yarn pack --out=${PACKS_DIRECTORY}/${tarballFilename} && cd ${PACKS_DIRECTORY} && npm publish ./${tarballFilename} --registry ${url} --force --access restricted --ignore-scripts`; + const command = `cd ${path.resolve( + '../code', + location + )} && yarn pack --out=${PACKS_DIRECTORY}/${tarballFilename} && cd ${PACKS_DIRECTORY} && npm publish ./${tarballFilename} --registry ${url} --force --access restricted --ignore-scripts`; exec(command, (e) => { if (e) { rej(e); From 122e94f4addea4d0917ee2c9ab6f9d47ac2c9bd3 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Mon, 6 Nov 2023 14:58:47 +0100 Subject: [PATCH 10/21] Fix Typescript issues --- scripts/dangerfile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dangerfile.ts b/scripts/dangerfile.ts index bd9bb6494602..6e3100736021 100644 --- a/scripts/dangerfile.ts +++ b/scripts/dangerfile.ts @@ -32,7 +32,7 @@ const checkRequiredLabels = (labels: string[]) => { const requiredLabels = flatten([ prLogConfig.skipLabels || [], - (prLogConfig.validLabels || []).map((keyVal: string) => keyVal[0]), + (prLogConfig.validLabels || []).map((keyVal) => keyVal[0]), ]); const blockingLabels = intersection(forbiddenLabels, labels); From 103794e3bb1b0e56bdb2ac0ae1257c0276163e5b Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Mon, 6 Nov 2023 14:59:01 +0100 Subject: [PATCH 11/21] Replace tsup with esbuild --- scripts/prepare/facade.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare/facade.ts b/scripts/prepare/facade.ts index c5d6b793ea68..2a1a62d73b52 100755 --- a/scripts/prepare/facade.ts +++ b/scripts/prepare/facade.ts @@ -70,7 +70,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { ]); if (pre) { - await exec(`${tsnodePath} ${post}`, { cwd }); + await exec(`node --loader esbuild-register/loader -r esbuild-register ${post}`, { cwd }); } }; From b9f0e4eef5af9b8b7c8e821bd3197034f4a55dfb Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Mon, 6 Nov 2023 15:19:58 +0100 Subject: [PATCH 12/21] Use node directly to check angular framework --- code/frameworks/angular/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index 057073ce695f..b7072dd55452 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -33,7 +33,7 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/node_modules/.bin/tsc", + "check": "node ../../../scripts/node_modules/.bin/tsc", "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" }, "dependencies": { From 29f5388958746fa1363d545bcb4302777e49ecd9 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Mon, 6 Nov 2023 15:20:13 +0100 Subject: [PATCH 13/21] Fix sandbox generation --- code/package.json | 2 +- package.json | 2 +- scripts/tasks/sandbox.ts | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/code/package.json b/code/package.json index c20521acc1fa..9241403005c9 100644 --- a/code/package.json +++ b/code/package.json @@ -49,7 +49,7 @@ "storybook:ui": "NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" ./lib/cli/bin/index.js dev --port 6006 --config-dir ./ui/.storybook", "storybook:ui:build": "NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" ./lib/cli/bin/index.js build --config-dir ./ui/.storybook", "storybook:ui:chromatic": "yarn chromatic --build-script-name storybook:ui:build --storybook-config-dir ./ui/.storybook --storybook-base-dir ./code --project-token=${CHROMATIC_TOKEN_STORYBOOK_UI:-MISSING_PROJECT_TOKEN} --only-changed --exit-zero-on-changes --exit-once-uploaded", - "task": "cd .. && yarn task", + "task": "yarn --cwd ../scripts task", "test": "NODE_OPTIONS=--max_old_space_size=4096 jest --config ./jest.config.js", "test:cli": "npm --prefix lib/cli run test" }, diff --git a/package.json b/package.json index 7564dbbfd79f..3e7e7cadb807 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "nx": "cd code; yarn nx", "pretty-docs": "cd scripts; yarn install >/dev/null; yarn docs:prettier:write", "start": "yarn task --task dev --template react-vite/default-ts --start-from=install", - "task": "echo 'Installing Script Dependencies...'; cd scripts; yarn install >/dev/null; yarn task", + "task": "echo 'Installing Script Dependencies...'; cd scripts; yarn install >/dev/null; cd ..; yarn --cwd=./scripts task", "test": "cd code; yarn test", "upload-bench": "cd scripts; yarn upload-bench" }, diff --git a/scripts/tasks/sandbox.ts b/scripts/tasks/sandbox.ts index 58e7d92fe421..5e3bade5d5d3 100644 --- a/scripts/tasks/sandbox.ts +++ b/scripts/tasks/sandbox.ts @@ -55,9 +55,10 @@ export const sandbox: Task = { await remove(details.sandboxDir); } - const { create, install, addStories, extendMain, init, addExtraDependencies } = await import( - './sandbox-parts' - ); + const { create, install, addStories, extendMain, init, addExtraDependencies } = + // @ts-expect-error esbuild for some reason exports a default object + // eslint-disable-next-line import/extensions + (await import('./sandbox-parts.ts')).default; let startTime = now(); await create(details, options); From 55dc4f21713ff708c20cacd6457b9b5129d82145 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Tue, 7 Nov 2023 09:50:44 +0100 Subject: [PATCH 14/21] Use esMain helper to check for execution origin --- scripts/combine-compodoc.ts | 5 +-- scripts/event-log-checker.ts | 5 +-- scripts/get-report-message.ts | 5 +-- scripts/get-template.ts | 5 +-- scripts/release/cancel-preparation-runs.ts | 5 +-- scripts/release/ensure-next-ahead.ts | 5 +-- scripts/release/generate-pr-description.ts | 5 +-- scripts/release/get-changelog-from-file.ts | 5 +-- scripts/release/get-current-version.ts | 5 +-- scripts/release/get-version-changelog.ts | 5 +-- scripts/release/is-pr-frozen.ts | 5 +-- scripts/release/is-prerelease.ts | 5 +-- scripts/release/is-version-published.ts | 5 +-- scripts/release/label-patches.ts | 5 +-- scripts/release/pick-patches.ts | 5 +-- scripts/release/publish.ts | 5 +-- scripts/release/unreleased-changes-exists.ts | 5 +-- scripts/release/version.ts | 5 +-- scripts/release/write-changelog.ts | 5 +-- scripts/sandbox/generate.ts | 5 +-- scripts/utils/esmain.ts | 40 ++++++++++++++++++++ 21 files changed, 80 insertions(+), 60 deletions(-) create mode 100644 scripts/utils/esmain.ts diff --git a/scripts/combine-compodoc.ts b/scripts/combine-compodoc.ts index 0a4472edb7bc..251a5d88f50a 100755 --- a/scripts/combine-compodoc.ts +++ b/scripts/combine-compodoc.ts @@ -6,7 +6,7 @@ import { join, resolve } from 'path'; import { realpath, readFile, writeFile, lstat } from 'fs-extra'; import { globSync } from 'glob'; import { directory } from 'tempy'; -import url from 'url'; +import esMain from './utils/esmain'; import { execaCommand } from './utils/exec'; const logger = console; @@ -68,8 +68,7 @@ async function run(cwd: string) { await writeFile(join(cwd, 'documentation.json'), JSON.stringify(documentation)); } -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta.url)) { run(resolve(process.argv[2])) .then(() => process.exit(0)) .catch((err) => { diff --git a/scripts/event-log-checker.ts b/scripts/event-log-checker.ts index 4f418bffde9e..2ffc395858e7 100644 --- a/scripts/event-log-checker.ts +++ b/scripts/event-log-checker.ts @@ -2,7 +2,7 @@ import chalk from 'chalk'; import assert from 'assert'; import fetch from 'node-fetch'; -import url from 'url'; +import esMain from './utils/esmain'; import { allTemplates } from '../code/lib/cli/src/sandbox-templates'; import versions from '../code/lib/cli/src/versions'; import { oneWayHash } from '../code/lib/telemetry/src/one-way-hash'; @@ -115,8 +115,7 @@ async function run() { export {}; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { run() .then(() => process.exit(0)) .catch((err) => { diff --git a/scripts/get-report-message.ts b/scripts/get-report-message.ts index 170938cbde0a..ce67a50f29cf 100644 --- a/scripts/get-report-message.ts +++ b/scripts/get-report-message.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import { readJson } from 'fs-extra'; import { join } from 'path'; -import url from 'url'; +import esMain from './utils/esmain'; import { CODE_DIRECTORY } from './utils/constants'; import { execaCommand } from './utils/exec'; @@ -64,8 +64,7 @@ async function run() { console.log(`${title}${body}${footer}`.replace(/\n/g, '\\n')); } -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { run().catch((err) => { console.error(err); process.exit(1); diff --git a/scripts/get-template.ts b/scripts/get-template.ts index 5c4b43ad0cb2..7da650b41c90 100644 --- a/scripts/get-template.ts +++ b/scripts/get-template.ts @@ -4,7 +4,7 @@ import { program } from 'commander'; import dedent from 'ts-dedent'; import chalk from 'chalk'; import yaml from 'yaml'; -import url from 'url'; +import esMain from './utils/esmain'; import { allTemplates, templatesByCadence, @@ -180,8 +180,7 @@ async function run({ cadence, task, check }: RunOptions) { ); } -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { program .description('Retrieve the template to run for a given cadence and task') .option('--cadence ', 'Which cadence you want to run the script for') diff --git a/scripts/release/cancel-preparation-runs.ts b/scripts/release/cancel-preparation-runs.ts index 9253f12041c5..529f096fcbb0 100644 --- a/scripts/release/cancel-preparation-runs.ts +++ b/scripts/release/cancel-preparation-runs.ts @@ -6,7 +6,7 @@ import chalk from 'chalk'; import program from 'commander'; import dedent from 'ts-dedent'; -import url from 'url'; +import esMain from '../utils/esmain'; import { githubRestClient } from './utils/github-client'; program @@ -100,8 +100,7 @@ export const run = async () => { } }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { run().catch((err) => { console.error(err); // this is non-critical work, so we don't want to fail the CI build if this fails diff --git a/scripts/release/ensure-next-ahead.ts b/scripts/release/ensure-next-ahead.ts index 2deae1bee36e..bf861ce46163 100644 --- a/scripts/release/ensure-next-ahead.ts +++ b/scripts/release/ensure-next-ahead.ts @@ -14,7 +14,7 @@ import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; import { readJson } from 'fs-extra'; -import url from 'url'; +import esMain from '../utils/esmain'; import { run as bumpVersion } from './version'; import { git } from './utils/git-client'; @@ -93,8 +93,7 @@ export const run = async (options: unknown) => { ); }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/generate-pr-description.ts b/scripts/release/generate-pr-description.ts index a62c586db867..065a3cf2adee 100644 --- a/scripts/release/generate-pr-description.ts +++ b/scripts/release/generate-pr-description.ts @@ -5,7 +5,7 @@ import { z } from 'zod'; import dedent from 'ts-dedent'; import semver from 'semver'; import { setOutput } from '@actions/core'; -import url from 'url'; +import esMain from '../utils/esmain'; import type { Change } from './utils/get-changes'; import { getChanges, LABELS_BY_IMPORTANCE, RELEASED_LABELS } from './utils/get-changes'; import { getCurrentVersion } from './get-current-version'; @@ -296,8 +296,7 @@ export const run = async (rawOptions: unknown) => { } }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/get-changelog-from-file.ts b/scripts/release/get-changelog-from-file.ts index 7a5ea3ecaddd..264e8d6ebec7 100644 --- a/scripts/release/get-changelog-from-file.ts +++ b/scripts/release/get-changelog-from-file.ts @@ -6,7 +6,7 @@ import { readFile } from 'fs-extra'; import path from 'path'; import semver from 'semver'; import dedent from 'ts-dedent'; -import url from 'url'; +import esMain from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; program @@ -55,8 +55,7 @@ export const getChangelogFromFile = async (args: { return result; }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); getChangelogFromFile({ version: parsed.args[0], diff --git a/scripts/release/get-current-version.ts b/scripts/release/get-current-version.ts index df91678f9c44..6012b70eff19 100644 --- a/scripts/release/get-current-version.ts +++ b/scripts/release/get-current-version.ts @@ -3,7 +3,7 @@ import chalk from 'chalk'; import { setOutput } from '@actions/core'; import path from 'path'; import { readJson } from 'fs-extra'; -import url from 'url'; +import esMain from '../utils/esmain'; const CODE_DIR_PATH = path.join(__dirname, '..', '..', 'code'); const CODE_PACKAGE_JSON_PATH = path.join(CODE_DIR_PATH, 'package.json'); @@ -18,8 +18,7 @@ export const getCurrentVersion = async () => { return version; }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { getCurrentVersion().catch((err) => { console.error(err); process.exit(1); diff --git a/scripts/release/get-version-changelog.ts b/scripts/release/get-version-changelog.ts index c70ec902bb0d..93a927ff7579 100644 --- a/scripts/release/get-version-changelog.ts +++ b/scripts/release/get-version-changelog.ts @@ -2,7 +2,7 @@ import { setOutput } from '@actions/core'; import chalk from 'chalk'; import { program } from 'commander'; -import url from 'url'; +import esMain from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; import { getChanges } from './utils/get-changes'; @@ -27,8 +27,7 @@ export const getVersionChangelog = async (args: { version?: string; verbose?: bo return changelogText; }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); getVersionChangelog({ version: parsed.args[0], verbose: parsed.opts().verbose }).catch((err) => { console.error(err); diff --git a/scripts/release/is-pr-frozen.ts b/scripts/release/is-pr-frozen.ts index d2e774b82cb7..2379bcd497be 100644 --- a/scripts/release/is-pr-frozen.ts +++ b/scripts/release/is-pr-frozen.ts @@ -4,7 +4,7 @@ import program from 'commander'; import { setOutput } from '@actions/core'; import path from 'path'; import { readJson } from 'fs-extra'; -import url from 'url'; +import esMain from '../utils/esmain'; import { getPullInfoFromCommit } from './utils/get-github-info'; import { git } from './utils/git-client'; @@ -99,8 +99,7 @@ export const run = async (options: unknown) => { return isFrozen; }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/is-prerelease.ts b/scripts/release/is-prerelease.ts index ab9606073de6..5a5424d5a8b0 100644 --- a/scripts/release/is-prerelease.ts +++ b/scripts/release/is-prerelease.ts @@ -3,7 +3,7 @@ import chalk from 'chalk'; import program from 'commander'; import { setOutput } from '@actions/core'; import semver from 'semver'; -import url from 'url'; +import esMain from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; program @@ -39,8 +39,7 @@ export const isPrerelease = async (args: { version?: string; verbose?: boolean } return result; }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); isPrerelease({ version: parsed.args[0], diff --git a/scripts/release/is-version-published.ts b/scripts/release/is-version-published.ts index a0b97d1a155c..e24ca5594953 100644 --- a/scripts/release/is-version-published.ts +++ b/scripts/release/is-version-published.ts @@ -3,7 +3,7 @@ import chalk from 'chalk'; import program from 'commander'; import { setOutput } from '@actions/core'; import fetch from 'node-fetch'; -import url from 'url'; +import esMain from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; program @@ -78,8 +78,7 @@ export const run = async (args: unknown[], options: unknown) => { return isAlreadyPublished; }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); run(parsed.args, parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/label-patches.ts b/scripts/release/label-patches.ts index a23fbfe07a3e..43d110d25612 100644 --- a/scripts/release/label-patches.ts +++ b/scripts/release/label-patches.ts @@ -1,7 +1,7 @@ import program from 'commander'; import { v4 as uuidv4 } from 'uuid'; import ora from 'ora'; -import url from 'url'; +import esMain from '../utils/esmain'; import { getLabelIds, githubGraphQlClient, getUnpickedPRs } from './utils/github-client'; import { getPullInfoFromCommits, getRepo } from './utils/get-changes'; import { getLatestTag, git } from './utils/git-client'; @@ -94,8 +94,7 @@ export const run = async (options: unknown) => { } }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const options = program.parse().opts(); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/pick-patches.ts b/scripts/release/pick-patches.ts index cfaaf9693771..595ab58f425f 100644 --- a/scripts/release/pick-patches.ts +++ b/scripts/release/pick-patches.ts @@ -5,7 +5,7 @@ import chalk from 'chalk'; import ora from 'ora'; import { setOutput } from '@actions/core'; import invariant from 'tiny-invariant'; -import url from 'url'; +import esMain from '../utils/esmain'; import { git } from './utils/git-client'; import { getUnpickedPRs } from './utils/github-client'; @@ -86,8 +86,7 @@ export const run = async (_: unknown) => { } }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const options = program.parse(process.argv); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/publish.ts b/scripts/release/publish.ts index 82b01c552e9b..8573e368f4e2 100644 --- a/scripts/release/publish.ts +++ b/scripts/release/publish.ts @@ -8,7 +8,7 @@ import { readJson } from 'fs-extra'; import fetch from 'node-fetch'; import dedent from 'ts-dedent'; import pRetry from 'p-retry'; -import url from 'url'; +import esMain from '../utils/esmain'; import { execaCommand } from '../utils/exec'; program @@ -190,8 +190,7 @@ export const run = async (options: unknown) => { ); }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/unreleased-changes-exists.ts b/scripts/release/unreleased-changes-exists.ts index c0cd5260d59b..5c8978f979a3 100644 --- a/scripts/release/unreleased-changes-exists.ts +++ b/scripts/release/unreleased-changes-exists.ts @@ -4,7 +4,7 @@ import program from 'commander'; import { z } from 'zod'; import { setOutput } from '@actions/core'; import { intersection } from 'lodash'; -import url from 'url'; +import esMain from '../utils/esmain'; import type { Change } from './utils/get-changes'; import { RELEASED_LABELS, getChanges } from './utils/get-changes'; import { getCurrentVersion } from './get-current-version'; @@ -78,8 +78,7 @@ ${chalk.blue(changesToRelease.map(({ title, pull }) => ` #${pull}: ${title}`).j return { changesToRelease, hasChangesToRelease }; }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/version.ts b/scripts/release/version.ts index da9e7894d050..592826104539 100644 --- a/scripts/release/version.ts +++ b/scripts/release/version.ts @@ -6,7 +6,7 @@ import path from 'path'; import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; -import url from 'url'; +import esMain from '../utils/esmain'; import type { Workspace } from '../utils/workspace'; import { getWorkspaces } from '../utils/workspace'; import { execaCommand } from '../utils/exec'; @@ -294,8 +294,7 @@ export const run = async (options: unknown) => { } }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const options = program.parse().opts(); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/write-changelog.ts b/scripts/release/write-changelog.ts index a353309b65af..2f80d381ef49 100644 --- a/scripts/release/write-changelog.ts +++ b/scripts/release/write-changelog.ts @@ -5,7 +5,7 @@ import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; import { readFile, writeFile, writeJson } from 'fs-extra'; -import url from 'url'; +import esMain from '../utils/esmain'; import { getChanges } from './utils/get-changes'; program @@ -133,8 +133,7 @@ export const run = async (args: unknown[], options: unknown) => { console.log(`✅ Wrote Changelog to file`); }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { const parsed = program.parse(); run(parsed.args, parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index 229df395bbb3..5c2ab47d0971 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -6,7 +6,7 @@ import prettyTime from 'pretty-hrtime'; import { copy, emptyDir, ensureDir, move, remove, rename, writeFile } from 'fs-extra'; import { program } from 'commander'; import { directory } from 'tempy'; -import url from 'url'; +import esMain from '../utils/esmain'; import { execaCommand } from '../utils/exec'; import type { OptionValues } from '../utils/options'; @@ -251,8 +251,7 @@ export const generate = async ({ await runGenerators(generatorConfigs, localRegistry, debug); }; -const modulePath = url.fileURLToPath(import.meta.url); -if (process.argv[1] === modulePath) { +if (esMain(import.meta)) { program .description('Generate sandboxes from a set of possible templates') .option('--templates [templates...]', 'Space-delimited list of templates to include') diff --git a/scripts/utils/esmain.ts b/scripts/utils/esmain.ts new file mode 100644 index 000000000000..286f8b250276 --- /dev/null +++ b/scripts/utils/esmain.ts @@ -0,0 +1,40 @@ +import path from 'path'; +import process from 'process'; +import { createRequire } from 'module'; +import { fileURLToPath } from 'url'; + +/** + * Strip the extension from a filename if it has one. + * @param {string} name A filename. + * @return {string} The filename without a path. + */ +export function stripExt(name: string) { + const extension = path.extname(name); + if (!extension) { + return name; + } + + return name.slice(0, -extension.length); +} + +/** + * Check if a module was run directly with node as opposed to being + * imported from another module. + */ +export default function esMain(url: string) { + if (!url || !process.argv[1]) { + return false; + } + + const require = createRequire(url); + const scriptPath = require.resolve(process.argv[1]); + + const modulePath = fileURLToPath(url); + + const extension = path.extname(scriptPath); + if (extension) { + return modulePath === scriptPath; + } + + return stripExt(modulePath) === scriptPath; +} From 40e627f8b461ea3865f1b91350c17c231affcb16 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Tue, 7 Nov 2023 09:51:08 +0100 Subject: [PATCH 15/21] Add import for execa package in combine-compodoc.ts --- scripts/combine-compodoc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/combine-compodoc.ts b/scripts/combine-compodoc.ts index 251a5d88f50a..3eaad97df6d0 100755 --- a/scripts/combine-compodoc.ts +++ b/scripts/combine-compodoc.ts @@ -6,8 +6,8 @@ import { join, resolve } from 'path'; import { realpath, readFile, writeFile, lstat } from 'fs-extra'; import { globSync } from 'glob'; import { directory } from 'tempy'; +import { execaCommand } from 'execa'; import esMain from './utils/esmain'; -import { execaCommand } from './utils/exec'; const logger = console; From 25b69072d225fd4383d116ddf4d4daa994db7bf4 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Tue, 7 Nov 2023 14:30:03 +0100 Subject: [PATCH 16/21] Fix esMain helper usage --- scripts/event-log-checker.ts | 2 +- scripts/get-report-message.ts | 2 +- scripts/get-template.ts | 2 +- scripts/release/cancel-preparation-runs.ts | 2 +- scripts/release/ensure-next-ahead.ts | 2 +- scripts/release/generate-pr-description.ts | 2 +- scripts/release/get-changelog-from-file.ts | 2 +- scripts/release/get-current-version.ts | 2 +- scripts/release/get-version-changelog.ts | 2 +- scripts/release/is-pr-frozen.ts | 2 +- scripts/release/is-prerelease.ts | 2 +- scripts/release/is-version-published.ts | 2 +- scripts/release/label-patches.ts | 2 +- scripts/release/pick-patches.ts | 2 +- scripts/release/publish.ts | 2 +- scripts/release/unreleased-changes-exists.ts | 2 +- scripts/release/version.ts | 2 +- scripts/release/write-changelog.ts | 2 +- scripts/sandbox/generate.ts | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/event-log-checker.ts b/scripts/event-log-checker.ts index 2ffc395858e7..d480ccd1a0cd 100644 --- a/scripts/event-log-checker.ts +++ b/scripts/event-log-checker.ts @@ -115,7 +115,7 @@ async function run() { export {}; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { run() .then(() => process.exit(0)) .catch((err) => { diff --git a/scripts/get-report-message.ts b/scripts/get-report-message.ts index ce67a50f29cf..75df6ba066fc 100644 --- a/scripts/get-report-message.ts +++ b/scripts/get-report-message.ts @@ -64,7 +64,7 @@ async function run() { console.log(`${title}${body}${footer}`.replace(/\n/g, '\\n')); } -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { run().catch((err) => { console.error(err); process.exit(1); diff --git a/scripts/get-template.ts b/scripts/get-template.ts index 7da650b41c90..0b54568b3143 100644 --- a/scripts/get-template.ts +++ b/scripts/get-template.ts @@ -180,7 +180,7 @@ async function run({ cadence, task, check }: RunOptions) { ); } -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { program .description('Retrieve the template to run for a given cadence and task') .option('--cadence ', 'Which cadence you want to run the script for') diff --git a/scripts/release/cancel-preparation-runs.ts b/scripts/release/cancel-preparation-runs.ts index 529f096fcbb0..811de60bfa52 100644 --- a/scripts/release/cancel-preparation-runs.ts +++ b/scripts/release/cancel-preparation-runs.ts @@ -100,7 +100,7 @@ export const run = async () => { } }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { run().catch((err) => { console.error(err); // this is non-critical work, so we don't want to fail the CI build if this fails diff --git a/scripts/release/ensure-next-ahead.ts b/scripts/release/ensure-next-ahead.ts index bf861ce46163..4bc4bfbab35b 100644 --- a/scripts/release/ensure-next-ahead.ts +++ b/scripts/release/ensure-next-ahead.ts @@ -93,7 +93,7 @@ export const run = async (options: unknown) => { ); }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/generate-pr-description.ts b/scripts/release/generate-pr-description.ts index 065a3cf2adee..31bcc3c63c1a 100644 --- a/scripts/release/generate-pr-description.ts +++ b/scripts/release/generate-pr-description.ts @@ -296,7 +296,7 @@ export const run = async (rawOptions: unknown) => { } }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/get-changelog-from-file.ts b/scripts/release/get-changelog-from-file.ts index 264e8d6ebec7..62a248f06d97 100644 --- a/scripts/release/get-changelog-from-file.ts +++ b/scripts/release/get-changelog-from-file.ts @@ -55,7 +55,7 @@ export const getChangelogFromFile = async (args: { return result; }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); getChangelogFromFile({ version: parsed.args[0], diff --git a/scripts/release/get-current-version.ts b/scripts/release/get-current-version.ts index 6012b70eff19..7fa283d4f08e 100644 --- a/scripts/release/get-current-version.ts +++ b/scripts/release/get-current-version.ts @@ -18,7 +18,7 @@ export const getCurrentVersion = async () => { return version; }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { getCurrentVersion().catch((err) => { console.error(err); process.exit(1); diff --git a/scripts/release/get-version-changelog.ts b/scripts/release/get-version-changelog.ts index 93a927ff7579..a3c6e645f793 100644 --- a/scripts/release/get-version-changelog.ts +++ b/scripts/release/get-version-changelog.ts @@ -27,7 +27,7 @@ export const getVersionChangelog = async (args: { version?: string; verbose?: bo return changelogText; }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); getVersionChangelog({ version: parsed.args[0], verbose: parsed.opts().verbose }).catch((err) => { console.error(err); diff --git a/scripts/release/is-pr-frozen.ts b/scripts/release/is-pr-frozen.ts index 2379bcd497be..2eb52528dda7 100644 --- a/scripts/release/is-pr-frozen.ts +++ b/scripts/release/is-pr-frozen.ts @@ -99,7 +99,7 @@ export const run = async (options: unknown) => { return isFrozen; }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/is-prerelease.ts b/scripts/release/is-prerelease.ts index 5a5424d5a8b0..ef15bf6c40b2 100644 --- a/scripts/release/is-prerelease.ts +++ b/scripts/release/is-prerelease.ts @@ -39,7 +39,7 @@ export const isPrerelease = async (args: { version?: string; verbose?: boolean } return result; }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); isPrerelease({ version: parsed.args[0], diff --git a/scripts/release/is-version-published.ts b/scripts/release/is-version-published.ts index e24ca5594953..6a57efa92d55 100644 --- a/scripts/release/is-version-published.ts +++ b/scripts/release/is-version-published.ts @@ -78,7 +78,7 @@ export const run = async (args: unknown[], options: unknown) => { return isAlreadyPublished; }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); run(parsed.args, parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/label-patches.ts b/scripts/release/label-patches.ts index 43d110d25612..68572d45c87c 100644 --- a/scripts/release/label-patches.ts +++ b/scripts/release/label-patches.ts @@ -94,7 +94,7 @@ export const run = async (options: unknown) => { } }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const options = program.parse().opts(); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/pick-patches.ts b/scripts/release/pick-patches.ts index 595ab58f425f..9bdbf53977ec 100644 --- a/scripts/release/pick-patches.ts +++ b/scripts/release/pick-patches.ts @@ -86,7 +86,7 @@ export const run = async (_: unknown) => { } }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const options = program.parse(process.argv); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/publish.ts b/scripts/release/publish.ts index 8573e368f4e2..32c1b57c5b26 100644 --- a/scripts/release/publish.ts +++ b/scripts/release/publish.ts @@ -190,7 +190,7 @@ export const run = async (options: unknown) => { ); }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/unreleased-changes-exists.ts b/scripts/release/unreleased-changes-exists.ts index 5c8978f979a3..e076e640d302 100644 --- a/scripts/release/unreleased-changes-exists.ts +++ b/scripts/release/unreleased-changes-exists.ts @@ -78,7 +78,7 @@ ${chalk.blue(changesToRelease.map(({ title, pull }) => ` #${pull}: ${title}`).j return { changesToRelease, hasChangesToRelease }; }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); run(parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/release/version.ts b/scripts/release/version.ts index 592826104539..57c0973583cf 100644 --- a/scripts/release/version.ts +++ b/scripts/release/version.ts @@ -294,7 +294,7 @@ export const run = async (options: unknown) => { } }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const options = program.parse().opts(); run(options).catch((err) => { console.error(err); diff --git a/scripts/release/write-changelog.ts b/scripts/release/write-changelog.ts index 2f80d381ef49..30a64dd366ee 100644 --- a/scripts/release/write-changelog.ts +++ b/scripts/release/write-changelog.ts @@ -133,7 +133,7 @@ export const run = async (args: unknown[], options: unknown) => { console.log(`✅ Wrote Changelog to file`); }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { const parsed = program.parse(); run(parsed.args, parsed.opts()).catch((err) => { console.error(err); diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index 5c2ab47d0971..e625bd194baa 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -251,7 +251,7 @@ export const generate = async ({ await runGenerators(generatorConfigs, localRegistry, debug); }; -if (esMain(import.meta)) { +if (esMain(import.meta.url)) { program .description('Generate sandboxes from a set of possible templates') .option('--templates [templates...]', 'Space-delimited list of templates to include') From 4baa40ffb727330f2ac1b6ba5d9466c4a6c7301c Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Wed, 8 Nov 2023 08:41:12 +0100 Subject: [PATCH 17/21] Fix danger.js --- scripts/dangerfile.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/dangerfile.ts b/scripts/dangerfile.ts index 6e3100736021..754686981c80 100644 --- a/scripts/dangerfile.ts +++ b/scripts/dangerfile.ts @@ -2,14 +2,13 @@ import { fail, danger } from 'danger'; import { execSync } from 'child_process'; -import flatten from 'lodash/flatten.js'; -import intersection from 'lodash/intersection.js'; -import isEmpty from 'lodash/isEmpty.js'; - -import pkg from '../code/package.json'; - execSync('npm install lodash'); +const flatten = require('lodash/flatten.js'); +const intersection = require('lodash/intersection.js'); +const isEmpty = require('lodash/isEmpty.js'); + +const pkg = require('../code/package.json'); // eslint-disable-line import/newline-after-import const prLogConfig = pkg['pr-log']; const Versions = { @@ -32,7 +31,7 @@ const checkRequiredLabels = (labels: string[]) => { const requiredLabels = flatten([ prLogConfig.skipLabels || [], - (prLogConfig.validLabels || []).map((keyVal) => keyVal[0]), + (prLogConfig.validLabels || []).map((keyVal: string) => keyVal[0]), ]); const blockingLabels = intersection(forbiddenLabels, labels); From 758c0de182ccf448bb206350b25ee3afd715ef80 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Wed, 8 Nov 2023 09:59:43 +0100 Subject: [PATCH 18/21] Remove custom execa implementation --- scripts/get-report-message.ts | 4 ++-- scripts/release/publish.ts | 4 +++- scripts/release/version.ts | 3 ++- scripts/sandbox/generate.ts | 3 ++- scripts/sandbox/publish.ts | 6 +++--- scripts/sandbox/utils/git.ts | 10 ++++++---- scripts/upload-bench.ts | 9 ++++++--- scripts/utils/exec.ts | 13 ------------- scripts/utils/workspace.ts | 2 +- 9 files changed, 25 insertions(+), 29 deletions(-) diff --git a/scripts/get-report-message.ts b/scripts/get-report-message.ts index 75df6ba066fc..a10bbdd276e1 100644 --- a/scripts/get-report-message.ts +++ b/scripts/get-report-message.ts @@ -1,9 +1,9 @@ /* eslint-disable no-console */ import { readJson } from 'fs-extra'; import { join } from 'path'; +import { execaCommand } from 'execa'; import esMain from './utils/esmain'; import { CODE_DIRECTORY } from './utils/constants'; -import { execaCommand } from './utils/exec'; type Branch = 'main' | 'next' | 'alpha' | 'next-release' | 'latest-release'; type Workflow = 'merged' | 'daily'; @@ -28,7 +28,7 @@ const getFooter = async (branch: Branch, workflow: Workflow, job: string) => { : // show last 24h merges for daily workflow `git log --merges --since="24 hours ago" --pretty=format:"\`%h\` %<(12)%ar %s [%an]"`; - const result = await execaCommand(mergeCommits, { shell: true }); + const result = await execaCommand(mergeCommits, { shell: true, cleanup: true }); const formattedResult = result.stdout // discord needs escaped line breaks .replace(/\n/g, '\\n') diff --git a/scripts/release/publish.ts b/scripts/release/publish.ts index 32c1b57c5b26..c5f509ccd00a 100644 --- a/scripts/release/publish.ts +++ b/scripts/release/publish.ts @@ -8,8 +8,8 @@ import { readJson } from 'fs-extra'; import fetch from 'node-fetch'; import dedent from 'ts-dedent'; import pRetry from 'p-retry'; +import { execaCommand } from 'execa'; import esMain from '../utils/esmain'; -import { execaCommand } from '../utils/exec'; program .name('publish') @@ -111,6 +111,7 @@ const buildAllPackages = async () => { console.log(`🏗️ Building all packages...`); await execaCommand('yarn task --task=compile --start-from=compile --no-link', { stdio: 'inherit', + cleanup: true, cwd: CODE_DIR_PATH, }); console.log(`🏗️ Packages successfully built`); @@ -146,6 +147,7 @@ const publishAllPackages = async ({ () => execaCommand(command, { stdio: 'inherit', + cleanup: true, cwd: CODE_DIR_PATH, }), { diff --git a/scripts/release/version.ts b/scripts/release/version.ts index 57c0973583cf..db3f30fa8a80 100644 --- a/scripts/release/version.ts +++ b/scripts/release/version.ts @@ -6,10 +6,10 @@ import path from 'path'; import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; +import { execaCommand } from 'execa'; import esMain from '../utils/esmain'; import type { Workspace } from '../utils/workspace'; import { getWorkspaces } from '../utils/workspace'; -import { execaCommand } from '../utils/exec'; program .name('version') @@ -284,6 +284,7 @@ export const run = async (options: unknown) => { await execaCommand(`yarn install --mode=update-lockfile`, { cwd: path.join(CODE_DIR_PATH), stdio: verbose ? 'inherit' : undefined, + cleanup: true, }); console.log(`✅ Updated lock file with ${chalk.blue('yarn install --mode=update-lockfile')}`); } diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index e625bd194baa..e94459e4d915 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -6,8 +6,8 @@ import prettyTime from 'pretty-hrtime'; import { copy, emptyDir, ensureDir, move, remove, rename, writeFile } from 'fs-extra'; import { program } from 'commander'; import { directory } from 'tempy'; +import { execaCommand } from 'execa'; import esMain from '../utils/esmain'; -import { execaCommand } from '../utils/exec'; import type { OptionValues } from '../utils/options'; import { createOptions } from '../utils/options'; @@ -99,6 +99,7 @@ export const runCommand = async (script: string, options: ExecaOptions, debug = return execaCommand(script, { stdout: debug ? 'inherit' : 'ignore', shell: true, + cleanup: true, ...options, }); }; diff --git a/scripts/sandbox/publish.ts b/scripts/sandbox/publish.ts index a40fc2bd0540..e4307690efdd 100755 --- a/scripts/sandbox/publish.ts +++ b/scripts/sandbox/publish.ts @@ -3,7 +3,7 @@ import { join } from 'path'; import { existsSync } from 'fs'; import * as tempy from 'tempy'; import { copy, emptyDir, readdir, remove, stat, writeFile } from 'fs-extra'; -import { execaCommand } from '../utils/exec'; +import { execaCommand } from 'execa'; import { getTemplatesData, renderTemplate } from './utils/template'; // eslint-disable-next-line import/no-cycle @@ -26,8 +26,8 @@ const publish = async (options: PublishOptions & { tmpFolder: string }) => { const templatesData = await getTemplatesData(branch === 'main' ? 'main' : 'next'); logger.log(`👯‍♂️ Cloning the repository ${remote} in branch ${branch}`); - await execaCommand(`git clone ${remote} .`, { cwd: tmpFolder }); - await execaCommand(`git checkout ${branch}`, { cwd: tmpFolder }); + await execaCommand(`git clone ${remote} .`, { cwd: tmpFolder, cleanup: true }); + await execaCommand(`git checkout ${branch}`, { cwd: tmpFolder, cleanup: true }); // otherwise old files will stick around and result inconsistent states logger.log(`🗑 Delete existing template dirs from clone`); diff --git a/scripts/sandbox/utils/git.ts b/scripts/sandbox/utils/git.ts index dea378eae921..71de33aa38fe 100644 --- a/scripts/sandbox/utils/git.ts +++ b/scripts/sandbox/utils/git.ts @@ -1,7 +1,7 @@ import fetch from 'node-fetch'; import invariant from 'tiny-invariant'; -import { execaCommand } from '../../utils/exec'; +import { execaCommand } from 'execa'; // eslint-disable-next-line import/no-cycle import { logger } from '../publish'; @@ -50,9 +50,9 @@ export async function commitAllToGit({ cwd, branch }: { cwd: string; branch: str try { logger.log(`💪 Committing everything to the repository`); - await execaCommand('git add .', { cwd }); + await execaCommand('git add .', { cwd, cleanup: true }); - const currentCommitHash = (await execaCommand('git rev-parse HEAD')).stdout + const currentCommitHash = (await execaCommand('git rev-parse HEAD', { cleanup: true })).stdout .toString() .slice(0, 12); @@ -63,7 +63,8 @@ export async function commitAllToGit({ cwd, branch }: { cwd: string; branch: str const previousCommitHash = await getTheLastCommitHashThatUpdatedTheSandboxRepo(branch); const mergeCommits = ( await execaCommand( - `git log ${previousCommitHash}..${currentCommitHash} --merges --pretty=%s` + `git log ${previousCommitHash}..${currentCommitHash} --merges --pretty=%s`, + { cleanup: true } ) ).stdout .toString() @@ -95,6 +96,7 @@ export async function commitAllToGit({ cwd, branch }: { cwd: string; branch: str await execaCommand(gitCommitCommand, { shell: true, + cleanup: true, cwd, }); } catch (e) { diff --git a/scripts/upload-bench.ts b/scripts/upload-bench.ts index e841ec363c33..250c6154ce25 100644 --- a/scripts/upload-bench.ts +++ b/scripts/upload-bench.ts @@ -1,10 +1,10 @@ import { join } from 'path'; import { BigQuery } from '@google-cloud/bigquery'; +import { execaCommand } from 'execa'; import type { BenchResults } from './bench/types'; import { loadBench } from './bench/utils'; import { SANDBOX_DIRECTORY } from './utils/constants'; -import { execaCommand } from './utils/exec'; const templateKey = process.argv[2]; @@ -64,8 +64,11 @@ const uploadBench = async () => { const row = { ...defaults, branch: - process.env.CIRCLE_BRANCH || (await execaCommand('git rev-parse --abbrev-ref HEAD')).stdout, - commit: process.env.CIRCLE_SHA1 || (await execaCommand('git rev-parse HEAD')).stdout, + process.env.CIRCLE_BRANCH || + (await execaCommand('git rev-parse --abbrev-ref HEAD', { cleanup: true })).stdout, + commit: + process.env.CIRCLE_SHA1 || + (await execaCommand('git rev-parse HEAD', { cleanup: true })).stdout, timestamp: new Date().toISOString(), label: templateKey, ...results, diff --git a/scripts/utils/exec.ts b/scripts/utils/exec.ts index 4dec95e814fc..536c36aecf14 100644 --- a/scripts/utils/exec.ts +++ b/scripts/utils/exec.ts @@ -13,19 +13,6 @@ type StepOptions = { signal?: AbortSignal; }; -// Reimplementation of `execaCommand` to use `getExeca` -export const execaCommand = async ( - command: string, - options: Options = {} -): Promise> => { - // We await here because execaCommand returns a promise, but that's not what the user expects - // eslint-disable-next-line @typescript-eslint/return-await - return await execa(command, { - cleanup: true, - ...options, - }); -}; - export const exec = async ( command: string | string[], options: Options = {}, diff --git a/scripts/utils/workspace.ts b/scripts/utils/workspace.ts index a9af2eb46fa2..7edef2d14f16 100644 --- a/scripts/utils/workspace.ts +++ b/scripts/utils/workspace.ts @@ -1,6 +1,6 @@ import memoize from 'memoizerific'; +import { execaCommand } from 'execa'; import { CODE_DIRECTORY } from './constants'; -import { execaCommand } from './exec'; export type Workspace = { name: string; location: string }; From 6d5080e0a16527231aeaab6e17ba484ec98d4d2a Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Wed, 8 Nov 2023 15:48:16 +0100 Subject: [PATCH 19/21] Fix tests --- scripts/release/__tests__/version.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/release/__tests__/version.test.ts b/scripts/release/__tests__/version.test.ts index 98069ffaba74..22a2cb7ca8a1 100644 --- a/scripts/release/__tests__/version.test.ts +++ b/scripts/release/__tests__/version.test.ts @@ -11,8 +11,8 @@ jest.mock('../../../code/lib/cli/src/versions', () => ({ '@storybook/addon-a11y': '7.1.0-alpha.29', })); -jest.mock('../../utils/exec'); -const { execaCommand } = require('../../utils/exec'); +jest.mock('execa'); +const { execaCommand } = require('execa'); jest.mock('../../utils/workspace', () => ({ getWorkspaces: jest.fn().mockResolvedValue([ @@ -288,6 +288,7 @@ describe('Version', () => { ); expect(execaCommand).toHaveBeenCalledWith('yarn install --mode=update-lockfile', { cwd: path.join(CODE_DIR_PATH), + cleanup: true, stdio: undefined, }); } From e792e6fea90b8203d3a1d75cde85644bf7e63de4 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Tue, 14 Nov 2023 15:27:14 +0100 Subject: [PATCH 20/21] Update package.json scripts to use esbuild-register from scripts/node_modules --- code/addons/a11y/package.json | 4 ++-- code/addons/actions/package.json | 4 ++-- code/addons/backgrounds/package.json | 4 ++-- code/addons/controls/package.json | 4 ++-- code/addons/docs/package.json | 4 ++-- code/addons/essentials/package.json | 4 ++-- code/addons/gfm/package.json | 4 ++-- code/addons/highlight/package.json | 4 ++-- code/addons/interactions/package.json | 4 ++-- code/addons/jest/package.json | 4 ++-- code/addons/links/package.json | 4 ++-- code/addons/measure/package.json | 4 ++-- code/addons/outline/package.json | 4 ++-- code/addons/storyshots-core/package.json | 4 ++-- code/addons/storyshots-puppeteer/package.json | 4 ++-- code/addons/storysource/package.json | 4 ++-- code/addons/themes/package.json | 4 ++-- code/addons/toolbars/package.json | 4 ++-- code/addons/viewport/package.json | 4 ++-- code/builders/builder-manager/package.json | 4 ++-- code/builders/builder-vite/package.json | 4 ++-- code/builders/builder-webpack5/package.json | 4 ++-- code/deprecated/addons/package.json | 4 ++-- code/deprecated/channel-postmessage/package.json | 4 ++-- code/deprecated/channel-websocket/package.json | 4 ++-- code/deprecated/client-api/package.json | 4 ++-- code/deprecated/core-client/package.json | 4 ++-- code/deprecated/manager-api-shim/package.json | 4 ++-- code/deprecated/preview-web/package.json | 4 ++-- code/deprecated/store/package.json | 4 ++-- code/frameworks/angular/package.json | 2 +- code/frameworks/ember/package.json | 4 ++-- code/frameworks/html-vite/package.json | 4 ++-- code/frameworks/html-webpack5/package.json | 4 ++-- code/frameworks/nextjs/package.json | 4 ++-- code/frameworks/preact-vite/package.json | 4 ++-- code/frameworks/preact-webpack5/package.json | 4 ++-- code/frameworks/react-vite/package.json | 4 ++-- code/frameworks/react-webpack5/package.json | 4 ++-- code/frameworks/server-webpack5/package.json | 4 ++-- code/frameworks/svelte-vite/package.json | 4 ++-- code/frameworks/svelte-webpack5/package.json | 4 ++-- code/frameworks/sveltekit/package.json | 4 ++-- code/frameworks/vue-vite/package.json | 4 ++-- code/frameworks/vue-webpack5/package.json | 4 ++-- code/frameworks/vue3-vite/package.json | 4 ++-- code/frameworks/vue3-webpack5/package.json | 4 ++-- code/frameworks/web-components-vite/package.json | 4 ++-- code/frameworks/web-components-webpack5/package.json | 4 ++-- code/lib/channels/package.json | 4 ++-- code/lib/cli/package.json | 4 ++-- code/lib/client-logger/package.json | 4 ++-- code/lib/codemod/package.json | 4 ++-- code/lib/core-common/package.json | 4 ++-- code/lib/core-events/package.json | 4 ++-- code/lib/core-server/package.json | 4 ++-- code/lib/core-webpack/package.json | 4 ++-- code/lib/csf-plugin/package.json | 4 ++-- code/lib/csf-tools/package.json | 4 ++-- code/lib/docs-tools/package.json | 4 ++-- code/lib/instrumenter/package.json | 4 ++-- code/lib/manager-api/package.json | 4 ++-- code/lib/node-logger/package.json | 4 ++-- code/lib/postinstall/package.json | 4 ++-- code/lib/preview-api/package.json | 4 ++-- code/lib/preview/package.json | 4 ++-- code/lib/react-dom-shim/package.json | 4 ++-- code/lib/router/package.json | 4 ++-- code/lib/source-loader/package.json | 4 ++-- code/lib/telemetry/package.json | 4 ++-- code/lib/test/package.json | 4 ++-- code/lib/theming/package.json | 4 ++-- code/lib/types/package.json | 4 ++-- code/presets/create-react-app/package.json | 4 ++-- code/presets/html-webpack/package.json | 4 ++-- code/presets/preact-webpack/package.json | 4 ++-- code/presets/react-webpack/package.json | 4 ++-- code/presets/server-webpack/package.json | 4 ++-- code/presets/svelte-webpack/package.json | 4 ++-- code/presets/vue-webpack/package.json | 4 ++-- code/presets/vue3-webpack/package.json | 4 ++-- code/presets/web-components-webpack/package.json | 4 ++-- code/renderers/html/package.json | 4 ++-- code/renderers/preact/package.json | 4 ++-- code/renderers/react/package.json | 4 ++-- code/renderers/server/package.json | 4 ++-- code/renderers/svelte/package.json | 2 +- code/renderers/vue/package.json | 2 +- code/renderers/vue3/package.json | 2 +- code/renderers/web-components/package.json | 4 ++-- code/ui/blocks/package.json | 4 ++-- code/ui/components/package.json | 4 ++-- code/ui/manager/package.json | 4 ++-- 93 files changed, 182 insertions(+), 182 deletions(-) diff --git a/code/addons/a11y/package.json b/code/addons/a11y/package.json index 982115b501f5..0f34cd9e527f 100644 --- a/code/addons/a11y/package.json +++ b/code/addons/a11y/package.json @@ -60,8 +60,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addon-highlight": "workspace:*", diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index dae971d82905..40e68c4fff34 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -77,8 +77,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/backgrounds/package.json b/code/addons/backgrounds/package.json index e698e3eba4b8..56b2bff935ae 100644 --- a/code/addons/backgrounds/package.json +++ b/code/addons/backgrounds/package.json @@ -73,8 +73,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/controls/package.json b/code/addons/controls/package.json index d19e4a64617e..78f29f924270 100644 --- a/code/addons/controls/package.json +++ b/code/addons/controls/package.json @@ -65,8 +65,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/blocks": "workspace:*", diff --git a/code/addons/docs/package.json b/code/addons/docs/package.json index 268c69b97d86..20b24e94d52d 100644 --- a/code/addons/docs/package.json +++ b/code/addons/docs/package.json @@ -94,8 +94,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@jest/transform": "^29.3.1", diff --git a/code/addons/essentials/package.json b/code/addons/essentials/package.json index 7401de032c27..e25426ea9e31 100644 --- a/code/addons/essentials/package.json +++ b/code/addons/essentials/package.json @@ -116,8 +116,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addon-actions": "workspace:*", diff --git a/code/addons/gfm/package.json b/code/addons/gfm/package.json index d83825748f7b..8ed921d17f37 100644 --- a/code/addons/gfm/package.json +++ b/code/addons/gfm/package.json @@ -48,8 +48,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/node-logger": "workspace:*", diff --git a/code/addons/highlight/package.json b/code/addons/highlight/package.json index 5450d894b52d..4a5b282644ee 100644 --- a/code/addons/highlight/package.json +++ b/code/addons/highlight/package.json @@ -58,8 +58,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-events": "workspace:*", diff --git a/code/addons/interactions/package.json b/code/addons/interactions/package.json index edb8a55e2a20..b7d115458cb6 100644 --- a/code/addons/interactions/package.json +++ b/code/addons/interactions/package.json @@ -69,8 +69,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/jest/package.json b/code/addons/jest/package.json index 4f78b3f8aa4e..f9bd67e38501 100644 --- a/code/addons/jest/package.json +++ b/code/addons/jest/package.json @@ -67,8 +67,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/links/package.json b/code/addons/links/package.json index f9f0592d43bc..8f9a7502df57 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -77,8 +77,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/measure/package.json b/code/addons/measure/package.json index 9368eecad955..78c569318775 100644 --- a/code/addons/measure/package.json +++ b/code/addons/measure/package.json @@ -72,8 +72,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/outline/package.json b/code/addons/outline/package.json index 6437a4f263eb..09eec0e02503 100644 --- a/code/addons/outline/package.json +++ b/code/addons/outline/package.json @@ -75,8 +75,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/storyshots-core/package.json b/code/addons/storyshots-core/package.json index b9529e0d292d..a00ae2eec731 100644 --- a/code/addons/storyshots-core/package.json +++ b/code/addons/storyshots-core/package.json @@ -33,8 +33,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@jest/transform": "^29.3.1", diff --git a/code/addons/storyshots-puppeteer/package.json b/code/addons/storyshots-puppeteer/package.json index b69d36e8acde..392174a3d0ce 100644 --- a/code/addons/storyshots-puppeteer/package.json +++ b/code/addons/storyshots-puppeteer/package.json @@ -32,8 +32,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@axe-core/puppeteer": "^4.2.0", diff --git a/code/addons/storysource/package.json b/code/addons/storysource/package.json index 85b40d56664a..09e970e9f607 100644 --- a/code/addons/storysource/package.json +++ b/code/addons/storysource/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/themes/package.json b/code/addons/themes/package.json index 595d64e9ef56..082775234046 100644 --- a/code/addons/themes/package.json +++ b/code/addons/themes/package.json @@ -70,8 +70,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/toolbars/package.json b/code/addons/toolbars/package.json index 9a10b7efdbc3..903a674205be 100644 --- a/code/addons/toolbars/package.json +++ b/code/addons/toolbars/package.json @@ -65,8 +65,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/addons/viewport/package.json b/code/addons/viewport/package.json index 4b997880b5fa..d690529d0e68 100644 --- a/code/addons/viewport/package.json +++ b/code/addons/viewport/package.json @@ -70,8 +70,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/builders/builder-manager/package.json b/code/builders/builder-manager/package.json index d35b2c97a213..0c64ca32e651 100644 --- a/code/builders/builder-manager/package.json +++ b/code/builders/builder-manager/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@fal-works/esbuild-plugin-global-externals": "^2.1.2", diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index 2d5a24ce0d35..d4e02fa8c3c6 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/builders/builder-webpack5/package.json b/code/builders/builder-webpack5/package.json index 990af8a140d3..d72f0de4a961 100644 --- a/code/builders/builder-webpack5/package.json +++ b/code/builders/builder-webpack5/package.json @@ -57,8 +57,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/core": "^7.23.2", diff --git a/code/deprecated/addons/package.json b/code/deprecated/addons/package.json index 9d15fd59224f..89bbf3000895 100644 --- a/code/deprecated/addons/package.json +++ b/code/deprecated/addons/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/manager-api": "workspace:*", diff --git a/code/deprecated/channel-postmessage/package.json b/code/deprecated/channel-postmessage/package.json index bf22209c5f64..9723d53d21aa 100644 --- a/code/deprecated/channel-postmessage/package.json +++ b/code/deprecated/channel-postmessage/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/deprecated/channel-websocket/package.json b/code/deprecated/channel-websocket/package.json index 8e291a4ac852..cf9f8c2472bf 100644 --- a/code/deprecated/channel-websocket/package.json +++ b/code/deprecated/channel-websocket/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/deprecated/client-api/package.json b/code/deprecated/client-api/package.json index 25fa94650e05..ab9bd1a38dff 100644 --- a/code/deprecated/client-api/package.json +++ b/code/deprecated/client-api/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/core-client/package.json b/code/deprecated/core-client/package.json index ff265bb1919d..8b8c0b1ea459 100644 --- a/code/deprecated/core-client/package.json +++ b/code/deprecated/core-client/package.json @@ -31,8 +31,8 @@ "module": "dist/entry.mjs", "types": "dist/entry.d.ts", "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/manager-api-shim/package.json b/code/deprecated/manager-api-shim/package.json index 4c15fa4d619a..1924599d02f2 100644 --- a/code/deprecated/manager-api-shim/package.json +++ b/code/deprecated/manager-api-shim/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/preview-web/package.json b/code/deprecated/preview-web/package.json index 08a093f37f55..cc75dde0e9f9 100644 --- a/code/deprecated/preview-web/package.json +++ b/code/deprecated/preview-web/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/deprecated/store/package.json b/code/deprecated/store/package.json index 5c948facc749..d63b568308d1 100644 --- a/code/deprecated/store/package.json +++ b/code/deprecated/store/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/facade.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index 25e790336a6e..9ad294cb298c 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -34,7 +34,7 @@ ], "scripts": { "check": "node ../../../scripts/node_modules/.bin/tsc", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/ember/package.json b/code/frameworks/ember/package.json index 94cdc922426e..6097d1b49c26 100644 --- a/code/frameworks/ember/package.json +++ b/code/frameworks/ember/package.json @@ -28,8 +28,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/tsc.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/html-vite/package.json b/code/frameworks/html-vite/package.json index 3618ec2a4b67..d9f204488b3d 100644 --- a/code/frameworks/html-vite/package.json +++ b/code/frameworks/html-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/addons": "workspace:*", diff --git a/code/frameworks/html-webpack5/package.json b/code/frameworks/html-webpack5/package.json index d09ccceefb23..e22026b0f95c 100644 --- a/code/frameworks/html-webpack5/package.json +++ b/code/frameworks/html-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index 11b092bc0ce0..695b57c1e738 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -70,8 +70,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/core": "^7.23.2", diff --git a/code/frameworks/preact-vite/package.json b/code/frameworks/preact-vite/package.json index 0110bb9d8d92..d0e66e400b51 100644 --- a/code/frameworks/preact-vite/package.json +++ b/code/frameworks/preact-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@preact/preset-vite": "^2.0.0", diff --git a/code/frameworks/preact-webpack5/package.json b/code/frameworks/preact-webpack5/package.json index 43065839e92f..8136f3948827 100644 --- a/code/frameworks/preact-webpack5/package.json +++ b/code/frameworks/preact-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/react-vite/package.json b/code/frameworks/react-vite/package.json index 5a4d27903523..91584f7309b9 100644 --- a/code/frameworks/react-vite/package.json +++ b/code/frameworks/react-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0", diff --git a/code/frameworks/react-webpack5/package.json b/code/frameworks/react-webpack5/package.json index 4e021b06fd8b..5e8d43899ba6 100644 --- a/code/frameworks/react-webpack5/package.json +++ b/code/frameworks/react-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/server-webpack5/package.json b/code/frameworks/server-webpack5/package.json index 2fed061b43bd..21f0e10fd88b 100644 --- a/code/frameworks/server-webpack5/package.json +++ b/code/frameworks/server-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/svelte-vite/package.json b/code/frameworks/svelte-vite/package.json index 8dde98399e7f..da2dfba2ff89 100644 --- a/code/frameworks/svelte-vite/package.json +++ b/code/frameworks/svelte-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/svelte-webpack5/package.json b/code/frameworks/svelte-webpack5/package.json index 36a873112a69..365d395a0165 100644 --- a/code/frameworks/svelte-webpack5/package.json +++ b/code/frameworks/svelte-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/sveltekit/package.json b/code/frameworks/sveltekit/package.json index 04e02d1e80f2..8701a4bfcbc2 100644 --- a/code/frameworks/sveltekit/package.json +++ b/code/frameworks/sveltekit/package.json @@ -46,8 +46,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/vue-vite/package.json b/code/frameworks/vue-vite/package.json index 3cdc090a67f8..0a5b94b74d13 100644 --- a/code/frameworks/vue-vite/package.json +++ b/code/frameworks/vue-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/vue-webpack5/package.json b/code/frameworks/vue-webpack5/package.json index e247fdc1519d..2258ba6eb848 100644 --- a/code/frameworks/vue-webpack5/package.json +++ b/code/frameworks/vue-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/vue3-vite/package.json b/code/frameworks/vue3-vite/package.json index db006e4cb91e..1b2b62723b28 100644 --- a/code/frameworks/vue3-vite/package.json +++ b/code/frameworks/vue3-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/vue3-webpack5/package.json b/code/frameworks/vue3-webpack5/package.json index a0b50a309047..d46d7162f347 100644 --- a/code/frameworks/vue3-webpack5/package.json +++ b/code/frameworks/vue3-webpack5/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-webpack5": "workspace:*", diff --git a/code/frameworks/web-components-vite/package.json b/code/frameworks/web-components-vite/package.json index 2fe348aeee46..2c32f1352d13 100644 --- a/code/frameworks/web-components-vite/package.json +++ b/code/frameworks/web-components-vite/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/builder-vite": "workspace:*", diff --git a/code/frameworks/web-components-webpack5/package.json b/code/frameworks/web-components-webpack5/package.json index f77d6ff57e56..2f9d4153b9dc 100644 --- a/code/frameworks/web-components-webpack5/package.json +++ b/code/frameworks/web-components-webpack5/package.json @@ -46,8 +46,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/preset-env": "^7.23.2", diff --git a/code/lib/channels/package.json b/code/lib/channels/package.json index 97041d0eb68c..ed8d4525fb22 100644 --- a/code/lib/channels/package.json +++ b/code/lib/channels/package.json @@ -65,8 +65,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/cli/package.json b/code/lib/cli/package.json index f202d09551d8..5d5f33c23b0f 100644 --- a/code/lib/cli/package.json +++ b/code/lib/cli/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts", + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts", "test": "jest test/**/*.test.js" }, "dependencies": { diff --git a/code/lib/client-logger/package.json b/code/lib/client-logger/package.json index 01f6e4e61581..209d761a0c3b 100644 --- a/code/lib/client-logger/package.json +++ b/code/lib/client-logger/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/global": "^5.0.0" diff --git a/code/lib/codemod/package.json b/code/lib/codemod/package.json index 519ea66221be..4f91b18e2f85 100644 --- a/code/lib/codemod/package.json +++ b/code/lib/codemod/package.json @@ -48,8 +48,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/core": "^7.23.2", diff --git a/code/lib/core-common/package.json b/code/lib/core-common/package.json index 6ff3e17086d7..80e74f7ef11b 100644 --- a/code/lib/core-common/package.json +++ b/code/lib/core-common/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-events": "workspace:*", diff --git a/code/lib/core-events/package.json b/code/lib/core-events/package.json index 1d81fd572edd..ada82cb59c26 100644 --- a/code/lib/core-events/package.json +++ b/code/lib/core-events/package.json @@ -74,8 +74,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "ts-dedent": "^2.0.0" diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index e8fa26863523..dd3add9d69b7 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -56,8 +56,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@aw-web-design/x-default-browser": "1.4.126", diff --git a/code/lib/core-webpack/package.json b/code/lib/core-webpack/package.json index 76228f4cf4b6..dacc6e45deb8 100644 --- a/code/lib/core-webpack/package.json +++ b/code/lib/core-webpack/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-common": "workspace:*", diff --git a/code/lib/csf-plugin/package.json b/code/lib/csf-plugin/package.json index 5bb7401fca86..f873a212f9d5 100644 --- a/code/lib/csf-plugin/package.json +++ b/code/lib/csf-plugin/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/csf-tools": "workspace:*", diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 4fd7fc4fca05..63acbbeac118 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -38,8 +38,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/generator": "^7.23.0", diff --git a/code/lib/docs-tools/package.json b/code/lib/docs-tools/package.json index a93540f256ae..f99cd0eb0ed6 100644 --- a/code/lib/docs-tools/package.json +++ b/code/lib/docs-tools/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-common": "workspace:*", diff --git a/code/lib/instrumenter/package.json b/code/lib/instrumenter/package.json index ff32f64c19f0..8994bae83cbd 100644 --- a/code/lib/instrumenter/package.json +++ b/code/lib/instrumenter/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index a78be8748e84..aba346d66532 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -39,8 +39,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/node-logger/package.json b/code/lib/node-logger/package.json index 742132de9201..3caebf579171 100644 --- a/code/lib/node-logger/package.json +++ b/code/lib/node-logger/package.json @@ -38,8 +38,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "devDependencies": { "@types/npmlog": "^4.1.2", diff --git a/code/lib/postinstall/package.json b/code/lib/postinstall/package.json index f23342659ea8..42b7332b2e69 100644 --- a/code/lib/postinstall/package.json +++ b/code/lib/postinstall/package.json @@ -41,8 +41,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "devDependencies": { "jest": "^29.7.0", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 6e11c55daa3b..5e577c588d15 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -64,8 +64,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/preview/package.json b/code/lib/preview/package.json index 8fe5fbdcb4cb..5d1bd5d50296 100644 --- a/code/lib/preview/package.json +++ b/code/lib/preview/package.json @@ -52,8 +52,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/esm-bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/esm-bundle.ts" }, "devDependencies": { "@storybook/channels": "workspace:*", diff --git a/code/lib/react-dom-shim/package.json b/code/lib/react-dom-shim/package.json index 986c08dffa42..5adaf5afd744 100644 --- a/code/lib/react-dom-shim/package.json +++ b/code/lib/react-dom-shim/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "devDependencies": { "@storybook/types": "workspace:*", diff --git a/code/lib/router/package.json b/code/lib/router/package.json index 3e61b244e67f..63379996c90a 100644 --- a/code/lib/router/package.json +++ b/code/lib/router/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/source-loader/package.json b/code/lib/source-loader/package.json index 86757b2f41c9..7115659af6d3 100644 --- a/code/lib/source-loader/package.json +++ b/code/lib/source-loader/package.json @@ -41,8 +41,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/csf": "^0.1.0", diff --git a/code/lib/telemetry/package.json b/code/lib/telemetry/package.json index d4db3291c362..4117e5882c2a 100644 --- a/code/lib/telemetry/package.json +++ b/code/lib/telemetry/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/test/package.json b/code/lib/test/package.json index 4b082c255b90..94aeef099a96 100644 --- a/code/lib/test/package.json +++ b/code/lib/test/package.json @@ -39,8 +39,8 @@ "*.d.ts" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/lib/theming/package.json b/code/lib/theming/package.json index 8f8081cecaeb..5a1f26529adc 100644 --- a/code/lib/theming/package.json +++ b/code/lib/theming/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@emotion/use-insertion-effect-with-fallbacks": "^1.0.0", diff --git a/code/lib/types/package.json b/code/lib/types/package.json index 370d7950e78c..641f1cd585bd 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/presets/create-react-app/package.json b/code/presets/create-react-app/package.json index fa30b9f6d93a..3336d73a402e 100644 --- a/code/presets/create-react-app/package.json +++ b/code/presets/create-react-app/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1", diff --git a/code/presets/html-webpack/package.json b/code/presets/html-webpack/package.json index 4c24a2a7f387..d84193c78be7 100644 --- a/code/presets/html-webpack/package.json +++ b/code/presets/html-webpack/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/preact-webpack/package.json b/code/presets/preact-webpack/package.json index 4d74b3f36ab1..cc2506d710c4 100644 --- a/code/presets/preact-webpack/package.json +++ b/code/presets/preact-webpack/package.json @@ -45,8 +45,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/plugin-transform-react-jsx": "^7.22.15", diff --git a/code/presets/react-webpack/package.json b/code/presets/react-webpack/package.json index d34374359091..b8e179c279e0 100644 --- a/code/presets/react-webpack/package.json +++ b/code/presets/react-webpack/package.json @@ -65,8 +65,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/preset-flow": "^7.22.15", diff --git a/code/presets/server-webpack/package.json b/code/presets/server-webpack/package.json index cb705b236e54..484b4d771bb1 100644 --- a/code/presets/server-webpack/package.json +++ b/code/presets/server-webpack/package.json @@ -50,8 +50,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-server": "workspace:*", diff --git a/code/presets/svelte-webpack/package.json b/code/presets/svelte-webpack/package.json index fce2d9ab8588..1eb33bf8a33f 100644 --- a/code/presets/svelte-webpack/package.json +++ b/code/presets/svelte-webpack/package.json @@ -60,8 +60,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/vue-webpack/package.json b/code/presets/vue-webpack/package.json index e2ba65efb9cd..ab9b647953b3 100644 --- a/code/presets/vue-webpack/package.json +++ b/code/presets/vue-webpack/package.json @@ -55,8 +55,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/vue3-webpack/package.json b/code/presets/vue3-webpack/package.json index c58a47380471..58b3b6607323 100644 --- a/code/presets/vue3-webpack/package.json +++ b/code/presets/vue3-webpack/package.json @@ -55,8 +55,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-webpack": "workspace:*", diff --git a/code/presets/web-components-webpack/package.json b/code/presets/web-components-webpack/package.json index c33ca8e1ed21..5f71e9c87657 100644 --- a/code/presets/web-components-webpack/package.json +++ b/code/presets/web-components-webpack/package.json @@ -48,8 +48,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/plugin-syntax-dynamic-import": "^7.8.3", diff --git a/code/renderers/html/package.json b/code/renderers/html/package.json index 9ba0d6d7b0e9..ab3500dff9ef 100644 --- a/code/renderers/html/package.json +++ b/code/renderers/html/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/preact/package.json b/code/renderers/preact/package.json index eac5aec6f576..9dee71b45fa9 100644 --- a/code/renderers/preact/package.json +++ b/code/renderers/preact/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/react/package.json b/code/renderers/react/package.json index ce66b38cf818..daac2180662f 100644 --- a/code/renderers/react/package.json +++ b/code/renderers/react/package.json @@ -43,8 +43,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index 42f81613162a..92f601988151 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -42,8 +42,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/svelte/package.json b/code/renderers/svelte/package.json index bd7ff38d0b1a..09d93252fc65 100644 --- a/code/renderers/svelte/package.json +++ b/code/renderers/svelte/package.json @@ -48,7 +48,7 @@ ], "scripts": { "check": "svelte-check", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/renderers/vue/package.json b/code/renderers/vue/package.json index 4cead82af191..1f14d57e283b 100644 --- a/code/renderers/vue/package.json +++ b/code/renderers/vue/package.json @@ -44,7 +44,7 @@ ], "scripts": { "check": "vue-tsc --noEmit", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/renderers/vue3/package.json b/code/renderers/vue3/package.json index 76e24a10fd3e..cc6c71af5d3d 100644 --- a/code/renderers/vue3/package.json +++ b/code/renderers/vue3/package.json @@ -44,7 +44,7 @@ ], "scripts": { "check": "vue-tsc --noEmit", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/core-client": "workspace:*", diff --git a/code/renderers/web-components/package.json b/code/renderers/web-components/package.json index e765f82785ae..bd38fa466654 100644 --- a/code/renderers/web-components/package.json +++ b/code/renderers/web-components/package.json @@ -46,8 +46,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/client-logger": "workspace:*", diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index e8a52b797204..f0027b1c82ea 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -40,8 +40,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@storybook/channels": "workspace:*", diff --git a/code/ui/components/package.json b/code/ui/components/package.json index 4049f25e6960..937ab45eee27 100644 --- a/code/ui/components/package.json +++ b/code/ui/components/package.json @@ -55,8 +55,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" }, "dependencies": { "@radix-ui/react-select": "^1.2.2", diff --git a/code/ui/manager/package.json b/code/ui/manager/package.json index df38b64c1079..c7ceca1bfdbb 100644 --- a/code/ui/manager/package.json +++ b/code/ui/manager/package.json @@ -47,8 +47,8 @@ "!src/**/*" ], "scripts": { - "check": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/check.ts", - "prep": "node --loader esbuild-register/loader -r esbuild-register ../../../scripts/prepare/esm-bundle.ts" + "check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", + "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/esm-bundle.ts" }, "devDependencies": { "@fal-works/esbuild-plugin-global-externals": "^2.1.2", From e8f8a65aee104fa384c0d7505fc470c1804267e6 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Tue, 14 Nov 2023 17:15:47 +0100 Subject: [PATCH 21/21] Replace default export of esMain by named export --- scripts/combine-compodoc.ts | 2 +- scripts/event-log-checker.ts | 2 +- scripts/get-report-message.ts | 2 +- scripts/get-template.ts | 2 +- scripts/release/cancel-preparation-runs.ts | 2 +- scripts/release/ensure-next-ahead.ts | 2 +- scripts/release/generate-pr-description.ts | 2 +- scripts/release/get-changelog-from-file.ts | 2 +- scripts/release/get-current-version.ts | 2 +- scripts/release/get-version-changelog.ts | 2 +- scripts/release/is-pr-frozen.ts | 2 +- scripts/release/is-prerelease.ts | 2 +- scripts/release/is-version-published.ts | 2 +- scripts/release/label-patches.ts | 2 +- scripts/release/pick-patches.ts | 2 +- scripts/release/publish.ts | 2 +- scripts/release/unreleased-changes-exists.ts | 2 +- scripts/release/version.ts | 2 +- scripts/release/write-changelog.ts | 2 +- scripts/sandbox/generate.ts | 2 +- scripts/utils/esmain.ts | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/combine-compodoc.ts b/scripts/combine-compodoc.ts index 3eaad97df6d0..c355cc242831 100755 --- a/scripts/combine-compodoc.ts +++ b/scripts/combine-compodoc.ts @@ -7,7 +7,7 @@ import { realpath, readFile, writeFile, lstat } from 'fs-extra'; import { globSync } from 'glob'; import { directory } from 'tempy'; import { execaCommand } from 'execa'; -import esMain from './utils/esmain'; +import { esMain } from './utils/esmain'; const logger = console; diff --git a/scripts/event-log-checker.ts b/scripts/event-log-checker.ts index 2812dc089697..681e54f7dfe4 100644 --- a/scripts/event-log-checker.ts +++ b/scripts/event-log-checker.ts @@ -2,7 +2,7 @@ import chalk from 'chalk'; import assert from 'assert'; import fetch from 'node-fetch'; -import esMain from './utils/esmain'; +import { esMain } from './utils/esmain'; import { allTemplates } from '../code/lib/cli/src/sandbox-templates'; import versions from '../code/lib/cli/src/versions'; import { oneWayHash } from '../code/lib/telemetry/src/one-way-hash'; diff --git a/scripts/get-report-message.ts b/scripts/get-report-message.ts index a10bbdd276e1..d118bfed3b61 100644 --- a/scripts/get-report-message.ts +++ b/scripts/get-report-message.ts @@ -2,7 +2,7 @@ import { readJson } from 'fs-extra'; import { join } from 'path'; import { execaCommand } from 'execa'; -import esMain from './utils/esmain'; +import { esMain } from './utils/esmain'; import { CODE_DIRECTORY } from './utils/constants'; type Branch = 'main' | 'next' | 'alpha' | 'next-release' | 'latest-release'; diff --git a/scripts/get-template.ts b/scripts/get-template.ts index 0b54568b3143..ee3b81b13025 100644 --- a/scripts/get-template.ts +++ b/scripts/get-template.ts @@ -4,7 +4,7 @@ import { program } from 'commander'; import dedent from 'ts-dedent'; import chalk from 'chalk'; import yaml from 'yaml'; -import esMain from './utils/esmain'; +import { esMain } from './utils/esmain'; import { allTemplates, templatesByCadence, diff --git a/scripts/release/cancel-preparation-runs.ts b/scripts/release/cancel-preparation-runs.ts index 811de60bfa52..56cca697d1d9 100644 --- a/scripts/release/cancel-preparation-runs.ts +++ b/scripts/release/cancel-preparation-runs.ts @@ -6,7 +6,7 @@ import chalk from 'chalk'; import program from 'commander'; import dedent from 'ts-dedent'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { githubRestClient } from './utils/github-client'; program diff --git a/scripts/release/ensure-next-ahead.ts b/scripts/release/ensure-next-ahead.ts index 4bc4bfbab35b..308004f031cf 100644 --- a/scripts/release/ensure-next-ahead.ts +++ b/scripts/release/ensure-next-ahead.ts @@ -14,7 +14,7 @@ import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; import { readJson } from 'fs-extra'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { run as bumpVersion } from './version'; import { git } from './utils/git-client'; diff --git a/scripts/release/generate-pr-description.ts b/scripts/release/generate-pr-description.ts index 31bcc3c63c1a..438c13fb4a91 100644 --- a/scripts/release/generate-pr-description.ts +++ b/scripts/release/generate-pr-description.ts @@ -5,7 +5,7 @@ import { z } from 'zod'; import dedent from 'ts-dedent'; import semver from 'semver'; import { setOutput } from '@actions/core'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import type { Change } from './utils/get-changes'; import { getChanges, LABELS_BY_IMPORTANCE, RELEASED_LABELS } from './utils/get-changes'; import { getCurrentVersion } from './get-current-version'; diff --git a/scripts/release/get-changelog-from-file.ts b/scripts/release/get-changelog-from-file.ts index 62a248f06d97..d400ad581507 100644 --- a/scripts/release/get-changelog-from-file.ts +++ b/scripts/release/get-changelog-from-file.ts @@ -6,7 +6,7 @@ import { readFile } from 'fs-extra'; import path from 'path'; import semver from 'semver'; import dedent from 'ts-dedent'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; program diff --git a/scripts/release/get-current-version.ts b/scripts/release/get-current-version.ts index 7fa283d4f08e..fffa703ab088 100644 --- a/scripts/release/get-current-version.ts +++ b/scripts/release/get-current-version.ts @@ -3,7 +3,7 @@ import chalk from 'chalk'; import { setOutput } from '@actions/core'; import path from 'path'; import { readJson } from 'fs-extra'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; const CODE_DIR_PATH = path.join(__dirname, '..', '..', 'code'); const CODE_PACKAGE_JSON_PATH = path.join(CODE_DIR_PATH, 'package.json'); diff --git a/scripts/release/get-version-changelog.ts b/scripts/release/get-version-changelog.ts index a3c6e645f793..ce0464d62517 100644 --- a/scripts/release/get-version-changelog.ts +++ b/scripts/release/get-version-changelog.ts @@ -2,7 +2,7 @@ import { setOutput } from '@actions/core'; import chalk from 'chalk'; import { program } from 'commander'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; import { getChanges } from './utils/get-changes'; diff --git a/scripts/release/is-pr-frozen.ts b/scripts/release/is-pr-frozen.ts index 2eb52528dda7..70d04c9509f2 100644 --- a/scripts/release/is-pr-frozen.ts +++ b/scripts/release/is-pr-frozen.ts @@ -4,7 +4,7 @@ import program from 'commander'; import { setOutput } from '@actions/core'; import path from 'path'; import { readJson } from 'fs-extra'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { getPullInfoFromCommit } from './utils/get-github-info'; import { git } from './utils/git-client'; diff --git a/scripts/release/is-prerelease.ts b/scripts/release/is-prerelease.ts index ef15bf6c40b2..b35f423820ea 100644 --- a/scripts/release/is-prerelease.ts +++ b/scripts/release/is-prerelease.ts @@ -3,7 +3,7 @@ import chalk from 'chalk'; import program from 'commander'; import { setOutput } from '@actions/core'; import semver from 'semver'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; program diff --git a/scripts/release/is-version-published.ts b/scripts/release/is-version-published.ts index 6a57efa92d55..54c19a465eb7 100644 --- a/scripts/release/is-version-published.ts +++ b/scripts/release/is-version-published.ts @@ -3,7 +3,7 @@ import chalk from 'chalk'; import program from 'commander'; import { setOutput } from '@actions/core'; import fetch from 'node-fetch'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { getCurrentVersion } from './get-current-version'; program diff --git a/scripts/release/label-patches.ts b/scripts/release/label-patches.ts index 68572d45c87c..453e64105abf 100644 --- a/scripts/release/label-patches.ts +++ b/scripts/release/label-patches.ts @@ -1,7 +1,7 @@ import program from 'commander'; import { v4 as uuidv4 } from 'uuid'; import ora from 'ora'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { getLabelIds, githubGraphQlClient, getUnpickedPRs } from './utils/github-client'; import { getPullInfoFromCommits, getRepo } from './utils/get-changes'; import { getLatestTag, git } from './utils/git-client'; diff --git a/scripts/release/pick-patches.ts b/scripts/release/pick-patches.ts index 9bdbf53977ec..be713f5f5d51 100644 --- a/scripts/release/pick-patches.ts +++ b/scripts/release/pick-patches.ts @@ -5,7 +5,7 @@ import chalk from 'chalk'; import ora from 'ora'; import { setOutput } from '@actions/core'; import invariant from 'tiny-invariant'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { git } from './utils/git-client'; import { getUnpickedPRs } from './utils/github-client'; diff --git a/scripts/release/publish.ts b/scripts/release/publish.ts index c5f509ccd00a..cd69f5260ce8 100644 --- a/scripts/release/publish.ts +++ b/scripts/release/publish.ts @@ -9,7 +9,7 @@ import fetch from 'node-fetch'; import dedent from 'ts-dedent'; import pRetry from 'p-retry'; import { execaCommand } from 'execa'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; program .name('publish') diff --git a/scripts/release/unreleased-changes-exists.ts b/scripts/release/unreleased-changes-exists.ts index e076e640d302..7944edbac73f 100644 --- a/scripts/release/unreleased-changes-exists.ts +++ b/scripts/release/unreleased-changes-exists.ts @@ -4,7 +4,7 @@ import program from 'commander'; import { z } from 'zod'; import { setOutput } from '@actions/core'; import { intersection } from 'lodash'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import type { Change } from './utils/get-changes'; import { RELEASED_LABELS, getChanges } from './utils/get-changes'; import { getCurrentVersion } from './get-current-version'; diff --git a/scripts/release/version.ts b/scripts/release/version.ts index db3f30fa8a80..c56d7afa5b54 100644 --- a/scripts/release/version.ts +++ b/scripts/release/version.ts @@ -7,7 +7,7 @@ import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; import { execaCommand } from 'execa'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import type { Workspace } from '../utils/workspace'; import { getWorkspaces } from '../utils/workspace'; diff --git a/scripts/release/write-changelog.ts b/scripts/release/write-changelog.ts index 30a64dd366ee..5af64eba3a8e 100644 --- a/scripts/release/write-changelog.ts +++ b/scripts/release/write-changelog.ts @@ -5,7 +5,7 @@ import program from 'commander'; import semver from 'semver'; import { z } from 'zod'; import { readFile, writeFile, writeJson } from 'fs-extra'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import { getChanges } from './utils/get-changes'; program diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index e94459e4d915..8f7ae78fb0d2 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -7,7 +7,7 @@ import { copy, emptyDir, ensureDir, move, remove, rename, writeFile } from 'fs-e import { program } from 'commander'; import { directory } from 'tempy'; import { execaCommand } from 'execa'; -import esMain from '../utils/esmain'; +import { esMain } from '../utils/esmain'; import type { OptionValues } from '../utils/options'; import { createOptions } from '../utils/options'; diff --git a/scripts/utils/esmain.ts b/scripts/utils/esmain.ts index 286f8b250276..edc9d07b4322 100644 --- a/scripts/utils/esmain.ts +++ b/scripts/utils/esmain.ts @@ -21,7 +21,7 @@ export function stripExt(name: string) { * Check if a module was run directly with node as opposed to being * imported from another module. */ -export default function esMain(url: string) { +export function esMain(url: string) { if (!url || !process.argv[1]) { return false; }