@zokugun/artifact 0.7.0 → 0.9.0

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 (107) hide show
  1. package/README.md +22 -2
  2. package/lib/cli.js +16 -11
  3. package/lib/commands/add.js +95 -22
  4. package/lib/commands/index.d.ts +1 -0
  5. package/lib/commands/index.js +3 -1
  6. package/lib/commands/list.js +25 -7
  7. package/lib/commands/outdated.d.ts +1 -0
  8. package/lib/commands/outdated.js +73 -0
  9. package/lib/commands/remove.js +39 -18
  10. package/lib/commands/update.js +36 -21
  11. package/lib/compositors/codec.d.ts +3 -0
  12. package/lib/compositors/codec.js +46 -0
  13. package/lib/compositors/compose.d.ts +1 -0
  14. package/lib/compositors/compose.js +4 -0
  15. package/lib/compositors/index.d.ts +1 -0
  16. package/lib/compositors/index.js +3 -1
  17. package/lib/compositors/json.js +3 -66
  18. package/lib/compositors/rc.js +3 -56
  19. package/lib/compositors/yaml.js +24 -3
  20. package/lib/configs/install/read-install-config.d.ts +2 -5
  21. package/lib/configs/install/read-install-config.js +20 -18
  22. package/lib/configs/install/write-install-config.d.ts +2 -2
  23. package/lib/configs/install/write-install-config.js +2 -1
  24. package/lib/configs/package/read-listing-config.d.ts +7 -0
  25. package/lib/configs/package/read-listing-config.js +71 -0
  26. package/lib/configs/package/read-package-config.d.ts +2 -1
  27. package/lib/configs/package/read-package-config.js +96 -10
  28. package/lib/configs/utils/constants.d.ts +2 -2
  29. package/lib/configs/utils/constants.js +2 -2
  30. package/lib/configs/utils/merge-upsert-property.js +0 -8
  31. package/lib/configs/utils/normalize-file-always.js +5 -0
  32. package/lib/configs/utils/normalize-file-upsert.d.ts +2 -1
  33. package/lib/configs/utils/normalize-file-upsert.js +12 -5
  34. package/lib/journeys/commitlint/index.d.ts +1 -1
  35. package/lib/journeys/config.ts/index.d.ts +1 -1
  36. package/lib/journeys/config.ts/index.js +2 -6
  37. package/lib/journeys/default/index.d.ts +1 -1
  38. package/lib/journeys/gitignore/index.d.ts +1 -1
  39. package/lib/journeys/ignore/index.d.ts +1 -1
  40. package/lib/journeys/index.d.ts +2 -2
  41. package/lib/journeys/index.js +9 -11
  42. package/lib/journeys/npmignore/index.d.ts +1 -1
  43. package/lib/journeys/package/index.d.ts +1 -1
  44. package/lib/journeys/rc/index.d.ts +1 -1
  45. package/lib/journeys/tsconfig/index.d.ts +1 -1
  46. package/lib/parsers/index.d.ts +4 -0
  47. package/lib/parsers/index.js +41 -0
  48. package/lib/parsers/json.d.ts +4 -2
  49. package/lib/parsers/json.js +7 -2
  50. package/lib/parsers/jsonc/parse.d.ts +2 -5
  51. package/lib/parsers/jsonc/parse.js +8 -6
  52. package/lib/parsers/to-format.d.ts +2 -0
  53. package/lib/parsers/to-format.js +50 -0
  54. package/lib/parsers/yaml.d.ts +4 -2
  55. package/lib/parsers/yaml.js +7 -2
  56. package/lib/routes/command.js +7 -0
  57. package/lib/routes/index.d.ts +4 -3
  58. package/lib/routes/index.js +9 -7
  59. package/lib/routes/{list-sort-concat.d.ts → list-concat-after.d.ts} +1 -1
  60. package/lib/routes/{list-sort-concat.js → list-concat-after.js} +2 -2
  61. package/lib/routes/merge-dot-js.d.ts +2 -0
  62. package/lib/routes/merge-dot-js.js +8 -0
  63. package/lib/steps/configure-install-file-actions.js +1 -20
  64. package/lib/steps/configure-update-file-actions.js +1 -20
  65. package/lib/steps/execute-first-block.js +1 -1
  66. package/lib/steps/index.d.ts +0 -2
  67. package/lib/steps/index.js +4 -3
  68. package/lib/steps/merge-text-files.d.ts +1 -1
  69. package/lib/steps/merge-text-files.js +6 -2
  70. package/lib/steps/read-files.d.ts +1 -1
  71. package/lib/steps/read-files.js +56 -42
  72. package/lib/steps/read-incoming-config.js +1 -1
  73. package/lib/steps/remove-files.d.ts +1 -1
  74. package/lib/steps/remove-files.js +3 -2
  75. package/lib/steps/rename-files.d.ts +1 -1
  76. package/lib/steps/rename-files.js +3 -2
  77. package/lib/steps/validate-newer-package.d.ts +1 -1
  78. package/lib/steps/validate-newer-package.js +13 -2
  79. package/lib/types/config.d.ts +11 -7
  80. package/lib/types/context.d.ts +23 -3
  81. package/lib/types/context.js +6 -0
  82. package/lib/types/travel.d.ts +1 -0
  83. package/lib/utils/build-journey-plan.d.ts +2 -2
  84. package/lib/utils/build-route.d.ts +1 -1
  85. package/lib/utils/build-route.js +50 -19
  86. package/lib/utils/build-travel-plan.js +1 -0
  87. package/lib/utils/command/merge-and-chains.js +1 -1
  88. package/lib/utils/command/merge-command-records.js +1 -1
  89. package/lib/utils/command/merge-parts-by-prefix.js +12 -1
  90. package/lib/utils/command/merge-semicolon-segments.js +161 -4
  91. package/lib/utils/fnmatch.d.ts +1 -0
  92. package/lib/utils/fnmatch.js +11 -0
  93. package/lib/utils/format-table.d.ts +1 -0
  94. package/lib/utils/format-table.js +58 -0
  95. package/lib/utils/get-format.js +2 -9
  96. package/lib/utils/load-package.d.ts +6 -0
  97. package/lib/utils/load-package.js +26 -0
  98. package/lib/utils/template.js +1 -3
  99. package/lib/utils/time-difference.d.ts +1 -0
  100. package/lib/utils/time-difference.js +28 -0
  101. package/package.json +128 -125
  102. package/lib/journeys/fixpack/index.d.ts +0 -2
  103. package/lib/journeys/fixpack/index.js +0 -16
  104. package/lib/steps/validate-not-present-package.d.ts +0 -3
  105. package/lib/steps/validate-not-present-package.js +0 -24
  106. package/lib/utils/try-json.d.ts +0 -1
  107. package/lib/utils/try-json.js +0 -11
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeFileUpsert = normalizeFileUpsert;
4
4
  const is_it_type_1 = require("@zokugun/is-it-type");
