zerostart-cli 0.0.24 → 0.0.25

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.24');
86
+ .version('0.0.25');
87
87
  program
88
88
  .command('deploy-vercel')
89
89
  .description('Deploy the current project to Vercel')
@@ -229,10 +229,12 @@ program
229
229
  const defaultName = path.basename(cwd);
230
230
  let siteName = defaultName;
231
231
  let siteCreated = false;
232
+ let activeSiteId = undefined;
232
233
  while (!siteCreated) {
233
234
  const result = await netlifyManager.createSite(siteName, cwd);
234
235
  if (result.success) {
235
236
  siteCreated = true;
237
+ activeSiteId = result.siteId;
236
238
  }
237
239
  else if (result.reason === 'taken') {
238
240
  console.log(chalk_1.default.yellow(`\n The site name "${siteName}" is already taken.`));
@@ -277,7 +279,7 @@ program
277
279
  }
278
280
  const dSpinner = (0, ora_1.default)('Deploying to Netlify...').start();
279
281
  dSpinner.stop();
280
- const success = await netlifyManager.deploy(cwd);
282
+ const success = await netlifyManager.deploy(cwd, activeSiteId);
281
283
  if (success) {
282
284
  console.log();
283
285
  console.log(chalk_1.default.green(' ✔ Deployed to Netlify!'));
@@ -661,10 +663,12 @@ program
661
663
  // We do this interactively so if name is taken user can see error and handle it (or it just links if they own it)
662
664
  let siteName = config.name;
663
665
  let siteCreated = false;
666
+ let activeSiteId = undefined;
664
667
  while (!siteCreated) {
665
668
  const result = await netlifyManager.createSite(siteName, config.path);
666
669
  if (result.success) {
667
670
  siteCreated = true;
671
+ activeSiteId = result.siteId;
668
672
  }
669
673
  else if (result.reason === 'taken') {
670
674
  console.log(chalk_1.default.yellow(`\n The site name "${siteName}" is already taken.`));
@@ -709,7 +713,7 @@ program
709
713
  siteName = retryName;
710
714
  }
711
715
  }
712
- const success = await netlifyManager.deploy(config.path);
716
+ const success = await netlifyManager.deploy(config.path, activeSiteId);
713
717
  if (success) {
714
718
  console.log();
715
719
  console.log(chalk_1.default.green(' ✔ Deployed to Netlify!'));
@@ -65,29 +65,30 @@ class NetlifyManager {
65
65
  async createSite(name, cwd) {
66
66
  try {
67
67
  console.log(chalk_1.default.cyan(` Creating Netlify site "${name}"...`));
68
- // We need to capture output to detect "already exists" error
69
- // sites:create fails if name is taken.
70
68
  return new Promise((resolve) => {
71
69
  const child = (0, child_process_1.spawn)('netlify', ['sites:create', '--name', name], {
72
70
  cwd,
73
- stdio: ['inherit', 'pipe', 'pipe'] // Pipe stdout/stderr to capture
71
+ stdio: ['inherit', 'pipe', 'pipe']
74
72
  });
75
73
  let output = '';
76
74
  child.stdout?.on('data', (data) => {
77
- output += data.toString();
78
- process.stdout.write(data); // Passthrough
75
+ const str = data.toString();
76
+ output += str;
77
+ process.stdout.write(data);
79
78
  });
80
79
  child.stderr?.on('data', (data) => {
81
80
  output += data.toString();
82
- process.stderr.write(data); // Passthrough
81
+ process.stderr.write(data);
83
82
  });
84
83
  child.on('close', (code) => {
85
84
  if (code === 0) {
86
- resolve({ success: true });
85
+ // Extract Site ID/Project ID
86
+ // Format: "Site ID: 022..." or "Project ID: 022..."
87
+ const idMatch = output.match(/(?:Site|Project)\s+ID:\s+([a-zA-Z0-9-]+)/i);
88
+ const siteId = idMatch ? idMatch[1] : undefined;
89
+ resolve({ success: true, siteId });
87
90
  }
88
91
  else {
89
- // Check for common "name taken" indicators in Netlify CLI output
90
- // "Already exists" or "name is already taken"
91
92
  if (output.toLowerCase().includes('already exists') || output.toLowerCase().includes('taken')) {
92
93
  resolve({ success: false, reason: 'taken' });
93
94
  }
@@ -103,10 +104,13 @@ class NetlifyManager {
103
104
  return { success: false, reason: 'error' };
104
105
  }
105
106
  }
106
- async deploy(cwd) {
107
+ async deploy(cwd, siteId) {
107
108
  return new Promise((resolve) => {
108
- // Use spawn with stdio: 'inherit' to allow interactive site creation
109
- const child = (0, child_process_1.spawn)('netlify', ['deploy', '--prod'], {
109
+ const args = ['deploy', '--prod'];
110
+ if (siteId) {
111
+ args.push('--site', siteId);
112
+ }
113
+ const child = (0, child_process_1.spawn)('netlify', args, {
110
114
  cwd,
111
115
  stdio: 'inherit'
112
116
  });
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.24",
8
+ "version": "0.0.25",
9
9
  "engines": {
10
10
  "vscode": "^1.85.0"
11
11
  },