From 403f2b1fcfc11f24834c4e0ae0afb4683569680e Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Thu, 6 Jan 2022 15:44:13 +0100 Subject: [PATCH] remove unnecessary scripts --- package.json | 2 -- scripts/eject-typescript.mjs | 30 ------------------- scripts/prepublish-checks.mjs | 56 ----------------------------------- 3 files changed, 88 deletions(-) delete mode 100644 scripts/eject-typescript.mjs delete mode 100644 scripts/prepublish-checks.mjs diff --git a/package.json b/package.json index 54a8f1a3..e5bbe7ea 100644 --- a/package.json +++ b/package.json @@ -42,9 +42,7 @@ "storybook": "start-storybook -p 6006", "start": "concurrently \"yarn build:watch\" \"yarn storybook -- --no-manager-cache --quiet\"", "build-storybook": "build-storybook", - "prerelease": "zx scripts/prepublish-checks.mjs", "release": "yarn build && auto shipit", - "eject-ts": "zx scripts/eject-typescript.mjs", "test-storybook:jsdom": "jest --no-cache --config ./jsdom-jest.config.js -i", "test-storybook:playwright": "jest --no-cache --config ./test-runner-jest.config.js" }, diff --git a/scripts/eject-typescript.mjs b/scripts/eject-typescript.mjs deleted file mode 100644 index c9edb47e..00000000 --- a/scripts/eject-typescript.mjs +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env zx - -// Copy TS files and delete src -await $`cp -r ./src ./srcTS`; -await $`rm -rf ./src`; -await $`mkdir ./src`; - -// Convert TS code to JS -await $`babel --no-babelrc --presets @babel/preset-typescript ./srcTS -d ./src --extensions \".js,.jsx,.ts,.tsx\" --ignore "./srcTS/typings.d.ts"`; - -// Format the newly created .js files -await $`prettier --write ./src`; - -// Add in minimal files required for the TS build setup -await $`touch ./src/dummy.ts`; -await $`printf "export {};" >> ./src/dummy.ts`; - -await $`touch ./src/typings.d.ts`; -await $`printf 'declare module "global";' >> ./src/typings.d.ts`; - -// Clean up -await $`rm -rf ./srcTS`; - -console.log( - chalk.green.bold` -TypeScript Ejection complete!`, - chalk.green` -Addon code converted with JS. The TypeScript build setup is still available in case you want to adopt TypeScript in the future. -` -); diff --git a/scripts/prepublish-checks.mjs b/scripts/prepublish-checks.mjs deleted file mode 100644 index c53f3c06..00000000 --- a/scripts/prepublish-checks.mjs +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env zx - -const packageJson = require("../package.json"); -const boxen = require("boxen"); -const dedent = require("dedent"); - -const name = packageJson.name; -const displayName = packageJson.storybook.displayName; - -let exitCode = 0; -$.verbose = false; - -/** - * Check that meta data has been updated - */ -if (name.includes("addon-kit") || displayName.includes("Addon Kit")) { - console.error( - boxen( - dedent` - ${chalk.red.bold("Missing metadata")} - - ${chalk.red(dedent`Your package name and/or displayName includes default values from the Addon Kit. - The addon gallery filters out all such addons. - - 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" } - ) - ); - - exitCode = 1; -} - -/** - * Check that README has been updated - */ -const readmeTestStrings = - "# Storybook Addon Kit|Click the \\*\\*Use this template\\*\\* button to get started.|https://user-images.githubusercontent.com/42671/106809879-35b32000-663a-11eb-9cdc-89f178b5273f.gif"; - -if ((await $`cat README.md | grep -E ${readmeTestStrings}`.exitCode) == 0) { - console.error( - boxen( - dedent` - ${chalk.red.bold("README not updated")} - - ${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" } - ) - ); - - exitCode = 1; -} - -process.exit(exitCode);