@create-node-app/core 0.3.12 → 0.3.14

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/index.js CHANGED
@@ -2954,6 +2954,11 @@ var __async = (__this, __arguments, generator) => {
2954
2954
  step((generator = generator.apply(__this, __arguments)).next());
2955
2955
  });
2956
2956
  };
2957
+ function pathspec(...paths) {
2958
+ const key = new String(paths);
2959
+ cache.set(key, paths);
2960
+ return key;
2961
+ }
2957
2962
  function isPathSpec(path4) {
2958
2963
  return path4 instanceof String && cache.has(path4);
2959
2964
  }
@@ -3096,6 +3101,12 @@ function pick(source, properties) {
3096
3101
  function delay(duration = 0) {
3097
3102
  return new Promise((done) => setTimeout(done, duration));
3098
3103
  }
3104
+ function orVoid(input) {
3105
+ if (input === false) {
3106
+ return void 0;
3107
+ }
3108
+ return input;
3109
+ }
3099
3110
  var NULL;
3100
3111
  var NOOP;
3101
3112
  var objectToString;
@@ -3352,6 +3363,7 @@ __export2(utils_exports, {
3352
3363
  isUserFunction: () => isUserFunction,
3353
3364
  last: () => last,
3354
3365
  objectToString: () => objectToString,
3366
+ orVoid: () => orVoid,
3355
3367
  parseStringResponse: () => parseStringResponse,
3356
3368
  pick: () => pick,
3357
3369
  prefixedArray: () => prefixedArray,
@@ -3786,6 +3798,28 @@ var init_config = __esm({
3786
3798
  })(GitConfigScope || {});
3787
3799
  }
3788
3800
  });
3801
+ function isDiffNameStatus(input) {
3802
+ return diffNameStatus.has(input);
3803
+ }
3804
+ var DiffNameStatus;
3805
+ var diffNameStatus;
3806
+ var init_diff_name_status = __esm({
3807
+ "src/lib/tasks/diff-name-status.ts"() {
3808
+ DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
3809
+ DiffNameStatus2["ADDED"] = "A";
3810
+ DiffNameStatus2["COPIED"] = "C";
3811
+ DiffNameStatus2["DELETED"] = "D";
3812
+ DiffNameStatus2["MODIFIED"] = "M";
3813
+ DiffNameStatus2["RENAMED"] = "R";
3814
+ DiffNameStatus2["CHANGED"] = "T";
3815
+ DiffNameStatus2["UNMERGED"] = "U";
3816
+ DiffNameStatus2["UNKNOWN"] = "X";
3817
+ DiffNameStatus2["BROKEN"] = "B";
3818
+ return DiffNameStatus2;
3819
+ })(DiffNameStatus || {});
3820
+ diffNameStatus = new Set(Object.values(DiffNameStatus));
3821
+ }
3822
+ });
3789
3823
  function grepQueryBuilder(...params) {
3790
3824
  return new GrepQuery().param(...params);
3791
3825
  }
@@ -4402,6 +4436,19 @@ var init_commit = __esm({
4402
4436
  init_task();
4403
4437
  }
4404
4438
  });
