Skip to content

Commit

Permalink
Merge pull request #37 from nats-io/version-checks
Browse files Browse the repository at this point in the history
Added version generation/check
  • Loading branch information
aricart authored Jun 11, 2024
2 parents 4cf5147 + ab021cf commit d66cf7a
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 6 deletions.
12 changes: 12 additions & 0 deletions bin/generate_version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import npmConfig from '../package.json' with {type: "json"};
import jsrConfig from "../jsr.json" with {type: "json"};

if(npmConfig.version !== jsrConfig.version) {
throw new Error(`unmatched versions - npm: ${npmConfig.version} jsr: ${jsrConfig.version}`);
}

const v = npmConfig.version

Deno.writeTextFileSync("./src/version.ts", `
// this file is autogenerated - do not edit
export const version = "${v}";`, {create: true});
35 changes: 35 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nats-io/nkeys",
"version": "1.2.0-3",
"version": "1.2.0-4",
"exports": {
".": "./modules/esm/mod.ts"
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nkeys.js",
"version": "1.2.0-3",
"version": "1.2.0-4",
"description": "A public-key signature system based on Ed25519 for the NATS ecosystem in javascript",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -9,8 +9,8 @@
"clean": "rm -Rf build/ lib/ nkeys.d.ts nkeys.mjs ./coverage",
"fmt": "deno fmt src/ examples/ modules/ test/ node_test/",
"cjs": "deno run --allow-all bin/cjs-fix-imports.ts -o build/ src/ modules/cjs/ node_test/",
"generate": "deno run -A ./bin/tweetnacl-esm.ts",
"stage": "npm run init && npm run cjs && npm run generate && tsc",
"generate": "deno run -A bin/generate_version.ts && deno run -A ./bin/tweetnacl-esm.ts",
"stage": "npm run init && npm run generate && npm run cjs && tsc",
"prepare": "npm run clean && npm run stage && npm run generate && deno bundle modules/esm/mod.ts nkeys.mjs",
"test": "npm run clean && npm run prepare && node --test && deno test -A test/",
"cover": "npm run clean && npm run prepare && deno test --coverage=coverage -A test/ && deno coverage ./coverage --lcov > ./coverage/out.lcov && genhtml -o ./coverage/html ./coverage/out.lcov && open ./coverage/html/index.html",
Expand Down
2 changes: 2 additions & 0 deletions src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export {
} from "./nkeys.ts";

export { decode, encode } from "./util.ts";

export { version } from "./version.ts";
2 changes: 2 additions & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// this file is autogenerated - do not edit
export const version = "1.2.0-4";

0 comments on commit d66cf7a

Please sign in to comment.