@lionweb/cli 0.5.0-beta.5 → 0.5.0-beta.7
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization-extractor.d.ts","sourceRoot":"","sources":["../src/serialization-extractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization-extractor.d.ts","sourceRoot":"","sources":["../src/serialization-extractor.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,wBAAwB,SAAgB,MAAM,kBAU1D,CAAA"}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { writeFileSync } from "fs";
|
|
2
2
|
import { extname } from "path";
|
|
3
|
-
import { currentSerializationFormatVersion, deserializeLanguage,
|
|
3
|
+
import { currentSerializationFormatVersion, deserializeLanguage, lioncoreKey } from "@lionweb/core";
|
|
4
4
|
import { asText, readFileAsJson, shortenedSerialization, sortedSerialization, writeJsonAsFile } from "@lionweb/utilities";
|
|
5
5
|
const isRecord = (json) => typeof json === "object" && !Array.isArray(json);
|
|
6
6
|
const isSerializedLanguage = (json) => isRecord(json)
|
|
7
7
|
&& json["serializationFormatVersion"] === currentSerializationFormatVersion
|
|
8
8
|
&& "languages" in json
|
|
9
9
|
&& Array.isArray(json["languages"])
|
|
10
|
-
&& json["languages"].some((language) => isRecord(language) && language["key"] ===
|
|
11
|
-
|
|
10
|
+
&& json["languages"].some((language) => isRecord(language) && language["key"] === lioncoreKey);
|
|
11
|
+
const readChunk = async (path) => {
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
const extlessPath = path.substring(0, path.length - extname(path).length);
|
|
15
|
-
const sortedJson = sortedSerialization(json);
|
|
16
|
-
writeJsonAsFile(extlessPath + ".sorted.json", sortedJson);
|
|
17
|
-
writeJsonAsFile(extlessPath + ".shortened.json", shortenedSerialization(json)); // (could also sort)
|
|
18
|
-
if (isSerializedLanguage(json)) {
|
|
19
|
-
writeFileSync(extlessPath + ".txt", asText(deserializeLanguage(json)));
|
|
20
|
-
}
|
|
21
|
-
console.log(`extracted: "${path}" -> "${extlessPath}"`);
|
|
13
|
+
return readFileAsJson(path);
|
|
22
14
|
}
|
|
23
|
-
catch (
|
|
15
|
+
catch (e) {
|
|
24
16
|
console.error(`"${path}" is not a valid JSON file`);
|
|
17
|
+
throw e;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const extractFromSerialization = async (path) => {
|
|
21
|
+
const json = await readChunk(path);
|
|
22
|
+
const extlessPath = path.substring(0, path.length - extname(path).length);
|
|
23
|
+
const sortedJson = sortedSerialization(json);
|
|
24
|
+
writeJsonAsFile(extlessPath + ".sorted.json", sortedJson);
|
|
25
|
+
writeJsonAsFile(extlessPath + ".shortened.json", shortenedSerialization(json)); // (could also sort)
|
|
26
|
+
if (isSerializedLanguage(json)) {
|
|
27
|
+
writeFileSync(extlessPath + ".txt", asText(deserializeLanguage(json)));
|
|
25
28
|
}
|
|
29
|
+
console.log(`extracted: "${path}" -> "${extlessPath}"`);
|
|
26
30
|
};
|
|
27
31
|
//# sourceMappingURL=serialization-extractor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization-extractor.js","sourceRoot":"","sources":["../src/serialization-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,IAAI,CAAA;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAC,iCAAiC,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"serialization-extractor.js","sourceRoot":"","sources":["../src/serialization-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,IAAI,CAAA;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAC,iCAAiC,EAAE,mBAAmB,EAAE,WAAW,EAAqB,MAAM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AE,UAAU,CAAC,CAAA;IACzD,eAAe,CAAC,WAAW,GAAG,iBAAiB,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAA,CAAG,oBAAoB;IACrG,IAAI,oBAAoB,CAAC,IAAI,CAAC,EAAE;QAC5B,aAAa,CAAC,WAAW,GAAG,MAAM,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KACzE;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,SAAS,WAAW,GAAG,CAAC,CAAA;AAC3D,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/cli",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.7",
|
|
4
4
|
"description": "LionWeb CLI for {Java|Type}Script",
|
|
5
5
|
"bin": "./dist/lionweb-cli.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@lionweb/core": "0.5.0-beta.
|
|
20
|
-
"@lionweb/utilities": "0.5.0-beta.
|
|
19
|
+
"@lionweb/core": "0.5.0-beta.7",
|
|
20
|
+
"@lionweb/utilities": "0.5.0-beta.7"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "20.6.3",
|