Skip to content

Commit bf6ce5f

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

File tree

5 files changed

+20
-51
lines changed

5 files changed

+20
-51
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

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

+17-14
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,25 @@ mkdir -p "$BUILD_DIR"
2929
for MODULE_TYPE in esm cjs; do
3030
echo "Building ${MODULE_TYPE}"
3131

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

3535
tsc -p tsconfig.${MODULE_TYPE}.json
3636

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

4040
# Remove browser files from non-browser builds
41-
for FILE in ${MODULE_DIST_DIR}/*-browser*;do
41+
for FILE in ${NODE_DIST_DIR}/*-browser*;do
4242
rm -f $FILE
4343
done
4444

4545
# Move browser files into place for browser builds
4646
(
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}
47+
# Temporarily cd into BROWSER_DIST_DIR to avoid having to deal with
48+
# "-browser" appearing in both the dir name and file name of FILE's full
49+
# path
50+
cd ${BROWSER_DIST_DIR}
5051

5152
for FILE in *-browser*;do
5253
mv $FILE ${FILE/-browser/}
@@ -56,17 +57,19 @@ for MODULE_TYPE in esm cjs; do
5657
# esm/cjs-specific logic
5758
if [ "$MODULE_TYPE" = "esm" ]; then
5859
# ESM: copy bin files to dist
59-
cp -pr "$DIST_DIR/../src/bin" "$MODULE_DIST_DIR"
60+
cp -pr "$DIST_DIR/../src/bin" "$NODE_DIST_DIR"
6061
else
6162
# 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"
63+
echo "{\"type\":\"commonjs\"}" > "$NODE_DIST_DIR/package.json"
64+
echo "{\"type\":\"commonjs\"}" > "$BROWSER_DIST_DIR/package.json"
6465
fi
6566
done
6667

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
68+
if [ "${1-}" != "--no-pack" ]; then
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/*.tgz $BUILD_DIR/uuid.tgz
73+
fi
7174

7275
echo "-- fin --"

scripts/testpack.sh

-33
This file was deleted.

0 commit comments

Comments
 (0)