@zokugun/artifact 0.4.0 → 0.4.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 (59) hide show
  1. package/README.md +0 -2
  2. package/lib/cli.js +2 -0
  3. package/lib/commands/add.js +3 -3
  4. package/lib/commands/list.js +1 -2
  5. package/lib/commands/update.js +3 -3
  6. package/lib/compositors/compose.js +1 -2
  7. package/lib/compositors/fork.js +1 -2
  8. package/lib/compositors/json.js +18 -9
  9. package/lib/compositors/map-sort.js +1 -2
  10. package/lib/compositors/rc.js +18 -9
  11. package/lib/compositors/yaml.js +18 -9
  12. package/lib/configs/install/read-install-config.js +1 -2
  13. package/lib/configs/install/update-install-config.js +1 -2
  14. package/lib/configs/install/write-install-config.js +7 -6
  15. package/lib/configs/package/read-package-config.js +1 -2
  16. package/lib/journeys/index.js +1 -2
  17. package/lib/parsers/json.js +2 -3
  18. package/lib/parsers/jsonc/parse.js +1 -2
  19. package/lib/parsers/jsonc/stringify.js +1 -2
  20. package/lib/parsers/yaml.js +2 -3
  21. package/lib/routes/command.js +1 -2
  22. package/lib/routes/lines-concat.js +1 -2
  23. package/lib/routes/list-concat.js +1 -2
  24. package/lib/routes/list-sort-concat.js +1 -2
  25. package/lib/routes/map-concat.js +1 -2
  26. package/lib/routes/overwrite.js +1 -2
  27. package/lib/routes/primitive.js +1 -2
  28. package/lib/steps/apply-formatting.js +3 -4
  29. package/lib/steps/configure-branches.js +10 -3
  30. package/lib/steps/configure-install-file-actions.js +1 -2
  31. package/lib/steps/configure-update-file-actions.js +1 -2
  32. package/lib/steps/copy-binary-files.js +7 -6
  33. package/lib/steps/execute-first-block.js +2 -3
  34. package/lib/steps/execute-next-block.js +1 -2
  35. package/lib/steps/index.js +7 -6
  36. package/lib/steps/insert-final-new-line.js +3 -4
  37. package/lib/steps/merge-text-files.js +5 -6
  38. package/lib/steps/read-editor-config.js +22 -13
  39. package/lib/steps/read-files.js +3 -4
  40. package/lib/steps/read-incoming-config.js +1 -2
  41. package/lib/steps/read-incoming-package.js +1 -2
  42. package/lib/steps/remove-files.js +7 -6
  43. package/lib/steps/replace-templates.js +3 -4
  44. package/lib/steps/validate-newer-package.js +3 -4
  45. package/lib/steps/validate-not-present-package.js +3 -4
  46. package/lib/steps/write-text-files.js +19 -11
  47. package/lib/types/format.js +1 -1
  48. package/lib/utils/build-journey-plan.js +1 -2
  49. package/lib/utils/build-travel-plan.js +1 -2
  50. package/lib/utils/command/join-command.js +1 -2
  51. package/lib/utils/command/split-command.js +1 -2
  52. package/lib/utils/dev-null.js +1 -2
  53. package/lib/utils/read-buffer.js +5 -8
  54. package/lib/utils/resolve-request.js +1 -2
  55. package/lib/utils/template.js +17 -7
  56. package/lib/utils/to-lines.js +1 -2
  57. package/lib/utils/trim-final-newline.js +1 -2
  58. package/lib/utils/try-json.js +1 -2
  59. package/package.json +4 -3
@@ -12,13 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.executeFirstBlock = void 0;
15
+ exports.executeFirstBlock = executeFirstBlock;
16
16
  const node_path_1 = __importDefault(require("node:path"));
17
17
  const lodash_1 = require("lodash");
18
18
  const configs_1 = require("../configs");
