@create-node-app/core 0.3.1 → 0.3.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.
package/dist/index.js CHANGED
@@ -701,18 +701,19 @@ 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
+ stdio: "inherit"
714
709
  });
715
- });
710
+ console.log();
711
+ console.log(import_chalk3.default.green(successMessage));
712
+ } catch (error) {
713
+ console.log();
714
+ console.log(import_chalk3.default.red(errorMessage));
715
+ console.log();
716
+ }
716
717
  };
717
718
  var run = async ({
718
719
  root,
@@ -834,21 +835,27 @@ var run = async ({
834
835
  import_fs5.default.readFileSync(`${root}/package.json`, "utf8")
835
836
  );
836
837
  if (packageJson.scripts && packageJson.scripts["format"]) {
837
- await runCommandInProjectDir(
838
- root,
839
- runCommand,
840
- ["format"],
841
- "Successfully formatted code."
842
- );
838
+ try {
839
+ await runCommandInProjectDir(
840
+ root,
841
+ runCommand,
842
+ ["format"],
843
+ "Successfully formatted code."
844
+ );
845
+ } catch {
846
+ }
843
847
  }
844
848
  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
- );
849
+ try {
850
+ await runCommandInProjectDir(
851
+ root,
852
+ runCommand,
853
+ ["lint:fix"],
854
+ "Successfully fixed linting errors.",
855
+ "Failed to fix linting errors."
856
+ );
857
+ } catch {
858
+ }
852
859
  }
853
860
  }
854
861
  };
package/dist/index.mjs CHANGED
@@ -672,18 +672,19 @@ 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
+ stdio: "inherit"
685
680
  });
686
- });
681
+ console.log();
682
+ console.log(chalk3.green(successMessage));
683
+ } catch (error) {
684
+ console.log();
685
+ console.log(chalk3.red(errorMessage));
686
+ console.log();
687
+ }
687
688
  };
688
689
  var run = async ({
689
690
  root,
@@ -805,21 +806,27 @@ var run = async ({
805
806
  fs4.readFileSync(`${root}/package.json`, "utf8")
806
807
  );
807
808
  if (packageJson.scripts && packageJson.scripts["format"]) {
808
- await runCommandInProjectDir(
809
- root,
810
- runCommand,
811
- ["format"],
812
- "Successfully formatted code."
813
- );
809
+ try {
810
+ await runCommandInProjectDir(
811
+ root,
812
+ runCommand,
813
+ ["format"],
814
+ "Successfully formatted code."
815
+ );
816
+ } catch {
817
+ }
814
818
  }
815
819
  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
- );
820
+ try {
821
+ await runCommandInProjectDir(
822
+ root,
823
+ runCommand,
824
+ ["lint:fix"],
825
+ "Successfully fixed linting errors.",
826
+ "Failed to fix linting errors."
827
+ );
828
+ } catch {
829
+ }
823
830
  }
824
831
  }
825
832
  };
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.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",