zerostart-cli 0.0.21 → 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 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.21');
86
+ .version('0.0.22');
87
87
  program
88
88
  .command('deploy-vercel')
89
89
  .description('Deploy the current project to Vercel')
@@ -522,7 +522,7 @@ program
522
522
  vSpinner.succeed(chalk_1.default.green('Authenticated with Vercel'));
523
523
  }
524
524
  const dSpinner = (0, ora_1.default)('Deploying to Vercel...').start();
525
- const deploymentUrl = await vercelManager.deploy(config.path);
525
+ const deploymentUrl = await vercelManager.deploy(config.path, config.name);
526
526
  if (deploymentUrl) {
527
527
  dSpinner.succeed(chalk_1.default.green('Deployed to Vercel!'));
528
528
  console.log(chalk_1.default.gray(' URL: ') + chalk_1.default.cyan(deploymentUrl));
@@ -592,6 +592,11 @@ program
592
592
  }
593
593
  const dSpinner = (0, ora_1.default)('Deploying to Netlify...').start();
594
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);
595
600
  const success = await netlifyManager.deploy(config.path);
596
601
  if (success) {
597
602
  console.log();
@@ -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,6 +62,25 @@ class NetlifyManager {
58
62
  return false;
59
63
  }
60
64
  }
65
+ async createSite(name, cwd) {
66
+ try {
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
+ });
78
+ }
79
+ catch (error) {
80
+ console.error('Failed to create Netlify site:', error);
81
+ return false;
82
+ }
83
+ }
61
84
  async deploy(cwd) {
62
85
  return new Promise((resolve) => {
63
86
  // Use spawn with stdio: 'inherit' to allow interactive site creation
@@ -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
- // --yes to skip confirmation
55
- // --prod to deploy to production
56
- const { stdout } = await exec('vercel deploy --prod --yes', { cwd });
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) {
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.21",
8
+ "version": "0.0.22",
9
9
  "engines": {
10
10
  "vscode": "^1.85.0"
11
11
  },