create-gramstax 0.0.1 → 0.0.3
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/dist/src/index.cjs +13 -0
- package/dist/src/index.cjs.map +1 -0
- package/dist/src/index.d.cts +1 -0
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +12 -25
- package/dist/src/index.js.map +1 -0
- package/dist/src/templates/README.md +1 -1
- package/dist/src/templates/package.json +4 -4
- package/dist/src/templates/tsconfig.json +1 -1
- package/package.json +5 -4
- package/dist/package.json +0 -57
- package/dist/src/create-OLD.d.ts +0 -83
- package/dist/src/create-OLD.d.ts.map +0 -1
- package/dist/src/create-OLD.js +0 -676
- package/dist/src/create.d.ts +0 -34
- package/dist/src/create.d.ts.map +0 -1
- package/dist/src/create.js +0 -367
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/templates/src/env.d.ts +0 -8
- package/dist/src/utils/logger.d.ts +0 -3
- package/dist/src/utils/logger.d.ts.map +0 -1
- package/dist/src/utils/logger.js +0 -2
- package/src/create-OLD.ts +0 -783
- package/src/create.ts +0 -415
- package/src/index.ts +0 -28
- package/src/templates/.env.example +0 -17
- package/src/templates/.prettierignore +0 -1
- package/src/templates/.prettierrc +0 -23
- package/src/templates/LICENSE +0 -0
- package/src/templates/README.md +0 -121
- package/src/templates/bunfig.toml +0 -2
- package/src/templates/ecosystem.config.cjs +0 -26
- package/src/templates/package.json +0 -55
- package/src/templates/src/base/general.ts +0 -3
- package/src/templates/src/base/guard.ts +0 -3
- package/src/templates/src/base/page.ts +0 -3
- package/src/templates/src/base/repository.ts +0 -1
- package/src/templates/src/base/service.ts +0 -1
- package/src/templates/src/core/bot.ts +0 -22
- package/src/templates/src/db/index.ts +0 -3
- package/src/templates/src/env.d.ts +0 -8
- package/src/templates/src/guards/user.ts +0 -19
- package/src/templates/src/index.ts +0 -17
- package/src/templates/src/pages/general-error-input-notfound.ts +0 -34
- package/src/templates/src/pages/general-error.ts +0 -51
- package/src/templates/src/pages/help.ts +0 -56
- package/src/templates/src/pages/start.ts +0 -63
- package/src/templates/src/pages/username-notfound.ts +0 -41
- package/src/templates/src/repositories/example.ts +0 -5
- package/src/templates/src/services/example.ts +0 -4
- package/src/templates/src/templates/example.html +0 -7
- package/src/templates/src/threads/main.ts +0 -9
- package/src/templates/src/utils/log.ts +0 -3
- package/src/templates/tsconfig.json +0 -38
- package/src/utils/logger.ts +0 -3
- /package/dist/src/templates/{ecosystem.config.cjs → ecosystem.config.js} +0 -0
package/dist/src/create.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare class Create {
|
|
2
|
-
private projectDirectory?;
|
|
3
|
-
private version?;
|
|
4
|
-
private config;
|
|
5
|
-
constructor(projectDirectory?: string | undefined, version?: string | undefined);
|
|
6
|
-
printBanner(): void;
|
|
7
|
-
private getPackageManagerCommands;
|
|
8
|
-
/**
|
|
9
|
-
* Recursively copy directory structure
|
|
10
|
-
*/
|
|
11
|
-
private copyDirectorySync;
|
|
12
|
-
/**
|
|
13
|
-
* Replace template variables in content
|
|
14
|
-
*/
|
|
15
|
-
private replaceTemplateVariables;
|
|
16
|
-
private promptForProjectName;
|
|
17
|
-
private promptForConfiguration;
|
|
18
|
-
private installDependencies;
|
|
19
|
-
/**
|
|
20
|
-
* Step 1: Gather all project configuration through prompts
|
|
21
|
-
* NO EXECUTION - hanya mengumpulkan data dan validasi ringan
|
|
22
|
-
*/
|
|
23
|
-
private gatherProjectConfig;
|
|
24
|
-
/**
|
|
25
|
-
* Step 2: Execute project generation based on gathered config
|
|
26
|
-
*/
|
|
27
|
-
private executeProjectGeneration;
|
|
28
|
-
private setupEslintConfig;
|
|
29
|
-
/**
|
|
30
|
-
* Main public method: Prompt first, then execute
|
|
31
|
-
*/
|
|
32
|
-
createProject(): Promise<void>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=create.d.ts.map
|
package/dist/src/create.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/create.ts"],"names":[],"mappings":"AAgBA,qBAAa,MAAM;IAGE,OAAO,CAAC,gBAAgB,CAAC;IAAU,OAAO,CAAC,OAAO,CAAC;IAFtE,OAAO,CAAC,MAAM,CAA2B;gBAEd,gBAAgB,CAAC,EAAE,MAAM,YAAA,EAAU,OAAO,CAAC,EAAE,MAAM,YAAA;IAIvE,WAAW;IAelB,OAAO,CAAC,yBAAyB;IAkDjC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA4BzB;;OAEG;IACH,OAAO,CAAC,wBAAwB;YAQlB,oBAAoB;YAqBpB,sBAAsB;YAkDtB,mBAAmB;IA0BjC;;;OAGG;YACW,mBAAmB;IAiEjC;;OAEG;YACW,wBAAwB;YAuExB,iBAAiB;IAyB/B;;OAEG;IACU,aAAa;CAgB3B"}
|
package/dist/src/create.js
DELETED
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { log } from "./utils/logger";
|
|
4
|
-
import { spawn } from "child_process";
|
|
5
|
-
import enquirer from "enquirer";
|
|
6
|
-
export class Create {
|
|
7
|
-
projectDirectory;
|
|
8
|
-
version;
|
|
9
|
-
config;
|
|
10
|
-
constructor(projectDirectory, version) {
|
|
11
|
-
this.projectDirectory = projectDirectory;
|
|
12
|
-
this.version = version;
|
|
13
|
-
// Constructor hanya menerima parameter, tidak melakukan execution
|
|
14
|
-
}
|
|
15
|
-
printBanner() {
|
|
16
|
-
const banner = `
|
|
17
|
-
$$$$$$\\ $$\\
|
|
18
|
-
$$ __$$\\ $$ |
|
|
19
|
-
$$ / \\__| $$$$$$\\ $$$$$$\\ $$$$$$\\$$$$\\ $$$$$$$\\ $$$$$$\\ $$$$$$\\ $$\\ $$\\
|
|
20
|
-
$$ |$$$$\\ $$ __$$\\ \\____$$\\ $$ _$$ _$$\\ $$ _____|\\_$$ _| \\____$$\\ \\$$\\ $$ |
|
|
21
|
-
$$ |\\_$$ |$$ | \\__|$$$$$$$ |$$ / $$ / $$ |\\$$$$$$\\ $$ | $$$$$$$ | \\$$$$ /
|
|
22
|
-
$$ | $$ |$$ | $$ __$$ |$$ | $$ | $$ | \\____$$\\ $$ |$$\\ $$ __$$ | $$ $$<
|
|
23
|
-
\\$$$$$$ |$$ | \\$$$$$$$ |$$ | $$ | $$ |$$$$$$$ | \\$$$$ |\\$$$$$$$ |$$ /\\$$\\
|
|
24
|
-
\\______/ \\__| \\_______|\\__| \\__| \\__|\\_______/ \\____/ \\_______|\\__/ \\__|
|
|
25
|
-
|
|
26
|
-
`;
|
|
27
|
-
console.log(banner);
|
|
28
|
-
}
|
|
29
|
-
getPackageManagerCommands(packageManager) {
|
|
30
|
-
const commands = {
|
|
31
|
-
bun: {
|
|
32
|
-
install: `bun install`,
|
|
33
|
-
dev: `bun dev`,
|
|
34
|
-
start: `bun start`,
|
|
35
|
-
"pm2:start": `bun run pm2:start`,
|
|
36
|
-
"pm2:stop": `bun run pm2:stop`,
|
|
37
|
-
"pm2:restart": `bun run pm2:restart`,
|
|
38
|
-
"pm2:delete": `bun run pm2:delete`,
|
|
39
|
-
"pm2:logs": `bun run pm2:logs`,
|
|
40
|
-
"pm2:monit": `bun run pm2:monit`
|
|
41
|
-
},
|
|
42
|
-
npm: {
|
|
43
|
-
install: `npm install`,
|
|
44
|
-
dev: `npm run dev`,
|
|
45
|
-
start: `npm start`,
|
|
46
|
-
"pm2:start": `npm run pm2:start`,
|
|
47
|
-
"pm2:stop": `npm run pm2:stop`,
|
|
48
|
-
"pm2:restart": `npm run pm2:restart`,
|
|
49
|
-
"pm2:delete": `npm run pm2:delete`,
|
|
50
|
-
"pm2:logs": `npm run pm2:logs`,
|
|
51
|
-
"pm2:monit": `npm run pm2:monit`
|
|
52
|
-
},
|
|
53
|
-
pnpm: {
|
|
54
|
-
install: `pnpm install`,
|
|
55
|
-
dev: `pnpm dev`,
|
|
56
|
-
start: `pnpm start`,
|
|
57
|
-
"pm2:start": `pnpm pm2:start`,
|
|
58
|
-
"pm2:stop": `pnpm pm2:stop`,
|
|
59
|
-
"pm2:restart": `pnpm pm2:restart`,
|
|
60
|
-
"pm2:delete": `pnpm pm2:delete`,
|
|
61
|
-
"pm2:logs": `pnpm pm2:logs`,
|
|
62
|
-
"pm2:monit": `pnpm pm2:monit`
|
|
63
|
-
},
|
|
64
|
-
yarn: {
|
|
65
|
-
install: `yarn install`,
|
|
66
|
-
dev: `yarn dev`,
|
|
67
|
-
start: `yarn start`,
|
|
68
|
-
"pm2:start": `yarn pm2:start`,
|
|
69
|
-
"pm2:stop": `yarn pm2:stop`,
|
|
70
|
-
"pm2:restart": `yarn pm2:restart`,
|
|
71
|
-
"pm2:delete": `yarn pm2:delete`,
|
|
72
|
-
"pm2:logs": `yarn pm2:logs`,
|
|
73
|
-
"pm2:monit": `yarn pm2:monit`
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return commands[packageManager];
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Recursively copy directory structure
|
|
80
|
-
*/
|
|
81
|
-
copyDirectorySync(source, destination, variables = {}) {
|
|
82
|
-
// Create destination directory if it doesn't exist
|
|
83
|
-
if (!fs.existsSync(destination)) {
|
|
84
|
-
fs.mkdirSync(destination, { recursive: true });
|
|
85
|
-
}
|
|
86
|
-
// Read all items in source directory
|
|
87
|
-
const items = fs.readdirSync(source, { withFileTypes: true });
|
|
88
|
-
for (const item of items) {
|
|
89
|
-
const sourcePath = path.join(source, item.name);
|
|
90
|
-
const destPath = path.join(destination, item.name);
|
|
91
|
-
if (item.isDirectory()) {
|
|
92
|
-
// Recursively copy subdirectories
|
|
93
|
-
this.copyDirectorySync(sourcePath, destPath, variables);
|
|
94
|
-
}
|
|
95
|
-
else if (item.isFile()) {
|
|
96
|
-
// Copy file and replace variables if needed
|
|
97
|
-
let content = fs.readFileSync(sourcePath, `utf-8`);
|
|
98
|
-
// Replace template variables in content
|
|
99
|
-
content = this.replaceTemplateVariables(content, variables);
|
|
100
|
-
fs.writeFileSync(destPath, content);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Replace template variables in content
|
|
106
|
-
*/
|
|
107
|
-
replaceTemplateVariables(content, variables) {
|
|
108
|
-
let result = content;
|
|
109
|
-
for (const [key, value] of Object.entries(variables)) {
|
|
110
|
-
result = result.replace(new RegExp(`{{${key}}}`, `g`), value);
|
|
111
|
-
}
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
async promptForProjectName() {
|
|
115
|
-
const response = await enquirer.prompt({
|
|
116
|
-
type: `input`,
|
|
117
|
-
name: `projectName`,
|
|
118
|
-
message: `What is your project named?`,
|
|
119
|
-
initial: ``,
|
|
120
|
-
validate: (value) => {
|
|
121
|
-
if (value === ``) {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
if (!/^[a-z0-9-_]+$/i.test(value)) {
|
|
125
|
-
return `Project name can only contain letters, numbers, hyphens, and underscores`;
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
return response.projectName;
|
|
131
|
-
}
|
|
132
|
-
async promptForConfiguration() {
|
|
133
|
-
const questions = [];
|
|
134
|
-
// Package manager selection
|
|
135
|
-
questions.push({
|
|
136
|
-
type: `select`,
|
|
137
|
-
name: `packageManager`,
|
|
138
|
-
message: `Which package manager would you like to use?`,
|
|
139
|
-
choices: [
|
|
140
|
-
{ name: `bun`, message: `Bun (recommended)`, value: `bun` },
|
|
141
|
-
{ name: `npm`, message: `npm`, value: `npm` },
|
|
142
|
-
{ name: `pnpm`, message: `pnpm`, value: `pnpm` },
|
|
143
|
-
{ name: `yarn`, message: `Yarn`, value: `yarn` }
|
|
144
|
-
],
|
|
145
|
-
initial: 0
|
|
146
|
-
});
|
|
147
|
-
// Runtime selection
|
|
148
|
-
questions.push({
|
|
149
|
-
type: `select`,
|
|
150
|
-
name: `runtime`,
|
|
151
|
-
message: `Which runtime would you like to use?`,
|
|
152
|
-
choices: [
|
|
153
|
-
{ name: `bun`, message: `Bun (recommended)`, value: `bun` },
|
|
154
|
-
{ name: `node`, message: `Node.js`, value: `node` }
|
|
155
|
-
],
|
|
156
|
-
initial: 0
|
|
157
|
-
});
|
|
158
|
-
// ESLint
|
|
159
|
-
questions.push({
|
|
160
|
-
type: `confirm`,
|
|
161
|
-
name: `eslint`,
|
|
162
|
-
message: `Would you like to use ESLint?`,
|
|
163
|
-
initial: true
|
|
164
|
-
});
|
|
165
|
-
const answers = await enquirer.prompt(questions);
|
|
166
|
-
return {
|
|
167
|
-
packageManager: answers.packageManager,
|
|
168
|
-
runtime: answers.runtime,
|
|
169
|
-
eslint: answers.eslint
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
async installDependencies(projectPath, packageManager) {
|
|
173
|
-
return await new Promise((resolve, reject) => {
|
|
174
|
-
const installCommand = packageManager;
|
|
175
|
-
const installArgs = [`install`];
|
|
176
|
-
const installProcess = spawn(installCommand, installArgs, {
|
|
177
|
-
cwd: projectPath,
|
|
178
|
-
stdio: `inherit`,
|
|
179
|
-
shell: true
|
|
180
|
-
});
|
|
181
|
-
installProcess.on(`close`, (code) => {
|
|
182
|
-
if (code === 0) {
|
|
183
|
-
resolve(true);
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
log.fail(`Dependencies installation failed`);
|
|
187
|
-
resolve(false);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
installProcess.on(`error`, (error) => {
|
|
191
|
-
log.fail(`Dependencies installation failed: ${error.message}`);
|
|
192
|
-
resolve(false);
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Step 1: Gather all project configuration through prompts
|
|
198
|
-
* NO EXECUTION - hanya mengumpulkan data dan validasi ringan
|
|
199
|
-
*/
|
|
200
|
-
async gatherProjectConfig() {
|
|
201
|
-
// Display ASCII art banner
|
|
202
|
-
this.printBanner();
|
|
203
|
-
// ========== PHASE 1: GET PROJECT NAME ==========
|
|
204
|
-
let projectName = this.projectDirectory;
|
|
205
|
-
let projectPath;
|
|
206
|
-
let useCurrentDir = false;
|
|
207
|
-
if (!projectName) {
|
|
208
|
-
// PROMPT untuk project name
|
|
209
|
-
projectName = await this.promptForProjectName();
|
|
210
|
-
if (projectName === ``) {
|
|
211
|
-
// Empty name means use current directory
|
|
212
|
-
projectName = path.basename(process.cwd());
|
|
213
|
-
projectPath = process.cwd();
|
|
214
|
-
useCurrentDir = true;
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
projectPath = path.resolve(process.cwd(), projectName);
|
|
218
|
-
useCurrentDir = false;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
projectPath = path.resolve(process.cwd(), projectName);
|
|
223
|
-
useCurrentDir = false;
|
|
224
|
-
}
|
|
225
|
-
// PROMPT untuk configuration
|
|
226
|
-
const config = await this.promptForConfiguration();
|
|
227
|
-
const packageManager = config.packageManager;
|
|
228
|
-
const runtime = config.runtime;
|
|
229
|
-
const setupEslint = config.eslint;
|
|
230
|
-
// ========== SEMUA PROMPT SELESAI, SEKARANG VALIDASI ==========
|
|
231
|
-
log.info(`Create-gramstax v${this.version}`);
|
|
232
|
-
log.info(`Project: ${projectName}`);
|
|
233
|
-
log.info(`Location: ${projectPath}`);
|
|
234
|
-
log.info(`Package Manager: ${packageManager}`);
|
|
235
|
-
log.info(`Runtime: ${runtime}`);
|
|
236
|
-
log.info(`ESLint: ${setupEslint ? `Yes` : `No`}`);
|
|
237
|
-
// Validasi setelah semua prompt selesai
|
|
238
|
-
if (useCurrentDir) {
|
|
239
|
-
// Check if current directory is empty
|
|
240
|
-
const files = fs.readdirSync(projectPath);
|
|
241
|
-
if (files.length > 0) {
|
|
242
|
-
log.error(`Current directory is not empty!`);
|
|
243
|
-
process.exit(1);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
// Check if directory already exists
|
|
248
|
-
if (fs.existsSync(projectPath)) {
|
|
249
|
-
log.error(`Directory "${projectName}" already exists!`);
|
|
250
|
-
process.exit(1);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
projectName,
|
|
255
|
-
projectPath,
|
|
256
|
-
packageManager,
|
|
257
|
-
runtime,
|
|
258
|
-
setupEslint
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Step 2: Execute project generation based on gathered config
|
|
263
|
-
*/
|
|
264
|
-
async executeProjectGeneration(config) {
|
|
265
|
-
const { projectName, projectPath, packageManager, runtime, setupEslint } = config;
|
|
266
|
-
// Task 1: Create project directory
|
|
267
|
-
log.info(`Creating project directory..`);
|
|
268
|
-
if (!fs.existsSync(projectPath)) {
|
|
269
|
-
fs.mkdirSync(projectPath, { recursive: true });
|
|
270
|
-
}
|
|
271
|
-
// Task 2: Copy template files
|
|
272
|
-
log.info(`Copying template files..`);
|
|
273
|
-
const templatesPath = path.join(__dirname, `templates`);
|
|
274
|
-
const commands = this.getPackageManagerCommands(packageManager);
|
|
275
|
-
const variables = {
|
|
276
|
-
projectName,
|
|
277
|
-
installCmd: commands.install,
|
|
278
|
-
runDevCmd: commands.dev,
|
|
279
|
-
runStartCmd: commands.start,
|
|
280
|
-
runPm2StartCmd: commands[`pm2:start`],
|
|
281
|
-
runPm2StopCmd: commands[`pm2:stop`],
|
|
282
|
-
runPm2RestartCmd: commands[`pm2:restart`],
|
|
283
|
-
runPm2DeleteCmd: commands[`pm2:delete`],
|
|
284
|
-
runPm2LogsCmd: commands[`pm2:logs`],
|
|
285
|
-
runPm2MonitCmd: commands[`pm2:monit`]
|
|
286
|
-
};
|
|
287
|
-
this.copyDirectorySync(templatesPath, projectPath, variables);
|
|
288
|
-
// Task 3: Create logs directory
|
|
289
|
-
log.info(`Creating logs directory..`);
|
|
290
|
-
fs.mkdirSync(path.join(projectPath, `logs`), { recursive: true });
|
|
291
|
-
fs.writeFileSync(path.join(projectPath, `logs/.gitkeep`), ``);
|
|
292
|
-
// Task 4: Create .env.example
|
|
293
|
-
const envPath = path.join(projectPath, `.env`);
|
|
294
|
-
const envExamplePath = path.join(projectPath, `.env.example`);
|
|
295
|
-
if (fs.existsSync(envExamplePath)) {
|
|
296
|
-
log.info(`Creating .env file..`);
|
|
297
|
-
fs.renameSync(envExamplePath, envPath);
|
|
298
|
-
}
|
|
299
|
-
// Task 5: Remove bunfig.toml if runtime is NOT bun
|
|
300
|
-
if (runtime !== `bun`) {
|
|
301
|
-
log.info(`Removing bunfig.toml for Node.js runtime..`);
|
|
302
|
-
const bunfigPath = path.join(projectPath, `bunfig.toml`);
|
|
303
|
-
if (fs.existsSync(bunfigPath)) {
|
|
304
|
-
fs.unlinkSync(bunfigPath);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
// Task 6: Install dependencies
|
|
308
|
-
log.info(`Installing dependencies..`);
|
|
309
|
-
if (!(await this.installDependencies(projectPath, packageManager))) {
|
|
310
|
-
log.fail(`Project created failed!`);
|
|
311
|
-
return process.exit();
|
|
312
|
-
}
|
|
313
|
-
// Task 7: Setup ESLint if requested
|
|
314
|
-
if (setupEslint) {
|
|
315
|
-
log.info(`Setting up ESLint..`);
|
|
316
|
-
await this.setupEslintConfig(projectPath, packageManager);
|
|
317
|
-
}
|
|
318
|
-
// Final success message
|
|
319
|
-
log.info(`Project created successfully!`);
|
|
320
|
-
log.info(`Next steps: ${config.projectPath !== process.cwd() ? `cd ${projectName} && ` : ` `}${commands.install} && ${commands.dev}`);
|
|
321
|
-
log.info(`For production: ${commands[`pm2:start`]}`);
|
|
322
|
-
log.info(`Done..`);
|
|
323
|
-
}
|
|
324
|
-
async setupEslintConfig(projectPath, packageManager) {
|
|
325
|
-
return new Promise((resolve) => {
|
|
326
|
-
const initProcess = spawn(`npm`, [`init`, `@eslint/config@latest`], {
|
|
327
|
-
cwd: projectPath,
|
|
328
|
-
stdio: `inherit`,
|
|
329
|
-
shell: true
|
|
330
|
-
});
|
|
331
|
-
initProcess.on(`close`, (code) => {
|
|
332
|
-
if (code === 0) {
|
|
333
|
-
resolve();
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
log.fail(`ESLint setup failed. You can set it up later with: npm init @eslint/config`);
|
|
337
|
-
resolve();
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
initProcess.on(`error`, (error) => {
|
|
341
|
-
log.fail(`ESLint setup failed: ${error.message}`);
|
|
342
|
-
log.info(`You can set it up later with: npm init @eslint/config`);
|
|
343
|
-
resolve();
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Main public method: Prompt first, then execute
|
|
349
|
-
*/
|
|
350
|
-
async createProject() {
|
|
351
|
-
try {
|
|
352
|
-
// Step 1: Gather all configuration through prompts
|
|
353
|
-
this.config = await this.gatherProjectConfig();
|
|
354
|
-
// Step 2: Execute project generation with the gathered config
|
|
355
|
-
await this.executeProjectGeneration(this.config);
|
|
356
|
-
}
|
|
357
|
-
catch (error) {
|
|
358
|
-
if (error instanceof Error) {
|
|
359
|
-
log.error(`Failed to create project: ${error.message}`);
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
log.error(`Failed to create project: ${String(error)}`);
|
|
363
|
-
}
|
|
364
|
-
process.exit(1);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,gBAAgB,CAAA;AAE1C,eAAO,MAAM,GAAG,eAAsB,CAAA"}
|
package/dist/src/utils/logger.js
DELETED