layero 0.11.21 → 0.11.23
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/layero.js +1 -0
- package/dist/commands/data-files.js +16 -1
- package/dist/commands/deploy.js +13 -0
- package/dist/exit-codes.js +1 -0
- package/package.json +1 -1
package/dist/bin/layero.js
CHANGED
|
@@ -452,6 +452,7 @@ async function main() {
|
|
|
452
452
|
"(layero.json buildCommand or the package.json build script) and serves the folder with index.html")
|
|
453
453
|
.option("--name <name>", "project name (only used on first deploy)")
|
|
454
454
|
.option("--db <database>", "connect the organization's database before the build, so the first build already gets the Data API URL and key")
|
|
455
|
+
.option("--address <label>", "site address of a NEW project: inbox → inbox.layero.app (ignored for an existing project)")
|
|
455
456
|
.option("--project <id_or_slug>", "deploy into an existing project, ignoring local config")
|
|
456
457
|
.option("-y, --yes", "non-interactive: accept defaults and skip the --prod confirmation")
|
|
457
458
|
.option("--config", "(legacy alias of the default behaviour — auto-detect + .layero/project.json values)")
|
|
@@ -35,10 +35,25 @@ async function gateway(url, key, path, init = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
if (!res.ok) {
|
|
37
37
|
const message = body?.message || body?.error || `${res.status}`;
|
|
38
|
-
throw new LayeroError("storage_refused", `хранилище отказало: ${message}`, body?.hint ??
|
|
38
|
+
throw new LayeroError("storage_refused", `хранилище отказало: ${message}`, body?.hint ?? refusalAdvice(res.status, body));
|
|
39
39
|
}
|
|
40
40
|
return body;
|
|
41
41
|
}
|
|
42
|
+
/** Совет по отказу — по его причине. Раньше на любой отказ советовали
|
|
43
|
+
* включить файлы, и на «бакет уже есть» это был совет мимо (R2-04, 27.10). */
|
|
44
|
+
function refusalAdvice(status, body) {
|
|
45
|
+
const text = `${body?.error ?? ""} ${body?.message ?? ""} ${body?.statusCode ?? ""}`.toLowerCase();
|
|
46
|
+
if (status === 409 || text.includes("already exists") || text.includes("duplicate")) {
|
|
47
|
+
return "бакет с таким именем уже есть — посмотреть: layero data buckets list, или выберите другое имя";
|
|
48
|
+
}
|
|
49
|
+
if (status === 401 || status === 403) {
|
|
50
|
+
return "ключ хранилища не подошёл — повторите команду; не помогло — проверьте, что файлы включены: layero data enable --storage";
|
|
51
|
+
}
|
|
52
|
+
if (status === 400 && text.includes("name")) {
|
|
53
|
+
return "имя бакета — латиница, цифры, дефис и подчёркивание";
|
|
54
|
+
}
|
|
55
|
+
return "проверьте, что файлы включены: layero data enable --storage";
|
|
56
|
+
}
|
|
42
57
|
export async function dataBucketsListCmd(opts) {
|
|
43
58
|
const { api, org, db, ref } = await target(opts);
|
|
44
59
|
const s = await api.openStorageSession(org, db.id);
|
package/dist/commands/deploy.js
CHANGED
|
@@ -728,6 +728,7 @@ export async function deployCmd(opts) {
|
|
|
728
728
|
runtime_kind_origin: setup.runtime_kind_origin,
|
|
729
729
|
root_directory: opts.root ?? null,
|
|
730
730
|
env_vars: existing?.env_vars ?? {},
|
|
731
|
+
...(opts.address ? { address: opts.address } : {}),
|
|
731
732
|
commit_message: prebuiltDir
|
|
732
733
|
? `CLI prebuilt deploy (${prebuiltDir})`
|
|
733
734
|
: "CLI deploy",
|
|
@@ -743,6 +744,18 @@ export async function deployCmd(opts) {
|
|
|
743
744
|
// подменять его на `internal` значит ломать их обработку.
|
|
744
745
|
throw new LayeroError("project_not_found", `no project with id/slug "${opts.project}"`, "run `layero projects list` to see available projects");
|
|
745
746
|
}
|
|
747
|
+
// «Адрес по умолчанию недоступен» — с кодом, а не голым 409, и с флагом,
|
|
748
|
+
// которым его задать: раньше совет «укажите вручную» указывал в никуда (R2-13).
|
|
749
|
+
if (err instanceof ApiError && err.status === 409 && err.body.includes("address_required")) {
|
|
750
|
+
let message = "адрес по умолчанию недоступен";
|
|
751
|
+
try {
|
|
752
|
+
message = JSON.parse(err.body)?.detail?.message ?? message;
|
|
753
|
+
}
|
|
754
|
+
catch {
|
|
755
|
+
// тело не JSON — оставляем общий текст
|
|
756
|
+
}
|
|
757
|
+
throw new LayeroError("address_required", message, "задайте адрес сайта: layero deploy --address <имя> (станет <имя>.layero.app)");
|
|
758
|
+
}
|
|
746
759
|
if (err instanceof ApiError && err.status === 403) {
|
|
747
760
|
throw new LayeroError("forbidden", `access denied: ${err.body.slice(0, 200)}`, "check that your token has the required scope and that you're a member of the organization");
|
|
748
761
|
}
|
package/dist/exit-codes.js
CHANGED
package/package.json
CHANGED