zerostart-cli 0.0.20 → 0.0.22
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 +23 -13
- package/out/managers/NetlifyManager.js +30 -12
- package/out/managers/VercelManager.js +6 -5
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -83,7 +83,7 @@ function showGitHubTokenHelp() {
|
|
|
83
83
|
program
|
|
84
84
|
.name('zerostart')
|
|
85
85
|
.description('Create and deploy a complete project with one command')
|
|
86
|
-
.version('0.0.
|
|
86
|
+
.version('0.0.22');
|
|
87
87
|
program
|
|
88
88
|
.command('deploy-vercel')
|
|
89
89
|
.description('Deploy the current project to Vercel')
|
|
@@ -213,13 +213,16 @@ program
|
|
|
213
213
|
nSpinner.succeed(chalk_1.default.green('Authenticated'));
|
|
214
214
|
}
|
|
215
215
|
const dSpinner = (0, ora_1.default)('Deploying to Netlify...').start();
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
console.log(
|
|
216
|
+
dSpinner.stop(); // Stop spinner to allow interactive input
|
|
217
|
+
const success = await netlifyManager.deploy(cwd);
|
|
218
|
+
if (success) {
|
|
219
|
+
console.log();
|
|
220
|
+
console.log(chalk_1.default.green(' ✔ Deployed to Netlify!'));
|
|
221
|
+
console.log(chalk_1.default.gray(' Run ') + chalk_1.default.cyan('netlify open') + chalk_1.default.gray(' to view your site.'));
|
|
220
222
|
}
|
|
221
223
|
else {
|
|
222
|
-
|
|
224
|
+
console.log();
|
|
225
|
+
console.log(chalk_1.default.red(' ✖ Deployment failed'));
|
|
223
226
|
console.log(chalk_1.default.gray(' Try running ') + chalk_1.default.cyan('netlify login') + chalk_1.default.gray(' and ') + chalk_1.default.cyan('netlify deploy') + chalk_1.default.gray(' manually.'));
|
|
224
227
|
}
|
|
225
228
|
}
|
|
@@ -519,7 +522,7 @@ program
|
|
|
519
522
|
vSpinner.succeed(chalk_1.default.green('Authenticated with Vercel'));
|
|
520
523
|
}
|
|
521
524
|
const dSpinner = (0, ora_1.default)('Deploying to Vercel...').start();
|
|
522
|
-
const deploymentUrl = await vercelManager.deploy(config.path);
|
|
525
|
+
const deploymentUrl = await vercelManager.deploy(config.path, config.name);
|
|
523
526
|
if (deploymentUrl) {
|
|
524
527
|
dSpinner.succeed(chalk_1.default.green('Deployed to Vercel!'));
|
|
525
528
|
console.log(chalk_1.default.gray(' URL: ') + chalk_1.default.cyan(deploymentUrl));
|
|
@@ -588,14 +591,21 @@ program
|
|
|
588
591
|
nSpinner.succeed(chalk_1.default.green('Authenticated with Netlify'));
|
|
589
592
|
}
|
|
590
593
|
const dSpinner = (0, ora_1.default)('Deploying to Netlify...').start();
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
594
|
+
dSpinner.stop(); // Stop spinner to allow interactive input
|
|
595
|
+
// Try to create site first to enforce name
|
|
596
|
+
console.log();
|
|
597
|
+
console.log(chalk_1.default.cyan(` Configuring Netlify site for "${config.name}"...`));
|
|
598
|
+
// We do this interactively so if name is taken user can see error and handle it (or it just links if they own it)
|
|
599
|
+
await netlifyManager.createSite(config.name, config.path);
|
|
600
|
+
const success = await netlifyManager.deploy(config.path);
|
|
601
|
+
if (success) {
|
|
602
|
+
console.log();
|
|
603
|
+
console.log(chalk_1.default.green(' ✔ Deployed to Netlify!'));
|
|
604
|
+
console.log(chalk_1.default.gray(' Run ') + chalk_1.default.cyan('netlify open') + chalk_1.default.gray(' to view your site.'));
|
|
596
605
|
}
|
|
597
606
|
else {
|
|
598
|
-
|
|
607
|
+
console.log();
|
|
608
|
+
console.log(chalk_1.default.red(' ✖ Deployment failed'));
|
|
599
609
|
console.log(chalk_1.default.gray(' Try running ') + chalk_1.default.cyan('netlify login') + chalk_1.default.gray(' and ') + chalk_1.default.cyan('netlify deploy') + chalk_1.default.gray(' manually.'));
|
|
600
610
|
}
|
|
601
611
|
}
|
|
@@ -32,11 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.NetlifyManager = void 0;
|
|
37
40
|
const cp = __importStar(require("child_process"));
|
|
38
41
|
const util = __importStar(require("util"));
|
|
39
42
|
const child_process_1 = require("child_process");
|
|
43
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
40
44
|
const exec = util.promisify(cp.exec);
|
|
41
45
|
class NetlifyManager {
|
|
42
46
|
async checkNetlifyInstalled() {
|
|
@@ -58,23 +62,37 @@ class NetlifyManager {
|
|
|
58
62
|
return false;
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
async
|
|
65
|
+
async createSite(name, cwd) {
|
|
62
66
|
try {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
console.log(chalk_1.default.cyan(` Creating Netlify site "${name}"...`));
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
// Using 'sites:create' might prompt if not authenticated, but we check auth before this.
|
|
70
|
+
const child = (0, child_process_1.spawn)('netlify', ['sites:create', '--name', name], {
|
|
71
|
+
cwd,
|
|
72
|
+
stdio: 'inherit'
|
|
73
|
+
});
|
|
74
|
+
child.on('close', (code) => {
|
|
75
|
+
resolve(code === 0);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
71
78
|
}
|
|
72
79
|
catch (error) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return null;
|
|
80
|
+
console.error('Failed to create Netlify site:', error);
|
|
81
|
+
return false;
|
|
76
82
|
}
|
|
77
83
|
}
|
|
84
|
+
async deploy(cwd) {
|
|
85
|
+
return new Promise((resolve) => {
|
|
86
|
+
// Use spawn with stdio: 'inherit' to allow interactive site creation
|
|
87
|
+
const child = (0, child_process_1.spawn)('netlify', ['deploy', '--prod'], {
|
|
88
|
+
cwd,
|
|
89
|
+
stdio: 'inherit'
|
|
90
|
+
});
|
|
91
|
+
child.on('close', (code) => {
|
|
92
|
+
resolve(code === 0);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
78
96
|
async checkAuth() {
|
|
79
97
|
try {
|
|
80
98
|
await exec('netlify status');
|
|
@@ -48,12 +48,13 @@ class VercelManager {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
async deploy(cwd) {
|
|
51
|
+
async deploy(cwd, projectName) {
|
|
52
52
|
try {
|
|
53
|
-
// vercel deploy --prod --yes
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
// vercel deploy --prod --yes --name <name>
|
|
54
|
+
const cmd = projectName
|
|
55
|
+
? `vercel deploy --prod --yes --name ${projectName}`
|
|
56
|
+
: 'vercel deploy --prod --yes';
|
|
57
|
+
const { stdout } = await exec(cmd, { cwd });
|
|
57
58
|
return stdout.trim();
|
|
58
59
|
}
|
|
59
60
|
catch (error) {
|