diff --git a/script/build.js b/script/build.js index 97ef480d..ef831bfe 100644 --- a/script/build.js +++ b/script/build.js @@ -46,6 +46,6 @@ build({ target: "es2020", bundle: true, sourcemap: true, - banner: { js: `const version = "${version}";\n` }, + define: { WEBAUTHN_JSON_VERSION: JSON.stringify(version) }, outfile: "dist/bin/main.js", }); diff --git a/src/bin/main.ts b/src/bin/main.ts index 902f70f7..dbbe9573 100755 --- a/src/bin/main.ts +++ b/src/bin/main.ts @@ -1,13 +1,13 @@ /* tslint:disable:no-console no-var-requires */ -declare const version: string; +declare const WEBAUTHN_JSON_VERSION: string; import { schema } from "../webauthn-json"; const help = `Usage: ${process.argv[1]} schema`; const command = process.argv[2]; if (command === "schema") { - const schemaWithVersion = { ...schema, version }; + const schemaWithVersion = { ...schema, version: WEBAUTHN_JSON_VERSION }; console.log(JSON.stringify(schemaWithVersion, null, " ")); } else { console.log(help);