@lionweb/cli 0.1.0-beta.0 → 0.5.0-beta.4
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/CHANGELOG.md +6 -0
- package/README.md +52 -0
- package/build.sh +6 -0
- package/dist/lionweb-cli.d.ts +3 -0
- package/dist/lionweb-cli.d.ts.map +1 -0
- package/dist/{lioncore-cli.js → lionweb-cli.js} +6 -4
- package/dist/{lioncore-cli.js.map → lionweb-cli.js.map} +1 -1
- package/package.json +11 -8
- package/dist/lioncore-cli.d.ts +0 -2
- package/dist/lioncore-cli.d.ts.map +0 -1
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# The `cli` package
|
|
2
|
+
|
|
3
|
+
An NPM package that can be added to a Node.js/NPM codebase as follows:
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
$ npm add @lionweb/cli
|
|
7
|
+
```
|
|
8
|
+
It exposes an executable for use with a CLI.
|
|
9
|
+
It works as follows:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
$ node dist/lionweb-cli.js <command> <arguments>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
(Turning this into a proper NPM CLI command is a TODO.)
|
|
16
|
+
|
|
17
|
+
Just running
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
$ node dist/lionweb-cli.js
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
produces information about which commands are available.
|
|
24
|
+
|
|
25
|
+
Build the executable from source as follows:
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
$ ./build.sh
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Extracting essential information from a serialization chunk
|
|
33
|
+
|
|
34
|
+
Run the following command to make "extractions" from a serialization chunk (e.g.):
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
node dist/lionweb-cli.js extract ../artifacts/chunks/languages/lioncore.json
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This is meant as a way to inspect, reason about, and compare serialization because the format is rather verbose.
|
|
41
|
+
These extractions are:
|
|
42
|
+
|
|
43
|
+
* A "sorted" JSON with:
|
|
44
|
+
* all nodes sorted by ID,
|
|
45
|
+
* for all nodes, their properties, containments, and references sorted by key (from the meta-pointer),
|
|
46
|
+
* and all containments and references sorted by ID.
|
|
47
|
+
* A "shortened" JSON where keys are used as key names.
|
|
48
|
+
* If the serialization represents a language - i.e.: a LionCore model - then a textual version is generated as well.
|
|
49
|
+
|
|
50
|
+
This CLI utility does not perform any explicit validation apart from the file at the given path existing and being valid JSON.
|
|
51
|
+
It does some implicit validation as it can error out on incorrect serializations.
|
|
52
|
+
|
package/build.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lionweb-cli.d.ts","sourceRoot":"","sources":["../src/lionweb-cli.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import { argv } from "process";
|
|
2
3
|
import { extractFromSerialization } from "./serialization-extractor.js";
|
|
3
4
|
import { diagramFromSerialization } from "./m3/diagram-generator.js";
|
|
4
5
|
const main = (args) => {
|
|
5
6
|
if (args.length <= 2) {
|
|
6
|
-
console.log(`
|
|
7
|
+
console.log(`lionweb-cli is a LionWeb utility around LionWeb-TypeScript
|
|
7
8
|
|
|
8
|
-
Usage: $
|
|
9
|
+
Usage: $ lionweb-cli <command> <arguments>
|
|
9
10
|
|
|
10
11
|
Available commands are:
|
|
11
12
|
|
|
13
|
+
diagram
|
|
12
14
|
extract
|
|
13
15
|
`);
|
|
14
16
|
return;
|
|
@@ -35,11 +37,11 @@ If the chunk is the serialization of a LionCore Language/M2, then a textual rend
|
|
|
35
37
|
}
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
|
-
// TODO schema, Ecore
|
|
40
|
+
// TODO generate schema, import Ecore
|
|
39
41
|
default: {
|
|
40
42
|
console.error(`command "${command}" is not recognized`);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
};
|
|
44
46
|
main(argv);
|
|
45
|
-
//# sourceMappingURL=
|
|
47
|
+
//# sourceMappingURL=lionweb-cli.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"lionweb-cli.js","sourceRoot":"","sources":["../src/lionweb-cli.ts"],"names":[],"mappings":";AAGA,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAA;AAE5B,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAA;AAGlE,MAAM,IAAI,GAAG,CAAC,IAAc,EAAC,EAAE;IAC3B,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;QAClB,OAAO,CAAC,GAAG,CACnB;;;;;;;;CAQC,CACQ,CAAA;QACD,OAAM;KACT;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IACvB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACjC,QAAQ,OAAO,EAAE;QAEb,KAAK,SAAS,CAAC,CAAC;YACZ,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC1B,OAAO,CAAC,GAAG,CACP,8GAA8G,CACjH,CAAA;aACJ;iBAAM;gBACH,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;aAChD;YACD,OAAM;SACT;QAED,KAAK,SAAS,CAAC,CAAC;YACZ,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC1B,OAAO,CAAC,GAAG,CAC3B;yGACyG,CACxF,CAAA;aACJ;iBAAM;gBACH,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;aAChD;YACD,OAAM;SACT;QAED,sCAAsC;QAEtC,OAAO,CAAC,CAAC;YACL,OAAO,CAAC,KAAK,CAAC,YAAY,OAAO,qBAAqB,CAAC,CAAA;SAC1D;KACJ;AAEL,CAAC,CAAA;AAED,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.4",
|
|
4
4
|
"description": "LionWeb CLI for {Java|Type}Script",
|
|
5
|
+
"bin": "./dist/lionweb-cli.js",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"typings": "dist/index.d.ts",
|
|
8
9
|
"type": "module",
|
|
9
|
-
"license": "
|
|
10
|
+
"license": "Apache-2.0",
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/LionWeb-
|
|
13
|
+
"url": "https://github.com/LionWeb-io/lionweb-typescript.git"
|
|
13
14
|
},
|
|
14
15
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/LionWeb-
|
|
16
|
+
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@lionweb/core": "0.5.0-beta.3",
|
|
20
|
+
"@lionweb/utilities": "0.5.0-beta.3"
|
|
16
21
|
},
|
|
17
22
|
"devDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"
|
|
20
|
-
"@types/node": "^20.6.3",
|
|
21
|
-
"typescript": "^5.2.2"
|
|
23
|
+
"@types/node": "20.6.3",
|
|
24
|
+
"typescript": "5.2.2"
|
|
22
25
|
},
|
|
23
26
|
"scripts": {
|
|
24
27
|
"build": "tsc"
|
package/dist/lioncore-cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lioncore-cli.d.ts","sourceRoot":"","sources":["../src/lioncore-cli.ts"],"names":[],"mappings":""}
|