@venn-lang/cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +28 -7
- package/package.json +12 -12
- package/src/upgrade/version.ts +25 -7
package/dist/cli.mjs
CHANGED
|
@@ -9462,9 +9462,9 @@ function addNoneTerminalToCst(node, ruleName, ruleResult) {
|
|
|
9462
9462
|
}
|
|
9463
9463
|
//#endregion
|
|
9464
9464
|
//#region ../../node_modules/.pnpm/chevrotain@12.0.0/node_modules/chevrotain/lib/src/lang/lang_extensions.js
|
|
9465
|
-
const NAME = "name";
|
|
9465
|
+
const NAME$1 = "name";
|
|
9466
9466
|
function defineNameProp(obj, nameValue) {
|
|
9467
|
-
Object.defineProperty(obj, NAME, {
|
|
9467
|
+
Object.defineProperty(obj, NAME$1, {
|
|
9468
9468
|
enumerable: false,
|
|
9469
9469
|
configurable: true,
|
|
9470
9470
|
writable: false,
|
|
@@ -55970,20 +55970,41 @@ function isPlugin(value) {
|
|
|
55970
55970
|
}
|
|
55971
55971
|
//#endregion
|
|
55972
55972
|
//#region src/upgrade/version.ts
|
|
55973
|
+
/** The manifest to accept, so a neighbour's is never read by mistake. */
|
|
55974
|
+
const NAME = "@venn-lang/cli";
|
|
55975
|
+
/** Where the manifest sits relative to this file, in a release and in the tree. */
|
|
55976
|
+
const CANDIDATES = [
|
|
55977
|
+
"../package.json",
|
|
55978
|
+
"../../package.json",
|
|
55979
|
+
"../../../package.json"
|
|
55980
|
+
];
|
|
55973
55981
|
/**
|
|
55974
55982
|
* The version of the CLI that is running.
|
|
55975
55983
|
*
|
|
55976
55984
|
* Read from the package manifest rather than written into the source, so a
|
|
55977
|
-
* release cannot ship a binary that reports the version before it.
|
|
55978
|
-
*
|
|
55979
|
-
*
|
|
55985
|
+
* release cannot ship a binary that reports the version before it.
|
|
55986
|
+
*
|
|
55987
|
+
* The path is searched rather than assumed. The bundle flattens
|
|
55988
|
+
* `src/upgrade/version.ts` into `dist/cli.mjs`, so the manifest is two levels up
|
|
55989
|
+
* while developing and one in a release; assuming either one reports `0.0.0` to
|
|
55990
|
+
* everybody living with the other, and the name check keeps the search from
|
|
55991
|
+
* settling on some other package's manifest on the way up.
|
|
55980
55992
|
*/
|
|
55981
55993
|
const VERSION = read();
|
|
55982
55994
|
function read() {
|
|
55995
|
+
const require = createRequire(import.meta.url);
|
|
55996
|
+
for (const path of CANDIDATES) {
|
|
55997
|
+
const version = versionAt(require, path);
|
|
55998
|
+
if (version) return version;
|
|
55999
|
+
}
|
|
56000
|
+
return "0.0.0";
|
|
56001
|
+
}
|
|
56002
|
+
function versionAt(require, path) {
|
|
55983
56003
|
try {
|
|
55984
|
-
|
|
56004
|
+
const manifest = require(path);
|
|
56005
|
+
return manifest.name === NAME ? manifest.version : void 0;
|
|
55985
56006
|
} catch {
|
|
55986
|
-
return
|
|
56007
|
+
return;
|
|
55987
56008
|
}
|
|
55988
56009
|
}
|
|
55989
56010
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venn-lang/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The venn binary: one command for starting, checking, running and testing a Venn project.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"venn",
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"citty": "^0.2.2",
|
|
44
|
-
"@venn-lang/assert": "0.1.
|
|
45
|
-
"@venn-lang/contracts": "0.1.
|
|
46
|
-
"@venn-lang/core": "0.1.
|
|
47
|
-
"@venn-lang/dts": "0.1.
|
|
48
|
-
"@venn-lang/http": "0.1.
|
|
49
|
-
"@venn-lang/io": "0.1.
|
|
50
|
-
"@venn-lang/project": "0.1.
|
|
51
|
-
"@venn-lang/runtime": "0.1.
|
|
52
|
-
"@venn-lang/sdk": "0.1.
|
|
53
|
-
"@venn-lang/stdlib": "0.1.
|
|
54
|
-
"@venn-lang/types": "0.1.
|
|
44
|
+
"@venn-lang/assert": "0.1.1",
|
|
45
|
+
"@venn-lang/contracts": "0.1.1",
|
|
46
|
+
"@venn-lang/core": "0.1.1",
|
|
47
|
+
"@venn-lang/dts": "0.1.1",
|
|
48
|
+
"@venn-lang/http": "0.1.1",
|
|
49
|
+
"@venn-lang/io": "0.1.1",
|
|
50
|
+
"@venn-lang/project": "0.1.1",
|
|
51
|
+
"@venn-lang/runtime": "0.1.1",
|
|
52
|
+
"@venn-lang/sdk": "0.1.1",
|
|
53
|
+
"@venn-lang/stdlib": "0.1.1",
|
|
54
|
+
"@venn-lang/types": "0.1.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^24",
|
package/src/upgrade/version.ts
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
|
|
3
|
+
/** The manifest to accept, so a neighbour's is never read by mistake. */
|
|
4
|
+
const NAME = "@venn-lang/cli";
|
|
5
|
+
|
|
6
|
+
/** Where the manifest sits relative to this file, in a release and in the tree. */
|
|
7
|
+
const CANDIDATES = ["../package.json", "../../package.json", "../../../package.json"];
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* The version of the CLI that is running.
|
|
5
11
|
*
|
|
6
12
|
* Read from the package manifest rather than written into the source, so a
|
|
7
|
-
* release cannot ship a binary that reports the version before it.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
13
|
+
* release cannot ship a binary that reports the version before it.
|
|
14
|
+
*
|
|
15
|
+
* The path is searched rather than assumed. The bundle flattens
|
|
16
|
+
* `src/upgrade/version.ts` into `dist/cli.mjs`, so the manifest is two levels up
|
|
17
|
+
* while developing and one in a release; assuming either one reports `0.0.0` to
|
|
18
|
+
* everybody living with the other, and the name check keeps the search from
|
|
19
|
+
* settling on some other package's manifest on the way up.
|
|
10
20
|
*/
|
|
11
21
|
export const VERSION: string = read();
|
|
12
22
|
|
|
13
23
|
function read(): string {
|
|
24
|
+
const require = createRequire(import.meta.url);
|
|
25
|
+
for (const path of CANDIDATES) {
|
|
26
|
+
const version = versionAt(require, path);
|
|
27
|
+
if (version) return version;
|
|
28
|
+
}
|
|
29
|
+
return "0.0.0";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function versionAt(require: ReturnType<typeof createRequire>, path: string): string | undefined {
|
|
14
33
|
try {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
return manifest.version ?? "0.0.0";
|
|
34
|
+
const manifest = require(path) as { name?: string; version?: string };
|
|
35
|
+
return manifest.name === NAME ? manifest.version : undefined;
|
|
18
36
|
} catch {
|
|
19
|
-
return
|
|
37
|
+
return undefined;
|
|
20
38
|
}
|
|
21
39
|
}
|