@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 +32 -24
- package/dist/index.mjs +32 -24
- package/package.json +1 -1
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
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
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
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
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
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
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
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
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
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
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
|
};
|