19
19
  function executeFirstBlock(context) {
20
- var _a, _b, _c, _d;
21
20
  return __awaiter(this, void 0, void 0, function* () {
21
+ var _a, _b, _c, _d;
22
22
  const { name, version } = context.incomingPackage;
23
23
  const root = String((_b = (_a = context.incomingConfig.variants) === null || _a === void 0 ? void 0 : _a.root) !== null && _b !== void 0 ? _b : '');
24
24
  if (context.incomingVariant) {
@@ -91,7 +91,6 @@ function executeFirstBlock(context) {
91
91
  }
92
92
  });
93
93
  }
94
- exports.executeFirstBlock = executeFirstBlock;
95
94
  function pushToResult(name, version, variant, alias, context) {
96
95
  var _a, _b;
97
96
  var _c;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.executeNextBlock = void 0;
12
+ exports.executeNextBlock = executeNextBlock;
13
13
  const lodash_1 = require("lodash");
14
14
  function executeNextBlock(context) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
@@ -20,4 +20,3 @@ function executeNextBlock(context) {
20
20
  }
21
21
  });
22
22
  }
23
- exports.executeNextBlock = executeNextBlock;
@@ -9,7 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.composeSteps = exports.steps = void 0;
12
+ exports.steps = void 0;
13
+ exports.composeSteps = composeSteps;
14
+ const ansi_colors_1 = require("ansi-colors");
13
15
  const apply_formatting_1 = require("./apply-formatting");
14
16
  const configure_branches_1 = require("./configure-branches");
15
17
  const configure_install_file_actions_1 = require("./configure-install-file-actions");
@@ -81,14 +83,14 @@ function composeSteps(validations, processes) {
81
83
  });
82
84
  const commonFlow = (name, version, variant, branch, incomingPath, mainContext) => __awaiter(this, void 0, void 0, function* () {
83
85
  if (mainContext.options.verbose) {
84
- let message = `--> ${name}@${version}`;
86
+ let message = `\n=== ${name} version=${version} ===\n`;
85
87
  if (variant) {
86
- message += `:${variant}`;
88
+ message += ` variant=${variant}`;
87
89
  }
88
90
  if (branch) {
89
- message += `(${branch})`;
91
+ message += ` branch=${branch}`;
90
92
  }
91
- console.log(message);
93
+ console.log((0, ansi_colors_1.bgBlue)(message));
92
94
  }
93
95
  const context = Object.assign(Object.assign({}, mainContext), { incomingPath, incomingName: name, incomingVersion: version, incomingVariant: variant, incomingBranch: branch, incomingConfig: undefined, onExisting: () => 'merge', onMissing: () => 'continue', filters: () => undefined, routes: () => undefined, binaryFiles: [], textFiles: [], mergedTextFiles: [], formats: [] });
94
96
  let skipped = false;
@@ -102,4 +104,3 @@ function composeSteps(validations, processes) {
102
104
  });
103
105
  return { mainFlow, commonFlow };
104
106
  }
