@comet/create-app 1.14.0 → 1.15.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/README.md +0 -8
- package/lib/index.js +0 -8
- package/package.json +1 -1
- package/lib/scripts/remove-showcase/removeShowcase.js +0 -66
package/README.md
CHANGED
|
@@ -33,14 +33,6 @@ This command will create a new Comet app with the name "my-project" and enable v
|
|
|
33
33
|
|
|
34
34
|
The following commands can be used to customize the project setup:
|
|
35
35
|
|
|
36
|
-
- `remove-showcase`: Removes the showcase content from the project.
|
|
37
|
-
|
|
38
|
-
Example usage:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npx @comet/create-app remove-showcase
|
|
42
|
-
```
|
|
43
|
-
|
|
44
36
|
- `remove-site`: Removes the site from the project.
|
|
45
37
|
|
|
46
38
|
Example usage:
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const kleur_1 = __importDefault(require("kleur"));
|
|
8
8
|
const createApp_1 = require("./scripts/create-app/createApp");
|
|
9
|
-
const removeShowcase_1 = require("./scripts/remove-showcase/removeShowcase");
|
|
10
9
|
const removeSite_1 = require("./scripts/remove-site/removeSite");
|
|
11
10
|
const cwdIsCometProject_1 = require("./util/cwdIsCometProject");
|
|
12
11
|
const isValidNodeVersion_1 = require("./util/isValidNodeVersion");
|
|
@@ -33,13 +32,6 @@ void (async () => {
|
|
|
33
32
|
}
|
|
34
33
|
})
|
|
35
34
|
.configureOutput({ outputError: (str, write) => write(kleur_1.default.bgRed(str)) });
|
|
36
|
-
program.addCommand(new commander_1.Command("remove-showcase").option("-v, --verbose", "Enables extra console logs for verbose output.").action((options) => {
|
|
37
|
-
if (!(0, cwdIsCometProject_1.cwdIsCometProject)()) {
|
|
38
|
-
program.error("This command must be run from the root of a Comet project.");
|
|
39
|
-
}
|
|
40
|
-
console.log("Removing showcase content from project...");
|
|
41
|
-
(0, removeShowcase_1.removeShowcaseContent)(options.verbose);
|
|
42
|
-
}));
|
|
43
35
|
program.addCommand(new commander_1.Command("remove-site").option("-v, --verbose", "Enables extra console logs for verbose output.").action((options) => {
|
|
44
36
|
if (!(0, cwdIsCometProject_1.cwdIsCometProject)()) {
|
|
45
37
|
program.error(`This command must be run from the root of a Comet project.`);
|
package/package.json
CHANGED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeShowcaseContent = void 0;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const kleur_1 = __importDefault(require("kleur"));
|
|
9
|
-
const deleteFilesAndFolders_1 = require("../../util/deleteFilesAndFolders");
|
|
10
|
-
const runEslintFix_1 = require("../../util/runEslintFix");
|
|
11
|
-
async function removeFileContent(verbose) {
|
|
12
|
-
const contentToRemove = [
|
|
13
|
-
{
|
|
14
|
-
file: `./admin/src/Routes.tsx`,
|
|
15
|
-
replacements: [/\s*<.*?products.*?>/g],
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
file: `./admin/src/common/MasterMenu.tsx`,
|
|
19
|
-
replacements: [/\s*<MenuCollapsibleItem.*products`}\s*\/>\s*<\/MenuCollapsibleItem>/gs],
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
file: `./api/src/app.module.ts`,
|
|
23
|
-
replacements: [/\s*ProductsModule,/gs],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
file: `./api/src/db/fixtures/fixtures.console.ts`,
|
|
27
|
-
replacements: [/, @InjectRepository.*Product.*<Product>/gs, /\s*await Promise.all\(\[generateProducts.*]\);/gs],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
file: `./api/src/db/fixtures/fixtures.module.ts`,
|
|
31
|
-
replacements: ["MikroOrmModule.forFeature([Product]), "],
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
for (const content of contentToRemove) {
|
|
35
|
-
if (!(0, fs_1.existsSync)(content.file)) {
|
|
36
|
-
console.log(kleur_1.default.yellow(`File ${content.file} does not exist!`));
|
|
37
|
-
console.log(kleur_1.default.yellow(`Skipping: ${content.file}...`));
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
let fileContent = (0, fs_1.readFileSync)(content.file, "utf-8").toString();
|
|
41
|
-
for (const replacement of content.replacements) {
|
|
42
|
-
fileContent = fileContent.replaceAll(replacement, "");
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
(0, fs_1.writeFileSync)(content.file, fileContent);
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
(0, fs_1.writeFileSync)(content.file, fileContent);
|
|
49
|
-
console.log(kleur_1.default.yellow(`Could not lint: ${content.file}!`));
|
|
50
|
-
if (verbose)
|
|
51
|
-
console.log(kleur_1.default.grey(`${e}`));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async function removeShowcaseContent(verbose) {
|
|
56
|
-
await removeFileContent(verbose);
|
|
57
|
-
const filesToRemove = [
|
|
58
|
-
"api/src/products",
|
|
59
|
-
"admin/src/products",
|
|
60
|
-
"api/src/db/fixtures/generators/product.fixture.ts",
|
|
61
|
-
"api/src/db/migrations/Migration20220721123033.ts",
|
|
62
|
-
];
|
|
63
|
-
(0, deleteFilesAndFolders_1.deleteFilesAndFolders)(filesToRemove, verbose);
|
|
64
|
-
(0, runEslintFix_1.runEslintFix)(verbose);
|
|
65
|
-
}
|
|
66
|
-
exports.removeShowcaseContent = removeShowcaseContent;
|