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 3d48289
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 46 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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"test:benchmark": "cd examples/benchmark && HUSKY=0 npm install && npm test",
"test:browser": "wdio run ./wdio.conf.js",
"test:node": "npm-run-all --parallel examples:node:**",
"test:pack": "./scripts/testpack.sh",
"test:watch": "node --test --enable-source-maps --watch dist/esm/test/*.js",
"test": "node --test --enable-source-maps dist/esm/test/*.js"
},
Expand Down
23 changes: 12 additions & 11 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@ mkdir -p "$BUILD_DIR"
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 +57,17 @@ 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
npm pack --ignore-scripts --pack-destination "$BUILD_DIR"
mv $BUILD_DIR/*.tgz $BUILD_DIR/uuid.tgz

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

This file was deleted.

0 comments on commit 3d48289

Please sign in to comment.