Skip to content

Commit

Permalink
fix(npm): include the proper files in the npm tarball (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
favna authored Apr 9, 2024
1 parent 3b74254 commit 800c896
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ jobs:
yarn install
yarn build
cp ../../README.md .
cp ../../CHANGELOG.md .
if [ ${{ contains(github.ref, '-') }} = "true" ]; then
yarn npm publish --tag rc
else
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,45 @@ jobs:
printf "Checking MSRV for $package..."
cargo msrv --output-format json --path "$package" verify | tail -n 1 | jq --exit-status '.success'
done
tarball:
name: Check NodeJS tarball
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- name: Validate the files in the tarball
shell: bash
working-directory: npm/git-cliff
run: |
yarn install
yarn build
cp ../../README.md .
cp ../../CHANGELOG.md .
files_expected_in_tarball=(
"CHANGELOG.md"
"README.md"
"lib/cjs/index.cjs"
"lib/cjs/index.cjs.map"
"lib/cjs/index.d.cts"
"lib/cli/cli.js"
"lib/esm/index.d.ts"
"lib/esm/index.js"
"lib/esm/index.js.map"
"package.json"
)
tarball_output=$(yarn pack --dry-run)
for file in "${files_expected_in_tarball[@]}"; do
if [[ ! "$tarball_output" == *"$file"* ]]; then
echo "Error: Expected file '$file' not found in tarball."
exit 1
fi
done
3 changes: 3 additions & 0 deletions npm/git-cliff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
}
}
},
"files": [
"lib"
],
"scripts": {
"typecheck": "tsc",
"lint": "eslint .",
Expand Down
48 changes: 24 additions & 24 deletions npm/git-cliff/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1371,44 +1371,44 @@ __metadata:
languageName: node
linkType: hard

"git-cliff-darwin-arm64@npm:2.1.0-rc.0":
version: 2.1.0-rc.0
resolution: "git-cliff-darwin-arm64@npm:2.1.0-rc.0"
"git-cliff-darwin-arm64@npm:2.2.0":
version: 2.2.0
resolution: "git-cliff-darwin-arm64@npm:2.2.0"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"git-cliff-darwin-x64@npm:2.1.0-rc.0":
version: 2.1.0-rc.0
resolution: "git-cliff-darwin-x64@npm:2.1.0-rc.0"
"git-cliff-darwin-x64@npm:2.2.0":
version: 2.2.0
resolution: "git-cliff-darwin-x64@npm:2.2.0"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"git-cliff-linux-arm64@npm:2.1.0-rc.0":
version: 2.1.0-rc.0
resolution: "git-cliff-linux-arm64@npm:2.1.0-rc.0"
"git-cliff-linux-arm64@npm:2.2.0":
version: 2.2.0
resolution: "git-cliff-linux-arm64@npm:2.2.0"
conditions: os=linux & cpu=arm64
languageName: node
linkType: hard

"git-cliff-linux-x64@npm:2.1.0-rc.0":
version: 2.1.0-rc.0
resolution: "git-cliff-linux-x64@npm:2.1.0-rc.0"
"git-cliff-linux-x64@npm:2.2.0":
version: 2.2.0
resolution: "git-cliff-linux-x64@npm:2.2.0"
conditions: os=linux & cpu=x64
languageName: node
linkType: hard

"git-cliff-windows-arm64@npm:2.1.0-rc.0":
version: 2.1.0-rc.0
resolution: "git-cliff-windows-arm64@npm:2.1.0-rc.0"
"git-cliff-windows-arm64@npm:2.2.0":
version: 2.2.0
resolution: "git-cliff-windows-arm64@npm:2.2.0"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"git-cliff-windows-x64@npm:2.1.0-rc.0":
version: 2.1.0-rc.0
resolution: "git-cliff-windows-x64@npm:2.1.0-rc.0"
"git-cliff-windows-x64@npm:2.2.0":
version: 2.2.0
resolution: "git-cliff-windows-x64@npm:2.2.0"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
Expand All @@ -1422,12 +1422,12 @@ __metadata:
"@typescript-eslint/parser": "npm:^7.1.0"
eslint: "npm:^8.57.0"
execa: "npm:^8.0.1"
git-cliff-darwin-arm64: "npm:2.1.0-rc.0"
git-cliff-darwin-x64: "npm:2.1.0-rc.0"
git-cliff-linux-arm64: "npm:2.1.0-rc.0"
git-cliff-linux-x64: "npm:2.1.0-rc.0"
git-cliff-windows-arm64: "npm:2.1.0-rc.0"
git-cliff-windows-x64: "npm:2.1.0-rc.0"
git-cliff-darwin-arm64: "npm:2.2.0"
git-cliff-darwin-x64: "npm:2.2.0"
git-cliff-linux-arm64: "npm:2.2.0"
git-cliff-linux-x64: "npm:2.2.0"
git-cliff-windows-arm64: "npm:2.2.0"
git-cliff-windows-x64: "npm:2.2.0"
tsup: "npm:^8.0.2"
typescript: "npm:^5.3.3"
dependenciesMeta:
Expand Down
1 change: 1 addition & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ msg="# managed by release.sh"
sed -E -i "s/^version = .* $msg$/version = \"${1#v}\" $msg/" git-cliff*/Cargo.toml
sed -E -i "s/\"version\": \".+\"/\"version\": \"${1#v}\"/" npm/git-cliff/package.json
sed -E -i "s/\"(git-cliff-.+)\": \".+\"/\"\1\": \"${1#v}\"/g" npm/git-cliff/package.json
pushd npm/git-cliff && yarn install && popd
# update the changelog
cargo run -- --config cliff.toml --tag "$1" >CHANGELOG.md
git add -A && git commit -m "chore(release): prepare for $1"
Expand Down

0 comments on commit 800c896

Please sign in to comment.