Skip to content

Commit

Permalink
build: remove test:pack test
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Jan 9, 2025
1 parent 0a26361 commit 9f5b888
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 137 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ jobs:
- run: npm ci
- run: npm run test
- run: npm run test:node
- run: npm run test:pack
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx --no-install lint-staged
npm test
85 changes: 14 additions & 71 deletions examples/benchmark/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"build": "true",
"start": "npm run build && npx http-server . -o",
"pretest": "HUSKY=0 npm install",
"test": "node node.js"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "rm -rf dist && rollup -c",
"build": "npm install && rm -rf dist && rollup -c",
"start": "npm run build && npx http-server . -o"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "rm -rf dist && webpack",
"build": "npm install && rm -rf dist && webpack",
"start": "npm run build && npx http-server . -o"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/node-commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"pretest": "npm install",
"test": "node example.js"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/node-esmodules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"test:package": "( node --version | grep -vq 'v16' ) || ( node --experimental-json-modules package.mjs )",
"test:example": "node example.mjs",
"pretest": "npm install",
"test": "npm-run-all test:*"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/node-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"pretest": "npm install",
"test": "jest"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/node-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"build": "rm -rf dist && webpack",
"pretest": "npm install",
"test": "npm run build && node dist/v1.js && node dist/v4.js && node dist/v7.js && node dist/all.js"
},
"dependencies": {
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,26 @@
"docs": "npm run build && npx runmd --output=README.md README_js.md",
"eslint:check": "eslint src/ test/ examples/ *.[jt]s",
"eslint:fix": "eslint --fix src/ test/ examples/ *.[jt]s",
"examples:browser:rollup:build": "cd examples/browser-rollup && npm install && npm run build",
"examples:browser:webpack:build": "cd examples/browser-webpack && npm install && npm run build",
"examples:node:commonjs:test": "cd examples/node-commonjs && npm install && npm test",
"examples:node:esmodules:test": "cd examples/node-esmodules && npm install && npm test",
"examples:node:jest:test": "cd examples/node-jest && npm install && npm test",
"examples:browser:rollup:build": "cd examples/browser-rollup && npm run build",
"examples:browser:webpack:build": "cd examples/browser-webpack && npm run build",
"examples:node:commonjs:test": "cd examples/node-commonjs && npm test",
"examples:node:esmodules:test": "cd examples/node-esmodules && npm test",
"examples:node:jest:test": "cd examples/node-jest && npm test",
"lint": "npm run eslint:check && npm run prettier:check",
"md": "runmd --watch --output=README.md README_js.md",
"prepack": "npm run build",
"prepack": "npm run build -- --no-pack",
"prepare": "husky",
"prepublishOnly": "npm run build",
"pretest:benchmark": "npm run build",
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all --parallel examples:browser:**",
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all examples:browser:**",
"pretest:node": "npm run build",
"pretest": "npm run build",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"release": "standard-version --no-verify",
"test:benchmark": "cd examples/benchmark && HUSKY=0 npm install && npm test",
"test:benchmark": "cd examples/benchmark && npm test",
"test:browser": "wdio run ./wdio.conf.js",
"test:node": "npm-run-all --parallel examples:node:**",
"test:pack": "./scripts/testpack.sh",
"test:node": "npm-run-all examples:node:**",
"test:watch": "node --test --enable-source-maps --watch dist/esm/test/*.js",
"test": "node --test --enable-source-maps dist/esm/test/*.js"
},
Expand Down
41 changes: 22 additions & 19 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,29 @@ DIST_DIR="$ROOT/dist"
rm -rf "$DIST_DIR"
mkdir -p "$DIST_DIR"

# Prep build products dir (where we stick npm tarballs)
BUILD_DIR="$ROOT/.build"
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"

# Build each module type
for MODULE_TYPE in esm cjs; do
echo "Building ${MODULE_TYPE}"

MODULE_DIST_DIR="$DIST_DIR/${MODULE_TYPE}"
BROWSER_DIR="$DIST_DIR/${MODULE_TYPE}-browser"
NODE_DIST_DIR="$DIST_DIR/${MODULE_TYPE}"
BROWSER_DIST_DIR="$DIST_DIR/${MODULE_TYPE}-browser"

tsc -p tsconfig.${MODULE_TYPE}.json

# Clone files for browser builds
cp -pr ${MODULE_DIST_DIR} ${BROWSER_DIR}
cp -pr ${NODE_DIST_DIR} ${BROWSER_DIST_DIR}

# Remove browser files from non-browser builds
for FILE in ${MODULE_DIST_DIR}/*-browser*;do
for FILE in ${NODE_DIST_DIR}/*-browser*;do
rm -f $FILE
done

# Move browser files into place for browser builds
(
# Temporarily cd into BROWSER_DIR to avoid having to deal with "-browser"
# appearing in both the dir name and file name of FILE's full path
cd ${BROWSER_DIR}
# Temporarily cd into BROWSER_DIST_DIR to avoid having to deal with
# "-browser" appearing in both the dir name and file name of FILE's full
# path
cd ${BROWSER_DIST_DIR}

for FILE in *-browser*;do
mv $FILE ${FILE/-browser/}
Expand All @@ -56,17 +52,24 @@ for MODULE_TYPE in esm cjs; do
# esm/cjs-specific logic
if [ "$MODULE_TYPE" = "esm" ]; then
# ESM: copy bin files to dist
cp -pr "$DIST_DIR/../src/bin" "$MODULE_DIST_DIR"
cp -pr "$DIST_DIR/../src/bin" "$NODE_DIST_DIR"
else
# CJS: Add package.json that specifies type: commonjs
echo "{\"type\":\"commonjs\"}" > "$MODULE_DIST_DIR/package.json"
echo "{\"type\":\"commonjs\"}" > "$BROWSER_DIR/package.json"
echo "{\"type\":\"commonjs\"}" > "$NODE_DIST_DIR/package.json"
echo "{\"type\":\"commonjs\"}" > "$BROWSER_DIST_DIR/package.json"
fi
done

# Create tarball for local installation (in tests and examples)
echo "Packing tarball"
npm pack --ignore-scripts --pack-destination "$BUILD_DIR" > /dev/null 2>&1
mv $BUILD_DIR/*.tgz $BUILD_DIR/uuid.tgz
if [ "${1-}" != "--no-pack" ]; then
# Prep tarball dir
BUILD_DIR="$ROOT/.build"
mkdir -p "$BUILD_DIR"
rm -rf "$BUILD_DIR/uuid-*.tgz"

# Create tarball for local installation (in tests and examples)
echo "Packing tarball"
npm pack --pack-destination "$BUILD_DIR" > /dev/null 2>&1
mv $BUILD_DIR/uuid-*.tgz $BUILD_DIR/uuid.tgz
fi

echo "-- fin --"
33 changes: 0 additions & 33 deletions scripts/testpack.sh

This file was deleted.

0 comments on commit 9f5b888

Please sign in to comment.