4439
+ function first_commit_default() {
4440
+ return {
4441
+ firstCommit() {
4442
+ return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments));
4443
+ }
4444
+ };
4445
+ }
4446
+ var init_first_commit = __esm({
4447
+ "src/lib/tasks/first-commit.ts"() {
4448
+ init_utils();
4449
+ init_task();
4450
+ }
4451
+ });
4405
4452
  function hashObjectTask(filePath, write) {
4406
4453
  const commands = ["hash-object", filePath];
4407
4454
  if (write) {
@@ -4518,6 +4565,7 @@ var init_parse_diff_summary = __esm({
4518
4565
  "src/lib/parsers/parse-diff-summary.ts"() {
4519
4566
  init_log_format();
4520
4567
  init_DiffSummary();
4568
+ init_diff_name_status();
4521
4569
  init_utils();
4522
4570
  statParser = [
4523
4571
  new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => {
@@ -4583,11 +4631,12 @@ var init_parse_diff_summary = __esm({
4583
4631
  })
4584
4632
  ];
4585
4633
  nameStatusParser = [
4586
- new LineParser(/([ACDMRTUXB])\s*(.+)$/, (result, [_status, file]) => {
4634
+ new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => {
4587
4635
  result.changed++;
4588
4636
  result.files.push({
4589
- file,
4637
+ file: to != null ? to : from,
4590
4638
  changes: 0,
4639
+ status: orVoid(isDiffNameStatus(status) && status),
4591
4640
  insertions: 0,
4592
4641
  deletions: 0,
4593
4642
  binary: false
@@ -4735,7 +4784,7 @@ function parseLogOptions(opt = {}, customArgs = []) {
4735
4784
  suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
4736
4785
  }
4737
4786
  if (filterString(opt.file)) {
4738
- suffix.push("--follow", opt.file);
4787
+ command.push("--follow", pathspec(opt.file));
4739
4788
  }
4740
4789
  appendTaskOptions(userOptions(opt), command);
4741
4790
  return {
@@ -4772,6 +4821,7 @@ var excludeOptions;
4772
4821
  var init_log = __esm({
4773
4822
  "src/lib/tasks/log.ts"() {
4774
4823
  init_log_format();
4824
+ init_pathspec();
4775
4825
  init_parse_list_log_summary();
4776
4826
  init_utils();
4777
4827
  init_task();
@@ -5431,6 +5481,7 @@ var init_simple_git_api = __esm({
5431
5481
  init_checkout();
5432
5482
  init_commit();
5433
5483
  init_config();
5484
+ init_first_commit();
5434
5485
  init_grep();
5435
5486
  init_hash_object();
5436
5487
  init_init();
@@ -5504,7 +5555,7 @@ var init_simple_git_api = __esm({
5504
5555
  return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
5505
5556
  }
5506
5557
  };
5507
- Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), grep_default(), log_default(), show_default(), version_default());
5558
+ Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default());
5508
5559
  }
5509
5560
  });
5510
5561
  var scheduler_exports = {};
@@ -6450,6 +6501,7 @@ init_task_configuration_error();
6450
6501
  init_check_is_repo();
6451
6502
  init_clean();
6452
6503
  init_config();
6504
+ init_diff_name_status();
6453
6505
  init_grep();
6454
6506
  init_reset();
6455
6507
  function abortPlugin(signal) {
@@ -7299,7 +7351,8 @@ var batchedWriteFiles = async (operations) => {
7299
7351
  try {
7300
7352
  makeDirectory((0, import_path3.dirname)(operation.path));
7301
7353
  await writeFileAsync(operation.path, operation.content, {
7302
- flag: operation.flag
7354
+ flag: operation.flag,
7355
+ mode: operation.mode
7303
7356
  });
7304
7357
  if (operation.verbose) {
7305
7358
  console.log(import_chalk2.default.green(`Added "${operation.path}" successfully`));
@@ -7318,12 +7371,14 @@ var batchedAppendFiles = async (operations) => {
7318
7371
  const batchedPromises = operations.map(async (operation) => {
7319
7372
  try {
7320
7373
  const content = await (0, import_util.promisify)(import_fs4.default.readFile)(operation.src, "utf8");
7374
+ const fileMode = (await (0, import_util.promisify)(import_fs4.default.stat)(operation.src)).mode;
7321
7375
  await batchedWriteFiles([
7322
7376
  {
7323
7377
  path: operation.dest,
7324
7378
  content,
7325
7379
  flag: "a+",
7326
- verbose: operation.verbose
7380
+ verbose: operation.verbose,
7381
+ mode: fileMode
7327
7382
  }
7328
7383
  ]);
7329
7384
  } catch (err) {
@@ -7386,10 +7441,9 @@ var templateLoader = ({
7386
7441
  const operations = [];
7387
7442
  try {
7388
7443
  const flag = mode.includes("append") ? "a+" : "w";
7389
- const file = await (0, import_util.promisify)(import_fs4.default.readFile)(
7390
- `${templateDir}/${path4}`,
7391
- "utf8"
7392
- );
7444
+ const filePath = `${templateDir}/${path4}`;
7445
+ const file = await (0, import_util.promisify)(import_fs4.default.readFile)(filePath, "utf8");
7446
+ const fileMode = (await (0, import_util.promisify)(import_fs4.default.stat)(filePath)).mode;
7393
7447
  const newFile = import_underscore.default.template(file);
7394
7448
  const newPath = path4.replace(/.template$/, "").replace(/.append$/, "").replace(/.if-(npm|yarn|pnpm)$/, "").replace(SRC_PATH_PATTERN, getSrcDirPattern(srcDir));
7395
7449
  operations.push({
@@ -7402,7 +7456,8 @@ var templateLoader = ({
7402
7456
  ...customOptions
7403
7457
  }),
7404
7458
  flag,
7405
- verbose
7459
+ verbose,
7460
+ mode: fileMode
7406
7461
  });
7407
7462
  } catch (err) {
7408
7463
  if (verbose) {
@@ -7779,7 +7834,7 @@ var createApp = async ({
7779
7834
  console.log();
7780
7835
  const useYarn = customOptions.packageManager === "yarn" && shouldUseYarn();
7781
7836
  const usePnpm = customOptions.packageManager === "pnpm" && shouldUsePnpm();
7782
- const runCommand = useYarn ? "yarn" : "npm run";
7837
+ const runCommand = useYarn ? "yarn" : usePnpm ? "pnpm run" : "npm run";
7783
7838
  const installCommand = useYarn ? "yarn" : usePnpm ? "pnpm install" : "npm install";
7784
7839
  const { packageJson, dependencies, devDependencies } = await loadPackages({
7785
7840
  templatesOrExtensions,
package/dist/index.mjs CHANGED
@@ -2947,6 +2947,11 @@ var __async = (__this, __arguments, generator) => {
2947
2947
  step((generator = generator.apply(__this, __arguments)).next());
2948
2948
  });
2949
2949
  };
2950
+ function pathspec(...paths) {
2951
+ const key = new String(paths);
2952
+ cache.set(key, paths);
2953
+ return key;
2954
+ }
2950
2955
  function isPathSpec(path4) {
2951
2956
  return path4 instanceof String && cache.has(path4);
2952
2957
  }
@@ -3089,6 +3094,12 @@ function pick(source, properties) {
3089
3094
  function delay(duration = 0) {
3090
3095
  return new Promise((done) => setTimeout(done, duration));
3091
3096
  }
3097
+ function orVoid(input) {
3098
+ if (input === false) {
3099
+ return void 0;
3100
+ }
3101
+ return input;
3102
+ }
3092
3103
  var NULL;
3093
3104
  var NOOP;
3094
3105
  var objectToString;
@@ -3345,6 +3356,7 @@ __export(utils_exports, {
3345
3356
  isUserFunction: () => isUserFunction,
3346
3357
  last: () => last,
3347
3358
  objectToString: () => objectToString,
3359
+ orVoid: () => orVoid,
3348
3360
  parseStringResponse: () => parseStringResponse,
3349
3361
  pick: () => pick,
3350
3362
  prefixedArray: () => prefixedArray,
@@ -3779,6 +3791,28 @@ var init_config = __esm({
3779
3791
  })(GitConfigScope || {});
3780
3792
  }
3781
3793
  });
3794
+ function isDiffNameStatus(input) {
3795
+ return diffNameStatus.has(input);
3796
+ }
3797
+ var DiffNameStatus;
3798
+ var diffNameStatus;
3799
+ var init_diff_name_status = __esm({
3800
+ "src/lib/tasks/diff-name-status.ts"() {
3801
+ DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
3802
+ DiffNameStatus2["ADDED"] = "A";
3803
+ DiffNameStatus2["COPIED"] = "C";
3804
+ DiffNameStatus2["DELETED"] = "D";
3805
+ DiffNameStatus2["MODIFIED"] = "M";
3806
+ DiffNameStatus2["RENAMED"] = "R";
3807
+ DiffNameStatus2["CHANGED"] = "T";
3808
+ DiffNameStatus2["UNMERGED"] = "U";
3809
+ DiffNameStatus2["UNKNOWN"] = "X";
3810
+ DiffNameStatus2["BROKEN"] = "B";
3811
+ return DiffNameStatus2;
3812
+ })(DiffNameStatus || {});
3813
+ diffNameStatus = new Set(Object.values(DiffNameStatus));
3814
+ }
3815
+ });
3782
3816
  function grepQueryBuilder(...params) {
3783
3817
  return new GrepQuery().param(...params);
3784
3818
  }
@@ -4395,6 +4429,19 @@ var init_commit = __esm({
4395
4429
  init_task();
4396
4430
  }
4397
4431
  });
4432
+ function first_commit_default() {
4433
+ return {
4434
+ firstCommit() {
4435
+ return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments));
4436
+ }
4437
+ };
4438
+ }
4439
+ var init_first_commit = __esm({
4440
+ "src/lib/tasks/first-commit.ts"() {
4441
+ init_utils();
4442
+ init_task();
4443
+ }
4444
+ });
4398
4445
  function hashObjectTask(filePath, write) {
4399
4446
  const commands = ["hash-object", filePath];
4400
4447
  if (write) {
@@ -4511,6 +4558,7 @@ var init_parse_diff_summary = __esm({
4511
4558
  "src/lib/parsers/parse-diff-summary.ts"() {
4512
4559
  init_log_format();
4513
4560
  init_DiffSummary();
4561
+ init_diff_name_status();
4514
4562
  init_utils();
4515
4563
  statParser = [
4516
4564
  new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => {
@@ -4576,11 +4624,12 @@ var init_parse_diff_summary = __esm({
4576
4624
  })
4577
4625
  ];
4578
4626
  nameStatusParser = [
4579
- new LineParser(/([ACDMRTUXB])\s*(.+)$/, (result, [_status, file]) => {
4627
+ new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => {
4580
4628
  result.changed++;
4581
4629
  result.files.push({
4582
- file,
4630
+ file: to != null ? to : from,
4583
4631
  changes: 0,
4632
+ status: orVoid(isDiffNameStatus(status) && status),
4584
4633
  insertions: 0,
4585
4634
  deletions: 0,
4586
4635
  binary: false
@@ -4728,7 +4777,7 @@ function parseLogOptions(opt = {}, customArgs = []) {
4728
4777
  suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
4729
4778
  }
4730
4779
  if (filterString(opt.file)) {
4731
- suffix.push("--follow", opt.file);
4780
+ command.push("--follow", pathspec(opt.file));
4732
4781
  }
4733
4782
  appendTaskOptions(userOptions(opt), command);
4734
4783
  return {
@@ -4765,6 +4814,7 @@ var excludeOptions;
4765
4814
  var init_log = __esm({
4766
4815
  "src/lib/tasks/log.ts"() {
4767
4816
  init_log_format();
4817
+ init_pathspec();
4768
4818
  init_parse_list_log_summary();
4769
4819
  init_utils();
4770
4820
  init_task();
@@ -5424,6 +5474,7 @@ var init_simple_git_api = __esm({
5424
5474
  init_checkout();
5425
5475
  init_commit();
5426
5476
  init_config();
5477
+ init_first_commit();
5427
5478
  init_grep();
5428
5479
  init_hash_object();
5429
5480
  init_init();
@@ -5497,7 +5548,7 @@ var init_simple_git_api = __esm({
5497
5548
  return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
5498
5549
  }
5499
5550
  };
5500
- Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), grep_default(), log_default(), show_default(), version_default());
5551
+ Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default());
5501
5552
  }
5502
5553
  });
5503
5554
  var scheduler_exports = {};
@@ -6443,6 +6494,7 @@ init_task_configuration_error();
6443
6494
  init_check_is_repo();
6444
6495
  init_clean();
6445
6496
  init_config();
6497
+ init_diff_name_status();
6446
6498
  init_grep();
6447
6499
  init_reset();
6448
6500
  function abortPlugin(signal) {
@@ -7292,7 +7344,8 @@ var batchedWriteFiles = async (operations) => {
7292
7344
  try {
7293
7345
  makeDirectory(dirname(operation.path));
7294
7346
  await writeFileAsync(operation.path, operation.content, {
7295
- flag: operation.flag
7347
+ flag: operation.flag,
7348
+ mode: operation.mode
7296
7349
  });
7297
7350
  if (operation.verbose) {
7298
7351
  console.log(chalk2.green(`Added "${operation.path}" successfully`));
@@ -7311,12 +7364,14 @@ var batchedAppendFiles = async (operations) => {
7311
7364
  const batchedPromises = operations.map(async (operation) => {
7312
7365
  try {
7313
7366
  const content = await promisify(fs3.readFile)(operation.src, "utf8");
7367
+ const fileMode = (await promisify(fs3.stat)(operation.src)).mode;
7314
7368
  await batchedWriteFiles([
7315
7369
  {
7316
7370
  path: operation.dest,
7317
7371
  content,
7318
7372
  flag: "a+",
7319
- verbose: operation.verbose
7373
+ verbose: operation.verbose,
7374
+ mode: fileMode
7320
7375
  }
7321
7376
  ]);
7322
7377
  } catch (err) {
@@ -7379,10 +7434,9 @@ var templateLoader = ({
7379
7434
  const operations = [];
7380
7435
  try {
7381
7436
  const flag = mode.includes("append") ? "a+" : "w";
7382
- const file = await promisify(fs3.readFile)(
7383
- `${templateDir}/${path4}`,
7384
- "utf8"
7385
- );
7437
+ const filePath = `${templateDir}/${path4}`;
7438
+ const file = await promisify(fs3.readFile)(filePath, "utf8");
7439
+ const fileMode = (await promisify(fs3.stat)(filePath)).mode;
7386
7440
  const newFile = _.template(file);
7387
7441
  const newPath = path4.replace(/.template$/, "").replace(/.append$/, "").replace(/.if-(npm|yarn|pnpm)$/, "").replace(SRC_PATH_PATTERN, getSrcDirPattern(srcDir));
7388
7442
  operations.push({
@@ -7395,7 +7449,8 @@ var templateLoader = ({
7395
7449
  ...customOptions
7396
7450
  }),
7397
7451
  flag,
7398
- verbose
7452
+ verbose,
7453
+ mode: fileMode
7399
7454
  });
7400
7455
  } catch (err) {
7401
7456
  if (verbose) {
@@ -7772,7 +7827,7 @@ var createApp = async ({
7772
7827
  console.log();
7773
7828
  const useYarn = customOptions.packageManager === "yarn" && shouldUseYarn();
7774
7829
  const usePnpm = customOptions.packageManager === "pnpm" && shouldUsePnpm();
7775
- const runCommand = useYarn ? "yarn" : "npm run";
7830
+ const runCommand = useYarn ? "yarn" : usePnpm ? "pnpm run" : "npm run";
7776
7831
  const installCommand = useYarn ? "yarn" : usePnpm ? "pnpm install" : "npm install";
7777
7832
  const { packageJson, dependencies, devDependencies } = await loadPackages({
7778
7833
  templatesOrExtensions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@create-node-app/core",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -27,11 +27,11 @@
27
27
  "@types/download": "^8.0.2",
28
28
  "@types/envinfo": "^7.8.1",
29
29
  "@types/fs-extra": "^11.0.2",
30
- "@types/lodash.merge": "^4.6.7",
30
+ "@types/lodash.merge": "^4.6.9",
31
31
  "@types/node": "^18.14.6",
32
32
  "@types/underscore": "^1.11.4",
33
33
  "eslint": "^7.32.0",
34
- "simple-git": "^3.19.1",
34
+ "simple-git": "^3.22.0",
35
35
  "tsconfig": "*",
36
36
  "typescript": "^4.5.2"
37
37
  },
@@ -40,7 +40,7 @@
40
40
  "commander": "^7.0.0",
41
41
  "cross-spawn": "^6.0.5",
42
42
  "debug": "^4.2.0",
43
- "download": "^8.0.0",
43
+ "download": "^3.3.0",
44
44
  "envinfo": "^7.10.0",
45
45
  "lodash.merge": "^4.6.2",
46
46
  "readdirp": "^3.4.0",