zerostart-cli 0.0.46 → 0.0.47
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 +38 -10
- package/out/services/GitHubServiceCLI.js +7 -1
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -185,7 +185,7 @@ async function initializeProject(name, language, type, options) {
|
|
|
185
185
|
program
|
|
186
186
|
.name('zerostart')
|
|
187
187
|
.description('Create and deploy a complete project with one command')
|
|
188
|
-
.version('0.0.
|
|
188
|
+
.version('0.0.47');
|
|
189
189
|
// zerostart init [project-name]
|
|
190
190
|
program
|
|
191
191
|
.command('init [project-name]')
|
|
@@ -523,7 +523,7 @@ program
|
|
|
523
523
|
return;
|
|
524
524
|
}
|
|
525
525
|
const latestVersion = stdout.trim();
|
|
526
|
-
const currentVersion = '0.0.
|
|
526
|
+
const currentVersion = '0.0.47';
|
|
527
527
|
if (latestVersion === currentVersion) {
|
|
528
528
|
spinner.succeed(chalk_1.default.green('You are using the latest version!'));
|
|
529
529
|
}
|
|
@@ -639,11 +639,12 @@ async function startWizard(initialName) {
|
|
|
639
639
|
let language;
|
|
640
640
|
let github = false;
|
|
641
641
|
let githubToken = null;
|
|
642
|
+
let isPublic = false;
|
|
642
643
|
let cpInterface = 'both';
|
|
643
644
|
const BACK = '< Back';
|
|
644
645
|
const CAT_WEB = '🌐 Web Development (React, TS, HTML/CSS)';
|
|
645
646
|
const CAT_CP = '🏆 Competitive Programming (C++, Java, Python)';
|
|
646
|
-
while (step > 0 && step <=
|
|
647
|
+
while (step > 0 && step <= 7) {
|
|
647
648
|
// ── STEP 1: Category ────────────────────────────────────────────────
|
|
648
649
|
if (step === 1) {
|
|
649
650
|
const ans = await inquirer_1.default.prompt([{
|
|
@@ -743,12 +744,39 @@ async function startWizard(initialName) {
|
|
|
743
744
|
else {
|
|
744
745
|
cpInterface = ans.cpInterface;
|
|
745
746
|
github = false;
|
|
746
|
-
step =
|
|
747
|
+
step = 8; // CP projects skip to execution
|
|
747
748
|
}
|
|
748
749
|
}
|
|
749
|
-
// ── STEP 5:
|
|
750
|
+
// ── STEP 5: Public or Private? ───────────────────────────────────────
|
|
750
751
|
}
|
|
751
752
|
else if (step === 5) {
|
|
753
|
+
if (github) {
|
|
754
|
+
const ans = await inquirer_1.default.prompt([{
|
|
755
|
+
type: 'list',
|
|
756
|
+
name: 'isPublic',
|
|
757
|
+
message: 'Repository visibility:',
|
|
758
|
+
choices: [
|
|
759
|
+
{ name: '🔓 Public (everyone can see)', value: true },
|
|
760
|
+
{ name: '🔒 Private (only you can see)', value: false },
|
|
761
|
+
new inquirer_1.default.Separator(),
|
|
762
|
+
{ name: BACK, value: 'back' }
|
|
763
|
+
],
|
|
764
|
+
default: false
|
|
765
|
+
}]);
|
|
766
|
+
if (ans.isPublic === 'back') {
|
|
767
|
+
step--;
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
isPublic = ans.isPublic;
|
|
771
|
+
step++;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
step++;
|
|
776
|
+
}
|
|
777
|
+
// ── STEP 6: GitHub Token ────────────────────────────────────────────
|
|
778
|
+
}
|
|
779
|
+
else if (step === 6) {
|
|
752
780
|
if (github) {
|
|
753
781
|
showGitHubTokenHelp();
|
|
754
782
|
console.log(chalk_1.default.gray(' 💡 Tip: ') + chalk_1.default.white('Your token can be saved and reused for all future ZeroStart projects.'));
|
|
@@ -781,16 +809,16 @@ async function startWizard(initialName) {
|
|
|
781
809
|
}
|
|
782
810
|
else {
|
|
783
811
|
spinner.fail(chalk_1.default.red('Invalid token or no internet. Please try again.'));
|
|
784
|
-
// Stay on step
|
|
812
|
+
// Stay on step 6 to retry
|
|
785
813
|
}
|
|
786
814
|
}
|
|
787
815
|
}
|
|
788
816
|
else {
|
|
789
817
|
step++; // No GitHub — skip token step
|
|
790
818
|
}
|
|
791
|
-
// ── STEP
|
|
819
|
+
// ── STEP 7: Run locally or Deploy to Vercel? (Web Dev only) ────────
|
|
792
820
|
}
|
|
793
|
-
else if (step ===
|
|
821
|
+
else if (step === 7) {
|
|
794
822
|
const deployAns = await inquirer_1.default.prompt([{
|
|
795
823
|
type: 'list',
|
|
796
824
|
name: 'action',
|
|
@@ -814,14 +842,14 @@ async function startWizard(initialName) {
|
|
|
814
842
|
}
|
|
815
843
|
}
|
|
816
844
|
// ── Execute the project creation ─────────────────────────────────────────
|
|
817
|
-
if ((step >
|
|
845
|
+
if ((step > 7 || step === 8) && name && language) {
|
|
818
846
|
let type = types_1.ProjectType.WebApp;
|
|
819
847
|
if (language === types_1.ProjectLanguage.TypeScript)
|
|
820
848
|
type = types_1.ProjectType.CLITool;
|
|
821
849
|
if (category === CAT_CP)
|
|
822
850
|
type = types_1.ProjectType.DSAPractice;
|
|
823
851
|
const projectPath = await initializeProject(name, language, type, {
|
|
824
|
-
isPublic:
|
|
852
|
+
isPublic: isPublic,
|
|
825
853
|
createRemote: !!githubToken,
|
|
826
854
|
githubToken,
|
|
827
855
|
authMethod: 'none',
|
|
@@ -59,7 +59,13 @@ class GitHubServiceCLI {
|
|
|
59
59
|
return `https://${this.token}@github.com/${user.login}/${config.name}.git`;
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
62
|
-
|
|
62
|
+
if (error.response) {
|
|
63
|
+
console.error(`GitHub API Error (${error.status}): ${error.message}`);
|
|
64
|
+
// console.debug(`Response:`, error.response.data);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
console.error(`GitHub API Error: ${error.message}`);
|
|
68
|
+
}
|
|
63
69
|
// Don't throw, just return undefined so the process continues locally
|
|
64
70
|
return undefined;
|
|
65
71
|
}
|