@clarigen/cli 1.0.0-next.22 → 1.0.0-next.26

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.
@@ -58,35 +58,118 @@ var import_command2 = require("@oclif/command");
58
58
 
59
59
  // src/generate/files.ts
60
60
  var import_core2 = require("@clarigen/core");
61
- var import_path3 = require("path");
61
+ var import_path5 = require("path");
62
62
 
63
63
  // src/index.ts
64
64
  var import_command = require("@oclif/command");
65
65
 
66
66
  // src/config.ts
67
- var import_path2 = require("path");
68
- var import_promises2 = require("fs/promises");
69
- var import_fs = require("fs");
67
+ var import_path4 = require("path");
68
+ var import_promises4 = require("fs/promises");
69
+ var import_fs2 = require("fs");
70
70
 
71
71
  // src/clarinet-config.ts
72
72
  var import_toml = require("@iarna/toml");
73
- var import_path = require("path");
74
- var import_promises = require("fs/promises");
73
+ var import_path3 = require("path");
74
+ var import_promises3 = require("fs/promises");
75
75
  var import_wallet_sdk = require("micro-stacks/wallet-sdk");
76
76
  var import_toposort = require("toposort");
77
77
  var import_crypto = require("micro-stacks/crypto");
78
+
79
+ // src/generate/deployment.ts
80
+ var import_js_yaml = require("js-yaml");
81
+ var import_promises2 = require("fs/promises");
82
+ var import_path2 = require("path");
83
+ var import_fs = require("fs");
84
+
85
+ // src/writer.ts
86
+ var import_promises = require("fs/promises");
87
+ var import_path = require("path");
88
+ var import_prettier = require("prettier");
89
+ var defaultPrettierConfig = {
90
+ printWidth: 80,
91
+ semi: true,
92
+ singleQuote: true,
93
+ trailingComma: "es5"
94
+ };
95
+ async function resolvePrettierConfig() {
96
+ try {
97
+ const local = await (0, import_prettier.resolveConfig)(process.cwd());
98
+ if (local)
99
+ return local;
100
+ } catch (error) {
101
+ }
102
+ return defaultPrettierConfig;
103
+ }
104
+ async function formatFile(contents, path) {
105
+ try {
106
+ const fileName = (0, import_path.basename)(path);
107
+ const config = await resolvePrettierConfig();
108
+ const formatted = (0, import_prettier.format)(contents, __spreadProps(__spreadValues({}, config), {
109
+ filepath: fileName
110
+ }));
111
+ return formatted;
112
+ } catch (error) {
113
+ }
114
+ return contents;
115
+ }
116
+ async function writeFile(path, contents) {
117
+ const formatted = await formatFile(contents, path);
118
+ await (0, import_promises.writeFile)(path, formatted);
119
+ }
120
+
121
+ // src/generate/deployment.ts
122
+ async function parseDeployment(path) {
123
+ const contents = await (0, import_promises2.readFile)(path, { encoding: "utf-8" });
124
+ const parsed = (0, import_js_yaml.load)(contents);
125
+ return parsed;
126
+ }
127
+ async function generateDeployment(network, config) {
128
+ const file = `default.${network}-plan.yaml`;
129
+ const deploymentPath = (0, import_path2.resolve)(process.cwd(), config.clarinet, "deployments", file);
130
+ if ((0, import_fs.existsSync)(deploymentPath)) {
131
+ const plan = await parseDeployment(deploymentPath);
132
+ const varName = `${network}Deployment`;
133
+ const contents = `export const ${varName} = ${JSON.stringify(plan)} as const;
134
+ `;
135
+ const outputFile = (0, import_path2.resolve)(config.outputDir, "deployments", `${network}.ts`);
136
+ await writeFile(outputFile, contents);
137
+ }
138
+ }
139
+ async function generateDeployments(config) {
140
+ const networks = ["devnet", "simnet", "testnet", "mainnet"];
141
+ const folder = (0, import_path2.resolve)(process.cwd(), config.outputDir, "deployments");
142
+ await (0, import_promises2.mkdir)(folder, { recursive: true });
143
+ const generates = networks.map((n) => generateDeployment(n, config));
144
+ await Promise.all(generates);
145
+ }
146
+
147
+ // src/clarinet-config.ts
78
148
  async function getClarinetDevConfig(folder) {
79
- const baseConfigPath = (0, import_path.resolve)(folder, "settings", "Devnet.toml");
80
- const configContents = await (0, import_promises.readFile)(baseConfigPath, { encoding: "utf-8" });
149
+ const baseConfigPath = (0, import_path3.resolve)(folder, "settings", "Devnet.toml");
150
+ const configContents = await (0, import_promises3.readFile)(baseConfigPath, { encoding: "utf-8" });
81
151
  const config = (0, import_toml.parse)(configContents);
82
152
  return config;
83
153
  }
