Commit 79a944b
Changed files (3)
build/index.cjs
@@ -39,11 +39,10 @@ __reExport(index_exports, require("./goods.cjs"), module.exports);
var import_vendor2 = require("./vendor.cjs");
var import_util = require("./util.cjs");
var import_meta = {};
-var VERSION = (() => {
- var _a;
- const f = (file) => import_vendor.fs.readJsonSync(new URL(file, import_meta_url), { throws: false });
- return (_a = f("../package.json") || f("../jsr.json")) == null ? void 0 : _a.version;
-})();
+var _a;
+var VERSION = ((_a = import_vendor.fs.readJsonSync(new URL("../package.json", import_meta_url), {
+ throws: false
+})) == null ? void 0 : _a.version) || URL.parse(import_meta_url).pathname.split("/")[3];
var version = VERSION;
function nothrow(promise) {
return promise.nothrow();
scripts/build-jsr.mjs
@@ -57,10 +57,9 @@ fs.writeFileSync(
'./core': './src/core.ts',
'./cli': './src/cli.ts',
'./globals': './src/globals-jsr.ts',
- './jsr.json': './jsr.json',
},
publish: {
- include: ['src', 'README.md', 'LICENSE', 'jsr.json'],
+ include: ['src', 'README.md', 'LICENSE'],
exclude: ['src/globals.ts'],
},
nodeModulesDir: 'auto',
src/index.ts
@@ -19,11 +19,10 @@ export * from './core.ts'
export * from './goods.ts'
export { minimist, dotenv, fs, YAML, glob, glob as globby } from './vendor.ts'
-export const VERSION: string = (() => {
- const f = (file: string) =>
- fs.readJsonSync(new URL(file, import.meta.url), { throws: false })
- return (f('../package.json') || f('../jsr.json'))?.version
-})()
+export const VERSION: string =
+ fs.readJsonSync(new URL('../package.json', import.meta.url), {
+ throws: false,
+ })?.version || URL.parse(import.meta.url)!.pathname.split('/')[3] // extracts version from JSR url
export const version: string = VERSION