liftbay 0.3.0 → 0.3.1
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/index.js +20 -4
- package/package.json +1 -1
- package/skills/liftbay/SKILL.md +1 -1
package/dist/index.js
CHANGED
|
@@ -28672,6 +28672,22 @@ function cancelled(value) {
|
|
|
28672
28672
|
}
|
|
28673
28673
|
return value;
|
|
28674
28674
|
}
|
|
28675
|
+
var slugify = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
28676
|
+
async function createFirstOrg(lb, given) {
|
|
28677
|
+
const me = await unwrap(lb.GET("/v1/auth/me"));
|
|
28678
|
+
const suggested = given ?? (me.user.name?.trim() || me.user.email.split("@")[0]);
|
|
28679
|
+
const name = isInteractive() && !given ? cancelled(await text({ message: "Name your organization", initialValue: suggested, validate: (v) => slugify(v ?? "").length >= 2 ? void 0 : "At least 2 letters or digits" })) : suggested;
|
|
28680
|
+
const base = slugify(name).padEnd(2, "0");
|
|
28681
|
+
for (const slug of [base, `${base.slice(0, 35)}-${Math.random().toString(36).slice(2, 6)}`]) {
|
|
28682
|
+
const res = await lb.POST("/v1/orgs", { body: { name: name.slice(0, 64), slug } });
|
|
28683
|
+
if (res.data) {
|
|
28684
|
+
log.success(`Created organization ${import_picocolors3.default.bold(res.data.name)} ${import_picocolors3.default.dim(`(liftbay.dev/${res.data.slug})`)}`);
|
|
28685
|
+
return res.data;
|
|
28686
|
+
}
|
|
28687
|
+
if (res.response.status !== 409) await unwrap(Promise.resolve(res));
|
|
28688
|
+
}
|
|
28689
|
+
return fail("Couldn't pick a free organization URL. Pass --org <slug>.");
|
|
28690
|
+
}
|
|
28675
28691
|
async function ensureLinked(app, opts) {
|
|
28676
28692
|
const existing = readConfig();
|
|
28677
28693
|
if (existing) {
|
|
@@ -28680,7 +28696,7 @@ async function ensureLinked(app, opts) {
|
|
|
28680
28696
|
}
|
|
28681
28697
|
const lb = client();
|
|
28682
28698
|
const orgs = await unwrap(lb.GET("/v1/orgs"));
|
|
28683
|
-
if (!orgs.length)
|
|
28699
|
+
if (!orgs.length) orgs.push(await createFirstOrg(lb, opts.org));
|
|
28684
28700
|
let org = opts.org ?? (orgs.length === 1 ? orgs[0].slug : void 0);
|
|
28685
28701
|
if (!org) {
|
|
28686
28702
|
if (!isInteractive()) fail(`Several organizations available; pass --org (${orgs.map((o) => o.slug).join(", ")})`);
|
|
@@ -29609,7 +29625,7 @@ function parseVisibility(v) {
|
|
|
29609
29625
|
if (v && !VISIBILITIES.includes(v)) fail(`--visibility must be ${VISIBILITIES.join(", ")}`);
|
|
29610
29626
|
return v;
|
|
29611
29627
|
}
|
|
29612
|
-
var
|
|
29628
|
+
var slugify2 = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48) || "default";
|
|
29613
29629
|
function readEasProfiles(cwd = process.cwd()) {
|
|
29614
29630
|
const path2 = join8(cwd, "eas.json");
|
|
29615
29631
|
if (!existsSync6(path2)) return null;
|
|
@@ -29630,7 +29646,7 @@ function readEasProfiles(cwd = process.cwd()) {
|
|
|
29630
29646
|
return Object.keys(build2).filter((name) => !(extended.has(name) && !build2[name].channel && !build2[name].distribution && !build2[name].developmentClient)).map((name) => {
|
|
29631
29647
|
const r2 = resolveProfile(name);
|
|
29632
29648
|
const env2 = Object.fromEntries(Object.entries(r2.env ?? {}).filter(([k2, v]) => KEY.test(k2) && v !== void 0 && v !== null).map(([k2, v]) => [k2, String(v)]));
|
|
29633
|
-
return { name, slug:
|
|
29649
|
+
return { name, slug: slugify2(name), distribution: r2.distribution === "internal" ? "internal" : "store", channel: slugify2(r2.channel ?? name), env: env2, developmentClient: !!r2.developmentClient };
|
|
29634
29650
|
});
|
|
29635
29651
|
}
|
|
29636
29652
|
async function environments(lb, path2) {
|
|
@@ -30300,7 +30316,7 @@ async function channels() {
|
|
|
30300
30316
|
}
|
|
30301
30317
|
|
|
30302
30318
|
// src/index.ts
|
|
30303
|
-
var program2 = new Command("liftbay").description("Build, ship and update React Native apps").version("0.3.
|
|
30319
|
+
var program2 = new Command("liftbay").description("Build, ship and update React Native apps").version("0.3.1").option("--json", "print the result as JSON on stdout (progress goes to stderr; never prompts). Also LIFTBAY_JSON=1").hook("preAction", () => {
|
|
30304
30320
|
if (program2.opts().json || process.env.LIFTBAY_JSON === "1") enableJson();
|
|
30305
30321
|
});
|
|
30306
30322
|
var wrap = (fn) => async (...args) => {
|
package/package.json
CHANGED
package/skills/liftbay/SKILL.md
CHANGED
|
@@ -52,7 +52,7 @@ This detects the app (Expo or bare React Native), creates or links the Liftbay p
|
|
|
52
52
|
**Coming from EAS:** when the app has an `eas.json`, `init` uses it. Each EAS build profile becomes a Liftbay build profile with the same name, channel and distribution, and its `env` (with `extends` resolved) goes into an environment of the same name. Pass `--no-eas` to use Liftbay's default profiles instead.
|
|
53
53
|
|
|
54
54
|
Useful flags:
|
|
55
|
-
- `--org <slug>`: required if the user is in several organizations; the error lists them.
|
|
55
|
+
- `--org <slug>`: required if the user is in several organizations; the error lists them. For a new account with no organization yet, `init` creates one, named after `--org` or the person's name.
|
|
56
56
|
- `--project <slug>`
|
|
57
57
|
- `--platforms ios|android|all`
|
|
58
58
|
- `--runtime-policy appVersion|fingerprint`
|