Skip to content

Commit

Permalink
Add a prerelease check for metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
winkerVSbecks committed Mar 23, 2021
1 parent a56bf19 commit 5880f44
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
23 changes: 23 additions & 0 deletions check-metadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/local/bin/node

const chalk = require("chalk");
const packageJson = require("./package.json");

const name = packageJson.name;
const displayName = packageJson.storybook.displayName;

if (name.includes("addon-kit") || displayName.includes("Addon Kit")) {
console.error(
chalk.red.bold`
⚠️ Please configure appropriate metadata before publishing your addon.
`,
chalk.red`
Your package name and/or displayName includes default values from the Addon Kit.
The addon gallery filters out all such addons.
For more info on addon metadata, see: https://storybook.js.org/docs/react/addons/addon-catalog#addon-metadata
`
);

process.exit(1);
}
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"storybook": "start-storybook -p 6006",
"start": "concurrently \"npm run storybook -- --no-manager-cache --quiet\" \"npm run build -- --watch\"",
"build-storybook": "build-storybook",
"prerelease": "node check-metadata.js",
"release": "npm run build && auto shipit"
},
"devDependencies": {
Expand All @@ -36,6 +37,7 @@
"@storybook/react": "^6.1.14",
"auto": "^10.3.0",
"babel-loader": "^8.1.0",
"chalk": "^2.4.2",
"concurrently": "^5.3.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
Expand Down

0 comments on commit 5880f44

Please sign in to comment.