create-contentisland 0.1.4 → 0.2.0

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.
Files changed (2) hide show
  1. package/dist/index.js +334 -300
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { cac as ae } from "cac";
2
- import S from "prompts";
3
- import c from "node:fs/promises";
4
- import l from "node:path";
5
- import z from "node:child_process";
6
- import { existsSync as h } from "node:fs";
7
- import { createClient as oe } from "@content-island/api-client";
8
- const x = ".content-island", G = "config.json", L = ".gitignore", B = ".env", O = {
1
+ import { cac as le } from "cac";
2
+ import y from "prompts";
3
+ import l from "node:fs/promises";
4
+ import c from "node:path";
5
+ import V from "node:child_process";
6
+ import { existsSync as k } from "node:fs";
7
+ import { createClient as ge } from "@content-island/api-client";
8
+ const P = ".content-island", U = "config.json", O = ".gitignore", A = ".env", M = {
9
9
  aa: "Afaraf",
10
10
  ab: "Аҧсуа",
11
11
  ae: "Avesta",
@@ -198,17 +198,17 @@ const x = ".content-island", G = "config.json", L = ".gitignore", B = ".env", O
198
198
  bold: "\x1B[1m",
199
199
  cyan: "\x1B[36m",
200
200
  magenta: "\x1B[35m"
201
- }, C = (e) => {
201
+ }, E = (e) => {
202
202
  let t = "";
203
203
  return e?.bold && (t += p.bold), t;
204
204
  }, g = {
205
- green: (e, t) => `${p.green}${C(t)}${e}${p.reset}`,
206
- red: (e, t) => `${p.red}${C(t)}${e}${p.reset}`,
207
- yellow: (e, t) => `${p.yellow}${C(t)}${e}${p.reset}`,
205
+ green: (e, t) => `${p.green}${E(t)}${e}${p.reset}`,
206
+ red: (e, t) => `${p.red}${E(t)}${e}${p.reset}`,
207
+ yellow: (e, t) => `${p.yellow}${E(t)}${e}${p.reset}`,
208
208
  bold: (e) => `${p.bold}${e}${p.reset}`,
209
- cyan: (e, t) => `${p.cyan}${C(t)}${e}${p.reset}`,
210
- magenta: (e, t) => `${p.magenta}${C(t)}${e}${p.reset}`
211
- }, o = {
209
+ cyan: (e, t) => `${p.cyan}${E(t)}${e}${p.reset}`,
210
+ magenta: (e, t) => `${p.magenta}${E(t)}${e}${p.reset}`
211
+ }, a = {
212
212
  info: (e) => console.log(g.cyan("ℹ️ " + e)),
213
213
  success: (e) => console.log(g.green("✅ " + e)),
214
214
  warning: (e) => console.log(g.yellow("⚠️ " + e)),
@@ -233,51 +233,51 @@ const x = ".content-island", G = "config.json", L = ".gitignore", B = ".env", O
233
233
  updating: (e) => console.log(g.green("🔄 " + e)),
234
234
  run: (e) => console.log(g.green("🚀 " + e)),
235
235
  command: (e) => console.log(" " + g.magenta(e, { bold: !0 }))
236
- }, j = () => l.join(process.cwd(), x), se = async () => {
237
- const e = process.cwd(), t = l.join(e, L), n = `${x}/`;
238
- let a = "";
239
- h(t) && (a = await c.readFile(t, "utf-8"), a.includes(n)) || (a = a + `${a.endsWith(`
236
+ }, x = () => c.join(process.cwd(), P), de = async () => {
237
+ const e = process.cwd(), t = c.join(e, O), n = `${P}/`;
238
+ let o = "";
239
+ k(t) && (o = await l.readFile(t, "utf-8"), o.includes(n)) || (o = o + `${o.endsWith(`
240
240
  `) ? "" : `
241
241
  `}${n}
242
- `, await c.writeFile(t, a, "utf-8"), o.saved(`Added ${n} to ${L}`));
243
- }, ie = async () => {
244
- const e = j();
242
+ `, await l.writeFile(t, o, "utf-8"), a.saved(`Added ${n} to ${O}`));
243
+ }, ue = async () => {
244
+ const e = x();
245
245
  try {
246
- h(e) || (await c.mkdir(e, { recursive: !0 }), o.created(`Created: ${x}/`)), await se();
246
+ k(e) || (await l.mkdir(e, { recursive: !0 }), a.created(`Created: ${P}/`)), await de();
247
247
  } catch (t) {
248
- o.error(`Failed to create config directory: ${t.message}`);
248
+ a.error(`Failed to create config directory: ${t.message}`);
249
249
  }
250
- }, K = async () => l.join(j(), G), F = async () => {
251
- const e = await K();
252
- if (!h(e))
250
+ }, q = async () => c.join(x(), U), F = async () => {
251
+ const e = await q();
252
+ if (!k(e))
253
253
  return null;
254
254
  try {
255
- const t = await c.readFile(e, "utf-8");
255
+ const t = await l.readFile(e, "utf-8");
256
256
  return JSON.parse(t);
257
257
  } catch (t) {
258
- return o.warning(`Could not parse ${G}: ${t.message}`), null;
258
+ return a.warning(`Could not parse ${U}: ${t.message}`), null;
259
259
  }
260
- }, E = async (e) => {
260
+ }, v = async (e) => {
261
261
  let t = {
262
262
  ...e
263
263
  };
264
- await ie();
265
- const n = await K();
266
- if (h(n)) {
267
- const a = await F();
268
- a && (t = { ...a, ...e });
264
+ await ue();
265
+ const n = await q();
266
+ if (k(n)) {
267
+ const o = await F();
268
+ o && (t = { ...o, ...e });
269
269
  }
270
270
  try {
271
- const a = JSON.stringify(t, null, 2);
272
- await c.writeFile(n, a, "utf-8"), o.saved(`Saved configuration to ${n}`);
273
- } catch (a) {
274
- o.error(`Failed to save configuration: ${a.message}`);
271
+ const o = JSON.stringify(t, null, 2);
272
+ await l.writeFile(n, o, "utf-8"), a.saved(`Saved configuration to ${n}`);
273
+ } catch (o) {
274
+ a.error(`Failed to save configuration: ${o.message}`);
275
275
  }
276
- }, re = (e, t, n, a) => {
277
- let s = 0, i = t, r = !1, f = "", u = !1;
278
- const y = ['"', "'", "`"].includes(n);
279
- for (let m = t; m < e.length; m++) {
280
- const d = e[m];
276
+ }, pe = (e, t, n, o) => {
277
+ let s = 0, i = t, r = !1, m = "", u = !1;
278
+ const S = ['"', "'", "`"].includes(n);
279
+ for (let f = t; f < e.length; f++) {
280
+ const d = e[f];
281
281
  if (u) {
282
282
  u = !1;
283
283
  continue;
@@ -286,299 +286,332 @@ const x = ".content-island", G = "config.json", L = ".gitignore", B = ".env", O
286
286
  u = !0;
287
287
  continue;
288
288
  }
289
- if (y) {
289
+ if (S) {
290
290
  if (d === n && !r) {
291
291
  if (s++, s === 1)
292
292
  continue;
293
293
  if (s === 2) {
294
- i = m + 1;
294
+ i = f + 1;
295
295
  break;
296
296
  }
297
297
  }
298
298
  } else if (!r && (d === '"' || d === "'" || d === "`"))
299
- r = !0, f = d;
300
- else if (r && d === f)
299
+ r = !0, m = d;
300
+ else if (r && d === m)
301
301
  r = !1;
302
302
  else if (!r) {
303
303
  if (d === n)
304
304
  s++;
305
- else if (d === a && (s--, s === 0)) {
306
- i = m + 1;
305
+ else if (d === o && (s--, s === 0)) {
306
+ i = f + 1;
307
307
  break;
308
308
  }
309
309
  }
310
310
  }
311
311
  return i;
312
- }, I = async (e) => {
313
- const { filePath: t, property: n, startSymbol: a, endSymbol: s } = e, i = await c.readFile(t, "utf-8");
314
- let r = a;
315
- a === "[" && (r = "\\["), a === "{" && (r = "\\{"), a === "(" && (r = "\\(");
316
- const f = new RegExp(`${n}\\s*:\\s*(${r})`), u = i.match(f);
312
+ }, T = async (e) => {
313
+ const { filePath: t, property: n, startSymbol: o, endSymbol: s } = e, i = await l.readFile(t, "utf-8");
314
+ let r = o;
315
+ o === "[" && (r = "\\["), o === "{" && (r = "\\{"), o === "(" && (r = "\\(");
316
+ const m = new RegExp(`${n}\\s*:\\s*(${r})`), u = i.match(m);
317
317
  if (!u)
318
318
  return null;
319
- const y = i.indexOf(u[0]) + u[0].length - 1, m = re(i, y, a, s);
320
- return i.substring(y, m);
321
- }, ce = (e) => JSON.parse(
319
+ const S = i.indexOf(u[0]) + u[0].length - 1, f = pe(i, S, o, s);
320
+ return i.substring(S, f);
321
+ }, me = (e) => JSON.parse(
322
322
  e.replace(/'/g, '"').replace(/(\w+):/g, '"$1":').replace(/,\s*}/g, "}").replace(/,\s*]/g, "]")
323
- ), q = (e) => e.replace(/"/g, "'").replace(/'(\w+)':/g, "$1:"), le = async (e, t, n, a) => {
324
- let s = await I(n);
325
- if (s || (s = await I(a)), !s)
323
+ ), Y = (e) => e.replace(/"/g, "'").replace(/'(\w+)':/g, "$1:"), fe = async (e, t, n, o) => {
324
+ let s = await T(n);
325
+ if (s || (s = await T(o)), !s)
326
326
  throw new Error(
327
- `Could not find property '${n.property}' or fallback property '${a.property}' in file ${n.filePath}`
327
+ `Could not find property '${n.property}' or fallback property '${o.property}' in file ${n.filePath}`
328
328
  );
329
- const i = q(JSON.stringify(t, null, 2));
330
- return (await c.readFile(n.filePath, "utf-8")).replace(s, (f) => `${f},
329
+ const i = Y(JSON.stringify(t, null, 2));
330
+ return (await l.readFile(n.filePath, "utf-8")).replace(s, (m) => `${m},
331
331
  ${e}: ${i}`);
332
- }, ge = ".git", de = (e, t) => {
333
- const n = z.spawn("git", ["clone", "--depth=1", e, t], { stdio: "inherit" });
334
- return new Promise((a, s) => {
332
+ }, we = ".git", W = (e, t) => {
333
+ const n = V.spawn("git", ["clone", "--depth=1", e, t], { stdio: "inherit" });
334
+ return new Promise((o, s) => {
335
335
  n.on("close", (i) => {
336
- c.rm(l.join(t, ge), { recursive: !0, force: !0 }).finally(() => {
337
- i === 0 ? a() : s(new Error("Failed to clone repository. Please make sure the target folder is empty and try again."));
336
+ l.rm(c.join(t, we), { recursive: !0, force: !0 }).finally(() => {
337
+ i === 0 ? o() : s(new Error("Failed to clone repository. Please make sure the target folder is empty and try again."));
338
338
  });
339
339
  });
340
340
  });
341
- }, ue = (e) => {
342
- const t = z.spawn("npm", ["install"], {
341
+ }, H = (e) => {
342
+ const t = V.spawn("npm install", {
343
343
  cwd: e,
344
- stdio: "inherit"
344
+ stdio: "inherit",
345
+ shell: !0
345
346
  });
346
- return new Promise((n) => {
347
- t.on("close", (a) => {
348
- a === 0 || o.error("Failed to install dependencies. Please try running 'npm install' manually."), n();
347
+ return new Promise((n, o) => {
348
+ t.on("error", (s) => {
349
+ a.error(`Failed to install dependencies: ${s.message}`), a.error("Please try running 'npm install' manually."), o(s);
350
+ }), t.on("close", (s) => {
351
+ s === 0 || a.error("Failed to install dependencies. Please try running 'npm install' manually."), n();
349
352
  });
350
353
  });
351
- }, pe = "https://github.com/content-island/template-personal-static-site.git", fe = "create-dev-env.js", U = ".env-sample", me = async (e) => {
352
- const t = l.join(e, "package.json"), n = await c.readFile(t, "utf-8"), a = JSON.parse(n);
353
- if (a.scripts) {
354
- const { predev: s, ...i } = a.scripts;
355
- a.scripts = i;
354
+ }, Z = async (e) => {
355
+ const t = c.join(e, "package.json"), n = await l.readFile(t, "utf-8"), o = JSON.parse(n);
356
+ if (o.scripts) {
357
+ const { predev: s, ...i } = o.scripts;
358
+ o.scripts = i;
356
359
  }
357
- await c.writeFile(t, JSON.stringify(a, null, 2), "utf-8");
358
- }, we = async (e) => {
359
- const t = 'CONTENT_ISLAND_ACCESS_TOKEN=YOUR_TOKEN_HERE # You can find the access token in your project’s "General tab" (https://docs.contentisland.net/ui/project/general/)', n = l.join(e, U);
360
- await c.writeFile(n, t, "utf-8");
361
- };
360
+ await l.writeFile(t, JSON.stringify(o, null, 2), "utf-8");
361
+ }, X = async (e, t) => {
362
+ const n = 'CONTENT_ISLAND_ACCESS_TOKEN=YOUR_TOKEN_HERE # You can find the access token in your project’s "General tab" (https://docs.contentisland.net/ui/project/general/)', o = c.join(e, t);
363
+ await l.writeFile(o, n, "utf-8");
364
+ }, he = "https://github.com/content-island/template-minimal-astro.git", ye = "create-dev-env.js", D = ".env-sample";
362
365
  let w = process.cwd();
363
- const he = () => ({
366
+ const ke = () => ({
367
+ id: "minimal-astro",
368
+ hasToSaveConfig: !1,
369
+ getEnvFilePath: () => c.join(w, A),
370
+ onInit: async () => {
371
+ const { projectPath: e } = await y({
372
+ type: "text",
373
+ name: "projectPath",
374
+ message: "Where should we create your new minimal astro site project?",
375
+ initial: "./"
376
+ });
377
+ e && (w = c.join(process.cwd(), e), a.loading("Cloning Minimal Astro template repository..."), await W(he, w), a.success("Minimal Astro template repository cloned."));
378
+ const { installDeps: t } = await y({
379
+ type: "confirm",
380
+ name: "installDeps",
381
+ message: "Do you want to install the dependencies now?",
382
+ initial: !0
383
+ });
384
+ t && (a.loading("Installing dependencies..."), await H(w), a.success("Dependencies installed."));
385
+ },
386
+ syncProject: async () => {
387
+ a.info("Syncing Minimal Astro project..."), await l.unlink(c.join(w, ye)), await l.unlink(c.join(w, D)), await X(w, D), await Z(w), a.success("Minimal Astro project synchronized.");
388
+ },
389
+ onFinish: async () => {
390
+ a.run("Now you can start your project by running:"), a.newLine();
391
+ const e = c.relative(process.cwd(), w);
392
+ e && a.command(`cd ${e}`), a.command("npm run dev"), a.newLine();
393
+ }
394
+ }), Se = "https://github.com/content-island/template-personal-static-site.git", Ce = "create-dev-env.js", R = ".env-sample";
395
+ let h = process.cwd();
396
+ const Ee = () => ({
364
397
  id: "personal-static-site",
365
398
  hasToSaveConfig: !1,
366
- getEnvFilePath: () => l.join(w, B),
399
+ getEnvFilePath: () => c.join(h, A),
367
400
  onInit: async () => {
368
- const { projectPath: e } = await S({
401
+ const { projectPath: e } = await y({
369
402
  type: "text",
370
403
  name: "projectPath",
371
404
  message: "Where should we create your new personal static site project?",
372
405
  initial: "./"
373
406
  });
374
- e && (w = l.join(process.cwd(), e), o.loading("Cloning Personal Static Site template repository..."), await de(pe, w), o.success("Personal Static Site template repository cloned."));
375
- const { installDeps: t } = await S({
407
+ e && (h = c.join(process.cwd(), e), a.loading("Cloning Personal Static Site template repository..."), await W(Se, h), a.success("Personal Static Site template repository cloned."));
408
+ const { installDeps: t } = await y({
376
409
  type: "confirm",
377
410
  name: "installDeps",
378
411
  message: "Do you want to install the dependencies now?",
379
412
  initial: !0
380
413
  });
381
- t && (o.loading("Installing dependencies..."), await ue(w), o.success("Dependencies installed."));
414
+ t && (a.loading("Installing dependencies..."), await H(h), a.success("Dependencies installed."));
382
415
  },
383
416
  syncProject: async () => {
384
- o.info("Syncing Personal Static Site project..."), await c.unlink(l.join(w, fe)), await c.unlink(l.join(w, U)), await we(w), await me(w), o.success("Personal Static Site project synced.");
417
+ a.info("Syncing Personal Static Site project..."), await l.unlink(c.join(h, Ce)), await l.unlink(c.join(h, R)), await X(h, R), await Z(h), a.success("Personal Static Site project synchronized.");
385
418
  },
386
419
  onFinish: async () => {
387
- o.run("Now you can start your project by running:"), o.newLine();
388
- const e = l.relative(process.cwd(), w);
389
- e && o.command(`cd ${e}`), o.command("npm run dev"), o.newLine();
420
+ a.run("Now you can start your project by running:"), a.newLine();
421
+ const e = c.relative(process.cwd(), h);
422
+ e && a.command(`cd ${e}`), a.command("npm run dev"), a.newLine();
390
423
  }
391
- }), T = (e, t) => Array.isArray(e) ? e.map(t) : [], ye = (e, t) => ({
424
+ }), $ = (e, t) => Array.isArray(e) ? e.map(t) : [], ve = (e, t) => ({
392
425
  id: e.id,
393
426
  language: e.language,
394
427
  name: e.name,
395
428
  label: e.label,
396
- pages: T(e.pages, (n) => t.find((a) => a.id === n))
397
- }), ke = (e, t) => ({
429
+ pages: $(e.pages, (n) => t.find((o) => o.id === n))
430
+ }), be = (e, t) => ({
398
431
  id: e.id,
399
432
  language: e.language,
400
433
  index: e.index,
401
- folders: T(e.folders, (n) => ye(n, t))
434
+ folders: $(e.folders, (n) => ve(n, t))
402
435
  });
403
- let $ = null;
404
- const Se = (e) => {
405
- $ = oe({ accessToken: e });
406
- }, P = () => {
407
- if (!$)
436
+ let j = null;
437
+ const Ie = (e) => {
438
+ j = ge({ accessToken: e });
439
+ }, N = () => {
440
+ if (!j)
408
441
  throw new Error("API client not initialized. Call initializeClient first.");
409
- return $;
410
- }, Ce = async () => await P().getProject(), _ = async (e) => {
411
- const t = P(), n = await t.getContent({
442
+ return j;
443
+ }, Te = async () => await N().getProject(), z = async (e) => {
444
+ const t = N(), n = await t.getContent({
412
445
  contentType: "Root",
413
446
  includeRelatedContent: !0,
414
447
  language: e
415
448
  });
416
449
  if (!n)
417
450
  throw new Error(`Root content not found for language: ${e}`);
418
- const a = n.folders?.flatMap((i) => i.pages) || [], s = await t.getContentList({
451
+ const o = n.folders?.flatMap((i) => i.pages) || [], s = await t.getContentList({
419
452
  contentType: "Page",
420
453
  id: {
421
- in: a
454
+ in: o
422
455
  },
423
456
  language: e
424
457
  });
425
458
  if (!s)
426
- throw new Error(`Pages not found for IDs: ${a.join(", ")}`);
427
- return ke(n, s);
428
- }, Ee = async () => {
459
+ throw new Error(`Pages not found for IDs: ${o.join(", ")}`);
460
+ return be(n, s);
461
+ }, $e = async () => {
429
462
  try {
430
- return await P().getContent({
463
+ return await N().getContent({
431
464
  contentType: "Meta"
432
465
  });
433
466
  } catch (e) {
434
- e.message.includes("401") ? o.error(
467
+ e.message.includes("401") ? a.error(
435
468
  "The Content Island API token is missing or malformed. Verify that you've copied the complete token and that you have sufficient permissions."
436
- ) : o.error("The requested template is not of type StarLight, so the meta field could not be found."), process.exit(1);
469
+ ) : a.error("The requested template is not of type StarLight, so the meta field could not be found."), process.exit(1);
437
470
  }
438
- }, V = "astro.config.mjs", A = () => l.join(process.cwd(), "src", "content", "docs"), N = () => l.join(process.cwd(), V), be = () => {
439
- const e = [], t = N();
440
- h(t) || e.push(V);
441
- const n = A();
442
- return h(n) || e.push("src/content/docs directory"), {
471
+ }, Q = "astro.config.mjs", L = () => c.join(process.cwd(), "src", "content", "docs"), _ = () => c.join(process.cwd(), Q), je = () => {
472
+ const e = [], t = _();
473
+ k(t) || e.push(Q);
474
+ const n = L();
475
+ return k(n) || e.push("src/content/docs directory"), {
443
476
  valid: e.length === 0,
444
477
  missingItems: e
445
478
  };
446
- }, ve = async () => {
447
- const e = A();
448
- if (!h(e)) {
449
- o.info("Content docs directory not found, creating it..."), await c.mkdir(e, { recursive: !0 });
479
+ }, Pe = async () => {
480
+ const e = L();
481
+ if (!k(e)) {
482
+ a.info("Content docs directory not found, creating it..."), await l.mkdir(e, { recursive: !0 });
450
483
  return;
451
484
  }
452
- const t = await c.readdir(e);
485
+ const t = await l.readdir(e);
453
486
  for (const n of t) {
454
- const a = l.join(e, n);
455
- await c.rm(a, { recursive: !0, force: !0 });
487
+ const o = c.join(e, n);
488
+ await l.rm(o, { recursive: !0, force: !0 });
456
489
  }
457
- }, k = {
490
+ }, C = {
458
491
  sidebar: { start: "[", end: "]" },
459
492
  locales: { start: "{", end: "}" },
460
493
  title: { start: "'", end: "'" }
461
- }, Y = (e, t) => {
462
- const n = [], a = [];
494
+ }, ee = (e, t) => {
495
+ const n = [], o = [];
463
496
  for (const s of t) {
464
497
  const i = e.findIndex((r) => r.label === s.label);
465
498
  if (i >= 0) {
466
- const r = s.items && e[i].items ? Y(e[i].items || [], s.items) : s.items;
499
+ const r = s.items && e[i].items ? ee(e[i].items || [], s.items) : s.items;
467
500
  n[i] = {
468
501
  ...e[i],
469
502
  ...s,
470
503
  items: r
471
504
  };
472
505
  } else
473
- a.push(s);
506
+ o.push(s);
474
507
  }
475
- return n.push(...a), n.sort((s, i) => {
476
- const r = t.findIndex((u) => u.label === s.label), f = t.findIndex((u) => u.label === i.label);
477
- return r - f;
508
+ return n.push(...o), n.sort((s, i) => {
509
+ const r = t.findIndex((u) => u.label === s.label), m = t.findIndex((u) => u.label === i.label);
510
+ return r - m;
478
511
  });
479
- }, Ie = (e, t) => {
512
+ }, Ae = (e, t) => {
480
513
  const n = {
481
- root: { lang: e, label: O[e] }
514
+ root: { lang: e, label: M[e] }
482
515
  };
483
516
  return Array.isArray(t) ? t.reduce(
484
- (a, s) => ({
485
- ...a,
486
- [s]: { lang: s, label: O[s] }
517
+ (o, s) => ({
518
+ ...o,
519
+ [s]: { lang: s, label: M[s] }
487
520
  }),
488
521
  n
489
522
  ) : n;
490
- }, D = async (e, t, n) => {
491
- const a = N(), s = await I({
492
- filePath: a,
523
+ }, J = async (e, t, n) => {
524
+ const o = _(), s = await T({
525
+ filePath: o,
493
526
  property: t,
494
- startSymbol: k[t]?.start,
495
- endSymbol: k[t]?.end
527
+ startSymbol: C[t]?.start,
528
+ endSymbol: C[t]?.end
496
529
  });
497
530
  let i;
498
531
  if (s) {
499
- const r = q(JSON.stringify(e, null, 2));
500
- i = (await c.readFile(a, "utf-8")).replace(s, r);
532
+ const r = Y(JSON.stringify(e, null, 2));
533
+ i = (await l.readFile(o, "utf-8")).replace(s, r);
501
534
  } else
502
- i = await le(
535
+ i = await fe(
503
536
  t,
504
537
  e,
505
538
  {
506
- filePath: a,
539
+ filePath: o,
507
540
  property: n,
508
- startSymbol: k[n]?.start,
509
- endSymbol: k[n]?.end
541
+ startSymbol: C[n]?.start,
542
+ endSymbol: C[n]?.end
510
543
  },
511
544
  {
512
- filePath: a,
545
+ filePath: o,
513
546
  property: "title",
514
- startSymbol: k.title.start,
515
- endSymbol: k.title.end
547
+ startSymbol: C.title.start,
548
+ endSymbol: C.title.end
516
549
  }
517
550
  );
518
- await c.writeFile(a, i, "utf-8");
519
- }, Te = async (e, t, n) => {
551
+ await l.writeFile(o, i, "utf-8");
552
+ }, xe = async (e, t, n) => {
520
553
  try {
521
- let a = await I({
522
- filePath: N(),
554
+ let o = await T({
555
+ filePath: _(),
523
556
  property: "sidebar",
524
- startSymbol: k.sidebar.start,
525
- endSymbol: k.sidebar.end
557
+ startSymbol: C.sidebar.start,
558
+ endSymbol: C.sidebar.end
526
559
  }), s = [];
527
560
  try {
528
- s = a ? ce(a) : null;
561
+ s = o ? me(o) : null;
529
562
  } catch {
530
- o.warning("Could not parse existing sidebar in astro.config.mjs. A new sidebar will be created."), s = [];
563
+ a.warning("Could not parse existing sidebar in astro.config.mjs. A new sidebar will be created."), s = [];
531
564
  }
532
- s || (o.warning("No existing sidebar found in astro.config.mjs. A new sidebar will be created."), s = []);
533
- const i = Y(s, e);
534
- await D(i, "sidebar", "locales");
535
- const r = Ie(t, n);
536
- await D(r, "locales", "sidebar");
537
- } catch (a) {
538
- o.error(`Error reading astro.config.mjs: ${a.message}`), process.exit(1);
565
+ s || (a.warning("No existing sidebar found in astro.config.mjs. A new sidebar will be created."), s = []);
566
+ const i = ee(s, e);
567
+ await J(i, "sidebar", "locales");
568
+ const r = Ae(t, n);
569
+ await J(r, "locales", "sidebar");
570
+ } catch (o) {
571
+ a.error(`Error reading astro.config.mjs: ${o.message}`), process.exit(1);
539
572
  }
540
- }, $e = (e) => /^---\s*\n([\s\S]*?)\n---\s*\n/.test(e), xe = (e) => l.parse(e).name.replace(/[-_]/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").filter((a) => a.length > 0).map((a) => a.charAt(0).toUpperCase() + a.slice(1).toLowerCase()).join(" ");
541
- function je(e, t, n) {
542
- if ($e(e))
573
+ }, Fe = (e) => /^---\s*\n([\s\S]*?)\n---\s*\n/.test(e), Ne = (e) => c.parse(e).name.replace(/[-_]/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").filter((o) => o.length > 0).map((o) => o.charAt(0).toUpperCase() + o.slice(1).toLowerCase()).join(" ");
574
+ function Le(e, t, n) {
575
+ if (Fe(e))
543
576
  return e;
544
- const a = xe(t), s = `---
545
- title: "${a}"
577
+ const o = Ne(t), s = `---
578
+ title: "${o}"
546
579
  ---
547
580
 
548
581
  `;
549
- return o.warning(`Missing frontmatter in ${n}`), o.info(`Added default title: "${a}"`), o.warning("Please update the content in Content Island 🏝️ to include proper frontmatter"), o.newLine(), s + e;
582
+ return a.warning(`Missing frontmatter in ${n}`), a.info(`Added default title: "${o}"`), a.warning("Please update the content in Content Island 🏝️ to include proper frontmatter"), a.newLine(), s + e;
550
583
  }
551
- const v = async (e, t) => {
552
- const n = A(), a = l.join(n, e), s = je(t, e, l.relative(process.cwd(), a)), i = l.dirname(a);
553
- h(i) || await c.mkdir(i, { recursive: !0 }), await c.writeFile(a, s, "utf-8");
554
- }, Fe = async (e, t) => {
584
+ const I = async (e, t) => {
585
+ const n = L(), o = c.join(n, e), s = Le(t, e, c.relative(process.cwd(), o)), i = c.dirname(o);
586
+ k(i) || await l.mkdir(i, { recursive: !0 }), await l.writeFile(o, s, "utf-8");
587
+ }, _e = async (e, t) => {
555
588
  try {
556
- await v(e.index.filename, e.index.content);
589
+ await I(e.index.filename, e.index.content);
557
590
  for (const n of e.folders)
558
- for (const a of n.pages)
559
- await v(l.join(n.name, a.filename), a.content);
591
+ for (const o of n.pages)
592
+ await I(c.join(n.name, o.filename), o.content);
560
593
  for (const n of t) {
561
- await v(l.join(n.language, n.index.filename), n.index.content);
562
- for (const a of n.folders)
563
- for (const s of a.pages)
564
- await v(l.join(n.language, a.name, s.filename), s.content);
594
+ await I(c.join(n.language, n.index.filename), n.index.content);
595
+ for (const o of n.folders)
596
+ for (const s of o.pages)
597
+ await I(c.join(n.language, o.name, s.filename), s.content);
565
598
  }
566
599
  } catch (n) {
567
- o.error(`Error updating docs content: ${n.message}`), process.exit(1);
600
+ a.error(`Error updating docs content: ${n.message}`), process.exit(1);
568
601
  }
569
- }, Pe = async (e, t) => {
602
+ }, Oe = async (e, t) => {
570
603
  if (e.length === 1) {
571
604
  const s = e[0];
572
- return o.success(`Single language found: ${s}. Continuing...`), await E({ languageCode: s }), s;
605
+ return a.success(`Single language found: ${s}. Continuing...`), await v({ languageCode: s }), s;
573
606
  }
574
607
  const n = (await F())?.languageCode;
575
608
  if (n && !t) {
576
609
  if (e.includes(n))
577
- return o.info(`Using saved default language: ${n}`), n;
578
- o.warning(`Saved language '${n}' not found in project languages`), o.step("Will ask for new default language and save it");
610
+ return a.info(`Using saved default language: ${n}`), n;
611
+ a.warning(`Saved language '${n}' not found in project languages`), a.step("Will ask for new default language and save it");
579
612
  }
580
- o.step("Multiple languages found. Please select the default language:");
581
- const a = await S({
613
+ a.step("Multiple languages found. Please select the default language:");
614
+ const o = await y({
582
615
  type: "select",
583
616
  name: "language",
584
617
  message: "Select the default language:",
@@ -588,9 +621,9 @@ const v = async (e, t) => {
588
621
  })),
589
622
  initial: 0
590
623
  });
591
- return a.language || (o.error("Language selection is required to continue."), process.exit(1)), n !== a.language && (await E({ languageCode: a.language }), o.config(`Saving default language '${a.language}' to config`)), a.language;
592
- }, Ae = () => {
593
- o.detected(`
624
+ return o.language || (a.error("Language selection is required to continue."), process.exit(1)), n !== o.language && (await v({ languageCode: o.language }), a.config(`Saving default language '${o.language}' to config`)), o.language;
625
+ }, Me = () => {
626
+ a.detected(`
594
627
  ⭐ ✨ STARLIGHT PROJECT DETECTED ✨ ⭐
595
628
 
596
629
  ⭐ ✨ ⭐ ✨
@@ -600,184 +633,185 @@ const v = async (e, t) => {
600
633
  ⭐ ✨ ⭐ ✨ ⭐
601
634
  ✨ ⭐ ✨ ⭐ ✨
602
635
  ⭐ ✨ ⭐ ✨
603
- `), o.success("All good! Starlight ⭐ project detected successfully."), o.loading("Launching process..."), o.newLine();
604
- }, Ne = (e) => {
605
- o.newLine(), o.error("Starlight ⭐ project not found!"), o.newLine(), o.error("Missing required items:"), e.forEach((t) => {
606
- o.error(` • ${t}`);
607
- }), o.newLine(), o.error("Please make sure you are in the root directory of a Starlight ⭐ project."), o.warning("A Starlight ⭐ project should have:"), o.warning(" • astro.config.mjs file"), o.warning(" • src/content/docs directory"), o.newLine();
608
- }, W = (e) => {
636
+ `), a.success("All good! Starlight ⭐ project detected successfully."), a.loading("Launching process..."), a.newLine();
637
+ }, De = (e) => {
638
+ a.newLine(), a.error("Starlight ⭐ project not found!"), a.newLine(), a.error("Missing required items:"), e.forEach((t) => {
639
+ a.error(` • ${t}`);
640
+ }), a.newLine(), a.error("Please make sure you are in the root directory of a Starlight ⭐ project."), a.warning("A Starlight ⭐ project should have:"), a.warning(" • astro.config.mjs file"), a.warning(" • src/content/docs directory"), a.newLine();
641
+ }, te = (e) => {
609
642
  const t = e.reduce(
610
- (n, a) => ({ ...n, ...a }),
643
+ (n, o) => ({ ...n, ...o }),
611
644
  {}
612
645
  );
613
646
  return Object.keys(t).length > 0 ? t : void 0;
614
- }, H = (e) => e.filename.replace(/\.(mdx?|md)$/, ""), M = (e) => e.label ? e.label.trim() : H(e), Le = (e, t) => {
615
- const n = H(e), a = t.trim().toLowerCase();
616
- return n.toLocaleLowerCase() === "index" ? a : `${a}/${n}`;
617
- }, Oe = (e, t, n) => {
647
+ }, ne = (e) => e.filename.replace(/\.(mdx?|md)$/, ""), G = (e) => e.label ? e.label.trim() : ne(e), Re = (e, t) => {
648
+ const n = ne(e), o = t.trim().toLowerCase();
649
+ return n.toLocaleLowerCase() === "index" ? o : `${o}/${n}`;
650
+ }, ze = (e, t, n) => {
618
651
  e.filename.replace(/\.(mdx?|md)$/, "");
619
- const a = n.filter((s) => s.id === e.id).map((s) => ({ [s.language]: M(s) }));
652
+ const o = n.filter((s) => s.id === e.id).map((s) => ({ [s.language]: G(s) }));
620
653
  return {
621
- label: M(e),
622
- slug: Le(e, t),
623
- translations: W(a)
654
+ label: G(e),
655
+ slug: Re(e, t),
656
+ translations: te(o)
624
657
  };
625
- }, R = (e) => e.label ? e.label.trim() : e.name, _e = (e, t) => {
626
- const n = t.flatMap((i) => i.folders ?? []).filter((i) => i.id === e.id), a = n.flatMap((i) => i.pages ?? []).filter((i) => e.pages.some((r) => r.id === i.id)), s = n.map((i) => ({ [i.language]: R(i) }));
658
+ }, B = (e) => e.label ? e.label.trim() : e.name, Je = (e, t) => {
659
+ const n = t.flatMap((i) => i.folders ?? []).filter((i) => i.id === e.id), o = n.flatMap((i) => i.pages ?? []).filter((i) => e.pages.some((r) => r.id === i.id)), s = n.map((i) => ({ [i.language]: B(i) }));
627
660
  return {
628
- label: R(e),
629
- translations: W(s),
630
- items: T(e.pages, (i) => Oe(i, e.name, a))
661
+ label: B(e),
662
+ translations: te(s),
663
+ items: $(e.pages, (i) => ze(i, e.name, o))
631
664
  };
632
- }, De = (e, t) => T(e.folders, (n) => _e(n, t)), Me = () => ({
665
+ }, Ge = (e, t) => $(e.folders, (n) => Je(n, t)), Be = () => ({
633
666
  id: "starlight",
634
667
  hasToSaveConfig: !0,
635
- getEnvFilePath: () => l.join(j(), B),
668
+ getEnvFilePath: () => c.join(x(), A),
636
669
  onInit: async (e) => {
637
- o.step("Checking for Starlight ⭐ project...");
638
- const { valid: t, missingItems: n } = be();
639
- if (t || (Ne(n), process.exit(1)), Ae(), e.command === "init") {
640
- const a = l.join(process.cwd(), "package.json"), s = await c.readFile(a, "utf-8"), i = JSON.parse(s), r = i.scripts || {};
641
- i.scripts = { ...r, "content-update": "npm create contentisland@latest update" }, await c.writeFile(a, JSON.stringify(i, null, 2), "utf-8");
670
+ a.step("Checking for Starlight ⭐ project...");
671
+ const { valid: t, missingItems: n } = je();
672
+ if (t || (De(n), process.exit(1)), Me(), e.command === "init") {
673
+ const o = c.join(process.cwd(), "package.json"), s = await l.readFile(o, "utf-8"), i = JSON.parse(s), r = i.scripts || {};
674
+ i.scripts = { ...r, "content-update": "npm create contentisland@latest update" }, await l.writeFile(o, JSON.stringify(i, null, 2), "utf-8");
642
675
  }
643
676
  },
644
677
  syncProject: async (e) => {
645
678
  const { accessToken: t, askIfMultipleLanguages: n } = e;
646
- o.connecting("Initializing Content Island 🏝️ client..."), Se(t);
647
- const a = await Ee();
648
- o.success(`Connected to project using template: ${a.template} (version: ${a.version})`), a.template !== "starlight" && (o.warning(
679
+ a.connecting("Initializing Content Island 🏝️ client..."), Ie(t);
680
+ const o = await $e();
681
+ a.success(`Connected to project using template: ${o.template} (version: ${o.version})`), o.template !== "starlight" && (a.warning(
649
682
  "The project you are trying to sync is not using the Starlight ⭐ template. Please make sure you are using the correct template."
650
- ), process.exit(1)), await E({
651
- version: a.version
652
- }), o.fetching("Fetching project information from Content Island 🏝️ ...");
653
- const s = await Ce();
654
- o.success(`Project fetched: ${s.name}`);
683
+ ), process.exit(1)), await v({
684
+ version: o.version
685
+ }), a.fetching("Fetching project information from Content Island 🏝️ ...");
686
+ const s = await Te();
687
+ a.success(`Project fetched: ${s.name}`);
655
688
  const i = s.languages.map((d) => d);
656
- o.info(`Languages found (${i.length}): ${i.join(", ")}`);
657
- const r = await Pe(i, n);
658
- o.language(r);
659
- const f = i.filter((d) => d !== r), u = await _(r);
660
- let y = [];
661
- for (const d of f) {
662
- const ne = await _(d);
663
- y.push(ne);
689
+ a.info(`Languages found (${i.length}): ${i.join(", ")}`);
690
+ const r = await Oe(i, n);
691
+ a.language(r);
692
+ const m = i.filter((d) => d !== r), u = await z(r);
693
+ let S = [];
694
+ for (const d of m) {
695
+ const ce = await z(d);
696
+ S.push(ce);
664
697
  }
665
- o.clearing("Clearing existing docs content..."), await ve(), o.docs("Existing docs content cleared"), o.updating("Updating docs content with fetched data..."), await Fe(u, y), o.docs("Docs content updated"), o.config("Generating sidebar configuration...");
666
- const m = De(u, y);
667
- await Te(m, r, f), o.config("Sidebar configuration updated in astro.config.mjs");
698
+ a.clearing("Clearing existing docs content..."), await Pe(), a.docs("Existing docs content cleared"), a.updating("Updating docs content with fetched data..."), await _e(u, S), a.docs("Docs content updated"), a.config("Generating sidebar configuration...");
699
+ const f = Ge(u, S);
700
+ await xe(f, r, m), a.config("Sidebar configuration updated in astro.config.mjs");
668
701
  },
669
702
  onFinish: async () => {
670
- o.run("Now you can start your project by running:"), o.newLine(), o.command("npm run dev"), o.newLine();
703
+ a.run("Now you can start your project by running:"), a.newLine(), a.command("npm run dev"), a.newLine();
671
704
  }
672
- }), Z = {
673
- starlight: Me,
674
- "personal-static-site": he
675
- }, Re = (e) => {
676
- const t = Z[e];
705
+ }), ae = {
706
+ starlight: Be,
707
+ "personal-static-site": Ee,
708
+ "minimal-astro": ke
709
+ }, Ke = (e) => {
710
+ const t = ae[e];
677
711
  if (!t)
678
712
  throw new Error(`Template "${e}" not found`);
679
713
  return t();
680
- }, Je = () => Object.keys(Z), ze = async (e, t) => {
714
+ }, Ve = () => Object.keys(ae), Ue = async (e, t) => {
681
715
  let n;
682
- return n || (n = (await F())?.templateID), n && t && (o.info(`Existing template found: ${n}`), (await S({
716
+ return n || (n = (await F())?.templateID), n && t && (a.info(`Existing template found: ${n}`), (await y({
683
717
  type: "confirm",
684
718
  name: "useExisting",
685
719
  message: `An existing template (${n}) was found. Do you want to use it?`,
686
720
  initial: !0
687
- }))?.useExisting ? o.success(`Using existing template: ${n}`) : (n = null, o.step("Selecting new template..."))), n || (o.step("Please select a template:"), n = (await S({
721
+ }))?.useExisting ? a.success(`Using existing template: ${n}`) : (n = null, a.step("Selecting new template..."))), n || (a.step("Please select a template:"), n = (await y({
688
722
  type: "select",
689
723
  name: "templateID",
690
724
  message: "Select a template:",
691
725
  choices: e.map((s) => ({ title: s, value: s }))
692
- }))?.templateID), n || (o.error("Template is required to continue"), process.exit(1)), n;
693
- }, X = async (e) => {
726
+ }))?.templateID), n || (a.error("Template is required to continue"), process.exit(1)), n;
727
+ }, oe = async (e) => {
694
728
  try {
695
- const { selectedTemplateId: t, askIfExists: n } = e, a = Je();
696
- let s = a.find((i) => i === t);
697
- return s || (s = await ze(a, n)), o.detected(`Template selected: ${s}`), Re(s);
729
+ const { selectedTemplateId: t, askIfExists: n } = e, o = Ve();
730
+ let s = o.find((i) => i === t);
731
+ return s || (s = await Ue(o, n)), a.detected(`Template selected: ${s}`), Ke(s);
698
732
  } catch (t) {
699
- o.error(`Error configuring template: ${t.message}`), process.exit(1);
733
+ a.error(`Error configuring template: ${t.message}`), process.exit(1);
700
734
  }
701
- }, Q = "CONTENT_ISLAND_ACCESS_TOKEN", Ge = async (e) => {
702
- if (!h(e))
735
+ }, se = "CONTENT_ISLAND_ACCESS_TOKEN", qe = async (e) => {
736
+ if (!k(e))
703
737
  return null;
704
738
  try {
705
- const n = (await c.readFile(e, "utf-8")).match(new RegExp(`${Q}=(.+)`));
739
+ const n = (await l.readFile(e, "utf-8")).match(new RegExp(`${se}=(.+)`));
706
740
  return n ? n[1].trim() : null;
707
741
  } catch {
708
742
  return null;
709
743
  }
710
- }, ee = async (e, t) => {
744
+ }, ie = async (e, t) => {
711
745
  try {
712
- const n = `${Q}=${e}
713
- `, a = l.dirname(t);
714
- await c.mkdir(a, { recursive: !0 }), await c.writeFile(t, n, "utf-8"), o.token(`Access token saved to ${t}`);
746
+ const n = `${se}=${e}
747
+ `, o = c.dirname(t);
748
+ await l.mkdir(o, { recursive: !0 }), await l.writeFile(t, n, "utf-8"), a.token(`Access token saved to ${t}`);
715
749
  } catch (n) {
716
- o.error(`Failed to save the access token: ${n.message}`);
750
+ a.error(`Failed to save the access token: ${n.message}`);
717
751
  }
718
- }, J = (e) => {
719
- e || (o.error("Token is required to continue"), process.exit(1));
720
- }, Be = async (e, t) => {
721
- let n = e ? await Ge(e) : null;
722
- if (n && t && (o.info("Found existing Content Island 🏝️ token"), (await S({
752
+ }, K = (e) => {
753
+ e || (a.error("Token is required to continue"), process.exit(1));
754
+ }, Ye = async (e, t) => {
755
+ let n = e ? await qe(e) : null;
756
+ if (n && t && (a.info("Found existing Content Island 🏝️ token"), (await y({
723
757
  type: "confirm",
724
758
  name: "useExisting",
725
759
  message: "An existing token was found. Do you want to use it?",
726
760
  initial: !0
727
761
  }))?.useExisting || (n = null)), n)
728
- o.success("Using existing Content Island 🏝️ token");
762
+ a.success("Using existing Content Island 🏝️ token");
729
763
  else {
730
- t || o.warning("No existing token found");
731
- const a = await S({
764
+ t || a.warning("No existing token found");
765
+ const o = await y({
732
766
  type: "password",
733
767
  name: "token",
734
768
  message: "Enter your Content Island 🏝️ API token:",
735
769
  validate: (s) => s.length > 0 ? !0 : "Token is required"
736
770
  });
737
- J(a?.token), n = a?.token, e && await ee(n, e);
771
+ K(o?.token), n = o?.token, e && await ie(n, e);
738
772
  }
739
- return J(n), n;
740
- }, te = async (e) => {
741
- const { accessToken: t, envFilePath: n, askIfExists: a } = e;
773
+ return K(n), n;
774
+ }, re = async (e) => {
775
+ const { accessToken: t, envFilePath: n, askIfExists: o } = e;
742
776
  let s = t;
743
- return s ? (o.success("Using provided Content Island 🏝️ token"), await ee(s, n)) : s = await Be(n, a), s;
744
- }, Ke = async (e) => {
777
+ return s ? (a.success("Using provided Content Island 🏝️ token"), await ie(s, n)) : s = await Ye(n, o), s;
778
+ }, We = async (e) => {
745
779
  try {
746
- o.title("Content Island Integration"), o.step("Configuring template...");
747
- const t = await X({
780
+ a.title("Content Island Integration"), a.step("Configuring template...");
781
+ const t = await oe({
748
782
  selectedTemplateId: e.template,
749
783
  askIfExists: !0
750
784
  });
751
- t.onInit && (o.step("Running template initialization..."), await t.onInit({
785
+ t.onInit && (a.step("Running template initialization..."), await t.onInit({
752
786
  command: "init"
753
- })), t.hasToSaveConfig && (o.step("Saving configuration..."), await E({ templateID: t.id }), o.config("Template configuration saved")), o.step("Configuring access token...");
754
- const n = t.getEnvFilePath ? t.getEnvFilePath() : null, a = await te({
787
+ })), t.hasToSaveConfig && (a.step("Saving configuration..."), await v({ templateID: t.id }), a.config("Template configuration saved")), a.step("Configuring access token...");
788
+ const n = t.getEnvFilePath ? t.getEnvFilePath() : null, o = await re({
755
789
  accessToken: e.token,
756
790
  envFilePath: n,
757
791
  askIfExists: !0
758
792
  });
759
- o.token("Access token configured successfully"), o.step("Synchronizing project..."), await t.syncProject({ accessToken: a, askIfMultipleLanguages: !0 }), o.newLine(), o.complete("Content Island 🏝️ integration completed successfully!"), o.newLine(), t.onFinish && await t.onFinish();
793
+ a.token("Access token configured successfully"), a.step("Synchronizing project..."), await t.syncProject({ accessToken: o, askIfMultipleLanguages: !0 }), a.newLine(), a.complete("Content Island 🏝️ integration completed successfully!"), a.newLine(), t.onFinish && await t.onFinish();
760
794
  } catch (t) {
761
- o.newLine(), o.error("Error during Content Island integration:"), o.error(t instanceof Error ? t.message : String(t)), process.exit(1);
795
+ a.newLine(), a.error("Error during Content Island integration:"), a.error(t instanceof Error ? t.message : String(t)), process.exit(1);
762
796
  }
763
- }, qe = async () => {
797
+ }, He = async () => {
764
798
  try {
765
- o.title("Content Island Integration"), o.step("Configuring template...");
766
- const e = await X({ askIfExists: !1 });
767
- e.onInit && (o.step("Running template initialization..."), await e.onInit({
799
+ a.title("Content Island Integration"), a.step("Configuring template...");
800
+ const e = await oe({ askIfExists: !1 });
801
+ e.onInit && (a.step("Running template initialization..."), await e.onInit({
768
802
  command: "update"
769
- })), e.hasToSaveConfig && (o.step("Saving configuration..."), await E({ templateID: e.id }), o.config("Template configuration saved")), o.step("Configuring access token...");
770
- const t = e.getEnvFilePath ? e.getEnvFilePath() : null, n = await te({
803
+ })), e.hasToSaveConfig && (a.step("Saving configuration..."), await v({ templateID: e.id }), a.config("Template configuration saved")), a.step("Configuring access token...");
804
+ const t = e.getEnvFilePath ? e.getEnvFilePath() : null, n = await re({
771
805
  envFilePath: t,
772
806
  askIfExists: !1
773
807
  });
774
- o.token("Access token configured successfully"), o.step("Synchronizing project..."), await e.syncProject({ accessToken: n, askIfMultipleLanguages: !1 }), o.newLine(), o.complete("Content Island 🏝️ integration completed successfully!"), o.newLine(), e.onFinish && await e.onFinish();
808
+ a.token("Access token configured successfully"), a.step("Synchronizing project..."), await e.syncProject({ accessToken: n, askIfMultipleLanguages: !1 }), a.newLine(), a.complete("Content Island 🏝️ integration completed successfully!"), a.newLine(), e.onFinish && await e.onFinish();
775
809
  } catch (e) {
776
- o.newLine(), o.error("Error during Content Island integration:"), o.error(e instanceof Error ? e.message : String(e)), process.exit(1);
810
+ a.newLine(), a.error("Error during Content Island integration:"), a.error(e instanceof Error ? e.message : String(e)), process.exit(1);
777
811
  }
778
- }, Ue = "0.1.4", Ve = {
779
- version: Ue
780
- }, b = ae("create-contentisland");
812
+ }, Ze = "0.2.0", Xe = {
813
+ version: Ze
814
+ }, b = le("create-contentisland");
781
815
  b.command("", "Initialize and validate a project").example("npm create contentisland").example("npm create contentisland --token <token>").example("npm create contentisland --token <token> --template starlight").option(
782
816
  "--token <token>",
783
817
  "Your Content Island token (you can also set the CONTENT_ISLAND_ACCESS_TOKEN environment variable)",
@@ -785,11 +819,11 @@ b.command("", "Initialize and validate a project").example("npm create contentis
785
819
  default: process.env.CONTENT_ISLAND_ACCESS_TOKEN || void 0
786
820
  }
787
821
  ).option("--template <template>", "The template to use: starlight.").action(async (e) => {
788
- await Ke(e);
822
+ await We(e);
789
823
  });
790
824
  b.command("update", "Update content from Content Island 🏝️ (preserves existing token)").example("npm create contentisland update").action(async () => {
791
- await qe();
825
+ await He();
792
826
  });
793
827
  b.help();
794
- b.version(Ve.version);
828
+ b.version(Xe.version);
795
829
  b.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-contentisland",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Content Island - Starlight CLI",
5
5
  "private": false,
6
6
  "sideEffects": false,