@create-node-app/core 0.3.1 → 0.3.3

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
@@ -701,18 +701,20 @@ var install = (root, useYarn = false, usePnpm = false, dependencies = [], verbos
701
701
  });
702
702
  });
703
703
  };
704
- var runCommandInProjectDir = (root, command, args = [], successMessage = "Operation completed successfully.", errorMessage = "Operation failed.") => {
705
- return new Promise((resolve, reject) => {
706
- const child = (0, import_cross_spawn2.default)(command, args, { stdio: "inherit", cwd: root });
707
- child.on("close", (code) => {
708
- if (code !== 0) {
709
- console.log(import_chalk3.default.red(errorMessage));
710
- return;
711
- }
712
- console.log(import_chalk3.default.green(successMessage));
713
- resolve();
704
+ var runCommandInProjectDir = async (root, command, args = [], successMessage = "Operation completed successfully.", errorMessage = "Operation failed.") => {
705
+ try {
706
+ (0, import_child_process3.execSync)(`${command} ${args.join(" ")}`, {
707
+ cwd: root,
708
+ // don't show output in console
709
+ stdio: "ignore"
714
710
  });
715
- });
711
+ console.log();
712
+ console.log(import_chalk3.default.green(successMessage));
713
+ } catch (error) {
714
+ console.log();
715
+ console.log(import_chalk3.default.red(errorMessage));
716
+ console.log();
717
+ }
716
718
  };
717
719
  var run = async ({
718
720
  root,
@@ -834,21 +836,27 @@ var run = async ({
834
836
  import_fs5.default.readFileSync(`${root}/package.json`, "utf8")
835
837
  );
836
838
  if (packageJson.scripts && packageJson.scripts["format"]) {
837
- await runCommandInProjectDir(
838
- root,
839
- runCommand,
840
- ["format"],
841
- "Successfully formatted code."
842
- );
839
+ try {
840
+ await runCommandInProjectDir(
841
+ root,
842
+ runCommand,
843
+ ["format"],
844
+ "Successfully formatted code."
845
+ );
846
+ } catch {
847
+ }
843
848
  }
844
849
  if (packageJson.scripts && packageJson.scripts["lint:fix"]) {
845
- await runCommandInProjectDir(
846
- root,
847
- runCommand,
848
- ["lint:fix"],
849
- "Successfully fixed linting errors.",
850
- "Failed to fix linting errors."
851
- );
850
+ try {
851
+ await runCommandInProjectDir(
852
+ root,
853
+ runCommand,
854
+ ["lint:fix"],
855
+ "Successfully fixed linting errors.",
856
+ "Failed to fix linting errors."
857
+ );
858
+ } catch {
859
+ }
852
860
  }
853
861
  }
854
862
  };
package/dist/index.mjs CHANGED
@@ -672,18 +672,20 @@ var install = (root, useYarn = false, usePnpm = false, dependencies = [], verbos
672
672
  });
673
673
  });
674
674
  };
675
- var runCommandInProjectDir = (root, command, args = [], successMessage = "Operation completed successfully.", errorMessage = "Operation failed.") => {
676
- return new Promise((resolve, reject) => {
677
- const child = spawn2(command, args, { stdio: "inherit", cwd: root });
678
- child.on("close", (code) => {
679
- if (code !== 0) {
680
- console.log(chalk3.red(errorMessage));
681
- return;
682
- }
683
- console.log(chalk3.green(successMessage));
684
- resolve();
675
+ var runCommandInProjectDir = async (root, command, args = [], successMessage = "Operation completed successfully.", errorMessage = "Operation failed.") => {
676
+ try {
677
+ execSync2(`${command} ${args.join(" ")}`, {
678
+ cwd: root,
679
+ // don't show output in console
680
+ stdio: "ignore"
685
681
  });
686
- });
682
+ console.log();
683
+ console.log(chalk3.green(successMessage));
684
+ } catch (error) {
685
+ console.log();
686
+ console.log(chalk3.red(errorMessage));
687
+ console.log();
688
+ }
687
689
  };
688
690
  var run = async ({
689
691
  root,
@@ -805,21 +807,27 @@ var run = async ({
805
807
  fs4.readFileSync(`${root}/package.json`, "utf8")
806
808
  );
807
809
  if (packageJson.scripts && packageJson.scripts["format"]) {
808
- await runCommandInProjectDir(
809
- root,
810
- runCommand,
811
- ["format"],
812
- "Successfully formatted code."
813
- );
810
+ try {
811
+ await runCommandInProjectDir(
812
+ root,
813
+ runCommand,
814
+ ["format"],
815
+ "Successfully formatted code."
816
+ );
817
+ } catch {
818
+ }
814
819
  }
815
820
  if (packageJson.scripts && packageJson.scripts["lint:fix"]) {
816
- await runCommandInProjectDir(
817
- root,
818
- runCommand,
819
- ["lint:fix"],
820
- "Successfully fixed linting errors.",
821
- "Failed to fix linting errors."
822
- );
821
+ try {
822
+ await runCommandInProjectDir(
823
+ root,
824
+ runCommand,
825
+ ["lint:fix"],
826
+ "Successfully fixed linting errors.",
827
+ "Failed to fix linting errors."
828
+ );
829
+ } catch {
830
+ }
823
831
  }
824
832
  }
825
833
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@create-node-app/core",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",