zerostart-cli 0.0.12 → 0.0.13
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 +68 -7
- package/out/managers/NetlifyManager.js +10 -1
- package/out/managers/VercelManager.js +10 -1
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -314,15 +314,45 @@ program
|
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
if (vercelInstalled) {
|
|
317
|
-
//
|
|
318
|
-
const vSpinner = (0, ora_1.default)('
|
|
317
|
+
// Check Auth
|
|
318
|
+
const vSpinner = (0, ora_1.default)('Checking Vercel authentication...').start();
|
|
319
|
+
const loggedIn = await vercelManager.checkAuth();
|
|
320
|
+
if (!loggedIn) {
|
|
321
|
+
vSpinner.stop();
|
|
322
|
+
console.log(chalk_1.default.yellow('\n Authentication required to deploy.'));
|
|
323
|
+
const { doLogin } = await inquirer_1.default.prompt([
|
|
324
|
+
{
|
|
325
|
+
type: 'confirm',
|
|
326
|
+
name: 'doLogin',
|
|
327
|
+
message: 'Log in to Vercel now?',
|
|
328
|
+
default: true
|
|
329
|
+
}
|
|
330
|
+
]);
|
|
331
|
+
if (doLogin) {
|
|
332
|
+
console.log(chalk_1.default.gray(' Opening Vercel login...'));
|
|
333
|
+
const loginSuccess = await vercelManager.login();
|
|
334
|
+
if (!loginSuccess) {
|
|
335
|
+
console.log(chalk_1.default.red('\n Login failed. Skipping deployment.'));
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
console.log(chalk_1.default.green('\n Successfully logged in!'));
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
console.log(chalk_1.default.yellow(' Skipping deployment (not logged in).'));
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
vSpinner.succeed(chalk_1.default.green('Authenticated with Vercel'));
|
|
347
|
+
}
|
|
348
|
+
const dSpinner = (0, ora_1.default)('Deploying to Vercel...').start();
|
|
319
349
|
const deploymentUrl = await vercelManager.deploy(config.path);
|
|
320
350
|
if (deploymentUrl) {
|
|
321
|
-
|
|
351
|
+
dSpinner.succeed(chalk_1.default.green('Deployed to Vercel!'));
|
|
322
352
|
console.log(chalk_1.default.gray(' URL: ') + chalk_1.default.cyan(deploymentUrl));
|
|
323
353
|
}
|
|
324
354
|
else {
|
|
325
|
-
|
|
355
|
+
dSpinner.fail(chalk_1.default.red('Vercel deployment failed'));
|
|
326
356
|
console.log(chalk_1.default.gray(' Try running ') + chalk_1.default.cyan('vercel deploy') + chalk_1.default.gray(' manually inside the project folder.'));
|
|
327
357
|
}
|
|
328
358
|
}
|
|
@@ -353,15 +383,46 @@ program
|
|
|
353
383
|
}
|
|
354
384
|
}
|
|
355
385
|
if (netlifyInstalled) {
|
|
356
|
-
|
|
386
|
+
// Check Auth
|
|
387
|
+
const nSpinner = (0, ora_1.default)('Checking Netlify authentication...').start();
|
|
388
|
+
const loggedIn = await netlifyManager.checkAuth();
|
|
389
|
+
if (!loggedIn) {
|
|
390
|
+
nSpinner.stop();
|
|
391
|
+
console.log(chalk_1.default.yellow('\n Authentication required to deploy.'));
|
|
392
|
+
const { doLogin } = await inquirer_1.default.prompt([
|
|
393
|
+
{
|
|
394
|
+
type: 'confirm',
|
|
395
|
+
name: 'doLogin',
|
|
396
|
+
message: 'Log in to Netlify now?',
|
|
397
|
+
default: true
|
|
398
|
+
}
|
|
399
|
+
]);
|
|
400
|
+
if (doLogin) {
|
|
401
|
+
console.log(chalk_1.default.gray(' Opening Netlify login...'));
|
|
402
|
+
const loginSuccess = await netlifyManager.login();
|
|
403
|
+
if (!loginSuccess) {
|
|
404
|
+
console.log(chalk_1.default.red('\n Login failed. Skipping deployment.'));
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
console.log(chalk_1.default.green('\n Successfully logged in!'));
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
console.log(chalk_1.default.yellow(' Skipping deployment (not logged in).'));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
nSpinner.succeed(chalk_1.default.green('Authenticated with Netlify'));
|
|
416
|
+
}
|
|
417
|
+
const dSpinner = (0, ora_1.default)('Deploying to Netlify...').start();
|
|
357
418
|
const deploymentOutput = await netlifyManager.deploy(config.path);
|
|
358
419
|
if (deploymentOutput) {
|
|
359
|
-
|
|
420
|
+
dSpinner.succeed(chalk_1.default.green('Deployed to Netlify!'));
|
|
360
421
|
// Netlify output is verbose, maybe just say success
|
|
361
422
|
console.log(chalk_1.default.gray(' Check output for URL or run ') + chalk_1.default.cyan('netlify open'));
|
|
362
423
|
}
|
|
363
424
|
else {
|
|
364
|
-
|
|
425
|
+
dSpinner.fail(chalk_1.default.red('Netlify deployment failed'));
|
|
365
426
|
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.'));
|
|
366
427
|
}
|
|
367
428
|
}
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.NetlifyManager = void 0;
|
|
37
37
|
const cp = __importStar(require("child_process"));
|
|
38
38
|
const util = __importStar(require("util"));
|
|
39
|
+
const child_process_1 = require("child_process");
|
|
39
40
|
const exec = util.promisify(cp.exec);
|
|
40
41
|
class NetlifyManager {
|
|
41
42
|
async checkNetlifyInstalled() {
|
|
@@ -74,7 +75,7 @@ class NetlifyManager {
|
|
|
74
75
|
return null;
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
async
|
|
78
|
+
async checkAuth() {
|
|
78
79
|
try {
|
|
79
80
|
await exec('netlify status');
|
|
80
81
|
return true;
|
|
@@ -83,5 +84,13 @@ class NetlifyManager {
|
|
|
83
84
|
return false;
|
|
84
85
|
}
|
|
85
86
|
}
|
|
87
|
+
async login() {
|
|
88
|
+
return new Promise((resolve) => {
|
|
89
|
+
const child = (0, child_process_1.spawn)('netlify', ['login'], { stdio: 'inherit' });
|
|
90
|
+
child.on('close', (code) => {
|
|
91
|
+
resolve(code === 0);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
86
95
|
}
|
|
87
96
|
exports.NetlifyManager = NetlifyManager;
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.VercelManager = void 0;
|
|
37
37
|
const cp = __importStar(require("child_process"));
|
|
38
38
|
const util = __importStar(require("util"));
|
|
39
|
+
const child_process_1 = require("child_process");
|
|
39
40
|
const exec = util.promisify(cp.exec);
|
|
40
41
|
class VercelManager {
|
|
41
42
|
async checkVercelInstalled() {
|
|
@@ -60,7 +61,7 @@ class VercelManager {
|
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
async
|
|
64
|
+
async checkAuth() {
|
|
64
65
|
try {
|
|
65
66
|
// vercel login usually requires interaction. failing that, we check status.
|
|
66
67
|
// simpler to just check if they can access user info
|
|
@@ -71,6 +72,14 @@ class VercelManager {
|
|
|
71
72
|
return false;
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
async login() {
|
|
76
|
+
return new Promise((resolve) => {
|
|
77
|
+
const child = (0, child_process_1.spawn)('vercel', ['login'], { stdio: 'inherit' });
|
|
78
|
+
child.on('close', (code) => {
|
|
79
|
+
resolve(code === 0);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
74
83
|
async installGlobal() {
|
|
75
84
|
try {
|
|
76
85
|
await exec('npm install -g vercel');
|