@patterkit/cli 0.13.0 → 0.13.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +29 -31
  2. package/package.json +5 -4
package/dist/cli.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  // src/main.ts
4
4
  import { readFileSync as readFileSync2, existsSync, mkdirSync, writeFileSync, rmSync } from "fs";
5
- import { spawnSync } from "child_process";
6
5
  import { dirname, join, resolve } from "path";
7
6
  import { canonicalStringify, parseSource } from "@patterkit/core";
8
7
  import {
@@ -63,11 +62,12 @@ import {
63
62
  } from "@patterkit/ops";
64
63
  import { createHash } from "crypto";
65
64
  import { writeTextFiles, writeBinaryFile, currentUser } from "@wildwinter/simple-vc-lib";
65
+ import { runMergetool } from "@wildwinter/toolkit/vcs";
66
66
 
67
67
  // package.json
68
68
  var package_default = {
69
69
  name: "@patterkit/cli",
70
- version: "0.13.0",
70
+ version: "0.13.2",
71
71
  description: "The `patter` CLI: validate, format, export, play, test coverage, localise, and merge Patter projects.",
72
72
  type: "module",
73
73
  license: "MIT",
@@ -96,9 +96,10 @@ var package_default = {
96
96
  "build:standalone:others": "node scripts/build-standalone.mjs --targets=linux-x64,linux-arm64,windows-x64"
97
97
  },
98
98
  dependencies: {
99
- "@patterkit/core": "0.9.2",
100
- "@patterkit/ops": "0.21.0",
101
- "@wildwinter/simple-vc-lib": "^0.5.2"
99
+ "@patterkit/core": "0.9.4",
100
+ "@patterkit/ops": "0.23.0",
101
+ "@wildwinter/simple-vc-lib": "^0.5.2",
102
+ "@wildwinter/toolkit": "^0.2.3"
102
103
  }
103
104
  };
104
105
 
@@ -852,33 +853,30 @@ ${shards.length} shard(s)${scopes.length ? ` and ${scopes.length} game scopes fi
852
853
  case "mergetool": {
853
854
  const [baseP, theirsP, oursP, outP] = positionals;
854
855
  if (!baseP || !theirsP || !oursP || !outP) return usage("mergetool", "needs BASE THEIRS OURS OUT");
855
- const fallback = typeof flags.fallback === "string" ? flags.fallback : void 0;
856
- if (isPatterSource(outP) || isPatterSource(oursP)) {
857
- const src = parseThree(baseP, oursP, theirsP, "mergetool");
858
- if (!src) return 2;
859
- try {
860
- const manifest = mergeManifest(src.ours, outP);
861
- return writeMergeResult(runMerge(src.base, src.ours, src.theirs, manifest ? { manifest } : void 0), outP, outP, false);
862
- } catch (e) {
863
- if (e instanceof UnsupportedMergeError) {
864
- console.error(`mergetool: ${e.message}`);
865
- return 2;
856
+ return runMergetool({
857
+ base: baseP,
858
+ theirs: theirsP,
859
+ ours: oursP,
860
+ out: outP,
861
+ fallback: typeof flags.fallback === "string" ? flags.fallback : void 0,
862
+ isSource: isPatterSource,
863
+ merge: () => {
864
+ const src = parseThree(baseP, oursP, theirsP, "mergetool");
865
+ if (!src) return 2;
866
+ try {
867
+ const manifest = mergeManifest(src.ours, outP);
868
+ return writeMergeResult(runMerge(src.base, src.ours, src.theirs, manifest ? { manifest } : void 0), outP, outP, false);
869
+ } catch (e) {
870
+ if (e instanceof UnsupportedMergeError) {
871
+ console.error(`mergetool: ${e.message}`);
872
+ return 2;
873
+ }
874
+ throw e;
866
875
  }
867
- throw e;
868
- }
869
- }
870
- if (!fallback) {
871
- console.error(`mergetool: ${outP} is not Patter source and no --fallback configured`);
872
- return 2;
873
- }
874
- const [cmd2, ...pre] = fallback.split(/\s+/).filter(Boolean);
875
- if (!cmd2) return usage("mergetool", "empty --fallback");
876
- const r = spawnSync(cmd2, [...pre, baseP, theirsP, oursP, outP], { stdio: "inherit" });
877
- if (r.error) {
878
- console.error(`mergetool: could not run the fallback '${cmd2}': ${r.error.message}`);
879
- return 1;
880
- }
881
- return r.status ?? 1;
876
+ },
877
+ error: (message) => console.error(message),
878
+ tool: "patter"
879
+ });
882
880
  }
883
881
  }
884
882
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "The `patter` CLI: validate, format, export, play, test coverage, localise, and merge Patter projects.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,8 +29,9 @@
29
29
  "build:standalone:others": "node scripts/build-standalone.mjs --targets=linux-x64,linux-arm64,windows-x64"
30
30
  },
31
31
  "dependencies": {
32
- "@patterkit/core": "0.9.2",
33
- "@patterkit/ops": "0.21.0",
34
- "@wildwinter/simple-vc-lib": "^0.5.2"
32
+ "@patterkit/core": "0.9.4",
33
+ "@patterkit/ops": "0.23.0",
34
+ "@wildwinter/simple-vc-lib": "^0.5.2",
35
+ "@wildwinter/toolkit": "^0.2.3"
35
36
  }
36
37
  }