Skip to content

Commit

Permalink
Update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
101arrowz authored Mar 2, 2022
1 parent af6ed42 commit be11ac3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@
"scripts": {
"build": "yarn build:lib",
"script": "node -r ts-node/register scripts/$SC.ts",
"build:lib": "tsc && tsc --project tsconfig.esm.json && yarn build:rewrite && yarn build:umd && yarn rename:mjs",
"build:lib": "tsc && tsc --project tsconfig.esm.json && yarn build:rewrite && yarn build:umd",
"build:umd": "SC=buildUMD yarn script",
"build:rewrite": "SC=rewriteBuilds yarn script",
"rename:mjs": "mv esm/index.js esm/index.mjs",
"prepack": "yarn build"
},
"devDependencies": {
Expand Down
8 changes: 5 additions & 3 deletions scripts/rewriteBuilds.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync, writeFileSync } from 'fs';
import { readFileSync, writeFileSync, unlinkSync } from 'fs';
import { join } from 'path';
const atClass = /\/\*\* \@class \*\//g, pure = '/*#__PURE__*/';

Expand All @@ -9,5 +9,7 @@ writeFileSync(libIndex, readFileSync(libIndex, 'utf-8')
.replace(/exports\.(.*) = void 0;\n/, '')
);

const esmIndex = join(__dirname, '..', 'esm', 'index.js')
writeFileSync(esmIndex, readFileSync(esmIndex, 'utf-8').replace(atClass, pure));
const esm = join(__dirname, '..', 'esm');
const esmIndex = join(esm, 'index.js');
writeFileSync(join(esm, 'index.mjs'), readFileSync(esmIndex, 'utf-8').replace(atClass, pure));
unlinkSync(esmIndex);

0 comments on commit be11ac3

Please sign in to comment.