diff --git a/scripts/prepublish-checks.js b/scripts/prepublish-checks.js index f65777b..6d7bb6d 100644 --- a/scripts/prepublish-checks.js +++ b/scripts/prepublish-checks.js @@ -2,11 +2,11 @@ import boxen from "boxen"; import dedent from "dedent"; -import { readFile } from 'fs/promises'; -import { globalPackages as globalManagerPackages } from "@storybook/manager/globals"; -import { globalPackages as globalPreviewPackages } from "@storybook/preview/globals"; +import { readFile } from "node:fs/promises"; +import { globalPackages as globalManagerPackages } from "storybook/internal/manager/globals"; +import { globalPackages as globalPreviewPackages } from "storybook/internal/preview/globals"; -const packageJson = await readFile('./package.json', 'utf8').then(JSON.parse); +const packageJson = await readFile("./package.json", "utf8").then(JSON.parse); const name = packageJson.name; const displayName = packageJson.storybook.displayName; @@ -28,8 +28,8 @@ if (name.includes("addon-kit") || displayName.includes("Addon Kit")) { Please configure appropriate metadata before publishing your addon. For more info, see: https://storybook.js.org/docs/react/addons/addon-catalog#addon-metadata`)}`, - { padding: 1, borderColor: "red" } - ) + { padding: 1, borderColor: "red" }, + ), ); exitCode = 1; @@ -50,8 +50,8 @@ if ((await $`cat README.md | grep -E ${readmeTestStrings}`.exitCode) == 0) { ${chalk.red(dedent`You are using the default README.md file that comes with the addon kit. Please update it to provide info on what your addon does and how to use it.`)} `, - { padding: 1, borderColor: "red" } - ) + { padding: 1, borderColor: "red" }, + ), ); exitCode = 1; @@ -63,7 +63,7 @@ if ((await $`cat README.md | grep -E ${readmeTestStrings}`.exitCode) == 0) { const peerDependencies = Object.keys(packageJson.peerDependencies || {}); const globalPackages = [...globalManagerPackages, ...globalPreviewPackages]; peerDependencies.forEach((dependency) => { - if(globalPackages.includes(dependency)) { + if (globalPackages.includes(dependency)) { console.error( boxen( dedent` @@ -74,13 +74,12 @@ peerDependencies.forEach((dependency) => { Check the "bundling" section in README.md for more information. If you are absolutely sure you are doing it correct, you should remove this check from scripts/prepublish-checks.js.`)} `, - { padding: 1, borderColor: "red" } - ) + { padding: 1, borderColor: "red" }, + ), ); - + exitCode = 1; - } -}) +}); process.exit(exitCode);