Skip to content

Commit 088f902

Browse files
committed
build: remove test:pack test
1 parent 0a26361 commit 088f902

File tree

6 files changed

+39
-127
lines changed

6 files changed

+39
-127
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,3 @@ jobs:
3535
- run: npm ci
3636
- run: npm run test
3737
- run: npm run test:node
38-
- run: npm run test:pack

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
npx --no-install lint-staged
1+
npm test

examples/benchmark/package-lock.json

+14-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@
9494
"examples:node:jest:test": "cd examples/node-jest && npm install && npm test",
9595
"lint": "npm run eslint:check && npm run prettier:check",
9696
"md": "runmd --watch --output=README.md README_js.md",
97-
"prepack": "npm run build",
97+
"prepack": "npm run build -- --no-pack",
9898
"prepare": "husky",
99+
"prepublishOnly": "npm run build",
99100
"pretest:benchmark": "npm run build",
100101
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all --parallel examples:browser:**",
101102
"pretest:node": "npm run build",
@@ -106,7 +107,6 @@
106107
"test:benchmark": "cd examples/benchmark && HUSKY=0 npm install && npm test",
107108
"test:browser": "wdio run ./wdio.conf.js",
108109
"test:node": "npm-run-all --parallel examples:node:**",
109-
"test:pack": "./scripts/testpack.sh",
110110
"test:watch": "node --test --enable-source-maps --watch dist/esm/test/*.js",
111111
"test": "node --test --enable-source-maps dist/esm/test/*.js"
112112
},

scripts/build.sh

+22-19
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,29 @@ DIST_DIR="$ROOT/dist"
2020
rm -rf "$DIST_DIR"
2121
mkdir -p "$DIST_DIR"
2222

23-
# Prep build products dir (where we stick npm tarballs)
24-
BUILD_DIR="$ROOT/.build"
25-
rm -rf "$BUILD_DIR"
26-
mkdir -p "$BUILD_DIR"
27-
2823
# Build each module type
2924
for MODULE_TYPE in esm cjs; do
3025
echo "Building ${MODULE_TYPE}"
3126

32-
MODULE_DIST_DIR="$DIST_DIR/${MODULE_TYPE}"
33-
BROWSER_DIR="$DIST_DIR/${MODULE_TYPE}-browser"
27+
NODE_DIST_DIR="$DIST_DIR/${MODULE_TYPE}"
28+
BROWSER_DIST_DIR="$DIST_DIR/${MODULE_TYPE}-browser"
3429

3530
tsc -p tsconfig.${MODULE_TYPE}.json
3631

3732
# Clone files for browser builds
38-
cp -pr ${MODULE_DIST_DIR} ${BROWSER_DIR}
33+
cp -pr ${NODE_DIST_DIR} ${BROWSER_DIST_DIR}
3934

4035
# Remove browser files from non-browser builds
41-
for FILE in ${MODULE_DIST_DIR}/*-browser*;do
36+
for FILE in ${NODE_DIST_DIR}/*-browser*;do
4237
rm -f $FILE
4338
done
4439

4540
# Move browser files into place for browser builds
4641
(
47-
# Temporarily cd into BROWSER_DIR to avoid having to deal with "-browser"
48-
# appearing in both the dir name and file name of FILE's full path
49-
cd ${BROWSER_DIR}
42+
# Temporarily cd into BROWSER_DIST_DIR to avoid having to deal with
43+
# "-browser" appearing in both the dir name and file name of FILE's full
44+
# path
45+
cd ${BROWSER_DIST_DIR}
5046

5147
for FILE in *-browser*;do
5248
mv $FILE ${FILE/-browser/}
@@ -56,17 +52,24 @@ for MODULE_TYPE in esm cjs; do
5652
# esm/cjs-specific logic
5753
if [ "$MODULE_TYPE" = "esm" ]; then
5854
# ESM: copy bin files to dist
59-
cp -pr "$DIST_DIR/../src/bin" "$MODULE_DIST_DIR"
55+
cp -pr "$DIST_DIR/../src/bin" "$NODE_DIST_DIR"
6056
else
6157
# CJS: Add package.json that specifies type: commonjs
62-
echo "{\"type\":\"commonjs\"}" > "$MODULE_DIST_DIR/package.json"
63-
echo "{\"type\":\"commonjs\"}" > "$BROWSER_DIR/package.json"
58+
echo "{\"type\":\"commonjs\"}" > "$NODE_DIST_DIR/package.json"
59+
echo "{\"type\":\"commonjs\"}" > "$BROWSER_DIST_DIR/package.json"
6460
fi
6561
done
6662

67-
# Create tarball for local installation (in tests and examples)
68-
echo "Packing tarball"
69-
npm pack --ignore-scripts --pack-destination "$BUILD_DIR" > /dev/null 2>&1
70-
mv $BUILD_DIR/*.tgz $BUILD_DIR/uuid.tgz
63+
if [ "${1-}" != "--no-pack" ]; then
64+
# Prep tarball dir
65+
BUILD_DIR="$ROOT/.build"
66+
mkdir -p "$BUILD_DIR"
67+
rm -rf "$BUILD_DIR/uuid-*.tgz"
68+
69+
# Create tarball for local installation (in tests and examples)
70+
echo "Packing tarball"
71+
npm pack --pack-destination "$BUILD_DIR" > /dev/null 2>&1
72+
mv $BUILD_DIR/uuid-*.tgz $BUILD_DIR/uuid.tgz
73+
fi
7174

7275
echo "-- fin --"

scripts/testpack.sh

-33
This file was deleted.

0 commit comments

Comments
 (0)