105
- exports.composeSteps = composeSteps;
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.insertFinalNewLine = void 0;
13
- function insertFinalNewLine({ mergedTextFiles }) {
14
- return __awaiter(this, void 0, void 0, function* () {
12
+ exports.insertFinalNewLine = insertFinalNewLine;
13
+ function insertFinalNewLine(_a) {
14
+ return __awaiter(this, arguments, void 0, function* ({ mergedTextFiles }) {
15
15
  for (const file of mergedTextFiles) {
16
16
  if (file.finalNewLine) {
17
17
  const withFinalNewLine = file.data.endsWith('\n');
@@ -22,4 +22,3 @@ function insertFinalNewLine({ mergedTextFiles }) {
22
22
  }
23
23
  });
24
24
  }
25
- exports.insertFinalNewLine = insertFinalNewLine;
@@ -12,18 +12,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.mergeTextFiles = void 0;
15
+ exports.mergeTextFiles = mergeTextFiles;
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
18
  const journeys_1 = require("../journeys");
19
- function mergeTextFiles({ targetPath, textFiles, mergedTextFiles, onExisting, onMissing, filters, routes, options }) {
20
- var _a;
21
- return __awaiter(this, void 0, void 0, function* () {
19
+ function mergeTextFiles(_a) {
20
+ return __awaiter(this, arguments, void 0, function* ({ targetPath, textFiles, mergedTextFiles, onExisting, onMissing, filters, routes, options }) {
21
+ var _b;
22
22
  for (const file of textFiles) {
23
23
  if (options.verbose) {
24
24
  console.log(`${file.name} is going to be merged`);
25
25
  }
26
- const journey = (_a = routes(file.name)) !== null && _a !== void 0 ? _a : (0, journeys_1.getJourney)(file.name);
26
+ const journey = (_b = routes(file.name)) !== null && _b !== void 0 ? _b : (0, journeys_1.getJourney)(file.name);
27
27
  if (!journey) {
28
28
  if (options.verbose) {
29
29
  console.log(`${file.name}, no merger has been found`);
@@ -105,4 +105,3 @@ function mergeTextFiles({ targetPath, textFiles, mergedTextFiles, onExisting, on
105
105
  }
106
106
  });
107
107
  }
108
- exports.mergeTextFiles = mergeTextFiles;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
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
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.readEditorConfig = void 0;
48
+ exports.readEditorConfig = readEditorConfig;
39
49
  const path_1 = __importDefault(require("path"));
40
50
  const editorconfig = __importStar(require("editorconfig"));
41
51
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -53,22 +63,22 @@ function buildFullGlob(glob) {
53
63
  }
54
64
  return glob.replace(/\*\*/g, '{*,**/**/**}');
55
65
  } // }}}
56
- function readEditorConfig({ incomingPath, targetPath, formats }) {
57
- return __awaiter(this, void 0, void 0, function* () {
66
+ function readEditorConfig(_a) {
67
+ return __awaiter(this, arguments, void 0, function* ({ incomingPath, targetPath, formats }) {
58
68
  let data;
59
69
  try {
60
70
  const dir = path_1.default.join(incomingPath, 'configs');
61
71
  const file = path_1.default.join(dir, '.editorconfig');
62
72
  data = yield fs_extra_1.default.readFile(file, 'utf-8');
63
73
  }
64
- catch (_a) {
74
+ catch (_b) {
65
75
  }
66
76
  if (!data) {
67
77
  try {
68
78
  const file = path_1.default.join(targetPath, '.editorconfig');
69
79
  data = yield fs_extra_1.default.readFile(file, 'utf-8');
70
80
  }
71
- catch (_b) {
81
+ catch (_c) {
72
82
  }
73
83
  }
74
84
  if (!data) {
@@ -98,4 +108,3 @@ function readEditorConfig({ incomingPath, targetPath, formats }) {
98
108
  formats.reverse();
99
109
  });
100
110
  }
101
- exports.readEditorConfig = readEditorConfig;
@@ -12,14 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.readFiles = void 0;
15
+ exports.readFiles = readFiles;
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
18
  const globby_1 = __importDefault(require("globby"));
19
19
  const istextorbinary_1 = require("istextorbinary");
20
20
  const read_buffer_1 = require("../utils/read-buffer");
21
- function readFiles({ incomingPath, textFiles, binaryFiles, options }) {
22
- return __awaiter(this, void 0, void 0, function* () {
21
+ function readFiles(_a) {
22
+ return __awaiter(this, arguments, void 0, function* ({ incomingPath, textFiles, binaryFiles, options }) {
23
23
  const cwd = path_1.default.join(incomingPath, 'configs');
24
24
  const files = yield (0, globby_1.default)(['**/*', '!**/*.lock', '!**/*-lock.*'], {
25
25
  cwd,
@@ -66,4 +66,3 @@ function readFiles({ incomingPath, textFiles, binaryFiles, options }) {
66
66
  }
67
67
  });
68
68
  }
69
- exports.readFiles = readFiles;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.readIncomingConfig = void 0;
12
+ exports.readIncomingConfig = readIncomingConfig;
13
13
  const configs_1 = require("../configs");
14
14
  function readIncomingConfig(context) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
@@ -22,4 +22,3 @@ function readIncomingConfig(context) {
22
22
  }
23
23
  });
24
24
  }
25
- exports.readIncomingConfig = readIncomingConfig;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.readIncomingPackage = void 0;
15
+ exports.readIncomingPackage = readIncomingPackage;
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
18
  const lodash_1 = require("lodash");
@@ -26,7 +26,6 @@ function readIncomingPackage(context) {
26
26
  context.incomingPackage = incomingPackage;
27
27
  });
28
28
  }
29
- exports.readIncomingPackage = readIncomingPackage;
30
29
  function isPackageManifest(value) {
31
30
  if ((0, lodash_1.isNil)(value) || !(0, lodash_1.isPlainObject)(value)) {
32
31
  return false;
@@ -12,13 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.removeFiles = void 0;
15
+ exports.removeFiles = removeFiles;
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
18
  const globby_1 = __importDefault(require("globby"));
19
19
  const micromatch_1 = require("micromatch");
20
- function removeFiles({ removedPatterns, targetPath, options }) {
21
- return __awaiter(this, void 0, void 0, function* () {
20
+ function removeFiles(_a) {
21
+ return __awaiter(this, arguments, void 0, function* ({ removedPatterns, targetPath, options }) {
22
22
  if (removedPatterns.length === 0) {
23
23
  return;
24
24
  }
@@ -29,8 +29,10 @@ function removeFiles({ removedPatterns, targetPath, options }) {
29
29
  });
30
30
  for (const file of files) {
31
31
  if ((0, micromatch_1.isMatch)(file, removedPatterns)) {
32
- const filePath = path_1.default.join(cwd, file);
33
- yield fs_extra_1.default.unlink(filePath);
32
+ if (!options.dryRun) {
33
+ const filePath = path_1.default.join(cwd, file);
34
+ yield fs_extra_1.default.unlink(filePath);
35
+ }
34
36
  if (options.verbose) {
35
37
  console.log(`${file} has been removed`);
36
38
  }
@@ -38,4 +40,3 @@ function removeFiles({ removedPatterns, targetPath, options }) {
38
40
  }
39
41
  });
40
42
  }
41
- exports.removeFiles = removeFiles;
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.replaceTemplates = void 0;
12
+ exports.replaceTemplates = replaceTemplates;
13
13
  const template_1 = require("../utils/template");
14
- function replaceTemplates({ textFiles, binaryFiles, targetPath }) {
15
- return __awaiter(this, void 0, void 0, function* () {
14
+ function replaceTemplates(_a) {
15
+ return __awaiter(this, arguments, void 0, function* ({ textFiles, binaryFiles, targetPath }) {
16
16
  const engine = new template_1.TemplateEngine(targetPath);
17
17
  for (const file of textFiles) {
18
18
  file.data = engine.render(file.data);
@@ -23,4 +23,3 @@ function replaceTemplates({ textFiles, binaryFiles, targetPath }) {
23
23
  }
24
24
  });
25
25
  }
26
- exports.replaceTemplates = replaceTemplates;
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.validateNewerPackage = void 0;
12
+ exports.validateNewerPackage = validateNewerPackage;
13
13
  const semver_1 = require("semver");
14
- function validateNewerPackage({ incomingPackage, config, options }) {
15
- return __awaiter(this, void 0, void 0, function* () {
14
+ function validateNewerPackage(_a) {
15
+ return __awaiter(this, arguments, void 0, function* ({ incomingPackage, config, options }) {
16
16
  if (options.force) {
17
17
  return;
18
18
  }
@@ -22,4 +22,3 @@ function validateNewerPackage({ incomingPackage, config, options }) {
22
22
  }
23
23
  });
24
24
  }
25
- exports.validateNewerPackage = validateNewerPackage;
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.validateNotPresentPackage = void 0;
13
- function validateNotPresentPackage({ incomingPackage, config, options }) {
14
- return __awaiter(this, void 0, void 0, function* () {
12
+ exports.validateNotPresentPackage = validateNotPresentPackage;
13
+ function validateNotPresentPackage(_a) {
14
+ return __awaiter(this, arguments, void 0, function* ({ incomingPackage, config, options }) {
15
15
  if (options.force) {
16
16
  return;
17
17
  }
@@ -30,4 +30,3 @@ function validateNotPresentPackage({ incomingPackage, config, options }) {
30
30
  }
31
31
  });
32
32
  }
33
- exports.validateNotPresentPackage = validateNotPresentPackage;
@@ -12,21 +12,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.writeTextFiles = void 0;
15
+ exports.writeTextFiles = writeTextFiles;
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
- function writeTextFiles({ mergedTextFiles, targetPath, options }) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- for (const file of mergedTextFiles) {
21
- const filePath = path_1.default.join(targetPath, file.name);
22
- yield fs_extra_1.default.outputFile(filePath, file.data, 'utf-8');
23
- if (file.mode) {
24
- yield fs_extra_1.default.chmod(filePath, file.mode);
25
- }
18
+ function writeTextFiles(_a) {
19
+ return __awaiter(this, arguments, void 0, function* ({ mergedTextFiles, targetPath, options }) {
20
+ if (options.dryRun) {
26
21
  if (options.verbose) {
27
- console.log(`${file.name} has been written as a text file`);
22
+ for (const file of mergedTextFiles) {
23
+ console.log(`${file.name} has been written as a text file`);
24
+ }
25
+ }
26
+ }
27
+ else {
28
+ for (const file of mergedTextFiles) {
29
+ const filePath = path_1.default.join(targetPath, file.name);
30
+ yield fs_extra_1.default.outputFile(filePath, file.data, 'utf-8');
31
+ if (file.mode) {
32
+ yield fs_extra_1.default.chmod(filePath, file.mode);
33
+ }
34
+ if (options.verbose) {
35
+ console.log(`${file.name} has been written as a text file`);
36
+ }
28
37
  }
29
38
  }
30
39
  });
31
40
  }
32
- exports.writeTextFiles = writeTextFiles;
@@ -5,4 +5,4 @@ var IndentStyle;
5
5
  (function (IndentStyle) {
6
6
  IndentStyle["SPACE"] = "space";
7
7
  IndentStyle["TAB"] = "tab";
8
- })(IndentStyle = exports.IndentStyle || (exports.IndentStyle = {}));
8
+ })(IndentStyle || (exports.IndentStyle = IndentStyle = {}));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildJourneyPlan = void 0;
3
+ exports.buildJourneyPlan = buildJourneyPlan;
4
4
  function buildJourneyPlan(plan, alias) {
5
5
  return (basename) => {
6
6
  const travel = plan(basename);
@@ -15,4 +15,3 @@ function buildJourneyPlan(plan, alias) {
15
15
  }
16
16
  };
17
17
  }
18
- exports.buildJourneyPlan = buildJourneyPlan;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildTravelPlan = void 0;
3
+ exports.buildTravelPlan = buildTravelPlan;
4
4
  function buildTravelPlan(...mappers) {
5
5
  return (basename) => {
6
6
  const mapper = mappers.find((mapper) => {
@@ -17,4 +17,3 @@ function buildTravelPlan(...mappers) {
17
17
  }
18
18
  };
19
19
  }
20
- exports.buildTravelPlan = buildTravelPlan;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.joinCommand = void 0;
3
+ exports.joinCommand = joinCommand;
4
4
  function joinCommand(commands) {
5
5
  const subcommands = [];
6
6
  for (const [key, values] of Object.entries(commands)) {
@@ -29,4 +29,3 @@ function joinCommand(commands) {
29
29
  }
30
30
  return subcommands.join(' ');
31
31
  }
32
- exports.joinCommand = joinCommand;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splitCommand = void 0;
3
+ exports.splitCommand = splitCommand;
4
4
  const lodash_1 = require("lodash");
5
5
  function splitCommand(command) {
6
6
  const result = {};
@@ -29,4 +29,3 @@ function splitCommand(command) {
29
29
  }
30
30
  return result;
31
31
  }
32
- exports.splitCommand = splitCommand;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDevNull = void 0;
3
+ exports.createDevNull = createDevNull;
4
4
  const fs_1 = require("fs");
5
5
  function createDevNull() {
6
6
  return (0, fs_1.createWriteStream)('/dev/null');
7
7
  }
8
- exports.createDevNull = createDevNull;
@@ -12,19 +12,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.readBuffer = void 0;
15
+ exports.readBuffer = readBuffer;
16
16
  const buffer_1 = require("buffer");
17
17
  const promises_1 = __importDefault(require("fs/promises"));
18
- function readBuffer(filepath, size, offset = 0) {
19
- return __awaiter(this, void 0, void 0, function* () {
18
+ function readBuffer(filepath_1, size_1) {
19
+ return __awaiter(this, arguments, void 0, function* (filepath, size, offset = 0) {
20
20
  const buffer = buffer_1.Buffer.alloc(size);
21
21
  const file = yield promises_1.default.open(filepath, 'r');
22
22
  try {
23
- const { bytesRead } = yield file.read(buffer, offset, size, 0);
23
+ const { bytesRead } = yield file.read(buffer, 0, size, offset);
24
24
  if (bytesRead < size) {
25
- const smaller = buffer_1.Buffer.alloc(bytesRead);
26
- buffer.copy(smaller, 0, 0, bytesRead);
27
- return smaller;
25
+ return buffer.slice(0, bytesRead);
28
26
  }
29
27
  else {
30
28
  return buffer;
@@ -35,4 +33,3 @@ function readBuffer(filepath, size, offset = 0) {
35
33
  }
36
34
  });
37
35
  }
38
- exports.readBuffer = readBuffer;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveRequest = void 0;
6
+ exports.resolveRequest = resolveRequest;
7
7
  const untildify_1 = __importDefault(require("untildify"));
8
8
  function resolveRequest(spec) {
9
9
  if (spec.startsWith('~')) {
@@ -40,4 +40,3 @@ function resolveRequest(spec) {
40
40
  return { name: spec };
41
41
  }
42
42
  } // }}}
43
- exports.resolveRequest = resolveRequest;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
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
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toLines = void 0;
3
+ exports.toLines = toLines;
4
4
  function toLines(value) {
5
5
  return value.split(/\r?\n/g);
6
6
  }
7
- exports.toLines = toLines;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trimFinalNewLine = void 0;
3
+ exports.trimFinalNewLine = trimFinalNewLine;
4
4
  const FINAL_NEWLINE_REGEX = /(\r?\n)*$/;
5
5
  function trimFinalNewLine(value) {
6
6
  return value.replace(FINAL_NEWLINE_REGEX, '');
7
7
  }
8
- exports.trimFinalNewLine = trimFinalNewLine;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryJson = void 0;
3
+ exports.tryJson = tryJson;
4
4
  function tryJson(value) {
5
5
  try {
6
6
  return JSON.parse(value);
@@ -9,4 +9,3 @@ function tryJson(value) {
9
9
  return undefined;
10
10
  }
11
11
  }
12
- exports.tryJson = tryJson;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zokugun/artifact",
3
3
  "description": "Boilerplate your project & keep your configurations up to date",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "author": {
6
6
  "name": "Baptiste Augrain",
7
7
  "email": "daiyam@zokugun.org"
@@ -33,7 +33,7 @@
33
33
  "watch:test": "tsc-watch -p test"
34
34
  },
35
35
  "dependencies": {
36
- "@zokugun/configdotts-merge": "^0.1.0",
36
+ "@zokugun/configdotts-merge": "^0.2.0",
37
37
  "ansi-colors": "^4.1.1",
38
38
  "commander": "^9.0.0",
39
39
  "dayjs": "^1.11.13",
@@ -50,6 +50,7 @@
50
50
  "pacote": "^13.0.5",
51
51
  "semver": "^7.3.5",
52
52
  "tempy": "^1.0.1",
53
+ "typescript": "^5.9.2",
53
54
  "untildify": "^4.0.0",
54
55
  "yaml": "^1.10.2"
55
56
  },
@@ -71,6 +72,7 @@
71
72
  "chai": "^4.3.4",
72
73
  "chai-as-promised": "^7.1.1",
73
74
  "commitizen": "^4.2.4",
75
+ "eslint": "8.11.0",
74
76
  "eslint-plugin-chai-friendly": "^0.7.2",
75
77
  "fixpack": "^4.0.0",
76
78
  "husky": "^7.0.1",
@@ -81,7 +83,6 @@
81
83
  "rewiremock": "^3.14.3",
82
84
  "source-map-support": "^0.5.20",
83
85
  "tsc-watch": "^4.5.0",
84
- "typescript": "^4.2.4",
85
86
  "universalify": "^2.0.0",
86
87
  "xo": "^0.48.0"
87
88
  },