@axeth/create-cli 2.0.2 → 2.0.4
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 +1 -1
- package/src/class/AxethCLI.ts +4 -52
package/package.json
CHANGED
package/src/class/AxethCLI.ts
CHANGED
|
@@ -36,58 +36,10 @@ class AxethCLI {
|
|
|
36
36
|
const spinner = prompt.spinner({ indicator: "dots" });
|
|
37
37
|
|
|
38
38
|
await this.generateTemplate(addonInfo, config, minecraftServerVersion, minecraftServerUIVersion, spinner);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// spinner.start("Installing dependencies...");
|
|
44
|
-
// try {
|
|
45
|
-
// await new Promise<void>((resolve, reject) => {
|
|
46
|
-
// //add dependency installation @minecraft/server{minecraftServerVersion} and @minecraft/server-ui@{minecraftServerUIVersion}
|
|
47
|
-
// //edit package.json to add these dependencies
|
|
48
|
-
// const packageJsonPath = path.join(cwd, 'package.json');
|
|
49
|
-
// const packageJson = fs.readJsonSync(packageJsonPath);
|
|
50
|
-
// packageJson.dependencies = packageJson.dependencies || {};
|
|
51
|
-
// packageJson.dependencies['@minecraft/server'] = `^${minecraftServerVersion}`;
|
|
52
|
-
// packageJson.dependencies['@minecraft/server-ui'] = `^${minecraftServerUIVersion}`;
|
|
53
|
-
// fs.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
|
|
54
|
-
|
|
55
|
-
// const child = spawn('bun', ['install'], { cwd, shell: true });
|
|
56
|
-
// let errorOutput = '';
|
|
57
|
-
// child.stderr && child.stderr.on('data', (data: Buffer) => {
|
|
58
|
-
// errorOutput += data.toString();
|
|
59
|
-
// });
|
|
60
|
-
// child.on('close', async (code: number) => {
|
|
61
|
-
// if (code === 0) {
|
|
62
|
-
// spinner.stop("Dependencies installed.");
|
|
63
|
-
// resolve();
|
|
64
|
-
// // Prompt to open VS Code
|
|
65
|
-
// const openVSCode = await prompt.confirm({
|
|
66
|
-
// message: "Open project in VS Code now?"
|
|
67
|
-
// });
|
|
68
|
-
// if (openVSCode) {
|
|
69
|
-
// const childCode = spawn('code', ['.'], { cwd, shell: true, stdio: 'ignore', detached: true });
|
|
70
|
-
// childCode.unref();
|
|
71
|
-
// }
|
|
72
|
-
// } else {
|
|
73
|
-
// spinner.stop("Dependency installation failed.");
|
|
74
|
-
// prompt.log.error(`bun install failed with code ${code}`);
|
|
75
|
-
// if (errorOutput) {
|
|
76
|
-
// prompt.log.error(errorOutput.trim());
|
|
77
|
-
// }
|
|
78
|
-
// reject(new Error(`bun install failed with code ${code}`));
|
|
79
|
-
// }
|
|
80
|
-
// });
|
|
81
|
-
// child.on('error', (err: Error) => {
|
|
82
|
-
// spinner.stop("Dependency installation failed.");
|
|
83
|
-
// prompt.log.error(`bun install process error: ${err.message}`);
|
|
84
|
-
// reject(err);
|
|
85
|
-
// });
|
|
86
|
-
// });
|
|
87
|
-
// } catch (err) {
|
|
88
|
-
// // spinner already stopped in error handler above
|
|
89
|
-
// prompt.log.error(`Failed to install dependencies: ${err}`);
|
|
90
|
-
// }
|
|
39
|
+
await prompt.confirm({
|
|
40
|
+
message: "Open on VSCode?",
|
|
41
|
+
initialValue: false
|
|
42
|
+
})
|
|
91
43
|
}
|
|
92
44
|
|
|
93
45
|
private async generateTemplate(addonInfo: { [x: string]: any }, config: { [x: string]: any }, minecraftServerVersion: string, minecraftServerUIVersion: string, spinner: any) {
|