zerostart-cli 0.0.37 → 0.0.38
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 +32 -75
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -160,68 +160,14 @@ async function initializeProject(name, language, type, options) {
|
|
|
160
160
|
program
|
|
161
161
|
.name('zerostart')
|
|
162
162
|
.description('Create and deploy a complete project with one command')
|
|
163
|
-
.version('0.0.
|
|
163
|
+
.version('0.0.38');
|
|
164
164
|
// zerostart init [project-name]
|
|
165
165
|
program
|
|
166
166
|
.command('init [project-name]')
|
|
167
167
|
.description('Initialize a new project with interactive prompts')
|
|
168
168
|
.action(async (projectName) => {
|
|
169
169
|
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
|
-
}
|
|
170
|
+
await startWizard(projectName);
|
|
225
171
|
});
|
|
226
172
|
// zerostart deploy
|
|
227
173
|
program
|
|
@@ -544,7 +490,7 @@ program
|
|
|
544
490
|
return;
|
|
545
491
|
}
|
|
546
492
|
const latestVersion = stdout.trim();
|
|
547
|
-
const currentVersion = '0.0.
|
|
493
|
+
const currentVersion = '0.0.38';
|
|
548
494
|
if (latestVersion === currentVersion) {
|
|
549
495
|
spinner.succeed(chalk_1.default.green('You are using the latest version!'));
|
|
550
496
|
}
|
|
@@ -620,10 +566,13 @@ shortcuts.forEach(s => {
|
|
|
620
566
|
async function startWizard(initialName) {
|
|
621
567
|
let step = 1;
|
|
622
568
|
let name = initialName;
|
|
569
|
+
let category;
|
|
623
570
|
let language;
|
|
624
571
|
let github = false;
|
|
625
572
|
let githubToken = null;
|
|
626
573
|
const BACK = '< Back';
|
|
574
|
+
const CAT_WEB = '🌐 Web Development (React, TS, HTML/CSS)';
|
|
575
|
+
const CAT_CP = '🏆 Competitive Programming (C++, Java, Python)';
|
|
627
576
|
while (step > 0 && step <= 4) {
|
|
628
577
|
if (step === 1) {
|
|
629
578
|
if (!name) {
|
|
@@ -638,29 +587,37 @@ async function startWizard(initialName) {
|
|
|
638
587
|
step++;
|
|
639
588
|
}
|
|
640
589
|
else if (step === 2) {
|
|
641
|
-
|
|
642
|
-
types_1.ProjectLanguage.React,
|
|
643
|
-
types_1.ProjectLanguage.TypeScript,
|
|
644
|
-
types_1.ProjectLanguage.HTMLCSS,
|
|
645
|
-
types_1.ProjectLanguage.CPP,
|
|
646
|
-
types_1.ProjectLanguage.Java,
|
|
647
|
-
types_1.ProjectLanguage.Python
|
|
648
|
-
];
|
|
649
|
-
if (!initialName)
|
|
650
|
-
choices.push(new inquirer_1.default.Separator(), BACK);
|
|
590
|
+
// Category Selection
|
|
651
591
|
const ans = await inquirer_1.default.prompt([{
|
|
652
592
|
type: 'list',
|
|
653
|
-
name: '
|
|
654
|
-
message: '
|
|
655
|
-
choices:
|
|
593
|
+
name: 'category',
|
|
594
|
+
message: 'What are you building?',
|
|
595
|
+
choices: [CAT_WEB, CAT_CP, new inquirer_1.default.Separator(), BACK]
|
|
656
596
|
}]);
|
|
657
|
-
if (ans.
|
|
597
|
+
if (ans.category === BACK) {
|
|
658
598
|
name = undefined;
|
|
659
599
|
step--;
|
|
660
600
|
}
|
|
661
601
|
else {
|
|
662
|
-
|
|
663
|
-
|
|
602
|
+
category = ans.category;
|
|
603
|
+
// Sub-selection for languages
|
|
604
|
+
const langChoices = category === CAT_WEB
|
|
605
|
+
? [types_1.ProjectLanguage.React, types_1.ProjectLanguage.TypeScript, types_1.ProjectLanguage.HTMLCSS, BACK]
|
|
606
|
+
: [types_1.ProjectLanguage.CPP, types_1.ProjectLanguage.Java, types_1.ProjectLanguage.Python, BACK];
|
|
607
|
+
const langAns = await inquirer_1.default.prompt([{
|
|
608
|
+
type: 'list',
|
|
609
|
+
name: 'language',
|
|
610
|
+
message: 'Select Language:',
|
|
611
|
+
choices: langChoices
|
|
612
|
+
}]);
|
|
613
|
+
if (langAns.language === BACK) {
|
|
614
|
+
// Stay on step 2, loop back to category selection
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
language = langAns.language;
|
|
619
|
+
step++;
|
|
620
|
+
}
|
|
664
621
|
}
|
|
665
622
|
}
|
|
666
623
|
else if (step === 3) {
|
|
@@ -682,7 +639,7 @@ async function startWizard(initialName) {
|
|
|
682
639
|
}
|
|
683
640
|
else {
|
|
684
641
|
github = false;
|
|
685
|
-
step++;
|
|
642
|
+
step++;
|
|
686
643
|
}
|
|
687
644
|
}
|
|
688
645
|
else if (step === 4) {
|
|
@@ -713,7 +670,7 @@ async function startWizard(initialName) {
|
|
|
713
670
|
let type = types_1.ProjectType.WebApp;
|
|
714
671
|
if (language === types_1.ProjectLanguage.TypeScript)
|
|
715
672
|
type = types_1.ProjectType.CLITool;
|
|
716
|
-
if (
|
|
673
|
+
if (category === CAT_CP)
|
|
717
674
|
type = types_1.ProjectType.DSAPractice;
|
|
718
675
|
await initializeProject(name, language, type, {
|
|
719
676
|
isPublic: false,
|