5
5
  const xtry_1 = require("@zokugun/xtry");
6
+ const build_journey_plan_js_1 = require("../../utils/build-journey-plan.js");
7
+ const build_route_js_1 = require("../../utils/build-route.js");
8
+ const build_travel_plan_js_1 = require("../../utils/build-travel-plan.js");
6
9
  const is_transform_js_1 = require("./is-transform.js");
7
- function normalizeFileUpsert(pattern, data, name) {
10
+ function normalizeFileUpsert(pattern, data, name, journeys, routes) {
8
11
  if (!(0, is_it_type_1.isRecord)(data)) {
9
12
  return (0, xtry_1.err)(`"${name}" must be an object.`);
10
13
  }
@@ -12,7 +15,6 @@ function normalizeFileUpsert(pattern, data, name) {
12
15
  let ifExists = 'merge';
13
16
  let ifMissing = 'merge';
14
17
  let rename;
15
- let route;
16
18
  let transforms = [];
17
19
  if ((0, is_it_type_1.isArray)(data.filter, is_it_type_1.isString)) {
18
20
  filter = data.filter;
@@ -37,8 +39,14 @@ function normalizeFileUpsert(pattern, data, name) {
37
39
  if ((0, is_it_type_1.isString)(data.rename)) {
38
40
  rename = data.rename;
39
41
  }
40
- if ((0, is_it_type_1.isRecord)(data.route)) {
41
- route = data.route;
42
+ if (journeys && routes && (0, is_it_type_1.isRecord)(data.route)) {
43
+ const route = (0, build_route_js_1.buildRoute)(data.route);
44
+ if (route.fails) {
45
+ return route;
46
+ }
47
+ const travel = (0, build_travel_plan_js_1.buildTravelPlan)([pattern, route.value]);
48
+ const journey = (0, build_journey_plan_js_1.buildJourneyPlan)(travel);
49
+ journeys[pattern] = journey;
42
50
  }
43
51
  if ((0, is_it_type_1.isArray)(data.transforms, is_transform_js_1.isTransform)) {
44
52
  transforms = data.transforms;
@@ -49,7 +57,6 @@ function normalizeFileUpsert(pattern, data, name) {
49
57
  ifMissing,
50
58
  pattern,
51
59
  rename,
52
- route,
53
60
  transforms,
54
61
  });
55
62
  } // }}}
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const configdotts_merge_1 = require("@zokugun/configdotts-merge");
3
+ const index_js_1 = require("../../routes/index.js");
4
4
  const build_journey_plan_js_1 = require("../../utils/build-journey-plan.js");
5
5
  const build_travel_plan_js_1 = require("../../utils/build-travel-plan.js");
6
- async function route({ current, incoming }) {
7
- const data = (0, configdotts_merge_1.merge)(current, incoming);
8
- return data;
9
- }
10
- const travelPlan = (0, build_travel_plan_js_1.buildTravelPlan)([/\.config\.ts/, route]);
6
+ const travelPlan = (0, build_travel_plan_js_1.buildTravelPlan)([/\.config\.ts/, index_js_1.mergeDotJs]);
11
7
  exports.default = (0, build_journey_plan_js_1.buildJourneyPlan)(travelPlan);
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- import { type Journey } from '../types/travel.js';
2
- export declare function getJourney(filename: string): Journey | undefined;
1
+ import { type JourneyPlan, type Journey } from '../types/travel.js';
2
+ export declare function getJourney(filename: string, plans?: JourneyPlan[]): Journey | undefined;
@@ -8,26 +8,24 @@ const path_1 = __importDefault(require("path"));
8
8
  const index_js_1 = __importDefault(require("./commitlint/index.js"));
9
9
  const index_js_2 = __importDefault(require("./config.ts/index.js"));
10
10
  const index_js_3 = __importDefault(require("./default/index.js"));
11
- const index_js_4 = __importDefault(require("./fixpack/index.js"));
12
- const index_js_5 = __importDefault(require("./gitignore/index.js"));
13
- const index_js_6 = __importDefault(require("./ignore/index.js"));
14
- const index_js_7 = __importDefault(require("./npmignore/index.js"));
15
- const index_js_8 = __importDefault(require("./package/index.js"));
16
- const index_js_9 = __importDefault(require("./rc/index.js"));
17
- const index_js_10 = __importDefault(require("./tsconfig/index.js"));
18
- const plans = [
11
+ const index_js_4 = __importDefault(require("./gitignore/index.js"));
12
+ const index_js_5 = __importDefault(require("./ignore/index.js"));
13
+ const index_js_6 = __importDefault(require("./npmignore/index.js"));
14
+ const index_js_7 = __importDefault(require("./package/index.js"));
15
+ const index_js_8 = __importDefault(require("./rc/index.js"));
16
+ const index_js_9 = __importDefault(require("./tsconfig/index.js"));
17
+ const DEFAULT_PLANS = [
19
18
  index_js_1.default,
20
19
  index_js_4.default,
21
20
  index_js_5.default,
22
21
  index_js_6.default,
23
22
  index_js_7.default,
24
- index_js_8.default,
25
- index_js_10.default,
26
23
  index_js_9.default,
24
+ index_js_8.default,
27
25
  index_js_2.default,
28
26
  index_js_3.default,
29
27
  ];
30
- function getJourney(filename) {
28
+ function getJourney(filename, plans = DEFAULT_PLANS) {
31
29
  const basename = path_1.default.basename(filename);
32
30
  for (const plan of plans) {
33
31
  const journey = plan(basename);
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (basename: string) => import("../../types/travel.js").Journey | undefined;
1
+ declare const _default: import("../../types/travel.js").JourneyPlan;
2
2
  export default _default;
@@ -0,0 +1,4 @@
1
+ export { toFormat } from './to-format.js';
2
+ export * as JSON from './json.js';
3
+ export * as JSONC from './jsonc/index.js';
4
+ export * as YAML from './yaml.js';
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.YAML = exports.JSONC = exports.JSON = exports.toFormat = void 0;
37
+ var to_format_js_1 = require("./to-format.js");
38
+ Object.defineProperty(exports, "toFormat", { enumerable: true, get: function () { return to_format_js_1.toFormat; } });
39
+ exports.JSON = __importStar(require("./json.js"));
40
+ exports.JSONC = __importStar(require("./jsonc/index.js"));
41
+ exports.YAML = __importStar(require("./yaml.js"));
@@ -1,2 +1,4 @@
1
- export declare function parse(data: string): Record<string, any>;
2
- export declare function stringify(data: Record<string, any>): string;
1
+ import { type ParseResult } from '../types/context.js';
2
+ import { type Transform } from './jsonc/transform.js';
3
+ export declare function parse(data: string): ParseResult;
4
+ export declare function stringify(data: Record<string, unknown>, _transform?: Transform): string;
@@ -2,9 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parse = parse;
4
4
  exports.stringify = stringify;
5
+ const sync_1 = require("@zokugun/xtry/sync");
5
6
  function parse(data) {
6
- return JSON.parse(data);
7
+ const result = (0, sync_1.xtry)(() => JSON.parse(data));
8
+ if (result.fails) {
9
+ return (0, sync_1.err)((0, sync_1.stringifyError)(result.error));
10
+ }
11
+ return (0, sync_1.ok)({ data: result.value });
7
12
  }
8
- function stringify(data) {
13
+ function stringify(data, _transform) {
9
14
  return JSON.stringify(data, null, '\t');
10
15
  }
@@ -1,5 +1,2 @@
1
- import { type Transform } from './transform.js';
2
- export declare function parse(text: string | undefined): {
3
- data: any;
4
- transform: Transform | undefined;
5
- };
1
+ import { type ParseResult } from '../../types/context.js';
2
+ export declare function parse(text: string): ParseResult;
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parse = parse;
4
+ const is_it_type_1 = require("@zokugun/is-it-type");
5
+ const xtry_1 = require("@zokugun/xtry");
4
6
  const jsonc_parser_1 = require("jsonc-parser");
5
7
  function parse(text) {
6
- if (!text) {
7
- return {
8
- data: undefined,
8
+ if (!(0, is_it_type_1.isNonBlankString)(text)) {
9
+ return (0, xtry_1.ok)({
10
+ data: {},
9
11
  transform: {},
10
- };
12
+ });
11
13
  }
12
14
  const stack = [];
13
15
  let current;
@@ -174,8 +176,8 @@ function parse(text) {
174
176
  }
175
177
  },
176
178
  });
177
- return {
179
+ return (0, xtry_1.ok)({
178
180
  data: current,
179
181
  transform,
180
- };
182
+ });
181
183
  }
@@ -0,0 +1,2 @@
1
+ import { type Codec } from '../types/context.js';
2
+ export declare function toFormat(value: 'json' | 'jsonc' | 'yaml'): Codec;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.toFormat = toFormat;
37
+ const JSON = __importStar(require("./json.js"));
38
+ const JSONC = __importStar(require("./jsonc/index.js"));
39
+ const YAML = __importStar(require("./yaml.js"));
40
+ function toFormat(value) {
41
+ if (value === 'json') {
42
+ return JSON;
43
+ }
44
+ else if (value === 'yaml') {
45
+ return YAML;
46
+ }
47
+ else {
48
+ return JSONC;
49
+ }
50
+ }
@@ -1,2 +1,4 @@
1
- export declare function parse(data: string): Record<string, unknown>;
2
- export declare function stringify(data: Record<string, unknown>): string;
1
+ import { type ParseResult } from '../types/context.js';
2
+ import { type Transform } from './jsonc/transform.js';
3
+ export declare function parse(data: string): ParseResult;
4
+ export declare function stringify(data: Record<string, unknown>, _transform?: Transform): string;
@@ -5,10 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parse = parse;
7
7
  exports.stringify = stringify;
8
+ const sync_1 = require("@zokugun/xtry/sync");
8
9
  const yaml_1 = __importDefault(require("yaml"));
9
10
  function parse(data) {
10
- return yaml_1.default.parse(data);
11
+ const result = (0, sync_1.xtry)(() => yaml_1.default.parse(data));
12
+ if (result.fails) {
13
+ return (0, sync_1.err)((0, sync_1.stringifyError)(result.error));
14
+ }
15
+ return (0, sync_1.ok)({ data: result.value });
11
16
  }
12
- function stringify(data) {
17
+ function stringify(data, _transform) {
13
18
  return yaml_1.default.stringify(data);
14
19
  }
@@ -18,6 +18,13 @@ async function command({ current, incoming }) {
18
18
  const incomingCommand = trueAndMatch[1].trim();
19
19
  return currentSegments.has(incomingCommand) ? current : `${current} && ${incomingCommand}`;
20
20
  }
21
+ const incomingAndMatch = /^(.+?)\s*&&\s*(.+)$/.exec(incoming);
22
+ if (incomingAndMatch && !current.includes('&&')) {
23
+ const left = incomingAndMatch[1].trim();
24
+ if (current.trim() === left || currentSegments.has(left)) {
25
+ return incoming;
26
+ }
27
+ }
21
28
  const mixed = (0, index_js_1.mergeWithSemicolonMix)(current, incoming);
22
29
  if (mixed) {
23
30
  return mixed;
@@ -1,8 +1,9 @@
1
1
  export { command } from './command.js';
2
- export { mapConcat } from './map-concat.js';
3
- export { mapDelete } from './map-delete.js';
4
2
  export { linesConcat } from './lines-concat.js';
5
3
  export { listConcat } from './list-concat.js';
6
- export { listSortConcat } from './list-sort-concat.js';
4
+ export { listConcatAfter } from './list-concat-after.js';
5
+ export { mapConcat } from './map-concat.js';
6
+ export { mapDelete } from './map-delete.js';
7
+ export { mergeDotJs } from './merge-dot-js.js';
7
8
  export { overwrite } from './overwrite.js';
8
9
  export { primitive } from './primitive.js';
@@ -1,18 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.primitive = exports.overwrite = exports.listSortConcat = exports.listConcat = exports.linesConcat = exports.mapDelete = exports.mapConcat = exports.command = void 0;
3
+ exports.primitive = exports.overwrite = exports.mergeDotJs = exports.mapDelete = exports.mapConcat = exports.listConcatAfter = exports.listConcat = exports.linesConcat = exports.command = void 0;
4
4
  var command_js_1 = require("./command.js");
5
5
  Object.defineProperty(exports, "command", { enumerable: true, get: function () { return command_js_1.command; } });
6
- var map_concat_js_1 = require("./map-concat.js");
7
- Object.defineProperty(exports, "mapConcat", { enumerable: true, get: function () { return map_concat_js_1.mapConcat; } });
8
- var map_delete_js_1 = require("./map-delete.js");
9
- Object.defineProperty(exports, "mapDelete", { enumerable: true, get: function () { return map_delete_js_1.mapDelete; } });
10
6
  var lines_concat_js_1 = require("./lines-concat.js");
11
7
  Object.defineProperty(exports, "linesConcat", { enumerable: true, get: function () { return lines_concat_js_1.linesConcat; } });
12
8
  var list_concat_js_1 = require("./list-concat.js");
13
9
  Object.defineProperty(exports, "listConcat", { enumerable: true, get: function () { return list_concat_js_1.listConcat; } });
14
- var list_sort_concat_js_1 = require("./list-sort-concat.js");
15
- Object.defineProperty(exports, "listSortConcat", { enumerable: true, get: function () { return list_sort_concat_js_1.listSortConcat; } });
10
+ var list_concat_after_js_1 = require("./list-concat-after.js");
11
+ Object.defineProperty(exports, "listConcatAfter", { enumerable: true, get: function () { return list_concat_after_js_1.listConcatAfter; } });
12
+ var map_concat_js_1 = require("./map-concat.js");
13
+ Object.defineProperty(exports, "mapConcat", { enumerable: true, get: function () { return map_concat_js_1.mapConcat; } });
14
+ var map_delete_js_1 = require("./map-delete.js");
15
+ Object.defineProperty(exports, "mapDelete", { enumerable: true, get: function () { return map_delete_js_1.mapDelete; } });
16
+ var merge_dot_js_js_1 = require("./merge-dot-js.js");
17
+ Object.defineProperty(exports, "mergeDotJs", { enumerable: true, get: function () { return merge_dot_js_js_1.mergeDotJs; } });
16
18
  var overwrite_js_1 = require("./overwrite.js");
17
19
  Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return overwrite_js_1.overwrite; } });
18
20
  var primitive_js_1 = require("./primitive.js");
@@ -1,4 +1,4 @@
1
- export declare function listSortConcat({ current, incoming }: {
1
+ export declare function listConcatAfter({ current, incoming }: {
2
2
  current: unknown[] | undefined;
3
3
  incoming: unknown[] | undefined;
4
4
  }): Promise<any[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listSortConcat = listSortConcat;
4
- async function listSortConcat({ current, incoming }) {
3
+ exports.listConcatAfter = listConcatAfter;
4
+ async function listConcatAfter({ current, incoming }) {
5
5
  if (!incoming) {
6
6
  return current ?? [];
7
7
  }
@@ -0,0 +1,2 @@
1
+ import { type Args } from '../types/travel.js';
2
+ export declare function mergeDotJs({ current, incoming }: Args<string>): Promise<string>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeDotJs = mergeDotJs;
4
+ const configdotts_merge_1 = require("@zokugun/configdotts-merge");
5
+ async function mergeDotJs({ current, incoming }) {
6
+ const data = (0, configdotts_merge_1.merge)(current, incoming);
7
+ return data;
8
+ }
@@ -4,7 +4,6 @@ exports.configureInstallFileActions = configureInstallFileActions;
4
4
  const is_it_type_1 = require("@zokugun/is-it-type");
5
5
  const xtry_1 = require("@zokugun/xtry");
6
6
  const micromatch_1 = require("micromatch");
7
- const build_travel_js_1 = require("../utils/build-travel.js");
8
7
  async function configureInstallFileActions(context) {
9
8
  const { install } = context.incomingConfig;
10
9
  if (!install) {
@@ -15,7 +14,7 @@ async function configureInstallFileActions(context) {
15
14
  const routes = {};
16
15
  const transformations = {};
17
16
  for (const file of install) {
18
- const { filter, ifExists, pattern, rename, route, transforms } = file;
17
+ const { filter, ifExists, pattern, rename, transforms } = file;
19
18
  if (rename) {
20
19
  context.renamedPatterns.push({
21
20
  from: pattern,
@@ -39,24 +38,6 @@ async function configureInstallFileActions(context) {
39
38
  if (filter) {
40
39
  filters[pattern] = filter;
41
40
  }
42
- if (route) {
43
- const { alias } = route;
44
- const travel = (0, build_travel_js_1.buildTravel)(route);
45
- if (travel.fails) {
46
- return travel;
47
- }
48
- if (alias) {
49
- routes[pattern] = {
50
- alias,
51
- travel: travel.value,
52
- };
53
- }
54
- else {
55
- routes[pattern] = {
56
- travel: travel.value,
57
- };
58
- }
59
- }
60
41
  if (transforms) {
61
42
  transformations[pattern] = transforms;
62
43
  }
@@ -4,7 +4,6 @@ exports.configureUpdateFileActions = configureUpdateFileActions;
4
4
  const is_it_type_1 = require("@zokugun/is-it-type");
5
5
  const xtry_1 = require("@zokugun/xtry");
6
6
  const micromatch_1 = require("micromatch");
7
- const build_travel_js_1 = require("../utils/build-travel.js");
8
7
  async function configureUpdateFileActions(context) {
9
8
  const { update } = context.incomingConfig;
10
9
  if (update === false) {
@@ -18,7 +17,7 @@ async function configureUpdateFileActions(context) {
18
17
  const routes = {};
19
18
  const transformations = {};
20
19
  for (const file of update) {
21
- const { filter, ifExists, ifMissing, pattern, rename, route, transforms } = file;
20
+ const { filter, ifExists, ifMissing, pattern, rename, transforms } = file;
22
21
  if (rename) {
23
22
  context.renamedPatterns.push({
24
23
  from: pattern,
@@ -45,24 +44,6 @@ async function configureUpdateFileActions(context) {
45
44
  if (filter) {
46
45
  filters[pattern] = filter;
47
46
  }
48
- if (route) {
49
- const { alias } = route;
50
- const travel = (0, build_travel_js_1.buildTravel)(route);
51
- if (travel.fails) {
52
- return travel;
53
- }
54
- if (alias) {
55
- routes[pattern] = {
56
- alias,
57
- travel: travel.value,
58
- };
59
- }
60
- else {
61
- routes[pattern] = {
62
- travel: travel.value,
63
- };
64
- }
65
- }
66
47
  if (transforms) {
67
48
  transformations[pattern] = transforms;
68
49
  }
@@ -23,7 +23,7 @@ async function executeFirstBlock(context) {
23
23
  alias = true;
24
24
  }
25
25
  const variantPath = node_path_1.default.join(context.packagePath, 'variants', variant);
26
- const configResult = await (0, index_js_1.readPackageConfig)(variantPath);
26
+ const configResult = await (0, index_js_1.readPackageConfig)(variantPath, context.global.routes);
27
27
  if (configResult.fails) {
28
28
  return configResult;
29
29
  }
@@ -20,7 +20,6 @@ import { replaceTemplates } from './replace-templates.js';
20
20
  import { transformUntouchedFiles } from './transform-untouched-files.js';
21
21
  import { unmergeTextFiles } from './unmerge-text-files.js';
22
22
  import { validateNewerPackage } from './validate-newer-package.js';
23
- import { validateNotPresentPackage } from './validate-not-present-package.js';
24
23
  import { validatePresentPackage } from './validate-present-package.js';
25
24
  import { writeTextFiles } from './write-text-files.js';
26
25
  export declare const steps: {
@@ -44,7 +43,6 @@ export declare const steps: {
44
43
  transformUntouchedFiles: typeof transformUntouchedFiles;
45
44
  unmergeTextFiles: typeof unmergeTextFiles;
46
45
  validateNewerPackage: typeof validateNewerPackage;
47
- validateNotPresentPackage: typeof validateNotPresentPackage;
48
46
  validatePresentPackage: typeof validatePresentPackage;
49
47
  writeTextFiles: typeof writeTextFiles;
50
48
  };
@@ -4,6 +4,7 @@ exports.steps = void 0;
4
4
  exports.composeSteps = composeSteps;
5
5
  const cli_utils_1 = require("@zokugun/cli-utils");
6
6
  const xtry_1 = require("@zokugun/xtry");
7
+ const context_js_1 = require("../types/context.js");
7
8
  const apply_formatting_js_1 = require("./apply-formatting.js");
8
9
  const configure_branches_js_1 = require("./configure-branches.js");
9
10
  const configure_install_file_actions_js_1 = require("./configure-install-file-actions.js");
@@ -24,7 +25,6 @@ const replace_templates_js_1 = require("./replace-templates.js");
24
25
  const transform_untouched_files_js_1 = require("./transform-untouched-files.js");
25
26
  const unmerge_text_files_js_1 = require("./unmerge-text-files.js");
26
27
  const validate_newer_package_js_1 = require("./validate-newer-package.js");
27
- const validate_not_present_package_js_1 = require("./validate-not-present-package.js");
28
28
  const validate_present_package_js_1 = require("./validate-present-package.js");
29
29
  const write_text_files_js_1 = require("./write-text-files.js");
30
30
  exports.steps = {
@@ -48,12 +48,11 @@ exports.steps = {
48
48
  transformUntouchedFiles: transform_untouched_files_js_1.transformUntouchedFiles,
49
49
  unmergeTextFiles: unmerge_text_files_js_1.unmergeTextFiles,
50
50
  validateNewerPackage: validate_newer_package_js_1.validateNewerPackage,
51
- validateNotPresentPackage: validate_not_present_package_js_1.validateNotPresentPackage,
52
51
  validatePresentPackage: validate_present_package_js_1.validatePresentPackage,
53
52
  writeTextFiles: write_text_files_js_1.writeTextFiles,
54
53
  };
55
54
  function composeSteps(validations, processes) {
56
- const mainFlow = async (targetPath, incomingPath, request, config, options) => {
55
+ const mainFlow = async (targetPath, incomingPath, request, config, global, options) => {
57
56
  const context = {
58
57
  binaryFiles: [],
59
58
  blocks: [],
@@ -61,9 +60,11 @@ function composeSteps(validations, processes) {
61
60
  config,
62
61
  filters: () => undefined,
63
62
  formats: [],
63
+ global,
64
64
  incomingPath,
65
65
  incomingVariant: request.variant,
66
66
  mergedTextFiles: [],
67
+ mode: context_js_1.Mode.Default,
67
68
  onExisting: () => 'merge',
68
69
  onMissing: () => 'continue',
69
70
  options,
@@ -1,3 +1,3 @@
1
1
  import { type AsyncDResult } from '@zokugun/xtry';
2
2
  import { type Context } from '../types/context.js';
3
- export declare function mergeTextFiles({ targetPath, textFiles, mergedTextFiles, onExisting, onMissing, filters, routes, transforms, options }: Context): AsyncDResult;
3
+ export declare function mergeTextFiles({ targetPath, textFiles, mergedTextFiles, onExisting, onMissing, filters, routes, transforms, incomingConfig, global, options }: Context): AsyncDResult;
@@ -11,12 +11,15 @@ const xtry_1 = require("@zokugun/xtry");
11
11
  const index_js_1 = require("../journeys/index.js");
12
12
  const detect_indent_js_1 = require("../utils/detect-indent.js");
13
13
  const has_final_new_line_js_1 = require("../utils/has-final-new-line.js");
14
- async function mergeTextFiles({ targetPath, textFiles, mergedTextFiles, onExisting, onMissing, filters, routes, transforms, options }) {
14
+ async function mergeTextFiles({ targetPath, textFiles, mergedTextFiles, onExisting, onMissing, filters, routes, transforms, incomingConfig, global, options }) {
15
15
  for (const file of textFiles) {
16
16
  if (options.verbose) {
17
17
  cli_utils_1.logger.debug(`${file.name} is going to be merged`);
18
18
  }
19
- const journey = routes(file.name) ?? (0, index_js_1.getJourney)(file.name);
19
+ const journey = routes(file.name)
20
+ ?? (0, index_js_1.getJourney)(file.name, Object.values(incomingConfig.journeys))
21
+ ?? (0, index_js_1.getJourney)(file.name, Object.values(global.journeys))
22
+ ?? (0, index_js_1.getJourney)(file.name);
20
23
  if (!journey) {
21
24
  if (options.verbose) {
22
25
  cli_utils_1.logger.debug(`${file.name}, no merger has been found`);
@@ -85,6 +88,7 @@ async function mergeTextFiles({ targetPath, textFiles, mergedTextFiles, onExisti
85
88
  }
86
89
  case 'overwrite': {
87
90
  mergedTextFiles.push(file);
91
+ global.overwrittenTextFiles.push(fileName);
88
92
  if (options.verbose) {
89
93
  cli_utils_1.logger.debug(`${file.name} has been overwritten`);
90
94
  }
@@ -1,3 +1,3 @@
1
1
  import { type AsyncDResult } from '@zokugun/xtry';
2
2
  import { type Context } from '../types/context.js';
3
- export declare function readFiles({ incomingPath, textFiles, binaryFiles, options }: Context): AsyncDResult;
3
+ export declare function readFiles({ incomingPath, textFiles, binaryFiles, mode, global, options }: Context): AsyncDResult;