@create-node-app/core 0.3.5 → 0.3.6

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
@@ -571,6 +571,8 @@ var fileLoader = ({
571
571
  appName,
572
572
  originalDirectory,
573
573
  verbose,
574
+ useYarn,
575
+ usePnpm,
574
576
  srcDir = DEFAULT_SRC_PATH,
575
577
  runCommand,
576
578
  installCommand,
@@ -589,6 +591,8 @@ var fileLoader = ({
589
591
  appName,
590
592
  originalDirectory,
591
593
  verbose,
594
+ useYarn,
595
+ usePnpm,
592
596
  mode,
593
597
  srcDir,
594
598
  runCommand,
@@ -604,6 +608,8 @@ var loadFiles = async ({
604
608
  appName,
605
609
  originalDirectory,
606
610
  verbose,
611
+ useYarn = false,
612
+ usePnpm = false,
607
613
  srcDir = DEFAULT_SRC_PATH,
608
614
  runCommand,
609
615
  installCommand,
@@ -621,22 +627,33 @@ var loadFiles = async ({
621
627
  "!package-lock.json",
622
628
  "!template.json",
623
629
  "!yarn.lock",
624
- "!pnpm-lock.yaml"
630
+ "!pnpm-lock.yaml",
631
+ // based on the package manager we want to ignore files containing
632
+ // the other package as condition.
633
+ // For example, if `usePnpm` is true, the we need to ignore
634
+ // all files with `.if-npm` or `.if-yarn` somewhere in the name.
635
+ ...usePnpm ? ["!*.if-npm.*", "!*.if-yarn.*"] : useYarn ? ["!*.if-npm.*", "!*.if-pnpm.*"] : ["!*.if-yarn.*", "!*.if-pnpm.*"]
625
636
  ],
626
637
  directoryFilter: ["!package"]
627
638
  })) {
628
639
  try {
640
+ const entryWithoutNodePackageManager = {
641
+ ...entry,
642
+ path: entry.path.replace(/\.if-(npm|yarn|pnpm)/, "")
643
+ };
629
644
  await fileLoader({
630
645
  root,
631
646
  templateDir,
632
647
  appName,
633
648
  originalDirectory,
634
649
  verbose,
650
+ useYarn,
651
+ usePnpm,
635
652
  srcDir,
636
653
  runCommand,
637
654
  installCommand,
638
655
  ...customOptions
639
- })(entry);
656
+ })(entryWithoutNodePackageManager);
640
657
  } catch (err) {
641
658
  if (verbose) {
642
659
  console.log(err);
@@ -671,13 +688,13 @@ var install = (root, useYarn = false, usePnpm = false, dependencies = [], verbos
671
688
  }
672
689
  } else if (usePnpm) {
673
690
  command = "pnpm";
674
- args = ["add", "--save"];
691
+ args = ["install", "--loglevel", "error"];
675
692
  if (isDevDependencies) {
676
693
  args.push("--save-dev");
694
+ } else {
695
+ args.push("--save");
677
696
  }
678
697
  args.push(...dependencies);
679
- args.push("--cwd");
680
- args.push(root);
681
698
  } else {
682
699
  command = "npm";
683
700
  args = ["install", "--loglevel", "error"];
@@ -752,6 +769,8 @@ var run = async ({
752
769
  appName,
753
770
  originalDirectory,
754
771
  verbose,
772
+ useYarn,
773
+ usePnpm,
755
774
  runCommand,
756
775
  installCommand,
757
776
  ...customOptions
package/dist/index.mjs CHANGED
@@ -542,6 +542,8 @@ var fileLoader = ({
542
542
  appName,
543
543
  originalDirectory,
544
544
  verbose,
545
+ useYarn,
546
+ usePnpm,
545
547
  srcDir = DEFAULT_SRC_PATH,
546
548
  runCommand,
547
549
  installCommand,
@@ -560,6 +562,8 @@ var fileLoader = ({
560
562
  appName,
561
563
  originalDirectory,
562
564
  verbose,
565
+ useYarn,
566
+ usePnpm,
563
567
  mode,
564
568
  srcDir,
565
569
  runCommand,
@@ -575,6 +579,8 @@ var loadFiles = async ({
575
579
  appName,
576
580
  originalDirectory,
577
581
  verbose,
582
+ useYarn = false,
583
+ usePnpm = false,
578
584
  srcDir = DEFAULT_SRC_PATH,
579
585
  runCommand,
580
586
  installCommand,
@@ -592,22 +598,33 @@ var loadFiles = async ({
592
598
  "!package-lock.json",
593
599
  "!template.json",
594
600
  "!yarn.lock",
595
- "!pnpm-lock.yaml"
601
+ "!pnpm-lock.yaml",
602
+ // based on the package manager we want to ignore files containing
603
+ // the other package as condition.
604
+ // For example, if `usePnpm` is true, the we need to ignore
605
+ // all files with `.if-npm` or `.if-yarn` somewhere in the name.
606
+ ...usePnpm ? ["!*.if-npm.*", "!*.if-yarn.*"] : useYarn ? ["!*.if-npm.*", "!*.if-pnpm.*"] : ["!*.if-yarn.*", "!*.if-pnpm.*"]
596
607
  ],
597
608
  directoryFilter: ["!package"]
598
609
  })) {
599
610
  try {
611
+ const entryWithoutNodePackageManager = {
612
+ ...entry,
613
+ path: entry.path.replace(/\.if-(npm|yarn|pnpm)/, "")
614
+ };
600
615
  await fileLoader({
601
616
  root,
602
617
  templateDir,
603
618
  appName,
604
619
  originalDirectory,
605
620
  verbose,
621
+ useYarn,
622
+ usePnpm,
606
623
  srcDir,
607
624
  runCommand,
608
625
  installCommand,
609
626
  ...customOptions
610
- })(entry);
627
+ })(entryWithoutNodePackageManager);
611
628
  } catch (err) {
612
629
  if (verbose) {
613
630
  console.log(err);
@@ -642,13 +659,13 @@ var install = (root, useYarn = false, usePnpm = false, dependencies = [], verbos
642
659
  }
643
660
  } else if (usePnpm) {
644
661
  command = "pnpm";
645
- args = ["add", "--save"];
662
+ args = ["install", "--loglevel", "error"];
646
663
  if (isDevDependencies) {
647
664
  args.push("--save-dev");
665
+ } else {
666
+ args.push("--save");
648
667
  }
649
668
  args.push(...dependencies);
650
- args.push("--cwd");
651
- args.push(root);
652
669
  } else {
653
670
  command = "npm";
654
671
  args = ["install", "--loglevel", "error"];
@@ -723,6 +740,8 @@ var run = async ({
723
740
  appName,
724
741
  originalDirectory,
725
742
  verbose,
743
+ useYarn,
744
+ usePnpm,
726
745
  runCommand,
727
746
  installCommand,
728
747
  ...customOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@create-node-app/core",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "scripts": {
17
17
  "lint": "eslint **/*.ts*",
18
18
  "lint:fix": "eslint **/*.ts* --fix",
19
- "typecheck": "tsc --noEmit",
19
+ "type-check": "tsc --noEmit",
20
20
  "build": "tsup ./index.ts --format esm,cjs --dts",
21
21
  "dev": "tsup ./index.ts --format esm,cjs --watch --dts"
22
22
  },