Skip to content

Commit

Permalink
chore: remove "type" key from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
lebmouse committed Aug 13, 2024
1 parent 9230130 commit 4167592
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"private": false,
"version": "0.0.31",
"packageManager": "[email protected]",
"type": "module",
"exports": {
".": {
"require": "./dist/index.js",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -117,4 +117,4 @@
"eslint --fix"
]
}
}
}
25 changes: 25 additions & 0 deletions tools/removePacakgeType.cjs
Original file line number Diff line number Diff line change
@@ -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.');
});
});

0 comments on commit 4167592

Please sign in to comment.