-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
executable file
·73 lines (68 loc) · 2.56 KB
/
index.ts
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
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env node
import { selfDestroy } from "./helpers/core/selfDestroy.js";
import chalk from "chalk";
import open from "open";
import { smartContractWizard } from "./helpers/smartContractsWizard/smartContractWizard.js";
import { buildSmartContract } from "./helpers/smartContractsWizard/smartContractBuilder.js";
import { startStandardWorkflow } from "./helpers/core/workflows/standardWorkflow.js";
import { startTemplatesWorkflow } from "./helpers/core/workflows/templatesWorkflow.js";
import context from "./helpers/core/context.js";
import { checkNewPackageUpdates } from "./helpers/utils/checkNewPackageUpdates.js";
console.log(
chalk.blue(`
«╠
'▒░▒╓ ╗ ╔ε
╬ ╬▒▒╦ ,, ╬ ,, ╠Γ ,, ,, ,, ,,
╓╬╬╬ ╠╬╬▒ ª╩ "╬ ╬ ,╬╜ ╙▒ ╠╬╙ '╙▒ ╬╜ ╙▒ ╚╠╙ '╬▒╜ '╠▒ ╬ ╬╜
φ╬╬╠ ,╔#δδ╠Γ ╬ ╠Γ ╠Γ ╠⌐ ╠╬####╝⌐ ╚╠ ╞╬ ]╬ ╬ ╬╜
╬╬╬╬ ╔╬╬╬╬╬╬╬╬╦ ╬ ╓╠Γ ╬ ╘╬, ,▒ ╠Γ ╠⌐ └╬, ,╗ ╚╠ ╞╬ ]╬ ╬╬╙
'''' '''''''''' "╙' ' ' '"" ' ' '""' '' ' ' ╬╙
create-web3-dapp ╝'
`)
);
console.log(
"Welcome to the create-web3-dapp wizard 🔮"
);
const startSmartContractFlow = async () => {
const currentPath = process.cwd().split("/");
const currentDirectory = currentPath[currentPath.length - 1];
if (currentDirectory !== "backend") {
console.log(
"ERROR: Make sure to be in a create-web3-dapp 'backend' directory before starting the smart contracts backback"
);
console.log(
"TIP: If you haven't already, run npx create-web3-dapp@latest to get started"
);
return;
}
const contractInfo = await smartContractWizard();
if (contractInfo) buildSmartContract(contractInfo, process.cwd());
};
async function main() {
checkNewPackageUpdates();
switch (process.argv[2]) {
case "marketplace":
try {
open("https://createweb3dapp.com");
} catch (e) {
selfDestroy(e);
}
break;
case "backpack":
startSmartContractFlow();
break;
case "nft-explorer":
context.dappInfo.template = 0;
startTemplatesWorkflow(false);
break;
case "creator-dapp":
context.dappInfo.template = 1;
startTemplatesWorkflow(true);
break;
default:
console.log("\n");
startStandardWorkflow();
break;
}
}
main();