diff --git a/.github/workflows/package-tag-publish.yml b/.github/workflows/package-tag-publish.yml index 307ed79..f41ba30 100644 --- a/.github/workflows/package-tag-publish.yml +++ b/.github/workflows/package-tag-publish.yml @@ -46,7 +46,8 @@ jobs: env: TAG_NAME: ${{ steps.tag-meta.outputs.BRANCH_SLUG }}-${{ steps.tag-meta.outputs.TIME }} run: | - rm -rf src .husky .github .storybook .prettierrc .eslint.config.js pnpm-lock.yaml vercel.json vite.config.js tsconfig.json tsconfig.build.json tsconfig.node.json + node ./tools/removePacakgeType.cjs + rm -rf tools src .husky .github .storybook .prettierrc .eslint.config.js pnpm-lock.yaml vercel.json vite.config.js tsconfig.json tsconfig.build.json tsconfig.node.json git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" CURRENT_VERSION=$(pnpm pkg get version | tr -d '"') diff --git a/package.json b/package.json index b388f36..fe6f5f2 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,8 @@ "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", "icongen": "svgr --out-dir ./src/icon/generated-default --index-template ./tools/svgrIndexTemplate.cjs -- ./src/icon/assets", - "prepare": "husky && panda codegen" + "prepare": "husky && panda codegen", + "prepublishOnly": "node tools/removePacakgeType.cjs" }, "dependencies": { "date-fns": "3.3.1", diff --git a/tools/removePacakgeType.cjs b/tools/removePacakgeType.cjs new file mode 100644 index 0000000..07c77c4 --- /dev/null +++ b/tools/removePacakgeType.cjs @@ -0,0 +1,25 @@ +/* eslint-disable no-undef */ +/* eslint-disable @typescript-eslint/no-var-requires */ +// app-router로 마이그레이션하면 제거될 코드입니디. +const fs = require('fs'); +const path = require('path'); + +const packagePath = path.resolve(__dirname, '..', 'package.json'); + +fs.readFile(packagePath, 'utf8', (err, data) => { + if (err) { + console.error(err); + return; + } + + const packageJson = JSON.parse(data); + delete packageJson.type; + + fs.writeFile(packagePath, JSON.stringify(packageJson, null, 2), 'utf8', err => { + if (err) { + console.error(err); + return; + } + console.log('The "type" key has been removed from the package.json file.'); + }); +});