Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(bundles): Stop publishing CDN bundles on npm #4901

Merged
merged 3 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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