Skip to content

Commit

Permalink
[CI] npm bundle check
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Nov 14, 2023
1 parent fbfd1f1 commit 321b72b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
32 changes: 32 additions & 0 deletions bin/check-bundle-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2021 The NATS Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
let tag = Deno.env.get("RELEASE_VERSION");
const pkg = await Deno.readTextFile("package.json");
const m = JSON.parse(pkg);
if(tag) {
if(tag.startsWith("v")) {
tag = tag.substring(1);
}
if(m.version !== tag) {
console.error(`[ERROR] expected RELEASE_VERSION and package versions to match ${tag} !== ${m.version}`);
Deno.exit(1);
}
console.log(`[OK] RELEASE_VERSION and package versions match ${tag}`);
} else {
console.log(`[SKIP] tag check`);
}


Deno.exit(0);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"test": "npm run prepare && ava --verbose && deno test -A --unstable test/",
"doc": "npm run clean && rm -Rf docs && npm run stage && node_modules/.bin/typedoc --out docs/ && touch ./docs/.nojekyll",
"bump-qualifier": "npm version prerelease --no-commit-hooks --no-git-tag-version",
"bump-release": "npm version patch --no-commit-hooks --no-git-tag-version"
"bump-release": "npm version patch --no-commit-hooks --no-git-tag-version",
"check-package": "deno run --allow-all bin/check-bundle-version.ts"
},
"engines": {
"node": ">=10.0.0"
Expand Down

0 comments on commit 321b72b

Please sign in to comment.