@comet/create-app 1.13.0 → 1.14.0
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/lib/index.js +7 -7
- package/lib/scripts/create-app/cleanupReadme.js +19 -4
- package/lib/scripts/create-app/cleanupWorkingDirectory.js +2 -2
- package/lib/scripts/create-app/createApp.js +30 -23
- package/lib/scripts/create-app/createInitialGitCommit.js +7 -2
- package/lib/scripts/create-app/createWorkingDirectoryCopy.js +14 -5
- package/lib/scripts/remove-showcase/removeShowcase.js +9 -8
- package/lib/scripts/remove-site/removeSite.js +14 -14
- package/lib/util/deleteFilesAndFolders.js +3 -3
- package/lib/util/removeReferenceInFile.js +19 -4
- package/lib/util/replacePlaceholder.js +5 -3
- package/lib/util/runEslintFix.js +8 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -33,19 +33,19 @@ void (async () => {
|
|
|
33
33
|
}
|
|
34
34
|
})
|
|
35
35
|
.configureOutput({ outputError: (str, write) => write(kleur_1.default.bgRed(str)) });
|
|
36
|
-
program.addCommand(new commander_1.Command("remove-showcase").action(() => {
|
|
36
|
+
program.addCommand(new commander_1.Command("remove-showcase").option("-v, --verbose", "Enables extra console logs for verbose output.").action((options) => {
|
|
37
37
|
if (!(0, cwdIsCometProject_1.cwdIsCometProject)()) {
|
|
38
|
-
program.error(
|
|
38
|
+
program.error("This command must be run from the root of a Comet project.");
|
|
39
39
|
}
|
|
40
|
-
console.log(
|
|
41
|
-
(0, removeShowcase_1.removeShowcaseContent)();
|
|
40
|
+
console.log("Removing showcase content from project...");
|
|
41
|
+
(0, removeShowcase_1.removeShowcaseContent)(options.verbose);
|
|
42
42
|
}));
|
|
43
|
-
program.addCommand(new commander_1.Command("remove-site").action(() => {
|
|
43
|
+
program.addCommand(new commander_1.Command("remove-site").option("-v, --verbose", "Enables extra console logs for verbose output.").action((options) => {
|
|
44
44
|
if (!(0, cwdIsCometProject_1.cwdIsCometProject)()) {
|
|
45
45
|
program.error(`This command must be run from the root of a Comet project.`);
|
|
46
46
|
}
|
|
47
|
-
console.log(
|
|
48
|
-
(0, removeSite_1.removeSite)();
|
|
47
|
+
console.log("Removing site from project...");
|
|
48
|
+
(0, removeSite_1.removeSite)(options.verbose);
|
|
49
49
|
}));
|
|
50
50
|
program.parse();
|
|
51
51
|
})();
|
|
@@ -22,13 +22,28 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.cleanupReadme = void 0;
|
|
27
30
|
const fs = __importStar(require("fs"));
|
|
31
|
+
const kleur_1 = __importDefault(require("kleur"));
|
|
28
32
|
const readmePath = "README.md";
|
|
29
|
-
function cleanupReadme() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
function cleanupReadme(verbose) {
|
|
34
|
+
try {
|
|
35
|
+
const originalReadme = fs.readFileSync(readmePath, "utf8").toString();
|
|
36
|
+
const newReadme = originalReadme.replace(/.+<!-- PROJECT_README_BEGIN.+-->\n\n/s, "");
|
|
37
|
+
fs.writeFileSync(readmePath, newReadme, "utf8");
|
|
38
|
+
if (verbose) {
|
|
39
|
+
console.log(kleur_1.default.grey("Cleaned up README.md"));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
console.log(kleur_1.default.yellow("Could not clean up README.md"));
|
|
44
|
+
if (verbose) {
|
|
45
|
+
console.log(kleur_1.default.grey(`${e}`));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
exports.cleanupReadme = cleanupReadme;
|
|
@@ -5,7 +5,7 @@ const deleteFilesAndFolders_1 = require("../../util/deleteFilesAndFolders");
|
|
|
5
5
|
const removeReferenceInFile_1 = require("../../util/removeReferenceInFile");
|
|
6
6
|
function cleanupWorkingDirectory(verbose) {
|
|
7
7
|
(0, deleteFilesAndFolders_1.deleteFilesAndFolders)(["create-app", ".git", ".github", "LICENSE"], verbose);
|
|
8
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)("lint-staged.config.js", /.*create-app.*\n/gim);
|
|
9
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)(".vscode/settings.json", /, "create-app"/g);
|
|
8
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)("lint-staged.config.js", /.*create-app.*\n/gim, verbose);
|
|
9
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)(".vscode/settings.json", /, "create-app"/g, verbose);
|
|
10
10
|
}
|
|
11
11
|
exports.cleanupWorkingDirectory = cleanupWorkingDirectory;
|
|
@@ -15,43 +15,50 @@ const cleanupReadme_1 = require("./cleanupReadme");
|
|
|
15
15
|
const cleanupWorkingDirectory_1 = require("./cleanupWorkingDirectory");
|
|
16
16
|
const createInitialGitCommit_1 = require("./createInitialGitCommit");
|
|
17
17
|
const createWorkingDirectoryCopy_1 = require("./createWorkingDirectoryCopy");
|
|
18
|
-
async function createApp(
|
|
19
|
-
console.log(
|
|
20
|
-
(0, createWorkingDirectoryCopy_1.createWorkingDirectoryCopy)(
|
|
21
|
-
(0, cleanupReadme_1.cleanupReadme)();
|
|
22
|
-
(0, cleanupWorkingDirectory_1.cleanupWorkingDirectory)(
|
|
23
|
-
(0, replacePlaceholder_1.replacePlaceholder)(
|
|
24
|
-
(0, createInitialGitCommit_1.createInitialGitCommit)();
|
|
25
|
-
if (
|
|
18
|
+
async function createApp(commandOptions) {
|
|
19
|
+
console.log(`Creating a new Comet app in ${kleur_1.default.blue(`${process_1.default.cwd()}\n`)}`);
|
|
20
|
+
(0, createWorkingDirectoryCopy_1.createWorkingDirectoryCopy)(commandOptions.projectName, commandOptions.verbose);
|
|
21
|
+
(0, cleanupReadme_1.cleanupReadme)(commandOptions.verbose);
|
|
22
|
+
(0, cleanupWorkingDirectory_1.cleanupWorkingDirectory)(commandOptions.verbose);
|
|
23
|
+
(0, replacePlaceholder_1.replacePlaceholder)(commandOptions.projectName, commandOptions.verbose);
|
|
24
|
+
(0, createInitialGitCommit_1.createInitialGitCommit)(commandOptions.verbose);
|
|
25
|
+
if (commandOptions.install) {
|
|
26
26
|
const spinner = (0, nanospinner_1.createSpinner)("Installing project...").spin();
|
|
27
27
|
try {
|
|
28
28
|
(0, child_process_1.execSync)("sh ./install.sh");
|
|
29
29
|
spinner.success();
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if (commandOptions.verbose)
|
|
31
|
+
console.log(kleur_1.default.grey("Successfully installed project."));
|
|
32
|
+
(0, runEslintFix_1.runEslintFix)(commandOptions.verbose);
|
|
32
33
|
}
|
|
33
34
|
catch (error) {
|
|
34
|
-
spinner.error(
|
|
35
|
+
spinner.error();
|
|
36
|
+
console.log(kleur_1.default.yellow("Could not install project."));
|
|
37
|
+
if (commandOptions.verbose)
|
|
38
|
+
console.log(kleur_1.default.grey(`${error}`));
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
(0, amendCommitChanges_1.amendCommitChanges)();
|
|
38
|
-
console.log(`\
|
|
39
|
-
console.log(
|
|
40
|
-
console.log(kleur_1.default.
|
|
41
|
-
console.log(
|
|
42
|
-
|
|
42
|
+
console.log(`\nSuccess! Created '${commandOptions.projectName}' at '${process_1.default.cwd()}'.`);
|
|
43
|
+
console.log(`Inside that directory, you can run several commands:\n`);
|
|
44
|
+
console.log(kleur_1.default.cyan(`nvm use`));
|
|
45
|
+
console.log(`Switches to the correct Node.js version.\n`);
|
|
46
|
+
if (!commandOptions.install) {
|
|
47
|
+
console.log(kleur_1.default.cyan(`sh ./install.sh`));
|
|
48
|
+
console.log(`Installs dependencies.\n`);
|
|
49
|
+
}
|
|
43
50
|
console.log(kleur_1.default.cyan(`npm run dev`));
|
|
44
|
-
console.log(
|
|
51
|
+
console.log(`Starts all services.\n`);
|
|
45
52
|
console.log(kleur_1.default.cyan(`npx dev-pm status [--interval]`));
|
|
46
|
-
console.log(
|
|
53
|
+
console.log(`Checks the status of services.\n`);
|
|
47
54
|
console.log(kleur_1.default.cyan(`npx dev-pm logs <service>`));
|
|
48
|
-
console.log(
|
|
55
|
+
console.log(`Shows the logs of a service.\n`);
|
|
49
56
|
console.log(kleur_1.default.cyan(`npx dev-pm restart <service>`));
|
|
50
|
-
console.log(
|
|
57
|
+
console.log(`Restarts a service.\n`);
|
|
51
58
|
console.log(kleur_1.default.cyan(`npx dev-pm shutdown`));
|
|
52
|
-
console.log(
|
|
59
|
+
console.log(`Shutdown all services.\n`);
|
|
53
60
|
console.log(kleur_1.default.cyan(`npm run --prefix api fixtures`));
|
|
54
|
-
console.log(
|
|
55
|
-
console.log(kleur_1.default.green(`\n☄️ Successfully created Comet app: ${
|
|
61
|
+
console.log(`Imports fixtures.\n`);
|
|
62
|
+
console.log(kleur_1.default.green(`\n☄️ Successfully created Comet app: ${commandOptions.projectName}`));
|
|
56
63
|
}
|
|
57
64
|
exports.createApp = createApp;
|
|
@@ -6,17 +6,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createInitialGitCommit = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const kleur_1 = __importDefault(require("kleur"));
|
|
9
|
-
function createInitialGitCommit() {
|
|
9
|
+
function createInitialGitCommit(verbose) {
|
|
10
10
|
try {
|
|
11
11
|
(0, child_process_1.execSync)("git init");
|
|
12
12
|
(0, child_process_1.execSync)("git add . -f");
|
|
13
13
|
const basedOnCommit = (0, child_process_1.execSync)('git ls-remote https://github.com/vivid-planet/comet-starter.git | head -1 | sed "s/HEAD//"');
|
|
14
14
|
(0, child_process_1.execSync)("git checkout -b setup-project");
|
|
15
15
|
(0, child_process_1.execSync)(`git commit -m "Initial commit from Starter" -m "Based on ${basedOnCommit}"`);
|
|
16
|
-
|
|
16
|
+
if (verbose) {
|
|
17
|
+
console.log(kleur_1.default.grey("Created initial git commit."));
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
catch (e) {
|
|
19
21
|
console.log(kleur_1.default.yellow("Could not create git commit."));
|
|
22
|
+
if (verbose) {
|
|
23
|
+
console.log(kleur_1.default.grey(`${e}`));
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
exports.createInitialGitCommit = createInitialGitCommit;
|
|
@@ -8,11 +8,20 @@ const child_process_1 = require("child_process");
|
|
|
8
8
|
const kleur_1 = __importDefault(require("kleur"));
|
|
9
9
|
const process_1 = __importDefault(require("process"));
|
|
10
10
|
function createWorkingDirectoryCopy(projectName, verbose) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
try {
|
|
12
|
+
const clone = `git clone --depth 1 https://github.com/vivid-planet/comet-starter.git ./${projectName}`;
|
|
13
|
+
(0, child_process_1.execSync)(clone);
|
|
14
|
+
process_1.default.chdir(`./${projectName}`);
|
|
15
|
+
if (verbose) {
|
|
16
|
+
console.log(kleur_1.default.grey("Cloned git repository."));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.log(kleur_1.default.red("Could not clone git repository."));
|
|
21
|
+
if (verbose) {
|
|
22
|
+
console.log(kleur_1.default.grey(`${e}`));
|
|
23
|
+
}
|
|
24
|
+
process_1.default.exit(1);
|
|
16
25
|
}
|
|
17
26
|
}
|
|
18
27
|
exports.createWorkingDirectoryCopy = createWorkingDirectoryCopy;
|
|
@@ -8,7 +8,7 @@ const fs_1 = require("fs");
|
|
|
8
8
|
const kleur_1 = __importDefault(require("kleur"));
|
|
9
9
|
const deleteFilesAndFolders_1 = require("../../util/deleteFilesAndFolders");
|
|
10
10
|
const runEslintFix_1 = require("../../util/runEslintFix");
|
|
11
|
-
async function removeFileContent() {
|
|
11
|
+
async function removeFileContent(verbose) {
|
|
12
12
|
const contentToRemove = [
|
|
13
13
|
{
|
|
14
14
|
file: `./admin/src/Routes.tsx`,
|
|
@@ -33,8 +33,8 @@ async function removeFileContent() {
|
|
|
33
33
|
];
|
|
34
34
|
for (const content of contentToRemove) {
|
|
35
35
|
if (!(0, fs_1.existsSync)(content.file)) {
|
|
36
|
-
console.log(kleur_1.default.
|
|
37
|
-
console.log(kleur_1.default.
|
|
36
|
+
console.log(kleur_1.default.yellow(`File ${content.file} does not exist!`));
|
|
37
|
+
console.log(kleur_1.default.yellow(`Skipping: ${content.file}...`));
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
let fileContent = (0, fs_1.readFileSync)(content.file, "utf-8").toString();
|
|
@@ -47,19 +47,20 @@ async function removeFileContent() {
|
|
|
47
47
|
catch (e) {
|
|
48
48
|
(0, fs_1.writeFileSync)(content.file, fileContent);
|
|
49
49
|
console.log(kleur_1.default.yellow(`Could not lint: ${content.file}!`));
|
|
50
|
-
|
|
50
|
+
if (verbose)
|
|
51
|
+
console.log(kleur_1.default.grey(`${e}`));
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
async function removeShowcaseContent() {
|
|
55
|
-
await removeFileContent();
|
|
55
|
+
async function removeShowcaseContent(verbose) {
|
|
56
|
+
await removeFileContent(verbose);
|
|
56
57
|
const filesToRemove = [
|
|
57
58
|
"api/src/products",
|
|
58
59
|
"admin/src/products",
|
|
59
60
|
"api/src/db/fixtures/generators/product.fixture.ts",
|
|
60
61
|
"api/src/db/migrations/Migration20220721123033.ts",
|
|
61
62
|
];
|
|
62
|
-
(0, deleteFilesAndFolders_1.deleteFilesAndFolders)(filesToRemove,
|
|
63
|
-
(0, runEslintFix_1.runEslintFix)();
|
|
63
|
+
(0, deleteFilesAndFolders_1.deleteFilesAndFolders)(filesToRemove, verbose);
|
|
64
|
+
(0, runEslintFix_1.runEslintFix)(verbose);
|
|
64
65
|
}
|
|
65
66
|
exports.removeShowcaseContent = removeShowcaseContent;
|
|
@@ -4,20 +4,20 @@ exports.removeSite = void 0;
|
|
|
4
4
|
const deleteFilesAndFolders_1 = require("../../util/deleteFilesAndFolders");
|
|
5
5
|
const removeReferenceInFile_1 = require("../../util/removeReferenceInFile");
|
|
6
6
|
const runEslintFix_1 = require("../../util/runEslintFix");
|
|
7
|
-
function removeSiteReferences() {
|
|
8
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)(".vscode/settings.json", /, "site"/g);
|
|
9
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)(".env", /# site.*NEXT_PUBLIC_SITE_IS_PREVIEW=false\n\n/gms);
|
|
10
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)("install.sh", /.*site.*\n/gim);
|
|
11
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)(".prettierignore", /.*site.*\n/gim);
|
|
12
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)("copy-schema-files.js", /.*site.*\n/gim);
|
|
13
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)("lint-staged.config.js", /.*site.*\n/gim);
|
|
14
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)("./package.json", / browser:site/g);
|
|
15
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)("./package.json", /.*site.*\n/gim);
|
|
16
|
-
(0, removeReferenceInFile_1.removeReferenceInFile)("dev-pm.config.js", /{[\n ]*name: "site.*},\n/gis);
|
|
7
|
+
function removeSiteReferences(verbose) {
|
|
8
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)(".vscode/settings.json", /, "site"/g, verbose);
|
|
9
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)(".env", /# site.*NEXT_PUBLIC_SITE_IS_PREVIEW=false\n\n/gms, verbose);
|
|
10
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)("install.sh", /.*site.*\n/gim, verbose);
|
|
11
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)(".prettierignore", /.*site.*\n/gim, verbose);
|
|
12
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)("copy-schema-files.js", /.*site.*\n/gim, verbose);
|
|
13
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)("lint-staged.config.js", /.*site.*\n/gim, verbose);
|
|
14
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)("./package.json", / browser:site/g, verbose);
|
|
15
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)("./package.json", /.*site.*\n/gim, verbose);
|
|
16
|
+
(0, removeReferenceInFile_1.removeReferenceInFile)("dev-pm.config.js", /{[\n ]*name: "site.*},\n/gis, verbose);
|
|
17
17
|
}
|
|
18
|
-
function removeSite() {
|
|
19
|
-
(0, deleteFilesAndFolders_1.deleteFilesAndFolders)(["site"],
|
|
20
|
-
removeSiteReferences();
|
|
21
|
-
(0, runEslintFix_1.runEslintFix)();
|
|
18
|
+
function removeSite(verbose) {
|
|
19
|
+
(0, deleteFilesAndFolders_1.deleteFilesAndFolders)(["site"], verbose);
|
|
20
|
+
removeSiteReferences(verbose);
|
|
21
|
+
(0, runEslintFix_1.runEslintFix)(verbose);
|
|
22
22
|
}
|
|
23
23
|
exports.removeSite = removeSite;
|
|
@@ -37,14 +37,14 @@ function deleteFilesAndFolders(files, verbose) {
|
|
|
37
37
|
retryDelay: 1000,
|
|
38
38
|
});
|
|
39
39
|
if (verbose) {
|
|
40
|
-
console.log(kleur_1.default.grey(`
|
|
40
|
+
console.log(kleur_1.default.grey(`Deleted ${toDelete}`));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
catch (e) {
|
|
44
|
+
console.log(kleur_1.default.yellow(`Could not delete ${toDelete}`));
|
|
44
45
|
if (verbose) {
|
|
45
|
-
console.log(e);
|
|
46
|
+
console.log(kleur_1.default.grey(`${e}`));
|
|
46
47
|
}
|
|
47
|
-
console.log(kleur_1.default.yellow(`Could not delete ${toDelete}`));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -22,12 +22,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.removeReferenceInFile = void 0;
|
|
27
30
|
const fs = __importStar(require("fs"));
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const kleur_1 = __importDefault(require("kleur"));
|
|
32
|
+
function removeReferenceInFile(filePath, regex, verbose) {
|
|
33
|
+
try {
|
|
34
|
+
const data = fs.readFileSync(filePath, "utf8");
|
|
35
|
+
const result = data.replace(regex, "");
|
|
36
|
+
fs.writeFileSync(filePath, result, "utf8");
|
|
37
|
+
if (verbose) {
|
|
38
|
+
console.log(kleur_1.default.grey(`Removed reference in ${filePath}`));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
console.log(kleur_1.default.yellow(`Could not remove reference in ${filePath}`));
|
|
43
|
+
if (verbose) {
|
|
44
|
+
console.log(kleur_1.default.grey(`${e}`));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
}
|
|
33
48
|
exports.removeReferenceInFile = removeReferenceInFile;
|
|
@@ -50,17 +50,19 @@ function replacePlaceholder(projectName, verbose) {
|
|
|
50
50
|
fs.writeFileSync(file, contents.replaceAll(placeholder, projectName));
|
|
51
51
|
changedFiles++;
|
|
52
52
|
if (verbose) {
|
|
53
|
-
console.log(kleur_1.default.grey(`
|
|
53
|
+
console.log(kleur_1.default.grey(`Replaced content in ${file}`));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
catch (e) {
|
|
58
|
-
console.log(e);
|
|
59
58
|
console.log(kleur_1.default.yellow(`Could not replace placeholder in ${file}`));
|
|
59
|
+
if (verbose) {
|
|
60
|
+
console.log(kleur_1.default.grey(`${e}`));
|
|
61
|
+
}
|
|
60
62
|
}
|
|
61
63
|
});
|
|
62
64
|
if (verbose) {
|
|
63
|
-
console.log(kleur_1.default.
|
|
65
|
+
console.log(kleur_1.default.grey(`Successfully replaced content in ${changedFiles} files`));
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
exports.replacePlaceholder = replacePlaceholder;
|
package/lib/util/runEslintFix.js
CHANGED
|
@@ -6,15 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.runEslintFix = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const kleur_1 = __importDefault(require("kleur"));
|
|
9
10
|
const hasDependenciesInstalled_1 = require("./hasDependenciesInstalled");
|
|
10
|
-
function runEslintFix() {
|
|
11
|
+
function runEslintFix(verbose) {
|
|
11
12
|
const microservices = ["admin", "api", "site"];
|
|
12
13
|
for (const microservice of microservices) {
|
|
13
14
|
if (!fs_1.default.existsSync(microservice)) {
|
|
14
15
|
continue;
|
|
15
16
|
}
|
|
16
|
-
else if (!(0, hasDependenciesInstalled_1.hasDependenciesInstalled)(microservice)) {
|
|
17
|
-
console.
|
|
17
|
+
else if (!(0, hasDependenciesInstalled_1.hasDependenciesInstalled)(microservice) && verbose) {
|
|
18
|
+
console.log(kleur_1.default.grey(`Skipping ESLint fix in ${microservice} because dependencies are not installed.`));
|
|
18
19
|
continue;
|
|
19
20
|
}
|
|
20
21
|
try {
|
|
@@ -23,9 +24,10 @@ function runEslintFix() {
|
|
|
23
24
|
(0, child_process_1.execSync)(`npm run --prefix ${microservice} lint:eslint -- --fix`);
|
|
24
25
|
}
|
|
25
26
|
catch (err) {
|
|
26
|
-
console.
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
console.log(kleur_1.default.yellow(`Failed to fix ESLint errors in ${microservice}.`));
|
|
28
|
+
if (verbose) {
|
|
29
|
+
console.log(kleur_1.default.grey(`${err}`));
|
|
30
|
+
}
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
}
|
package/package.json
CHANGED