vela 0.14.4 → 0.14.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 pc43 from "picocolors";
|
|
|
21
21
|
// package.json
|
|
22
22
|
var package_default = {
|
|
23
23
|
name: "vela",
|
|
24
|
-
version: "0.14.
|
|
24
|
+
version: "0.14.5",
|
|
25
25
|
type: "module",
|
|
26
26
|
description: "A CLI for creating and updating SvelteKit projects",
|
|
27
27
|
license: "MIT",
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
dependencies: {
|
|
58
58
|
"@clack/prompts": "^1.7.0",
|
|
59
59
|
"@faker-js/faker": "^10.6.0",
|
|
60
|
-
"@velastack/patterns": "^0.3.
|
|
60
|
+
"@velastack/patterns": "^0.3.4",
|
|
61
61
|
"@velastack/pocketbase-codegen": "^0.1.0",
|
|
62
62
|
"annotate-json-schema": "^0.1.1",
|
|
63
63
|
commander: "^13.1.0",
|
|
@@ -71,7 +71,7 @@ var package_default = {
|
|
|
71
71
|
picocolors: "^1.1.1",
|
|
72
72
|
pocketbase: "^0.28.0",
|
|
73
73
|
"pocketbase-server": "^0.40.5-beta.2",
|
|
74
|
-
stripe: "^
|
|
74
|
+
stripe: "^22.6.2",
|
|
75
75
|
svelte: "^5.56.10",
|
|
76
76
|
tar: "^7.5.22",
|
|
77
77
|
tinyexec: "^1.3.0",
|
|
@@ -903,7 +903,7 @@ function optionalStringArray(value) {
|
|
|
903
903
|
import fs8 from "node:fs";
|
|
904
904
|
import path7 from "node:path";
|
|
905
905
|
import process5 from "node:process";
|
|
906
|
-
import { exec } from "tinyexec";
|
|
906
|
+
import { exec, execSync } from "tinyexec";
|
|
907
907
|
import { Option } from "commander";
|
|
908
908
|
import * as p2 from "@clack/prompts";
|
|
909
909
|
import {
|
|
@@ -931,10 +931,10 @@ async function packageManagerPrompt(cwd) {
|
|
|
931
931
|
if (!process5.stdout.isTTY) return agent;
|
|
932
932
|
const options = [
|
|
933
933
|
{ label: "None", value: void 0 },
|
|
934
|
-
...AGENT_NAMES.map((pm2) => ({ value: pm2, label: pm2 }))
|
|
934
|
+
...AGENT_NAMES.filter(isInstalled).map((pm2) => ({ value: pm2, label: pm2 }))
|
|
935
935
|
];
|
|
936
936
|
const pm = await p2.select({
|
|
937
|
-
message: "
|
|
937
|
+
message: "Detected package managers. Which one should we use to install dependencies?",
|
|
938
938
|
options,
|
|
939
939
|
initialValue: agent
|
|
940
940
|
});
|
|
@@ -944,7 +944,25 @@ async function packageManagerPrompt(cwd) {
|
|
|
944
944
|
}
|
|
945
945
|
return pm;
|
|
946
946
|
}
|
|
947
|
+
var installedCache = /* @__PURE__ */ new Map();
|
|
948
|
+
function isInstalled(agent) {
|
|
949
|
+
let installed = installedCache.get(agent);
|
|
950
|
+
if (installed === void 0) {
|
|
951
|
+
try {
|
|
952
|
+
execSync(agent, ["--version"], { nodeOptions: { stdio: "ignore" } });
|
|
953
|
+
installed = true;
|
|
954
|
+
} catch {
|
|
955
|
+
installed = false;
|
|
956
|
+
}
|
|
957
|
+
installedCache.set(agent, installed);
|
|
958
|
+
}
|
|
959
|
+
return installed;
|
|
960
|
+
}
|
|
947
961
|
async function installDependencies(agent, cwd, { exitOnFailure = true } = {}) {
|
|
962
|
+
if (!isInstalled(agent)) {
|
|
963
|
+
p2.log.warn(`${agent} is not installed, skipping dependency installation.`);
|
|
964
|
+
return false;
|
|
965
|
+
}
|
|
948
966
|
const task = p2.taskLog({
|
|
949
967
|
title: `Installing dependencies with ${agent}...`,
|
|
950
968
|
limit: Math.ceil(process5.stdout.rows / 2),
|
|
@@ -2572,7 +2590,7 @@ var create = new Command3("create").description("scaffold a new velastack projec
|
|
|
2572
2590
|
return runCommand(async () => {
|
|
2573
2591
|
const listing = await listAllTemplates();
|
|
2574
2592
|
const options = parseOptions(optionsSchema2(listing), rawOpts);
|
|
2575
|
-
const { directory, packageManager: packageManager2, name, template, link: link2 } = await createProject2(
|
|
2593
|
+
const { directory, packageManager: packageManager2, installed, name, template, link: link2 } = await createProject2(
|
|
2576
2594
|
projectPath,
|
|
2577
2595
|
options,
|
|
2578
2596
|
listing
|
|
@@ -2584,7 +2602,7 @@ var create = new Command3("create").description("scaffold a new velastack projec
|
|
|
2584
2602
|
const hasSpaces = relative.includes(" ");
|
|
2585
2603
|
nextSteps.push(`\`cd ${hasSpaces ? `"${relative}"` : relative}\``);
|
|
2586
2604
|
}
|
|
2587
|
-
if (!
|
|
2605
|
+
if (!installed) {
|
|
2588
2606
|
const resolved = resolveCommand3(pm, "install", []);
|
|
2589
2607
|
if (resolved) {
|
|
2590
2608
|
nextSteps.push(
|
|
@@ -2681,12 +2699,13 @@ async function createProject2(cwdArg, options, listing) {
|
|
|
2681
2699
|
}
|
|
2682
2700
|
p9.log.success("Project created");
|
|
2683
2701
|
let packageManager2;
|
|
2702
|
+
let installed = false;
|
|
2684
2703
|
if (options.install !== false) {
|
|
2685
2704
|
const pm = typeof options.install === "string" ? options.install : await packageManagerPrompt(projectPath);
|
|
2686
2705
|
if (pm) {
|
|
2687
2706
|
const builds = template.backend ? ["esbuild", "pocketbase-server"] : ["esbuild"];
|
|
2688
2707
|
addPnpmBuildDependencies(projectPath, pm, builds);
|
|
2689
|
-
await installDependencies(pm, projectPath);
|
|
2708
|
+
installed = await installDependencies(pm, projectPath);
|
|
2690
2709
|
packageManager2 = pm;
|
|
2691
2710
|
}
|
|
2692
2711
|
}
|
|
@@ -2713,7 +2732,7 @@ async function createProject2(cwdArg, options, listing) {
|
|
|
2713
2732
|
);
|
|
2714
2733
|
p9.log.success("PocketBase initialized");
|
|
2715
2734
|
}
|
|
2716
|
-
return { directory: projectPath, packageManager: packageManager2, name, template, link: link2 };
|
|
2735
|
+
return { directory: projectPath, packageManager: packageManager2, installed, name, template, link: link2 };
|
|
2717
2736
|
}
|
|
2718
2737
|
async function linkOnCreate(name, template, options, onCancel2) {
|
|
2719
2738
|
const templateCms = template.cms === true;
|
|
@@ -2839,7 +2858,7 @@ async function runPattern(slug2, argv, input, report4, after) {
|
|
|
2839
2858
|
if (pattern.requires.ui === "shadcn" && features.ui !== "shadcn") {
|
|
2840
2859
|
assertShadcn(`vela ${pattern.command.base.replace(/^vela /, "")}`, workspaceRootDir);
|
|
2841
2860
|
}
|
|
2842
|
-
const
|
|
2861
|
+
const log53 = p10.taskLog({ title: report4.task.title });
|
|
2843
2862
|
let result;
|
|
2844
2863
|
try {
|
|
2845
2864
|
result = await pattern.generate({
|
|
@@ -2860,11 +2879,11 @@ async function runPattern(slug2, argv, input, report4, after) {
|
|
|
2860
2879
|
});
|
|
2861
2880
|
return collections2;
|
|
2862
2881
|
},
|
|
2863
|
-
logger: { info: (message) =>
|
|
2882
|
+
logger: { info: (message) => log53.message(message) }
|
|
2864
2883
|
});
|
|
2865
|
-
|
|
2884
|
+
log53.success(report4.task.success);
|
|
2866
2885
|
} catch (e) {
|
|
2867
|
-
|
|
2886
|
+
log53.error(report4.task.error);
|
|
2868
2887
|
throw e;
|
|
2869
2888
|
}
|
|
2870
2889
|
let afterError;
|
|
@@ -5587,6 +5606,14 @@ vela deploy runs the app as a Node server, which needs ${ADAPTER_NODE}:`
|
|
|
5587
5606
|
}
|
|
5588
5607
|
async function installAdapterDependencies(root) {
|
|
5589
5608
|
const agent = await packageManager(root);
|
|
5609
|
+
if (!isInstalled(agent)) {
|
|
5610
|
+
throw new AdapterError(
|
|
5611
|
+
`${agent} is not installed, so ${ADAPTER_NODE} couldn't be installed.
|
|
5612
|
+
|
|
5613
|
+
The config and package.json are already updated: install ${agent}, run \`${agent} install\`, then deploy again.`,
|
|
5614
|
+
""
|
|
5615
|
+
);
|
|
5616
|
+
}
|
|
5590
5617
|
const ok = await installDependencies(agent, root, { exitOnFailure: false });
|
|
5591
5618
|
if (!ok) {
|
|
5592
5619
|
throw new AdapterError(
|
|
@@ -6626,18 +6653,18 @@ var add = new Command50("add").description("add ui components (shadcn-svelte ite
|
|
|
6626
6653
|
(components, options) => runCommand(async () => {
|
|
6627
6654
|
const { workspaceRootDir } = await getWorkspace();
|
|
6628
6655
|
assertShadcn("vela ui add", workspaceRootDir);
|
|
6629
|
-
const
|
|
6656
|
+
const log53 = p31.taskLog({ title: "Adding UI components..." });
|
|
6630
6657
|
let outcome;
|
|
6631
6658
|
try {
|
|
6632
6659
|
outcome = await installComponents({
|
|
6633
6660
|
root: workspaceRootDir,
|
|
6634
6661
|
components,
|
|
6635
6662
|
overwrite: options.overwrite,
|
|
6636
|
-
logger: { info: (message) =>
|
|
6663
|
+
logger: { info: (message) => log53.message(message) }
|
|
6637
6664
|
});
|
|
6638
|
-
|
|
6665
|
+
log53.success("UI components ready");
|
|
6639
6666
|
} catch (e) {
|
|
6640
|
-
|
|
6667
|
+
log53.error("Could not add UI components");
|
|
6641
6668
|
throw e;
|
|
6642
6669
|
}
|
|
6643
6670
|
reportResult(uiAddReport(components, outcome));
|
|
@@ -6652,13 +6679,13 @@ var base = new Command51("base").description("change the base (gray) palette").a
|
|
|
6652
6679
|
(color) => runCommand(async () => {
|
|
6653
6680
|
const { workspaceRootDir } = await getWorkspace();
|
|
6654
6681
|
assertShadcn("vela ui base", workspaceRootDir);
|
|
6655
|
-
const
|
|
6682
|
+
const log53 = p32.taskLog({ title: `Applying the ${color} palette...` });
|
|
6656
6683
|
let outcome;
|
|
6657
6684
|
try {
|
|
6658
6685
|
outcome = await applyBaseColor({ root: workspaceRootDir, color });
|
|
6659
|
-
|
|
6686
|
+
log53.success("Palette applied");
|
|
6660
6687
|
} catch (e) {
|
|
6661
|
-
|
|
6688
|
+
log53.error("Could not change the base color");
|
|
6662
6689
|
throw e;
|
|
6663
6690
|
}
|
|
6664
6691
|
reportResult({
|
|
@@ -6767,14 +6794,14 @@ var style = new Command53("style").description("switch the shadcn-svelte style,
|
|
|
6767
6794
|
assertShadcn("vela ui style", workspaceRootDir);
|
|
6768
6795
|
const spinner8 = p34.spinner();
|
|
6769
6796
|
spinner8.start(`Reading the ${name} registry...`);
|
|
6770
|
-
let
|
|
6797
|
+
let log53;
|
|
6771
6798
|
let outcome;
|
|
6772
6799
|
try {
|
|
6773
6800
|
outcome = await switchStyle({
|
|
6774
6801
|
root: workspaceRootDir,
|
|
6775
6802
|
style: name,
|
|
6776
6803
|
font: options.font,
|
|
6777
|
-
logger: { info: (message) =>
|
|
6804
|
+
logger: { info: (message) => log53?.message(message) },
|
|
6778
6805
|
confirm: async (components) => {
|
|
6779
6806
|
spinner8.stop(`Read the ${name} registry`);
|
|
6780
6807
|
if (components.length > 0) {
|
|
@@ -6791,13 +6818,13 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
6791
6818
|
const ok = await p34.confirm({ message: `Switch to ${name}?`, initialValue: false });
|
|
6792
6819
|
if (p34.isCancel(ok) || !ok) return false;
|
|
6793
6820
|
}
|
|
6794
|
-
|
|
6821
|
+
log53 = p34.taskLog({ title: `Switching to the ${name} style...` });
|
|
6795
6822
|
return true;
|
|
6796
6823
|
}
|
|
6797
6824
|
});
|
|
6798
6825
|
} catch (e) {
|
|
6799
6826
|
spinner8.stop(`Could not switch to ${name}`);
|
|
6800
|
-
|
|
6827
|
+
log53?.error("Could not switch style");
|
|
6801
6828
|
throw e;
|
|
6802
6829
|
}
|
|
6803
6830
|
spinner8.stop(`Read the ${name} registry`);
|
|
@@ -6809,7 +6836,7 @@ ${components.map((c) => `- ${c}`).join("\n")}`
|
|
|
6809
6836
|
p34.cancel("Operation cancelled.");
|
|
6810
6837
|
return;
|
|
6811
6838
|
}
|
|
6812
|
-
|
|
6839
|
+
log53?.success("Style switched");
|
|
6813
6840
|
reportResult(uiStyleReport(outcome));
|
|
6814
6841
|
}, "Failed to switch style.")
|
|
6815
6842
|
);
|
|
@@ -6822,13 +6849,13 @@ var theme = new Command54("theme").description("change the accent color, keeping
|
|
|
6822
6849
|
(accent) => runCommand(async () => {
|
|
6823
6850
|
const { workspaceRootDir } = await getWorkspace();
|
|
6824
6851
|
assertShadcn("vela ui theme", workspaceRootDir);
|
|
6825
|
-
const
|
|
6852
|
+
const log53 = p35.taskLog({ title: `Applying the ${accent} accent...` });
|
|
6826
6853
|
let outcome;
|
|
6827
6854
|
try {
|
|
6828
6855
|
outcome = await applyTheme({ root: workspaceRootDir, theme: accent });
|
|
6829
|
-
|
|
6856
|
+
log53.success("Accent applied");
|
|
6830
6857
|
} catch (e) {
|
|
6831
|
-
|
|
6858
|
+
log53.error("Could not change the accent");
|
|
6832
6859
|
throw e;
|
|
6833
6860
|
}
|
|
6834
6861
|
reportResult({
|