Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Aug 5, 2024
1 parent b7ac914 commit eee3c2a
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions scripts/prepublish-checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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`
Expand All @@ -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);

0 comments on commit eee3c2a

Please sign in to comment.