Skip to content

Commit

Permalink
build(bundles): Stop publishing CDN bundles on npm (#4901)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored and Lms24 committed Apr 26, 2022
1 parent 38d6416 commit 67dd1a6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
3 changes: 0 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

*

# TODO remove bundles (which in the tarball are inside `build`) in v7
!/build/**/*

!/dist/**/*
!/esm/**/*
!/types/**/*
2 changes: 1 addition & 1 deletion packages/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
"build:esm:watch": "tsc -p tsconfig.esm.json --watch",
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:npm": "ts-node ../../scripts/prepack.ts --bundles --skipBundleCopy && npm pack ./build/npm",
"build:npm": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage *.js.map *.d.ts",
"fix": "run-s fix:eslint fix:prettier",
Expand Down
21 changes: 0 additions & 21 deletions scripts/prepack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import * as fs from 'fs';
import * as fse from 'fs-extra';
import * as path from 'path';

const NPM_BUILD_DIR = 'build/npm';
Expand Down Expand Up @@ -49,26 +48,6 @@ ASSETS.forEach(asset => {
}
});

// TODO remove in v7! Until then:
// copy CDN bundles into npm dir to temporarily keep bundles in npm tarball
// inside the tarball, they are located in `build/`
// for now, copy it by default, unless explicitly forbidden via an command line arg
const tmpCopyBundles = packageWithBundles && !process.argv.includes('--skipBundleCopy');
if (tmpCopyBundles) {
const npmTmpBundlesPath = path.resolve(buildDir, 'build');
const cdnBundlesPath = path.resolve('build', 'bundles');
try {
if (!fs.existsSync(npmTmpBundlesPath)) {
fs.mkdirSync(npmTmpBundlesPath);
}
void fse.copy(cdnBundlesPath, npmTmpBundlesPath);
} catch (error) {
console.error(`Error while tmp copying CDN bundles to ${buildDir}`);
process.exit(1);
}
}
// end remove

// package.json modifications
const packageJsonPath = path.resolve(buildDir, 'package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand Down

0 comments on commit 67dd1a6

Please sign in to comment.