This repository has been archived by the owner on Oct 18, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
executable file
·62 lines (52 loc) · 1.6 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env node
import fs from "fs-extra";
import path from "path";
import gitCreate from "./cli/helpers/gitCreate.js";
import nextSteps from "./cli/helpers/nextSteps.js";
import runCli from "./cli/index.js";
import createProject from "./cli/installers/createProject.js";
import getVersion from "./cli/utils/getCLIVersion.js";
import logger from "./cli/utils/logger.js";
import parseNameAndPath from "./cli/utils/parseNameAndPath.js";
import renderTitle from "./cli/utils/renderTitle.js";
const main = async () => {
renderTitle();
logger.info("To see the timeline of features marked as coming soon:");
logger.info("https://github.com/kinngh/create-shop-app/discussions/1");
const {
appName,
databaseTech,
graphqlTech,
// billingAPI,
// language,
flags: { git },
} = await runCli();
const [scopedAppName, appDir] = parseNameAndPath(appName);
const projectDir = await createProject({
projectName: appDir,
databaseTech,
graphqlTech,
});
if (git) {
await gitCreate(projectDir);
}
nextSteps({ projectName: appDir });
const packageJson = await fs.readJson(path.join(projectDir, "package.json"));
packageJson.name = scopedAppName;
packageJson.createShopApp = { version: getVersion() };
await fs.writeJson(path.join(projectDir, "package.json"), packageJson, {
spaces: 2,
});
process.exit(0);
};
main().catch((err) => {
logger.error("Aborting Installation");
if (err instanceof Error) {
logger.error(err);
} else {
logger.error(
"Unknown error occured. Please open an issue on GitHub with below:\n"
);
}
process.exit(1);
});