@vouchington/localization-compiler 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/README.md CHANGED
@@ -31,7 +31,7 @@ localization/catalog/tags.json merge=text
31
31
  ```gitconfig
32
32
  [merge "vouchington-localization"]
33
33
  name = Merge localization catalog shards by message id and locale
34
- driver = vouchington-localization git-merge %O %A %B
34
+ driver = vouchington-localization git-merge %O %A %B --path %P
35
35
  ```
36
36
 
37
37
  On conflict the driver writes conflict markers into `%A` (`<<<<<<< ours` / `=======` /
@@ -31,7 +31,7 @@ function merge(args) {
31
31
  const [ancestor, ours, theirs] = args;
32
32
  if (ancestor === undefined || ours === undefined || theirs === undefined)
33
33
  throw new TypeError(shardUsage());
34
- if (isTablePath(ours)) {
34
+ if (isTablePath(optional(args, '--path') ?? ours)) {
35
35
  mergeTableFiles(ancestor, ours, theirs);
36
36
  return undefined;
37
37
  }
@@ -48,7 +48,7 @@ export function shardUsage() {
48
48
  return [
49
49
  'Usage: vouchington-localization upsert --file <file> --row <json>',
50
50
  'Usage: vouchington-localization remove --file <file> --id <id> [--consumer <consumer>]',
51
- 'Usage: vouchington-localization git-merge <ancestor> <ours> <theirs>',
51
+ 'Usage: vouchington-localization git-merge <ancestor> <ours> <theirs> [--path <path>]',
52
52
  'Usage: vouchington-localization format --source <dir>',
53
53
  ].join('\n');
54
54
  }
@@ -79,7 +79,10 @@ function required(args, flag) {
79
79
  return value;
80
80
  }
81
81
  function optional(args, flag) {
82
- const value = args[args.indexOf(flag) + 1];
82
+ const index = args.indexOf(flag);
83
+ if (index === -1)
84
+ return undefined;
85
+ const value = args[index + 1];
83
86
  return value === undefined || value.startsWith('--') ? undefined : value;
84
87
  }
85
88
  function requiredPath(args, flag) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchington/localization-compiler",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Node compiler for localization JSON catalogs, immutable SQLite artifacts, and CLI resolution.",
5
5
  "homepage": "https://github.com/vouchington/vouchington-platform/tree/main/packages/localization-compiler#readme",
6
6
  "bugs": {