diff --git a/package.json b/package.json index b388f36e..eff5bc7e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "private": false, "version": "0.0.31", "packageManager": "pnpm@8.15.4", - "type": "module", "exports": { ".": { "require": "./dist/index.js", @@ -51,7 +50,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", @@ -117,4 +117,4 @@ "eslint --fix" ] } -} +} \ No newline at end of file diff --git a/tools/removePacakgeType.cjs b/tools/removePacakgeType.cjs new file mode 100644 index 00000000..78e2dba5 --- /dev/null +++ b/tools/removePacakgeType.cjs @@ -0,0 +1,25 @@ +/* eslint-disable no-undef */ +/* eslint-disable @typescript-eslint/no-var-requires */ + +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.'); + }); +});