vela 0.15.4 → 0.15.5

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/dist/bin.js CHANGED
@@ -21,7 +21,7 @@ import pc46 from "picocolors";
21
21
  // package.json
22
22
  var package_default = {
23
23
  name: "vela",
24
- version: "0.15.4",
24
+ version: "0.15.5",
25
25
  type: "module",
26
26
  description: "A CLI for creating and updating SvelteKit projects",
27
27
  license: "MIT",
@@ -3048,13 +3048,24 @@ function normalizeCmsUrl(url) {
3048
3048
  }
3049
3049
  function linkNextSteps(outcome) {
3050
3050
  const steps = [];
3051
- const { linked, cmsEndpoint, cmsSource, templateCms, loggedIn, interactive } = outcome;
3051
+ const { linked, cmsEndpoint, cmsSource, templateCms, loggedIn, interactive, seed } = outcome;
3052
3052
  if (templateCms && linked && cmsSource === "linked") {
3053
+ if (seed?.status === "seeded" || seed?.status === "already-seeded") {
3054
+ steps.push(
3055
+ `The site's content is already in its CMS, ready to edit: navigation, hours, contact details and every page.`
3056
+ );
3057
+ } else if (seed?.status === "failed") {
3058
+ steps.push(
3059
+ `Loading the template's content into the CMS failed (${seed.error}). Retry with "Load template content" at ${linked.dashboardUrl}/cms/settings; until then the site shows the copy built into its components.`
3060
+ );
3061
+ }
3053
3062
  steps.push(
3054
3063
  `Add an editor at ${linked.dashboardUrl}/cms/editors, then open any page with \`?edit\` and sign in from the admin bar.`
3055
3064
  );
3056
3065
  } else if (cmsEndpoint) {
3057
- steps.push("Open any page with `?edit` and sign in from the admin bar.");
3066
+ steps.push(
3067
+ templateCms ? "Open any page with `?edit` and sign in from the admin bar. The site shows its fallback copy until content is published to that CMS." : "Open any page with `?edit` and sign in from the admin bar."
3068
+ );
3058
3069
  } else if (templateCms) {
3059
3070
  steps.push(
3060
3071
  `When you have a CMS, set \`cmsEndpoint\` in \`src/lib/site.ts\`. ${FREE_CMS_HINT}.`
@@ -3166,6 +3177,12 @@ async function startSiteDeploy(apiKey, projectId) {
3166
3177
  method: "POST"
3167
3178
  });
3168
3179
  }
3180
+ async function seedSite(apiKey, projectId, input) {
3181
+ return apiFetch(apiKey, `/v1/projects/${projectId}/site/seed`, {
3182
+ method: "POST",
3183
+ body: JSON.stringify(input)
3184
+ });
3185
+ }
3169
3186
  async function destroyEnvironment(apiKey, projectId, envTag) {
3170
3187
  return apiFetch(apiKey, `/v1/projects/${projectId}/environments/${encodeURIComponent(envTag)}`, {
3171
3188
  method: "DELETE"
@@ -3234,6 +3251,16 @@ function toLinked(project, team) {
3234
3251
  dashboardUrl: dashboardUrl(team?.slug, project.slug)
3235
3252
  };
3236
3253
  }
3254
+ async function seedLinkedProject(apiKey, projectId, template) {
3255
+ try {
3256
+ return await seedSite(apiKey, projectId, {
3257
+ template: template.name,
3258
+ ...template.version ? { version: template.version } : {}
3259
+ });
3260
+ } catch (error) {
3261
+ return { status: "failed", error: error instanceof Error ? error.message : String(error) };
3262
+ }
3263
+ }
3237
3264
 
3238
3265
  // src/lib/project-config.ts
3239
3266
  import fs19 from "node:fs";
@@ -5796,10 +5823,24 @@ async function linkOnCreate(name, template, options, onCancel2) {
5796
5823
  outcome.cmsEndpoint = cmsEndpointFor(linked.projectId);
5797
5824
  outcome.cmsSource = "linked";
5798
5825
  p10.log.success(`CMS: ${outcome.cmsEndpoint}`);
5826
+ outcome.seed = await seedCms(apiKey ?? requireApiKey(), linked, template);
5799
5827
  }
5800
5828
  }
5801
5829
  return outcome;
5802
5830
  }
5831
+ async function seedCms(apiKey, linked, template) {
5832
+ if (template.source !== "remote") return void 0;
5833
+ const version = template.entry.version;
5834
+ const seed = await seedLinkedProject(apiKey, linked.projectId, { name: template.name, version });
5835
+ if (seed.status === "seeded") {
5836
+ p10.log.success(`CMS content loaded (${seed.locales.join(", ")})`);
5837
+ } else if (seed.status === "already-seeded") {
5838
+ p10.log.info("The CMS already has content; left as it is.");
5839
+ } else if (seed.status === "failed") {
5840
+ p10.log.warn(`Could not load the template's content into the CMS: ${seed.error}`);
5841
+ }
5842
+ return seed;
5843
+ }
5803
5844
  async function promptCms(onCancel2) {
5804
5845
  p10.note(`This template reads its copy from a hosted CMS.
5805
5846
  ${FREE_CMS_HINT}.`, "CMS");
@@ -14524,7 +14565,11 @@ var testServer = new Command101("test:server").description("run server tests").a
14524
14565
  vite = await createServer({
14525
14566
  mode: "test",
14526
14567
  plugins: [stubPagesPlugin()],
14527
- optimizeDeps: { noDiscovery: true }
14568
+ optimizeDeps: { noDiscovery: true },
14569
+ // This config differs from `vela dev`'s, so sharing node_modules/.vite
14570
+ // would make Vite re-optimize dependencies under a running dev server,
14571
+ // which then loads two copies of Svelte and fails reading `page`.
14572
+ cacheDir: "node_modules/.vite-test"
14528
14573
  });
14529
14574
  const vitePort = await findFreePort();
14530
14575
  await vite.listen(vitePort);