vela 0.10.8 → 0.10.9
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 +60 -9
- package/dist/bin.js.map +2 -2
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "vela",
|
|
10
|
-
version: "0.10.
|
|
10
|
+
version: "0.10.9",
|
|
11
11
|
type: "module",
|
|
12
12
|
description: "A CLI for creating and updating SvelteKit projects",
|
|
13
13
|
license: "MIT",
|
|
@@ -41,7 +41,7 @@ var package_default = {
|
|
|
41
41
|
dependencies: {
|
|
42
42
|
"@clack/prompts": "^1.7.0",
|
|
43
43
|
"@faker-js/faker": "^10.6.0",
|
|
44
|
-
"@velastack/patterns": "^0.1.
|
|
44
|
+
"@velastack/patterns": "^0.1.4",
|
|
45
45
|
"@velastack/pocketbase-codegen": "^0.1.0",
|
|
46
46
|
"annotate-json-schema": "^0.1.0",
|
|
47
47
|
commander: "^13.1.0",
|
|
@@ -1210,13 +1210,20 @@ function reportResult(report4) {
|
|
|
1210
1210
|
body.push(`${label3}:`);
|
|
1211
1211
|
for (const item of items) body.push(`- ${item}`);
|
|
1212
1212
|
}
|
|
1213
|
+
const failures = report4.failures ?? [];
|
|
1213
1214
|
if (body.length > 0) {
|
|
1214
1215
|
p3.log.success(`${report4.summary}
|
|
1215
1216
|
|
|
1216
1217
|
${body.join("\n")}`);
|
|
1217
|
-
} else {
|
|
1218
|
+
} else if (failures.length === 0) {
|
|
1218
1219
|
p3.log.success(report4.summary);
|
|
1219
1220
|
}
|
|
1221
|
+
for (const failure of failures) {
|
|
1222
|
+
const headline = failure.status === "not-found" ? `Could not find ${failure.path}` : `Could not update ${failure.path}`;
|
|
1223
|
+
p3.log.warn(failure.message ? `${headline}
|
|
1224
|
+
|
|
1225
|
+
${failure.message}` : headline);
|
|
1226
|
+
}
|
|
1220
1227
|
if (report4.nextSteps && report4.nextSteps.length > 0) {
|
|
1221
1228
|
p3.note(report4.nextSteps.map((s) => `- ${s}`).join("\n"), "Next steps", {
|
|
1222
1229
|
format: (line) => line
|
|
@@ -1749,6 +1756,7 @@ import { bySlug } from "@velastack/patterns";
|
|
|
1749
1756
|
function toRelative(root, filePath) {
|
|
1750
1757
|
return path13.isAbsolute(filePath) ? path13.relative(root, filePath) : filePath;
|
|
1751
1758
|
}
|
|
1759
|
+
var isSuccess = (f) => (f.status ?? "success") === "success";
|
|
1752
1760
|
async function runPattern(slug2, argv2, input, report4) {
|
|
1753
1761
|
const pattern = bySlug[slug2];
|
|
1754
1762
|
if (!pattern) {
|
|
@@ -1783,20 +1791,32 @@ async function runPattern(slug2, argv2, input, report4) {
|
|
|
1783
1791
|
throw e;
|
|
1784
1792
|
}
|
|
1785
1793
|
const rel = (f) => toRelative(workspaceRootDir, f);
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1794
|
+
const files = [...result.creates, ...result.modifies, ...result.deletes];
|
|
1795
|
+
const failures = files.filter((f) => !isSuccess(f)).map((f) => ({
|
|
1796
|
+
path: rel(f.path),
|
|
1797
|
+
status: f.status === "not-found" ? "not-found" : "failed",
|
|
1798
|
+
message: f.message
|
|
1799
|
+
}));
|
|
1800
|
+
const created = result.creates.filter(isSuccess);
|
|
1801
|
+
const modified = result.modifies.filter(isSuccess);
|
|
1802
|
+
const deleted = result.deletes.filter(isSuccess);
|
|
1803
|
+
const totalChanges = created.length + modified.length + deleted.length + result.components.length + result.packages.length + result.collections.length;
|
|
1804
|
+
if (totalChanges === 0 && failures.length === 0) {
|
|
1788
1805
|
p6.log.info(`${pattern.title ?? slug2} produced no changes.`);
|
|
1789
1806
|
return;
|
|
1790
1807
|
}
|
|
1791
1808
|
reportResult({
|
|
1792
1809
|
summary: report4.summary ?? `Applied ${pattern.title ?? slug2}.`,
|
|
1793
|
-
filesCreated:
|
|
1794
|
-
filesModified:
|
|
1795
|
-
filesDeleted:
|
|
1810
|
+
filesCreated: created.map((f) => rel(f.path)),
|
|
1811
|
+
filesModified: modified.map((f) => rel(f.path)),
|
|
1812
|
+
filesDeleted: deleted.map((f) => rel(f.path)),
|
|
1796
1813
|
componentsAdded: result.components,
|
|
1797
1814
|
packagesInstalled: result.packages,
|
|
1798
1815
|
collectionsAdded: result.collections.map((c) => c.name),
|
|
1799
|
-
|
|
1816
|
+
failures,
|
|
1817
|
+
// Next steps assume the pattern applied; when part of it didn't, the
|
|
1818
|
+
// remediation snippets above are the actual next step.
|
|
1819
|
+
nextSteps: failures.length > 0 ? void 0 : report4.nextSteps
|
|
1800
1820
|
});
|
|
1801
1821
|
}
|
|
1802
1822
|
|
|
@@ -7589,6 +7609,22 @@ Set them with \`vela env set POCKETBASE_SUPERUSER_EMAIL\` and \`vela env set POC
|
|
|
7589
7609
|
}
|
|
7590
7610
|
const localPort = await findFreePort("127.0.0.1");
|
|
7591
7611
|
await session.forwardLocalPort(localPort, "127.0.0.1", pbPort);
|
|
7612
|
+
if (!await superuserAuthenticates(localPort, email3, password11)) {
|
|
7613
|
+
await session.cancelForward(localPort, "127.0.0.1", pbPort);
|
|
7614
|
+
throw new Error(
|
|
7615
|
+
`${instance} does not accept the superuser credentials in its own environment.
|
|
7616
|
+
|
|
7617
|
+
They are what \`--remote-db\` renders the build as. The usual cause is a password
|
|
7618
|
+
changed in the PocketBase admin panel, which leaves the database and
|
|
7619
|
+
${pc15.cyan(`/etc/vela/apps/${instance}/env`)} disagreeing.
|
|
7620
|
+
|
|
7621
|
+
Point the environment at the password the database has:
|
|
7622
|
+
${pc15.cyan("vela env set POCKETBASE_SUPERUSER_PASSWORD")}
|
|
7623
|
+
|
|
7624
|
+
or build against a throwaway local database instead:
|
|
7625
|
+
${pc15.cyan("vela deploy --no-remote-db")}`
|
|
7626
|
+
);
|
|
7627
|
+
}
|
|
7592
7628
|
return {
|
|
7593
7629
|
pbPort,
|
|
7594
7630
|
env: {
|
|
@@ -7599,6 +7635,21 @@ Set them with \`vela env set POCKETBASE_SUPERUSER_EMAIL\` and \`vela env set POC
|
|
|
7599
7635
|
close: () => session.cancelForward(localPort, "127.0.0.1", pbPort)
|
|
7600
7636
|
};
|
|
7601
7637
|
}
|
|
7638
|
+
async function superuserAuthenticates(port, identity, password11) {
|
|
7639
|
+
try {
|
|
7640
|
+
const response = await fetch(
|
|
7641
|
+
`http://127.0.0.1:${port}/api/collections/_superusers/auth-with-password`,
|
|
7642
|
+
{
|
|
7643
|
+
method: "POST",
|
|
7644
|
+
headers: { "content-type": "application/json" },
|
|
7645
|
+
body: JSON.stringify({ identity, password: password11 })
|
|
7646
|
+
}
|
|
7647
|
+
);
|
|
7648
|
+
return response.ok;
|
|
7649
|
+
} catch {
|
|
7650
|
+
return true;
|
|
7651
|
+
}
|
|
7652
|
+
}
|
|
7602
7653
|
async function uploadRelease(session, instance, release, entries) {
|
|
7603
7654
|
const dir = remotePaths.release(instance, release);
|
|
7604
7655
|
await session.script(`mkdir -p "$1"`, { args: [dir] });
|