zerostart-cli 0.0.37 → 0.0.39
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/out/cli.js +62 -88
- package/package.json +2 -2
package/out/cli.js
CHANGED
|
@@ -143,6 +143,17 @@ async function initializeProject(name, language, type, options) {
|
|
|
143
143
|
console.log(chalk_1.default.gray(' - ') + chalk_1.default.cyan(link));
|
|
144
144
|
console.log(chalk_1.default.gray(' (Opening in your browser...)'));
|
|
145
145
|
openUrl(link);
|
|
146
|
+
// Open a new terminal window with the language interpreter running
|
|
147
|
+
const terminalCmds = {
|
|
148
|
+
[types_1.ProjectLanguage.Python]: 'start cmd /k "python"',
|
|
149
|
+
[types_1.ProjectLanguage.Java]: `start cmd /k "cd /d ${projectPath} && javac src/main/java/com/example/Main.java && java -cp src/main/java com.example.Main"`,
|
|
150
|
+
[types_1.ProjectLanguage.CPP]: `start cmd /k "cd /d ${projectPath} && g++ main.cpp -o main && main"`,
|
|
151
|
+
};
|
|
152
|
+
const termCmd = terminalCmds[language];
|
|
153
|
+
if (termCmd) {
|
|
154
|
+
console.log(chalk_1.default.bold.yellow(' Opening interactive terminal...'));
|
|
155
|
+
(0, child_process_1.exec)(termCmd, { cwd: projectPath });
|
|
156
|
+
}
|
|
146
157
|
}
|
|
147
158
|
if (language === types_1.ProjectLanguage.HTMLCSS) {
|
|
148
159
|
console.log(chalk_1.default.bold.cyan('\n Deployment:'));
|
|
@@ -160,68 +171,14 @@ async function initializeProject(name, language, type, options) {
|
|
|
160
171
|
program
|
|
161
172
|
.name('zerostart')
|
|
162
173
|
.description('Create and deploy a complete project with one command')
|
|
163
|
-
.version('0.0.
|
|
174
|
+
.version('0.0.38');
|
|
164
175
|
// zerostart init [project-name]
|
|
165
176
|
program
|
|
166
177
|
.command('init [project-name]')
|
|
167
178
|
.description('Initialize a new project with interactive prompts')
|
|
168
179
|
.action(async (projectName) => {
|
|
169
180
|
showBanner();
|
|
170
|
-
|
|
171
|
-
{ type: 'input', name: 'name', message: 'Project Name:', when: !projectName, default: 'my-project' },
|
|
172
|
-
{
|
|
173
|
-
type: 'list',
|
|
174
|
-
name: 'language',
|
|
175
|
-
message: 'Select Template:',
|
|
176
|
-
choices: [
|
|
177
|
-
types_1.ProjectLanguage.React,
|
|
178
|
-
types_1.ProjectLanguage.TypeScript,
|
|
179
|
-
types_1.ProjectLanguage.HTMLCSS,
|
|
180
|
-
types_1.ProjectLanguage.CPP,
|
|
181
|
-
types_1.ProjectLanguage.Java,
|
|
182
|
-
types_1.ProjectLanguage.Python
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
]);
|
|
186
|
-
const selectedLang = answers.language;
|
|
187
|
-
let createRemote = false;
|
|
188
|
-
let githubToken = null;
|
|
189
|
-
if (selectedLang === types_1.ProjectLanguage.React || selectedLang === types_1.ProjectLanguage.TypeScript) {
|
|
190
|
-
const { github } = await inquirer_1.default.prompt([
|
|
191
|
-
{ type: 'confirm', name: 'github', message: 'Do you want to add this to GitHub?', default: true }
|
|
192
|
-
]);
|
|
193
|
-
if (github) {
|
|
194
|
-
createRemote = true;
|
|
195
|
-
showGitHubTokenHelp();
|
|
196
|
-
const { token } = await inquirer_1.default.prompt([
|
|
197
|
-
{ type: 'password', name: 'token', message: 'Enter your GitHub Personal Access Token:', validate: (input) => input.length > 0 || 'Token is required' }
|
|
198
|
-
]);
|
|
199
|
-
githubToken = token;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
let type = types_1.ProjectType.WebApp;
|
|
203
|
-
if (selectedLang === types_1.ProjectLanguage.TypeScript)
|
|
204
|
-
type = types_1.ProjectType.CLITool;
|
|
205
|
-
if ([types_1.ProjectLanguage.CPP, types_1.ProjectLanguage.Java, types_1.ProjectLanguage.Python].includes(selectedLang))
|
|
206
|
-
type = types_1.ProjectType.DSAPractice;
|
|
207
|
-
await initializeProject(projectName || answers.name, selectedLang, type, {
|
|
208
|
-
isPublic: false,
|
|
209
|
-
createRemote: createRemote,
|
|
210
|
-
githubToken: githubToken,
|
|
211
|
-
authMethod: 'none'
|
|
212
|
-
});
|
|
213
|
-
if (selectedLang === types_1.ProjectLanguage.HTMLCSS) {
|
|
214
|
-
const { deploy } = await inquirer_1.default.prompt([
|
|
215
|
-
{ type: 'confirm', name: 'deploy', message: 'Do you want to deploy to Vercel right now?', default: true }
|
|
216
|
-
]);
|
|
217
|
-
if (deploy) {
|
|
218
|
-
const vercelManager = new VercelManager_1.VercelManager();
|
|
219
|
-
const projectPath = path.join(process.cwd(), projectName || answers.name);
|
|
220
|
-
if (await vercelManager.checkAuth()) {
|
|
221
|
-
await vercelManager.deploy(projectPath, projectName || answers.name);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
181
|
+
await startWizard(projectName);
|
|
225
182
|
});
|
|
226
183
|
// zerostart deploy
|
|
227
184
|
program
|
|
@@ -544,7 +501,7 @@ program
|
|
|
544
501
|
return;
|
|
545
502
|
}
|
|
546
503
|
const latestVersion = stdout.trim();
|
|
547
|
-
const currentVersion = '0.0.
|
|
504
|
+
const currentVersion = '0.0.38';
|
|
548
505
|
if (latestVersion === currentVersion) {
|
|
549
506
|
spinner.succeed(chalk_1.default.green('You are using the latest version!'));
|
|
550
507
|
}
|
|
@@ -618,61 +575,77 @@ shortcuts.forEach(s => {
|
|
|
618
575
|
});
|
|
619
576
|
});
|
|
620
577
|
async function startWizard(initialName) {
|
|
578
|
+
// Steps:
|
|
579
|
+
// 1 = Category (Web Dev / CP) — shown FIRST
|
|
580
|
+
// 2 = Language sub-selection
|
|
581
|
+
// 3 = Project Name
|
|
582
|
+
// 4 = GitHub? (only for React/TS)
|
|
583
|
+
// 5 = GitHub Token (only if GitHub = Yes)
|
|
621
584
|
let step = 1;
|
|
622
585
|
let name = initialName;
|
|
586
|
+
let category;
|
|
623
587
|
let language;
|
|
624
588
|
let github = false;
|
|
625
589
|
let githubToken = null;
|
|
626
590
|
const BACK = '< Back';
|
|
627
|
-
|
|
591
|
+
const CAT_WEB = '🌐 Web Development (React, TS, HTML/CSS)';
|
|
592
|
+
const CAT_CP = '🏆 Competitive Programming (C++, Java, Python)';
|
|
593
|
+
while (step > 0 && step <= 5) {
|
|
628
594
|
if (step === 1) {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}
|
|
595
|
+
// Step 1: Category Selection — shown FIRST
|
|
596
|
+
const ans = await inquirer_1.default.prompt([{
|
|
597
|
+
type: 'list',
|
|
598
|
+
name: 'category',
|
|
599
|
+
message: 'What are you building?',
|
|
600
|
+
choices: [CAT_WEB, CAT_CP]
|
|
601
|
+
}]);
|
|
602
|
+
category = ans.category;
|
|
638
603
|
step++;
|
|
639
604
|
}
|
|
640
605
|
else if (step === 2) {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
types_1.ProjectLanguage.TypeScript,
|
|
644
|
-
types_1.ProjectLanguage.
|
|
645
|
-
|
|
646
|
-
types_1.ProjectLanguage.Java,
|
|
647
|
-
types_1.ProjectLanguage.Python
|
|
648
|
-
];
|
|
649
|
-
if (!initialName)
|
|
650
|
-
choices.push(new inquirer_1.default.Separator(), BACK);
|
|
651
|
-
const ans = await inquirer_1.default.prompt([{
|
|
606
|
+
// Step 2: Language sub-selection
|
|
607
|
+
const langChoices = category === CAT_WEB
|
|
608
|
+
? [types_1.ProjectLanguage.React, types_1.ProjectLanguage.TypeScript, types_1.ProjectLanguage.HTMLCSS, new inquirer_1.default.Separator(), BACK]
|
|
609
|
+
: [types_1.ProjectLanguage.CPP, types_1.ProjectLanguage.Java, types_1.ProjectLanguage.Python, new inquirer_1.default.Separator(), BACK];
|
|
610
|
+
const langAns = await inquirer_1.default.prompt([{
|
|
652
611
|
type: 'list',
|
|
653
612
|
name: 'language',
|
|
654
|
-
message: 'Select
|
|
655
|
-
choices:
|
|
613
|
+
message: 'Select Language:',
|
|
614
|
+
choices: langChoices
|
|
656
615
|
}]);
|
|
657
|
-
if (
|
|
658
|
-
name = undefined;
|
|
616
|
+
if (langAns.language === BACK) {
|
|
659
617
|
step--;
|
|
660
618
|
}
|
|
661
619
|
else {
|
|
662
|
-
language =
|
|
620
|
+
language = langAns.language;
|
|
663
621
|
step++;
|
|
664
622
|
}
|
|
665
623
|
}
|
|
666
624
|
else if (step === 3) {
|
|
625
|
+
// Step 3: Project Name
|
|
626
|
+
if (!name) {
|
|
627
|
+
const ans = await inquirer_1.default.prompt([{
|
|
628
|
+
type: 'input',
|
|
629
|
+
name: 'name',
|
|
630
|
+
message: 'Project Name:',
|
|
631
|
+
default: 'my-project'
|
|
632
|
+
}]);
|
|
633
|
+
name = ans.name;
|
|
634
|
+
}
|
|
635
|
+
step++;
|
|
636
|
+
}
|
|
637
|
+
else if (step === 4) {
|
|
638
|
+
// Step 4: GitHub? (only for React/TS)
|
|
667
639
|
if (language === types_1.ProjectLanguage.React || language === types_1.ProjectLanguage.TypeScript) {
|
|
668
640
|
const ans = await inquirer_1.default.prompt([{
|
|
669
641
|
type: 'list',
|
|
670
642
|
name: 'github',
|
|
671
643
|
message: 'Do you want to add this to GitHub?',
|
|
672
|
-
choices: ['Yes', 'No', BACK],
|
|
644
|
+
choices: ['Yes', 'No', new inquirer_1.default.Separator(), BACK],
|
|
673
645
|
default: 'Yes'
|
|
674
646
|
}]);
|
|
675
647
|
if (ans.github === BACK) {
|
|
648
|
+
name = undefined; // reset name so it's re-asked if they go back
|
|
676
649
|
step--;
|
|
677
650
|
}
|
|
678
651
|
else {
|
|
@@ -682,10 +655,11 @@ async function startWizard(initialName) {
|
|
|
682
655
|
}
|
|
683
656
|
else {
|
|
684
657
|
github = false;
|
|
685
|
-
step++;
|
|
658
|
+
step++;
|
|
686
659
|
}
|
|
687
660
|
}
|
|
688
|
-
else if (step ===
|
|
661
|
+
else if (step === 5) {
|
|
662
|
+
// Step 5: GitHub Token (only if GitHub = Yes)
|
|
689
663
|
if (github) {
|
|
690
664
|
showGitHubTokenHelp();
|
|
691
665
|
const ans = await inquirer_1.default.prompt([
|
|
@@ -709,11 +683,11 @@ async function startWizard(initialName) {
|
|
|
709
683
|
}
|
|
710
684
|
}
|
|
711
685
|
}
|
|
712
|
-
if (step >
|
|
686
|
+
if (step > 5 && name && language) {
|
|
713
687
|
let type = types_1.ProjectType.WebApp;
|
|
714
688
|
if (language === types_1.ProjectLanguage.TypeScript)
|
|
715
689
|
type = types_1.ProjectType.CLITool;
|
|
716
|
-
if (
|
|
690
|
+
if (category === CAT_CP)
|
|
717
691
|
type = types_1.ProjectType.DSAPractice;
|
|
718
692
|
await initializeProject(name, language, type, {
|
|
719
693
|
isPublic: false,
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"zerostart": "./out/cli.js"
|
|
6
6
|
},
|
|
7
7
|
"description": "Create and deploy a complete project with one command.",
|
|
8
|
-
"version": "0.0.
|
|
8
|
+
"version": "0.0.39",
|
|
9
9
|
"engines": {
|
|
10
10
|
"vscode": "^1.85.0"
|
|
11
11
|
},
|
|
@@ -45,4 +45,4 @@
|
|
|
45
45
|
"inquirer": "^9.3.8",
|
|
46
46
|
"ora": "^5.4.1"
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
}
|