@axeth/create-cli 2.0.9 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axeth/create-cli",
3
- "version": "2.0.9",
3
+ "version": "2.1.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,9 +36,12 @@ class AxethCLI {
36
36
  const spinner = prompt.spinner({ indicator: "dots" });
37
37
 
38
38
  await this.generateTemplate(addonInfo, config, minecraftServerVersion, minecraftServerUIVersion, spinner);
39
+
40
+ const projectDir = path.join(process.cwd(), (addonInfo.addonName as string).replace(/\s+/g, "-").toLowerCase());
41
+
39
42
  //cd and bun run lint
40
43
  spinner.start("Linting generated add-on...");
41
- await this.runCommand(`cd ./${(addonInfo.addonName as string).replace(/\s+/g, "-").toLowerCase()} ; bun run lint`).catch((err) => {
44
+ await this.runCommand("bun run lint", projectDir).catch((err) => {
42
45
  spinner.stop("Linting failed.");
43
46
  console.error(color.red(err));
44
47
  process.exit(1);
@@ -51,7 +54,7 @@ class AxethCLI {
51
54
 
52
55
  if (openVSCode) {
53
56
  spinner.start("Opening VSCode...");
54
- await this.runCommand(`code ${path.join(process.cwd(), (addonInfo.addonName as string).replace(/\s+/g, "-").toLowerCase())}`);
57
+ await this.runCommand(`code "${projectDir}"`);
55
58
  spinner.stop("VSCode opened.");
56
59
  }
57
60
  prompt.outro(color.green(`\n Successfully created add-on: ${addonInfo.addonName}\n`));
@@ -201,9 +204,13 @@ class AxethCLI {
201
204
  prompt.intro(color.cyan(logo) + `\n ${title} - v${version}\n`);
202
205
  }
203
206
 
204
- private async runCommand(command: string): Promise<void> {
207
+ private async runCommand(command: string, cwd?: string): Promise<void> {
205
208
  return new Promise((resolve, reject) => {
206
- exec(command, (error, stdout, stderr) => {
209
+ const options: any = {};
210
+ if (cwd) {
211
+ options.cwd = cwd;
212
+ }
213
+ exec(command, options, (error, stdout, stderr) => {
207
214
  if (error) {
208
215
  reject(error);
209
216
  return;