84
154
  async function getClarinetConfig(folder) {
85
- const baseConfigPath = (0, import_path.resolve)(folder, "Clarinet.toml");
86
- const configContents = await (0, import_promises.readFile)(baseConfigPath, { encoding: "utf-8" });
155
+ const baseConfigPath = (0, import_path3.resolve)(folder, "Clarinet.toml");
156
+ const configContents = await (0, import_promises3.readFile)(baseConfigPath, { encoding: "utf-8" });
87
157
  const config = (0, import_toml.parse)(configContents);
88
158
  return config;
89
159
  }
160
+ async function getContractsFromDeployment(clarinetPath) {
161
+ const simnetPath = (0, import_path3.resolve)(clarinetPath || process.cwd(), "deployments/default.simnet-plan.yaml");
162
+ const deployment = await parseDeployment(simnetPath);
163
+ const txs = deployment.plan.batches[0].transactions;
164
+ return txs.map((_tx) => {
165
+ const tx = _tx["emulated-contract-publish"];
166
+ return {
167
+ file: tx.path,
168
+ name: tx["contract-name"],
169
+ address: tx["emulated-sender"]
170
+ };
171
+ });
172
+ }
90
173
  function getContractsFromClarinet(clarinetConfig, accounts) {
91
174
  const deployerAddress = accounts.deployer.address;
92
175
  const sortedContracts = sortClarinetContracts(clarinetConfig.contracts);
@@ -132,14 +215,15 @@ async function getClarinetAccounts(folder) {
132
215
  // src/config.ts
133
216
  var defaultConfigFile = {
134
217
  outputDir: "src/clarigen",
135
- clarinet: "."
218
+ clarinet: ".",
219
+ legacy: false
136
220
  };
137
221
  function configFilePath(rootPath) {
138
- return (0, import_path2.resolve)(rootPath, "clarigen.config.json");
222
+ return (0, import_path4.resolve)(rootPath, "clarigen.config.json");
139
223
  }
140
224
  async function configFileExists(configPath) {
141
225
  try {
142
- await (0, import_promises2.access)(configPath, import_fs.constants.R_OK);
226
+ await (0, import_promises4.access)(configPath, import_fs2.constants.R_OK);
143
227
  return true;
144
228
  } catch (error) {
145
229
  return false;
@@ -149,7 +233,7 @@ async function getConfigFile(rootPath) {
149
233
  const fullPath = configFilePath(rootPath);
150
234
  const exists = await configFileExists(fullPath);
151
235
  if (exists) {
152
- const configContents = await (0, import_promises2.readFile)(fullPath, { encoding: "utf-8" });
236
+ const configContents = await (0, import_promises4.readFile)(fullPath, { encoding: "utf-8" });
153
237
  const configFile = JSON.parse(configContents);
154
238
  return __spreadValues(__spreadValues({}, defaultConfigFile), configFile);
155
239
  }
@@ -158,11 +242,16 @@ async function getConfigFile(rootPath) {
158
242
  async function getProjectConfig(rootPath) {
159
243
  var _a, _b;
160
244
  const configFile = await getConfigFile(rootPath);
161
- const clarinetPath = (0, import_path2.resolve)(rootPath, configFile.clarinet);
245
+ const clarinetPath = (0, import_path4.resolve)(rootPath, configFile.clarinet);
162
246
  const clarinet = await getClarinetConfig(clarinetPath);
163
247
  const accounts = await getClarinetAccounts(clarinetPath);
164
- const contracts = getContractsFromClarinet(clarinet, accounts);
165
- const contractsDir = (0, import_path2.relative)(process.cwd(), (0, import_path2.join)(configFile.clarinet, "contracts"));
248
+ let contracts;
249
+ try {
250
+ contracts = await getContractsFromDeployment(clarinetPath);
251
+ } catch (error) {
252
+ contracts = getContractsFromClarinet(clarinet, accounts);
253
+ }
254
+ const contractsDir = (0, import_path4.relative)(process.cwd(), (0, import_path4.join)(configFile.clarinet, "contracts"));
166
255
  return __spreadProps(__spreadValues({}, configFile), {
167
256
  outputDir: ((_a = clarinet.clarigen) == null ? void 0 : _a.output_dir) || configFile.outputDir,
168
257
  docs: ((_b = clarinet.clarigen) == null ? void 0 : _b.docs) || configFile.docs,
@@ -361,8 +450,8 @@ export const accounts = {
361
450
  const contractVar = (0, import_core2.toCamelCase)(contractName);
362
451
  const contractInfo = `${contractVar}Info`;
363
452
  const contractInterface = `${(0, import_core2.toCamelCase)(contractName, true)}Contract`;
364
- const dirName = (0, import_path3.dirname)(contract.file);
365
- const importPath = `'./${(0, import_path3.join)(dirName || ".", contractName)}'`;
453
+ const dirName = (0, import_path5.dirname)(contract.file);
454
+ const importPath = `'./${contractName}'`;
366
455
  const _import = `import { ${contractInfo} } from ${importPath};`;
367
456
  imports.push(_import);
368
457
  const _export = `export type { ${contractInterface} } from ${importPath};`;
@@ -385,13 +474,13 @@ export const contracts = {
385
474
 
386
475
  // src/utils.ts
387
476
  var import_native_bin2 = require("@clarigen/native-bin");
388
- var import_path8 = require("path");
389
- var import_promises7 = require("fs/promises");
477
+ var import_path9 = require("path");
478
+ var import_promises8 = require("fs/promises");
390
479
 
391
480
  // src/docs.ts
392
481
  var import_claridocs = require("@clarigen/claridocs");
393
- var import_promises3 = require("fs/promises");
394
- var import_path4 = require("path");
482
+ var import_promises5 = require("fs/promises");
483
+ var import_path6 = require("path");
395
484
  async function generateMarkdownDoc({
396
485
  contractFile,
397
486
  contractName,
@@ -399,18 +488,18 @@ async function generateMarkdownDoc({
399
488
  abi,
400
489
  dirName
401
490
  }) {
402
- const contractSrc = await (0, import_promises3.readFile)(contractFile, { encoding: "utf-8" });
491
+ const contractSrc = await (0, import_promises5.readFile)(contractFile, { encoding: "utf-8" });
403
492
  const docs = (0, import_claridocs.createContractDocInfo)({ contractSrc, abi });
404
- const folder = (0, import_path4.resolve)(process.cwd(), docsPath, dirName || ".");
405
- const filePath = (0, import_path4.resolve)(folder, `${contractName}.md`);
493
+ const folder = (0, import_path6.resolve)(process.cwd(), docsPath, dirName || ".");
494
+ const filePath = (0, import_path6.resolve)(folder, `${contractName}.md`);
406
495
  const md = (0, import_claridocs.generateMarkdown)({
407
496
  contract: docs,
408
- contractFile: (0, import_path4.relative)(folder, contractFile),
497
+ contractFile: (0, import_path6.relative)(folder, contractFile),
409
498
  contractName,
410
499
  abi
411
500
  });
412
- await (0, import_promises3.mkdir)(folder, { recursive: true });
413
- await (0, import_promises3.writeFile)(filePath, md);
501
+ await (0, import_promises5.mkdir)(folder, { recursive: true });
502
+ await (0, import_promises5.writeFile)(filePath, md);
414
503
  }
415
504
  async function generateDocsIndex(configFile) {
416
505
  if (!configFile.docs)
@@ -423,14 +512,14 @@ async function generateDocsIndex(configFile) {
423
512
 
424
513
  ${contractLines.join("\n")}
425
514
  `;
426
- const filepath = (0, import_path4.resolve)(process.cwd(), configFile.docs, "README.md");
427
- await (0, import_promises3.writeFile)(filepath, fileContents);
515
+ const filepath = (0, import_path6.resolve)(process.cwd(), configFile.docs, "README.md");
516
+ await (0, import_promises5.writeFile)(filepath, fileContents);
428
517
  }
429
518
 
430
519
  // src/generate/single.ts
431
520
  var import_core3 = require("@clarigen/core");
432
- var import_path5 = require("path");
433
- var import_promises4 = require("fs/promises");
521
+ var import_path7 = require("path");
522
+ var import_promises6 = require("fs/promises");
434
523
  var import_util = require("util");
435
524
  function generateContractMeta(contract) {
436
525
  const { abi } = contract;
@@ -468,7 +557,7 @@ function generateContractMeta(contract) {
468
557
  return mapLine;
469
558
  });
470
559
  const otherAbi = JSON.stringify(rest);
471
- const contractFile = (0, import_path5.relative)(process.cwd(), contract.contractFile);
560
+ const contractFile = (0, import_path7.relative)(process.cwd(), contract.contractFile);
472
561
  return `{
473
562
  ${serializeLines("functions", functionLines)}
474
563
  ${serializeLines("variables", variableLines)}
@@ -533,143 +622,49 @@ function serializeLines(key, lines) {
533
622
  },`;
534
623
  }
535
624
  async function getSingleTypes() {
536
- const typesPath = (0, import_path5.resolve)(__dirname, "../../dist/abi-types.ts.txt");
537
- const typesFile = await (0, import_promises4.readFile)(typesPath, { encoding: "utf-8" });
625
+ const typesPath = (0, import_path7.resolve)(__dirname, "../../dist/abi-types.ts.txt");
626
+ const typesFile = await (0, import_promises6.readFile)(typesPath, { encoding: "utf-8" });
538
627
  return typesFile;
539
628
  }
540
629
 
541
- // src/writer.ts
542
- var import_promises5 = require("fs/promises");
543
- var import_path6 = require("path");
544
- var import_prettier = require("prettier");
545
- var defaultPrettierConfig = {
546
- printWidth: 80,
547
- semi: true,
548
- singleQuote: true,
549
- trailingComma: "es5"
550
- };
551
- async function resolvePrettierConfig() {
552
- try {
553
- const local = await (0, import_prettier.resolveConfig)(process.cwd());
554
- if (local)
555
- return local;
556
- } catch (error) {
557
- }
558
- return defaultPrettierConfig;
559
- }
560
- async function formatFile(contents, path) {
561
- try {
562
- const fileName = (0, import_path6.basename)(path);
563
- const config = await resolvePrettierConfig();
564
- const formatted = (0, import_prettier.format)(contents, __spreadProps(__spreadValues({}, config), {
565
- filepath: fileName
566
- }));
567
- return formatted;
568
- } catch (error) {
569
- }
570
- return contents;
571
- }
572
- async function writeFile2(path, contents) {
573
- const formatted = await formatFile(contents, path);
574
- await (0, import_promises5.writeFile)(path, formatted);
575
- }
576
-
577
630
  // src/generate/vars.ts
578
631
  var import_core4 = require("@clarigen/core");
579
632
  var import_native_bin = require("@clarigen/native-bin");
580
633
  var import_clarity = require("micro-stacks/clarity");
581
- async function getVariables({
582
- abi,
583
- contractIdentifier,
584
- provider
585
- }) {
586
- const variableTransforms = abi.variables.map((variable) => {
587
- return evalVariable({
588
- variable,
589
- provider,
590
- contractIdentifier
591
- });
592
- });
593
- const variables = await Promise.all(variableTransforms);
594
- return variables;
595
- }
596
- async function evalVariable({
597
- contractIdentifier,
598
- variable,
599
- provider
600
- }) {
601
- const code = getEvalCode(variable);
602
- const result = await (0, import_native_bin.evalRaw)({
603
- contractAddress: contractIdentifier,
604
- code,
605
- provider
606
- });
607
- const resultCV = (0, import_clarity.hexToCV)(result.output_serialized);
608
- const value = (0, import_core4.cvToValue)(resultCV, true);
609
- return __spreadProps(__spreadValues({}, variable), {
610
- defaultValue: value
611
- });
612
- }
613
- function getEvalCode(variable) {
614
- const { access: access2 } = variable;
615
- if (access2 === "variable") {
616
- return `(var-get ${variable.name})`;
617
- }
618
- return variable.name;
619
- }
620
634
 
621
- // src/generate/deployment.ts
622
- var import_js_yaml = require("js-yaml");
623
- var import_promises6 = require("fs/promises");
624
- var import_path7 = require("path");
625
- var import_fs2 = require("fs");
626
- async function parseDeployment(path) {
627
- const contents = await (0, import_promises6.readFile)(path, { encoding: "utf-8" });
628
- const parsed = (0, import_js_yaml.load)(contents);
629
- return parsed;
630
- }
631
- async function generateDeployment(network, config) {
632
- const file = `default.${network}-plan.yaml`;
633
- const deploymentPath = (0, import_path7.resolve)(process.cwd(), config.clarinet, "deployments", file);
634
- if ((0, import_fs2.existsSync)(deploymentPath)) {
635
- const plan = await parseDeployment(deploymentPath);
636
- const varName = `${network}Deployment`;
637
- const contents = `export const ${varName} = ${JSON.stringify(plan)} as const;
638
- `;
639
- const outputFile = (0, import_path7.resolve)(config.outputDir, "deployments", `${network}.ts`);
640
- await writeFile2(outputFile, contents);
635
+ // src/deno-run.ts
636
+ var import_child_process = require("child_process");
637
+ var import_util2 = require("util");
638
+ var exec = (0, import_util2.promisify)(import_child_process.exec);
639
+ async function getClarinetSession(cwd) {
640
+ const scriptPath = "https://raw.githubusercontent.com/mechanismHQ/clarigen-deno/main/src/cli/print.ts";
641
+ const command = `clarinet run ${scriptPath}`;
642
+ try {
643
+ const result = await exec(command, { cwd });
644
+ const sessionJSON = result.stdout.split("\n")[1];
645
+ const session = JSON.parse(sessionJSON);
646
+ return session;
647
+ } catch (error) {
648
+ console.error(`Error getting clarinet session`);
649
+ throw error;
641
650
  }
642
651
  }
643
- async function generateDeployments(config) {
644
- const networks = ["devnet", "simnet", "testnet", "mainnet"];
645
- const folder = (0, import_path7.resolve)(process.cwd(), config.outputDir, "deployments");
646
- await (0, import_promises6.mkdir)(folder, { recursive: true });
647
- const generates = networks.map((n) => generateDeployment(n, config));
648
- await Promise.all(generates);
649
- }
650
652
 
651
- // src/utils.ts
652
- var generateFilesForContract = async ({
653
- contractFile: _contractFile,
653
+ // src/contract.ts
654
+ var import_promises7 = require("fs/promises");
655
+ var import_path8 = require("path");
656
+ var generateFilesForContractWithSession = async ({
654
657
  outputFolder,
655
- provider,
656
- contractAddress,
658
+ sessionContract,
657
659
  dirName,
658
- contractName,
659
- docsPath
660
+ docsPath,
661
+ contractFile,
662
+ legacy = false
660
663
  }) => {
661
- const contractFile = (0, import_path8.resolve)(process.cwd(), _contractFile);
662
- const contractIdentifier = `${contractAddress}.${contractName}`;
663
- const abi = await (0, import_native_bin2.deployContract)({
664
- contractIdentifier,
665
- contractFilePath: contractFile,
666
- provider
667
- });
668
- const variables = await getVariables({
669
- abi,
670
- contractIdentifier,
671
- provider
672
- });
664
+ const contractIdentifier = sessionContract.contract_id;
665
+ const [contractAddress, contractName] = contractIdentifier.split(".");
666
+ const abi = sessionContract.contract_interface;
667
+ const variables = [];
673
668
  const typesFile = generateTypesFile(abi, contractName);
674
669
  const indexFile = generateIndexFile({
675
670
  contractFile: (0, import_path8.relative)(process.cwd(), contractFile),
@@ -686,11 +681,13 @@ var generateFilesForContract = async ({
686
681
  dirName
687
682
  });
688
683
  }
689
- const outputPath = (0, import_path8.resolve)(outputFolder, dirName || ".", contractName);
690
- await (0, import_promises7.mkdir)(outputPath, { recursive: true });
691
- await writeFile2((0, import_path8.resolve)(outputPath, "abi.ts"), abiFile);
692
- await writeFile2((0, import_path8.resolve)(outputPath, "index.ts"), indexFile);
693
- await writeFile2((0, import_path8.resolve)(outputPath, "types.ts"), typesFile);
684
+ if (legacy) {
685
+ const outputPath = (0, import_path8.resolve)(outputFolder, dirName || ".", contractName);
686
+ await (0, import_promises7.mkdir)(outputPath, { recursive: true });
687
+ await writeFile((0, import_path8.resolve)(outputPath, "abi.ts"), abiFile);
688
+ await writeFile((0, import_path8.resolve)(outputPath, "index.ts"), indexFile);
689
+ await writeFile((0, import_path8.resolve)(outputPath, "types.ts"), typesFile);
690
+ }
694
691
  return {
695
692
  abi,
696
693
  contractFile,
@@ -700,39 +697,46 @@ var generateFilesForContract = async ({
700
697
  variables
701
698
  };
702
699
  };
700
+
701
+ // src/utils.ts
703
702
  var generateProject = async (projectPath) => {
704
703
  const configFile = await getProjectConfig(projectPath);
705
704
  const { contractsDir, outputDir, contracts } = configFile;
706
- const outputFolder = (0, import_path8.resolve)(projectPath, outputDir);
705
+ const outputFolder = (0, import_path9.resolve)(projectPath, outputDir);
707
706
  const provider = await (0, import_native_bin2.createClarityBin)();
708
707
  const metas = [];
709
- for (const contract of contracts) {
710
- const contractFile = (0, import_path8.resolve)(projectPath, contractsDir, contract.file);
711
- const dirName = (0, import_path8.dirname)(contract.file);
712
- const meta = await generateFilesForContract({
713
- contractFile,
708
+ const session = await getClarinetSession((0, import_path9.resolve)(projectPath, configFile.clarinet));
709
+ for (const contract of session.contracts) {
710
+ const configContract = contracts.find((c) => c.name === contract.contract_id.split(".")[1]);
711
+ if (typeof configContract === "undefined") {
712
+ throw new Error(`No config contract found for ${contract.contract_id}`);
713
+ }
714
+ const contractFile = (0, import_path9.resolve)(projectPath, configFile.clarinet, configContract.file);
715
+ const meta = await generateFilesForContractWithSession({
716
+ sessionContract: contract,
714
717
  outputFolder,
715
- provider,
716
- contractAddress: contract.address,
717
- dirName,
718
- contractName: contract.name,
719
- docsPath: configFile.docs
718
+ docsPath: configFile.docs,
719
+ contractFile,
720
+ legacy: configFile.legacy
720
721
  });
721
722
  metas.push(meta);
722
723
  }
723
- const indexFile = generateProjectIndexFile(configFile);
724
724
  await generateDocsIndex(configFile);
725
- const indexPath = (0, import_path8.resolve)(outputFolder, "index.ts");
726
- await writeFile2(indexPath, indexFile);
727
- const singleFile = await generateSingleFile(configFile, metas);
728
- const singlePath = (0, import_path8.resolve)(outputFolder, "single.ts");
729
- await writeFile2(singlePath, singleFile);
725
+ if (configFile.legacy) {
726
+ const indexFile = generateProjectIndexFile(configFile);
727
+ const indexPath = (0, import_path9.resolve)(outputFolder, "index.ts");
728
+ await writeFile(indexPath, indexFile);
729
+ }
730
+ const singleFileContents = await generateSingleFile(configFile, metas);
731
+ const singleFile = configFile.legacy ? "single.ts" : "index.ts";
732
+ const singlePath = (0, import_path9.resolve)(outputFolder, singleFile);
733
+ await writeFile(singlePath, singleFileContents);
730
734
  await generateDeployments(configFile);
731
735
  };
732
736
 
733
737
  // src/commands/index.ts
734
738
  var import_chokidar = require("chokidar");
735
- var import_path9 = require("path");
739
+ var import_path10 = require("path");
736
740
  var import_chalk = require("chalk");
737
741
  var import_ora = __toESM(require("ora"));
738
742
  var _Generate = class extends import_command2.Command {
@@ -754,7 +758,7 @@ ${String(error.message)}`);
754
758
  }
755
759
  watcher.on("change", (path) => {
756
760
  const cb = async () => {
757
- const file = (0, import_path9.basename)(path);
761
+ const file = (0, import_path10.basename)(path);
758
762
  spinner.clear();
759
763
  spinner.start(`Change detected for ${(0, import_chalk.green)(file)}, generating.`);
760
764
  try {
@@ -776,7 +780,11 @@ ${msg}`);
776
780
  void cb();
777
781
  });
778
782
  } else {
779
- await generateProject(cwd);
783
+ try {
784
+ await generateProject(cwd);
785
+ } catch (error) {
786
+ console.log(error);
787
+ }
780
788
  }
781
789
  }
782
790
  };