@patterkit/cli 0.5.0 → 0.5.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.js +25 -22
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -190981,7 +190981,7 @@ var init_script_fonts = __esm({
|
|
|
190981
190981
|
});
|
|
190982
190982
|
|
|
190983
190983
|
// src/main.ts
|
|
190984
|
-
import { readFileSync as
|
|
190984
|
+
import { readFileSync as readFileSync9, existsSync as existsSync6 } from "fs";
|
|
190985
190985
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
190986
190986
|
import { join as join10, resolve as resolve8 } from "path";
|
|
190987
190987
|
|
|
@@ -239743,9 +239743,12 @@ function buildIndex(loaded) {
|
|
|
239743
239743
|
return out;
|
|
239744
239744
|
}
|
|
239745
239745
|
|
|
239746
|
+
// ../ops/src/pin.ts
|
|
239747
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
239748
|
+
|
|
239746
239749
|
// ../ops/src/pack.ts
|
|
239747
239750
|
var import_jszip = __toESM(require_lib3(), 1);
|
|
239748
|
-
import { readFileSync as
|
|
239751
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
239749
239752
|
import { dirname as dirname5, relative as relative4, sep as sep3 } from "path";
|
|
239750
239753
|
|
|
239751
239754
|
// ../../node_modules/@wildwinter/toolkit/dist/archive.js
|
|
@@ -239764,7 +239767,7 @@ var ENTRY_OPTS = ARCHIVE_ENTRY_OPTS;
|
|
|
239764
239767
|
async function runPack(startPath) {
|
|
239765
239768
|
const projectFile = findProjectFile(startPath);
|
|
239766
239769
|
const root2 = dirname5(projectFile);
|
|
239767
|
-
const project = parseSource(
|
|
239770
|
+
const project = parseSource(readFileSync6(projectFile, "utf8"));
|
|
239768
239771
|
const unresolved = sidecarIssues(walkFiles(root2, CONFLICT_SIDECAR));
|
|
239769
239772
|
if (unresolved.length) {
|
|
239770
239773
|
throw new Error(
|
|
@@ -239782,7 +239785,7 @@ async function runPack(startPath) {
|
|
|
239782
239785
|
};
|
|
239783
239786
|
const zip = new import_jszip.default();
|
|
239784
239787
|
zip.file("patter.manifest.json", JSON.stringify(manifest, null, 2) + "\n", ENTRY_OPTS);
|
|
239785
|
-
for (const f of files) zip.file(f.rel,
|
|
239788
|
+
for (const f of files) zip.file(f.rel, readFileSync6(f.abs, "utf8"), ENTRY_OPTS);
|
|
239786
239789
|
for (const f of scopes) zip.file(`${GAME_SCOPES_DIR}/${f.fileName}`, f.text, ENTRY_OPTS);
|
|
239787
239790
|
return zip.generateAsync({ type: "nodebuffer", compression: "DEFLATE", streamFiles: false });
|
|
239788
239791
|
}
|
|
@@ -239790,7 +239793,7 @@ async function runPack(startPath) {
|
|
|
239790
239793
|
// ../ops/src/unpack.ts
|
|
239791
239794
|
var import_jszip2 = __toESM(require_lib3(), 1);
|
|
239792
239795
|
import { join as join8, resolve as resolve6, sep as sep4 } from "path";
|
|
239793
|
-
import { existsSync as existsSync4, readFileSync as
|
|
239796
|
+
import { existsSync as existsSync4, readFileSync as readFileSync7 } from "fs";
|
|
239794
239797
|
var MANIFEST = "patter.manifest.json";
|
|
239795
239798
|
var isScopesEntry = (name) => {
|
|
239796
239799
|
const rest = name.startsWith(`${GAME_SCOPES_DIR}/`) ? name.slice(GAME_SCOPES_DIR.length + 1) : void 0;
|
|
@@ -239833,7 +239836,7 @@ function checkProvenance(returned, base, target) {
|
|
|
239833
239836
|
}
|
|
239834
239837
|
function targetProjectId(projectDir) {
|
|
239835
239838
|
try {
|
|
239836
|
-
const pf = parseSource(
|
|
239839
|
+
const pf = parseSource(readFileSync7(findProjectFile(projectDir), "utf8"));
|
|
239837
239840
|
return pf.project?.id;
|
|
239838
239841
|
} catch {
|
|
239839
239842
|
return void 0;
|
|
@@ -239865,7 +239868,7 @@ async function runUnpackMerge(returnedBytes, baseBytes, projectDir) {
|
|
|
239865
239868
|
throw new Error(`${rel}: the ${side} copy is not readable Patter source - ${e instanceof Error ? e.message : String(e)}`);
|
|
239866
239869
|
}
|
|
239867
239870
|
};
|
|
239868
|
-
const oursObj = readSide("ours",
|
|
239871
|
+
const oursObj = readSide("ours", readFileSync7(outPath, "utf8"));
|
|
239869
239872
|
const theirsObj = readSide("theirs", theirText);
|
|
239870
239873
|
const baseText = base.get(rel);
|
|
239871
239874
|
const baseObj = baseText !== void 0 ? readSide("base", baseText) : {};
|
|
@@ -239907,7 +239910,7 @@ function containedWrite(dir2, name) {
|
|
|
239907
239910
|
|
|
239908
239911
|
// ../../node_modules/@wildwinter/simple-vc-lib/dist/simpleVcLib.js
|
|
239909
239912
|
import { join as join9, dirname as dirname6, resolve as resolve7, sep as sep5, basename as basename7 } from "path";
|
|
239910
|
-
import { existsSync as existsSync5, readFileSync as
|
|
239913
|
+
import { existsSync as existsSync5, readFileSync as readFileSync8, statSync as statSync3, unlinkSync, rmSync, renameSync, accessSync, constants, chmodSync, mkdirSync as mkdirSync2, cpSync, readdirSync as readdirSync5, writeFileSync as writeFileSync2 } from "fs";
|
|
239911
239914
|
import { spawnSync, spawn } from "child_process";
|
|
239912
239915
|
var VALID_SYSTEMS = ["git", "perforce", "plastic", "svn", "filesystem"];
|
|
239913
239916
|
function loadConfig(startDir) {
|
|
@@ -239920,7 +239923,7 @@ function loadConfig(startDir) {
|
|
|
239920
239923
|
const configPath = join9(dir2, ".vcconfig");
|
|
239921
239924
|
if (existsSync5(configPath)) {
|
|
239922
239925
|
try {
|
|
239923
|
-
const parsed = JSON.parse(
|
|
239926
|
+
const parsed = JSON.parse(readFileSync8(configPath, "utf8"));
|
|
239924
239927
|
const system = parsed?.system?.toLowerCase();
|
|
239925
239928
|
if (system && VALID_SYSTEMS.includes(system)) {
|
|
239926
239929
|
return { system };
|
|
@@ -240513,7 +240516,7 @@ function shouldQueryLfsLocks(root2, options) {
|
|
|
240513
240516
|
}
|
|
240514
240517
|
function repoUsesLfsLocks(root2) {
|
|
240515
240518
|
try {
|
|
240516
|
-
return /(^|\s)lockable(\s|$)/m.test(
|
|
240519
|
+
return /(^|\s)lockable(\s|$)/m.test(readFileSync8(join9(root2, ".gitattributes"), "utf8"));
|
|
240517
240520
|
} catch {
|
|
240518
240521
|
return false;
|
|
240519
240522
|
}
|
|
@@ -241734,7 +241737,7 @@ function deleteFile(filePath) {
|
|
|
241734
241737
|
function writeTextFile(filePath, content, encoding = "utf8", forceWrite = false) {
|
|
241735
241738
|
if (!forceWrite && existsSync5(filePath)) {
|
|
241736
241739
|
try {
|
|
241737
|
-
const existing =
|
|
241740
|
+
const existing = readFileSync8(filePath, { encoding });
|
|
241738
241741
|
if (existing === content) return { success: true, status: "ok", message: "" };
|
|
241739
241742
|
} catch {
|
|
241740
241743
|
}
|
|
@@ -241752,7 +241755,7 @@ function writeTextFile(filePath, content, encoding = "utf8", forceWrite = false)
|
|
|
241752
241755
|
function writeBinaryFile(filePath, data, forceWrite = false) {
|
|
241753
241756
|
if (!forceWrite && existsSync5(filePath)) {
|
|
241754
241757
|
try {
|
|
241755
|
-
const existing =
|
|
241758
|
+
const existing = readFileSync8(filePath);
|
|
241756
241759
|
const incoming = Buffer.isBuffer(data) ? data : Buffer.from(data);
|
|
241757
241760
|
if (existing.equals(incoming)) return { success: true, status: "ok", message: "" };
|
|
241758
241761
|
} catch {
|
|
@@ -241784,7 +241787,7 @@ function writeTextFiles(files, encoding = "utf8") {
|
|
|
241784
241787
|
// package.json
|
|
241785
241788
|
var package_default = {
|
|
241786
241789
|
name: "@patterkit/cli",
|
|
241787
|
-
version: "0.5.
|
|
241790
|
+
version: "0.5.1",
|
|
241788
241791
|
description: "The `patter` CLI: validate, format, export, and play a Patter project.",
|
|
241789
241792
|
type: "module",
|
|
241790
241793
|
license: "MIT",
|
|
@@ -241814,7 +241817,7 @@ var package_default = {
|
|
|
241814
241817
|
},
|
|
241815
241818
|
dependencies: {
|
|
241816
241819
|
"@patterkit/core": "0.2.6",
|
|
241817
|
-
"@patterkit/ops": "0.
|
|
241820
|
+
"@patterkit/ops": "0.10.0",
|
|
241818
241821
|
"@wildwinter/simple-vc-lib": "^0.4.1"
|
|
241819
241822
|
}
|
|
241820
241823
|
};
|
|
@@ -241947,9 +241950,9 @@ function commitBinary(path, buffer2) {
|
|
|
241947
241950
|
function parseThree(baseP, oursP, theirsP, label) {
|
|
241948
241951
|
try {
|
|
241949
241952
|
return {
|
|
241950
|
-
base: parseSource(
|
|
241951
|
-
ours: parseSource(
|
|
241952
|
-
theirs: parseSource(
|
|
241953
|
+
base: parseSource(readFileSync9(baseP, "utf8")),
|
|
241954
|
+
ours: parseSource(readFileSync9(oursP, "utf8")),
|
|
241955
|
+
theirs: parseSource(readFileSync9(theirsP, "utf8"))
|
|
241953
241956
|
};
|
|
241954
241957
|
} catch (e) {
|
|
241955
241958
|
console.error(`${label}: cannot parse input - ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -242245,9 +242248,9 @@ ${count} issue(s)${advisory}`);
|
|
|
242245
242248
|
const loaded = loadProject(positionals[1] ?? ".");
|
|
242246
242249
|
const ext = file.slice(file.lastIndexOf(".")).toLowerCase();
|
|
242247
242250
|
let catalog;
|
|
242248
|
-
if (ext === ".json") catalog = jsonToCatalog(
|
|
242249
|
-
else if (ext === ".po" || ext === ".pot") catalog = poToCatalog(
|
|
242250
|
-
else if (ext === ".xlsx") catalog = await xlsxToCatalog(
|
|
242251
|
+
if (ext === ".json") catalog = jsonToCatalog(readFileSync9(file, "utf8"));
|
|
242252
|
+
else if (ext === ".po" || ext === ".pot") catalog = poToCatalog(readFileSync9(file, "utf8"));
|
|
242253
|
+
else if (ext === ".xlsx") catalog = await xlsxToCatalog(readFileSync9(file));
|
|
242251
242254
|
else {
|
|
242252
242255
|
console.error(`loc-import: unknown format '${ext}' (.json | .po | .xlsx)`);
|
|
242253
242256
|
return 2;
|
|
@@ -242313,7 +242316,7 @@ ${count} issue(s)${advisory}`);
|
|
|
242313
242316
|
console.error("unpack --merge: --base <sent.patter> is required");
|
|
242314
242317
|
return 2;
|
|
242315
242318
|
}
|
|
242316
|
-
const res = await runUnpackMerge(
|
|
242319
|
+
const res = await runUnpackMerge(readFileSync9(file), readFileSync9(flags.base), flags.o);
|
|
242317
242320
|
if (!res.provenance.ok) {
|
|
242318
242321
|
console.error("warning: these do not look like the same project");
|
|
242319
242322
|
console.error(` returned pack: ${res.provenance.returned ?? "(no manifest)"}`);
|
|
@@ -242332,7 +242335,7 @@ ${count} issue(s)${advisory}`);
|
|
|
242332
242335
|
${res.shards.length} shard(s) -> ${flags.o}; ${res.conflicts} conflict(s), ${res.warnings} warning(s)`);
|
|
242333
242336
|
return res.conflicts > 0 ? 1 : 0;
|
|
242334
242337
|
}
|
|
242335
|
-
const { shards, scopes } = await runUnpack(
|
|
242338
|
+
const { shards, scopes } = await runUnpack(readFileSync9(file), flags.o);
|
|
242336
242339
|
if (!commitWrites([...shards, ...scopes])) return 1;
|
|
242337
242340
|
for (const w of [...shards, ...scopes]) console.log(`unpacked: ${w.path}`);
|
|
242338
242341
|
console.log(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patterkit/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "The `patter` CLI: validate, format, export, and play a Patter project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@patterkit/core": "0.2.6",
|
|
33
|
-
"@patterkit/ops": "0.
|
|
33
|
+
"@patterkit/ops": "0.10.0",
|
|
34
34
|
"@wildwinter/simple-vc-lib": "^0.4.1"
|
|
35
35
|
}
|
|
36
36
|
}
|