@superwall/cli 2.6.0-beta.2 → 2.6.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/README.md +47 -16
- package/dist/{apple-Dc5pOPms.js → apple-BE1GBJFP.js} +17 -19
- package/dist/{approve-BSbdmOez.js → approve-yRZmvkCj.js} +9 -11
- package/dist/{assets-C_RjojkK.js → assets-DTAgbWw0.js} +3 -3
- package/dist/auth.d.ts +11 -4
- package/dist/auth.js +4 -5
- package/dist/base-zc1wl_9b.js +82 -0
- package/dist/{billing-B6HK-F_a.js → billing-C1LV4-BN.js} +3 -3
- package/dist/{build-DK88pTMW.js → build-CQd-pf7O.js} +35 -16
- package/dist/{client-x08fpvay.js → config-DCqRQTJ4.js} +162 -15
- package/dist/create-CSHGZDfB.js +18 -0
- package/dist/{create-kpqEhqkk.js → create-Costu6UT.js} +9 -9
- package/dist/{create-B6-Dr3GZ.js → create-wlCp83IH.js} +41 -41
- package/dist/{doctor-DYbm8IKQ.js → doctor-Bd9ffg51.js} +50 -10
- package/dist/entry.js +45 -40
- package/dist/{environment-BFNzLLPN.js → environment-Dn7irhZr.js} +1 -1
- package/dist/{drivers-Dyi-y9Jn.js → existing-BQMB_2AG.js} +305 -8
- package/dist/framework-DW5fqjh4.js +65 -0
- package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
- package/dist/{held-sKq3xrsT.js → held-D5wSX2Mf.js} +9 -9
- package/dist/held-Dmf5SR3p.js +15 -0
- package/dist/{install-DsIsif39.js → install-CxyqfKFe.js} +15 -17
- package/dist/{integrate-B8eA676b.js → integrate-MkyDDzI5.js} +33 -38
- package/dist/{login-BlpfYapG.js → login-B7IqDafm.js} +3 -3
- package/dist/{login-Blhxi20A.js → login-BMHDhxAx.js} +8 -9
- package/dist/login-Cp0-BgDZ.js +13 -0
- package/dist/{lookup-Dg55W9S7.js → lookup-DkcT4E-5.js} +28 -4
- package/dist/{migrate-DoRb9jmA.js → migrate-CdFoZipj.js} +66 -45
- package/dist/{notification-url-D82msWF5.js → notification-url-D6KKeXnk.js} +4 -4
- package/dist/{open-BAqLpTSI.js → open-COJE6ryI.js} +2 -2
- package/dist/{org-C4G7WjTV.js → org-BV8wwxwc.js} +4 -4
- package/dist/{organization-CmuQwcKN.js → organization-9R_1PJKk.js} +4 -4
- package/dist/{orgs-1OzwUtpT.js → orgs-ltP8H0Nl.js} +1 -2
- package/dist/{paths-gBbqgkS7.js → paths-Cb1RfjaX.js} +1 -1
- package/dist/{playbook-BKqlv77S.js → playbook-CVGolez9.js} +10 -14
- package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
- package/dist/{promote-D0i8A0CO.js → promote-B_HnFEbX.js} +27 -28
- package/dist/{pull-DgQ_UmGv.js → pull-DF4KYVcP.js} +72 -26
- package/dist/pull-JxiMyRwY.js +30 -0
- package/dist/{pull-CiIrJ5ik.js → pull-lYRULo4v.js} +33 -39
- package/dist/push-B5py7h5y.js +29 -0
- package/dist/{push-7N4XIVtg.js → push-BZN1Qpkq.js} +23 -12
- package/dist/{push-BWsXO7FN.js → push-BnllH2Rd.js} +8 -7
- package/dist/push-DHlUMkbf.js +21 -0
- package/dist/registry-BGEYCWyD.js +22 -0
- package/dist/{registry-aAR_8VOw.js → registry-CqePfigB.js} +1287 -902
- package/dist/{resolve-CcOpO_5s.js → resolve-B4bd3Qjl.js} +4 -4
- package/dist/{resources-DNwvf8rg.js → resources-BaURbSpY.js} +15 -2
- package/dist/{run-tVYJ3V5j.js → run-Bme4Egyl.js} +15 -17
- package/dist/{scan-dv0rrY4C.js → scan-DugxddUU.js} +1 -1
- package/dist/scan-J2DILUNE.js +4 -0
- package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
- package/dist/{scope-BXoQo30_.js → scope-DDYLQeZw.js} +24 -18
- package/dist/screenshot-file-Dix2Qynm.js +127 -0
- package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
- package/dist/{framework-JFLjmD5Y.js → selection-C439nEhn.js} +4 -54
- package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
- package/dist/{server-CcZGdYjE.js → server-C_aMxzvS.js} +40 -18
- package/dist/server-Cif9w5lM.js +33 -0
- package/dist/{session-dHBtgSN0.js → session-B7frlXXQ.js} +1 -1
- package/dist/{base-83ZTv6up.js → session-CfG3gzko.js} +8 -83
- package/dist/session-DvaPyOuH.js +5 -0
- package/dist/{migration-BUedsREQ.js → setup-DQEasPhx.js} +290 -28
- package/dist/skills/index.json +5 -0
- package/dist/skills/superwall/SKILL.md +37 -10
- package/dist/skills/superwall/references/api.md +66 -21
- package/dist/skills/superwall/references/asa.md +109 -64
- package/dist/skills/superwall/references/dashboard-links.md +65 -28
- package/dist/skills/superwall/references/data-analytics.md +1 -1
- package/dist/skills/superwall/workflows/dashboard/setup.md +15 -5
- package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/skills/superwall-framework/SKILL.md +248 -36
- package/dist/skills/superwall-framework/references/cli.md +98 -7
- package/dist/skills/superwall-framework/references/examples.md +2 -2
- package/dist/skills/superwall-framework/references/layout.md +30 -2
- package/dist/skills/superwall-framework/references/migrate-from-editor.md +5 -0
- package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
- package/dist/skills/teleport/SKILL.md +154 -0
- package/dist/skills/teleport/references/experiments.md +328 -0
- package/dist/skills/teleport/references/setup.md +157 -0
- package/dist/{skills-Q7xB784d.js → skills-DnegE1A6.js} +139 -9
- package/dist/{skills-Bqz2l_bx.js → skills-MmF7IyTg.js} +8 -12
- package/dist/source-DQs6iLtC.js +82 -0
- package/dist/{source-push-CG948HrX.js → source-push-MbJjh4Ki.js} +38 -14
- package/dist/{spinner-IA6hV8nI.js → spinner-Dcr-Dqdi.js} +7 -5
- package/dist/{starter-BtUUQWhd.js → starter-BlJ_InZJ.js} +2 -2
- package/dist/{status-CB_MrFu5.js → status-DHRxg1ZA.js} +9 -11
- package/dist/{output-Ggzq5_-t.js → storage-DdIAHolY.js} +40 -1
- package/dist/storekit-De998QOt.js +203 -0
- package/dist/storekit-iBCWmeKn.js +15 -0
- package/dist/{bind-DcWIIPgk.js → theme-BrUrye-c.js} +29 -6
- package/dist/token-CKCBQ4I8.js +100 -0
- package/dist/tools-skills/animate-onboarding/SKILL.md +1 -1
- package/dist/tools-skills/mobile-design/SKILL.md +1 -1
- package/dist/tools-skills/onboarding-questions/SKILL.md +1 -1
- package/dist/tools-skills/superwall/SKILL.md +43 -17
- package/dist/tools-skills/superwall/references/api.md +74 -24
- package/dist/tools-skills/superwall/references/asa.md +109 -64
- package/dist/tools-skills/superwall/references/dashboard-links.md +65 -28
- package/dist/tools-skills/superwall/references/data-analytics.md +1 -1
- package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +4 -3
- package/dist/tools-skills/superwall/workflows/dashboard/setup.md +21 -8
- package/dist/tools-skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/tools-skills/superwall/workflows/migrate/adapty.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/playbook.md +2 -2
- package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +4 -3
- package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +4 -3
- package/dist/tools-skills/superwall-editor/SKILL.md +2 -3
- package/dist/tools-skills/teleport/SKILL.md +154 -0
- package/dist/tools-skills/teleport/references/experiments.md +328 -0
- package/dist/tools-skills/teleport/references/setup.md +157 -0
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +1232 -746
- package/dist/{try-CS3jLyoP.js → try-C8QQbG0b.js} +17 -19
- package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
- package/dist/upgrade-CYFdpVpi.js +27 -0
- package/dist/upgrade-D0thxCA4.js +348 -0
- package/package.json +11 -3
- package/dist/config-CGcG7GOt.js +0 -113
- package/dist/create-Du8Fx7W5.js +0 -20
- package/dist/existing-WQ3pz94o.js +0 -97
- package/dist/held-DmOhszHR.js +0 -17
- package/dist/log-C0MDCfA2.js +0 -62
- package/dist/login-D9jfRO8w.js +0 -17
- package/dist/pull-CO5HlqBe.js +0 -36
- package/dist/push-BIhGDNpL.js +0 -30
- package/dist/push-BgqTddLA.js +0 -22
- package/dist/run-B-YoyB-a.js +0 -100
- package/dist/scan-BU41gcQY.js +0 -4
- package/dist/screenshot-file-XAS0Xy0e.js +0 -16
- package/dist/server-BemmM1FV.js +0 -29
- package/dist/session-4aITGsF1.js +0 -6
- package/dist/setup-m94dpT3t.js +0 -217
- package/dist/spawn-DmmmHIP-.js +0 -71
- package/dist/storage-pR0Wb0d9.js +0 -41
- package/dist/storekit-BMxyYAHj.js +0 -17
- package/dist/storekit-CQnwlpKV.js +0 -47
- package/dist/telemetry-DU56L7Cy.js +0 -56
- package/dist/theme-DUsCh-Vd.js +0 -25
- package/dist/token-BbUeExGJ.js +0 -70
- package/dist/upgrade-CKn88PZD.js +0 -206
- package/dist/upgrade-DfD3-ClG.js +0 -7
- /package/dist/{browser-Bp3yRKlU.js → browser-BVjaf98V.js} +0 -0
- /package/dist/{client-BJQXl62Q.js → client-BwYhzITp.js} +0 -0
- /package/dist/{design-lint-CiFc78aM.js → design-lint-mgO-2SGS.js} +0 -0
- /package/dist/{devtools-ByZ6XYnn.js → devtools-B6Vp6HMy.js} +0 -0
- /package/dist/{input-MDd67UIp.js → input-DOT_2Zvb.js} +0 -0
- /package/dist/{project-NoMtbMyl.js → project-BomArwSj.js} +0 -0
- /package/dist/{reports-HYVp169R.js → reports-hbxsd3Zo.js} +0 -0
- /package/dist/{storage-Bdz5AmqS.d.ts → storage-Bh3wT1Rn.d.ts} +0 -0
- /package/dist/{timing-Ca0TXY-A.js → timing-BKEEIBij.js} +0 -0
- /package/dist/{ui-D_qf3Gvw.js → ui-hFgji1e8.js} +0 -0
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import "./
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import
|
|
13
|
-
import { r as dashboardOrigin } from "./resolve-
|
|
14
|
-
import { a as findEntrypoint, s as readProject, t as ArtifactError } from "./project-
|
|
15
|
-
import "./
|
|
16
|
-
import "./
|
|
17
|
-
import { _ as DRAFT_MODULE_MAX_BYTES, a as summarizeSeries, c as defaultRange, n as parseFilters, u as bundleArtifact } from "./series-D2ZpZ8cx.js";
|
|
18
|
-
import { n as resolveOrganization, t as resolveAppScope } from "./organization-CmuQwcKN.js";
|
|
1
|
+
import "./token-CKCBQ4I8.js";
|
|
2
|
+
import "./storage-DdIAHolY.js";
|
|
3
|
+
import "./environment-Dn7irhZr.js";
|
|
4
|
+
import { y as ApiError } from "./config-DCqRQTJ4.js";
|
|
5
|
+
import "./resources-BaURbSpY.js";
|
|
6
|
+
import "./orgs-ltP8H0Nl.js";
|
|
7
|
+
import "./ui-hFgji1e8.js";
|
|
8
|
+
import "./spinner-Dcr-Dqdi.js";
|
|
9
|
+
import "./lookup-DkcT4E-5.js";
|
|
10
|
+
import "./types-Dc9U_4kp.js";
|
|
11
|
+
import { n as openBrowser } from "./browser-BVjaf98V.js";
|
|
12
|
+
import "./scope-Cg1AdAfO.js";
|
|
13
|
+
import { r as dashboardOrigin } from "./resolve-B4bd3Qjl.js";
|
|
14
|
+
import { a as findEntrypoint, s as readProject, t as ArtifactError } from "./project-BomArwSj.js";
|
|
15
|
+
import { _ as DRAFT_MODULE_MAX_BYTES, a as summarizeSeries, c as defaultRange, n as parseFilters, u as bundleArtifact } from "./series-B8NJK4yS.js";
|
|
16
|
+
import { n as resolveOrganization, t as resolveAppScope } from "./organization-9R_1PJKk.js";
|
|
19
17
|
import "./download-DhGd4hOB.js";
|
|
20
|
-
import { i as warnIfSdkBehind } from "./sdk-
|
|
18
|
+
import { i as warnIfSdkBehind } from "./sdk-BFunw4Hc.js";
|
|
21
19
|
|
|
22
20
|
//#region src/core/artifacts/try.ts
|
|
23
21
|
async function postDraft(ctx, path, body, options = {}) {
|
|
@@ -1,84 +1,6 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
|
|
4
|
-
//#region src/core/paywalls/project/types.ts
|
|
5
|
-
const TYPES_FILE = "superwall.d.ts";
|
|
6
|
-
const SUPERSEDED = ["superwall-env.d.ts", "superwall-routes.d.ts"];
|
|
7
|
-
const HEADER = `// Generated by the Superwall CLI. Commit it; don't edit it, and don't delete it.
|
|
8
|
-
// It is what makes \`import hero from "./assets/hero.jpg"\` typecheck and what
|
|
9
|
-
// makes router.push("...") autocomplete and reject typos. \`superwall dev\`
|
|
10
|
-
// rewrites it whenever your app/ directories change.
|
|
11
|
-
|
|
12
|
-
/// <reference types="superwall/assets" />
|
|
13
|
-
`;
|
|
14
|
-
const routeBlock = (names) => [
|
|
15
|
-
"declare module \"superwall/navigation\" {",
|
|
16
|
-
" interface SuperwallRoutes {",
|
|
17
|
-
...names.map((name) => ` ${JSON.stringify(name)}: true;`),
|
|
18
|
-
" }",
|
|
19
|
-
"}",
|
|
20
|
-
"",
|
|
21
|
-
"export type SuperwallRouteName = keyof import(\"superwall/navigation\").SuperwallRoutes;"
|
|
22
|
-
].join("\n");
|
|
23
|
-
const isStripeIdentifier = (identifier) => /^(test|live):price_[^:]+/.test(identifier);
|
|
24
|
-
const productBlock = (references, stripe) => [
|
|
25
|
-
"declare module \"superwall/hooks\" {",
|
|
26
|
-
" interface SuperwallProducts {",
|
|
27
|
-
...references.map((name) => ` ${JSON.stringify(name)}: true;`),
|
|
28
|
-
" }",
|
|
29
|
-
"",
|
|
30
|
-
" interface SuperwallStripeProducts {",
|
|
31
|
-
...stripe.map((name) => ` ${JSON.stringify(name)}: true;`),
|
|
32
|
-
" }",
|
|
33
|
-
"}"
|
|
34
|
-
].join("\n");
|
|
35
|
-
const productIdsOf = (surface) => surface.productIds ?? Object.fromEntries(Object.entries(surface.products).map(([reference, id]) => [reference, [id]]));
|
|
36
|
-
const declaredPlatforms = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : void 0;
|
|
37
|
-
async function collectProjectDeclarations(framework, root) {
|
|
38
|
-
const declarations = {
|
|
39
|
-
products: {},
|
|
40
|
-
platforms: {}
|
|
41
|
-
};
|
|
42
|
-
if (!framework.studioProject) return declarations;
|
|
43
|
-
try {
|
|
44
|
-
const payload = await framework.studioProject(root);
|
|
45
|
-
for (const surface of payload.surfaces) {
|
|
46
|
-
for (const [reference, ids] of Object.entries(productIdsOf(surface))) declarations.products[reference] = [...new Set([...declarations.products[reference] ?? [], ...ids])];
|
|
47
|
-
if (typeof surface.kind === "string" && typeof surface.id === "string") declarations.platforms[`${surface.kind}/${surface.id}`] = declaredPlatforms(surface.platforms);
|
|
48
|
-
}
|
|
49
|
-
return declarations;
|
|
50
|
-
} catch {
|
|
51
|
-
return declarations;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function projectTypes(project, products = {}) {
|
|
55
|
-
const names = /* @__PURE__ */ new Set();
|
|
56
|
-
for (const surface of project.surfaces) for (const route of surface.routes) names.add(route.name);
|
|
57
|
-
const sorted = [...names].sort();
|
|
58
|
-
const sortedProducts = Object.keys(products).sort();
|
|
59
|
-
const sortedStripe = Object.entries(products).filter(([, identifiers]) => identifiers.some(isStripeIdentifier)).map(([name]) => name).sort();
|
|
60
|
-
const blocks = [sorted.length > 0 ? routeBlock(sorted) : "", sortedProducts.length > 0 ? productBlock(sortedProducts, sortedStripe) : ""].filter(Boolean);
|
|
61
|
-
return blocks.length === 0 ? `${HEADER}\nexport {};\n` : `${HEADER}\n${blocks.join("\n\n")}\n`;
|
|
62
|
-
}
|
|
63
|
-
function writeProjectTypes(project, products = {}) {
|
|
64
|
-
const file = path.join(project.superwallDir, TYPES_FILE);
|
|
65
|
-
const next = projectTypes(project, products);
|
|
66
|
-
try {
|
|
67
|
-
if (!fs.existsSync(file) || fs.readFileSync(file, "utf8") !== next) fs.writeFileSync(file, next);
|
|
68
|
-
} catch {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
for (const name of SUPERSEDED) {
|
|
72
|
-
const stale = path.join(project.superwallDir, name);
|
|
73
|
-
try {
|
|
74
|
-
if (fs.readFileSync(stale, "utf8").includes("Superwall CLI")) fs.rmSync(stale);
|
|
75
|
-
} catch {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
//#endregion
|
|
82
4
|
//#region src/core/paywalls/project/lock.ts
|
|
83
5
|
const isScreenOrigin = (origin) => "path" in origin;
|
|
84
6
|
const isFileName = (value) => typeof value === "string" && value !== "" && !/[\\/]/.test(value) && !value.startsWith(".");
|
|
@@ -205,8 +127,14 @@ function formatLock(lock) {
|
|
|
205
127
|
};
|
|
206
128
|
return `${JSON.stringify(annotated, null, 2)}\n`;
|
|
207
129
|
}
|
|
208
|
-
|
|
130
|
+
const settled = ({ sourcePending: _,...binding }) => binding;
|
|
131
|
+
function formatSharedLock(superwallDir, landing) {
|
|
209
132
|
const { sources: _,...lock } = readLock(superwallDir);
|
|
133
|
+
if (landing) {
|
|
134
|
+
const section = landing.kind === "paywall" ? lock.paywalls : lock.funnels;
|
|
135
|
+
const bindings = section[landing.id];
|
|
136
|
+
if (bindings) section[landing.id] = Object.fromEntries(Object.entries(bindings).map(([platform, binding]) => [platform, binding.paywallId === landing.paywallId ? settled(binding) : binding]));
|
|
137
|
+
}
|
|
210
138
|
return formatLock(lock);
|
|
211
139
|
}
|
|
212
140
|
function writeLock(superwallDir, lock) {
|
|
@@ -285,4 +213,82 @@ const describeBindings = (bindings) => {
|
|
|
285
213
|
};
|
|
286
214
|
|
|
287
215
|
//#endregion
|
|
288
|
-
|
|
216
|
+
//#region src/core/paywalls/project/types.ts
|
|
217
|
+
const TYPES_FILE = "superwall.d.ts";
|
|
218
|
+
const SUPERSEDED = ["superwall-env.d.ts", "superwall-routes.d.ts"];
|
|
219
|
+
const HEADER = `// Generated by the Superwall CLI. Commit it; don't edit it, and don't delete it.
|
|
220
|
+
// It is what makes \`import hero from "./assets/hero.jpg"\` typecheck and what
|
|
221
|
+
// makes router.push("...") autocomplete and reject typos. \`superwall dev\`
|
|
222
|
+
// rewrites it whenever your app/ directories change.
|
|
223
|
+
|
|
224
|
+
/// <reference types="superwall/assets" />
|
|
225
|
+
`;
|
|
226
|
+
const routeBlock = (names) => [
|
|
227
|
+
"declare module \"superwall/navigation\" {",
|
|
228
|
+
" interface SuperwallRoutes {",
|
|
229
|
+
...names.map((name) => ` ${JSON.stringify(name)}: true;`),
|
|
230
|
+
" }",
|
|
231
|
+
"}",
|
|
232
|
+
"",
|
|
233
|
+
"export type SuperwallRouteName = keyof import(\"superwall/navigation\").SuperwallRoutes;"
|
|
234
|
+
].join("\n");
|
|
235
|
+
const isStripeIdentifier = (identifier) => /^(test|live):price_[^:]+/.test(identifier);
|
|
236
|
+
const productBlock = (references, stripe) => [
|
|
237
|
+
"declare module \"superwall/hooks\" {",
|
|
238
|
+
" interface SuperwallProducts {",
|
|
239
|
+
...references.map((name) => ` ${JSON.stringify(name)}: true;`),
|
|
240
|
+
" }",
|
|
241
|
+
"",
|
|
242
|
+
" interface SuperwallStripeProducts {",
|
|
243
|
+
...stripe.map((name) => ` ${JSON.stringify(name)}: true;`),
|
|
244
|
+
" }",
|
|
245
|
+
"}"
|
|
246
|
+
].join("\n");
|
|
247
|
+
const productIdsOf = (surface) => surface.productIds ?? Object.fromEntries(Object.entries(surface.products).map(([reference, id]) => [reference, [id]]));
|
|
248
|
+
const declaredPlatforms = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : void 0;
|
|
249
|
+
async function collectProjectDeclarations(framework, root) {
|
|
250
|
+
const declarations = {
|
|
251
|
+
products: {},
|
|
252
|
+
platforms: {}
|
|
253
|
+
};
|
|
254
|
+
if (!framework.studioProject) return declarations;
|
|
255
|
+
try {
|
|
256
|
+
const payload = await framework.studioProject(root);
|
|
257
|
+
for (const surface of payload.surfaces) {
|
|
258
|
+
for (const [reference, ids] of Object.entries(productIdsOf(surface))) declarations.products[reference] = [...new Set([...declarations.products[reference] ?? [], ...ids])];
|
|
259
|
+
if (typeof surface.kind === "string" && typeof surface.id === "string") declarations.platforms[`${surface.kind}/${surface.id}`] = declaredPlatforms(surface.platforms);
|
|
260
|
+
}
|
|
261
|
+
return declarations;
|
|
262
|
+
} catch {
|
|
263
|
+
return declarations;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function projectTypes(project, products = {}) {
|
|
267
|
+
const names = /* @__PURE__ */ new Set();
|
|
268
|
+
for (const surface of project.surfaces) for (const route of surface.routes) names.add(route.name);
|
|
269
|
+
const sorted = [...names].sort();
|
|
270
|
+
const sortedProducts = Object.keys(products).sort();
|
|
271
|
+
const sortedStripe = Object.entries(products).filter(([, identifiers]) => identifiers.some(isStripeIdentifier)).map(([name]) => name).sort();
|
|
272
|
+
const blocks = [sorted.length > 0 ? routeBlock(sorted) : "", sortedProducts.length > 0 ? productBlock(sortedProducts, sortedStripe) : ""].filter(Boolean);
|
|
273
|
+
return blocks.length === 0 ? `${HEADER}\nexport {};\n` : `${HEADER}\n${blocks.join("\n\n")}\n`;
|
|
274
|
+
}
|
|
275
|
+
function writeProjectTypes(project, products = {}) {
|
|
276
|
+
const file = path.join(project.superwallDir, TYPES_FILE);
|
|
277
|
+
const next = projectTypes(project, products);
|
|
278
|
+
try {
|
|
279
|
+
if (!fs.existsSync(file) || fs.readFileSync(file, "utf8") !== next) fs.writeFileSync(file, next);
|
|
280
|
+
} catch {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
for (const name of SUPERSEDED) {
|
|
284
|
+
const stale = path.join(project.superwallDir, name);
|
|
285
|
+
try {
|
|
286
|
+
if (fs.readFileSync(stale, "utf8").includes("Superwall CLI")) fs.rmSync(stale);
|
|
287
|
+
} catch {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
//#endregion
|
|
294
|
+
export { writeLock as _, describeBindings as a, writeSources as b, isScreenOrigin as c, parseSources as d, readLock as f, writeBindings as g, writeBinding as h, NewerLockError as i, originKey as l, writeApp as m, collectProjectDeclarations as n, formatLock as o, removeBinding as p, writeProjectTypes as r, formatSharedLock as s, TYPES_FILE as t, parseLock as u, writeOrigin as v, writeSnapshot as y };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "./token-CKCBQ4I8.js";
|
|
2
|
+
import "./storage-DdIAHolY.js";
|
|
3
|
+
import "./environment-Dn7irhZr.js";
|
|
4
|
+
import "./config-DCqRQTJ4.js";
|
|
5
|
+
import "./skills-DnegE1A6.js";
|
|
6
|
+
import "./scan-DugxddUU.js";
|
|
7
|
+
import "./resources-BaURbSpY.js";
|
|
8
|
+
import "./orgs-ltP8H0Nl.js";
|
|
9
|
+
import "./ui-hFgji1e8.js";
|
|
10
|
+
import "./spinner-Dcr-Dqdi.js";
|
|
11
|
+
import "./org-BV8wwxwc.js";
|
|
12
|
+
import "./theme-BrUrye-c.js";
|
|
13
|
+
import "./lookup-DkcT4E-5.js";
|
|
14
|
+
import "./types-Dc9U_4kp.js";
|
|
15
|
+
import "./session-CfG3gzko.js";
|
|
16
|
+
import "./existing-BQMB_2AG.js";
|
|
17
|
+
import "./paths-Cb1RfjaX.js";
|
|
18
|
+
import "./setup-DQEasPhx.js";
|
|
19
|
+
import "./framework-DW5fqjh4.js";
|
|
20
|
+
import "./login-BMHDhxAx.js";
|
|
21
|
+
import "./browser-BVjaf98V.js";
|
|
22
|
+
import "./login-B7IqDafm.js";
|
|
23
|
+
import "./git-Hf9Wc7Hp.js";
|
|
24
|
+
import "./scope-Cg1AdAfO.js";
|
|
25
|
+
import { a as printAutoUpdate, c as renderUpdateNotice, d as runUpgrade, f as selectAutoUpdate, i as maybeNotifyUpdate, l as resolveUpdate, n as isGlobalInstall, o as recordAutoUpdate, p as selectCachedLatest, r as isNewerVersion, s as refreshUpdateCheck, t as flushUpdateCheck, u as resolveUpdateTag } from "./upgrade-D0thxCA4.js";
|
|
26
|
+
|
|
27
|
+
export { flushUpdateCheck, isGlobalInstall, isNewerVersion, maybeNotifyUpdate, printAutoUpdate, recordAutoUpdate, refreshUpdateCheck, renderUpdateNotice, resolveUpdate, resolveUpdateTag, runUpgrade, selectAutoUpdate, selectCachedLatest };
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { _ as RUNNING_VIA_NPX, a as AUTO_UPDATE, x as VERSION } from "./environment-Dn7irhZr.js";
|
|
2
|
+
import { c as readSkillsSync, d as writeAutoUpdate, l as readUpdateCheck, n as readAutoUpdate, v as writeUpdateCheck } from "./config-DCqRQTJ4.js";
|
|
3
|
+
import { v as spawnStream } from "./skills-DnegE1A6.js";
|
|
4
|
+
import { i as readPackageJson, r as allDeps } from "./scan-DugxddUU.js";
|
|
5
|
+
import { M as textField, j as parseJson } from "./resources-BaURbSpY.js";
|
|
6
|
+
import { c as selectLockfileManagers } from "./setup-DQEasPhx.js";
|
|
7
|
+
import { execSync } from "node:child_process";
|
|
8
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
import pc from "picocolors";
|
|
13
|
+
|
|
14
|
+
//#region src/core/support/project-install.ts
|
|
15
|
+
function selectInstallDir(from) {
|
|
16
|
+
for (let dir = from;; dir = dirname(dir)) {
|
|
17
|
+
if (existsSync(join(dir, "node_modules", "superwall", "package.json"))) return dir;
|
|
18
|
+
if (dir === dirname(dir)) return void 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function selectDirsBetween(from, to) {
|
|
22
|
+
const dirs = [];
|
|
23
|
+
for (let dir = from;; dir = dirname(dir)) {
|
|
24
|
+
dirs.push(dir);
|
|
25
|
+
if (dir === to || dir === dirname(dir)) return dirs;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function dependsOnSuperwall(dir) {
|
|
29
|
+
return "superwall" in allDeps(readPackageJson(dir));
|
|
30
|
+
}
|
|
31
|
+
function resolveInstallCommand(dirs) {
|
|
32
|
+
for (const dir of dirs) {
|
|
33
|
+
const [manager] = selectLockfileManagers(dir);
|
|
34
|
+
if (manager) return manager === "npm" ? "npm i" : `${manager} add`;
|
|
35
|
+
}
|
|
36
|
+
return "npm i";
|
|
37
|
+
}
|
|
38
|
+
function selectProjectInstall(dir = process.cwd(), tag = "latest") {
|
|
39
|
+
const cwd = realpathSync(dir);
|
|
40
|
+
for (const anchor of [join(cwd, "superwall", "package.json"), join(cwd, "package.json")]) {
|
|
41
|
+
const installDir = selectInstallDir(dirname(anchor));
|
|
42
|
+
if (!installDir) continue;
|
|
43
|
+
const packageJson = join(installDir, "node_modules", "superwall", "package.json");
|
|
44
|
+
const projectDir = selectDirsBetween(dirname(anchor), installDir).find(dependsOnSuperwall) ?? installDir;
|
|
45
|
+
const where = relative(cwd, projectDir);
|
|
46
|
+
const install = `${resolveInstallCommand([...selectDirsBetween(projectDir, installDir), cwd])} superwall@${tag}`;
|
|
47
|
+
return {
|
|
48
|
+
version: textField(parseJson(readFileSync(packageJson, "utf8")), "version"),
|
|
49
|
+
manifest: join(where, "package.json"),
|
|
50
|
+
update: where ? `cd ${where} && ${install}` : install
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/core/support/upgrade.ts
|
|
57
|
+
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
58
|
+
const REGISTRY_URL = "https://registry.npmjs.org/superwall/";
|
|
59
|
+
const RELEASE_NOTES_URL = "https://github.com/superwall/superwall/releases/tag/v";
|
|
60
|
+
const pending = [];
|
|
61
|
+
function isNewerVersion(latest, current) {
|
|
62
|
+
const [latestCore = "", latestPre] = splitPrerelease(latest);
|
|
63
|
+
const [currentCore = "", currentPre] = splitPrerelease(current);
|
|
64
|
+
const l = latestCore.split(".").map((n) => parseInt(n, 10));
|
|
65
|
+
const c = currentCore.split(".").map((n) => parseInt(n, 10));
|
|
66
|
+
for (let i = 0; i < 3; i++) {
|
|
67
|
+
const a = l[i] ?? 0;
|
|
68
|
+
const b = c[i] ?? 0;
|
|
69
|
+
if (Number.isNaN(a) || Number.isNaN(b)) return false;
|
|
70
|
+
if (a !== b) return a > b;
|
|
71
|
+
}
|
|
72
|
+
if (currentPre === void 0) return false;
|
|
73
|
+
if (latestPre === void 0) return true;
|
|
74
|
+
return comparePrerelease(latestPre.split("."), currentPre.split(".")) > 0;
|
|
75
|
+
}
|
|
76
|
+
function splitPrerelease(full) {
|
|
77
|
+
const plus = full.indexOf("+");
|
|
78
|
+
const version = plus === -1 ? full : full.slice(0, plus);
|
|
79
|
+
const dash = version.indexOf("-");
|
|
80
|
+
return dash === -1 ? [version, void 0] : [version.slice(0, dash), version.slice(dash + 1)];
|
|
81
|
+
}
|
|
82
|
+
function comparePrerelease(a, b) {
|
|
83
|
+
const numeric = /^\d+$/;
|
|
84
|
+
for (let i = 0; i < Math.min(a.length, b.length); i++) {
|
|
85
|
+
const x = a[i] ?? "";
|
|
86
|
+
const y = b[i] ?? "";
|
|
87
|
+
if (x === y) continue;
|
|
88
|
+
if (numeric.test(x) && numeric.test(y)) return Number(x) - Number(y);
|
|
89
|
+
if (numeric.test(x)) return -1;
|
|
90
|
+
if (numeric.test(y)) return 1;
|
|
91
|
+
return x < y ? -1 : 1;
|
|
92
|
+
}
|
|
93
|
+
return a.length - b.length;
|
|
94
|
+
}
|
|
95
|
+
function resolveUpdateTag(version = VERSION) {
|
|
96
|
+
return splitPrerelease(version)[1] === void 0 ? "latest" : "next";
|
|
97
|
+
}
|
|
98
|
+
async function selectLatestVersion(current = VERSION) {
|
|
99
|
+
try {
|
|
100
|
+
const res = await fetch(`${REGISTRY_URL}${resolveUpdateTag(current)}`, {
|
|
101
|
+
headers: { accept: "application/json" },
|
|
102
|
+
signal: AbortSignal.timeout(5e3)
|
|
103
|
+
});
|
|
104
|
+
if (!res.ok) return null;
|
|
105
|
+
const { version } = await res.json();
|
|
106
|
+
return version ?? null;
|
|
107
|
+
} catch {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function majorOf(version) {
|
|
112
|
+
return parseInt(version.split(".")[0] ?? "", 10);
|
|
113
|
+
}
|
|
114
|
+
function selectCachedLatest(current = VERSION) {
|
|
115
|
+
const tag = resolveUpdateTag(current);
|
|
116
|
+
const cached = readUpdateCheck(tag);
|
|
117
|
+
if ((cached?.tag ?? "latest") !== tag) return void 0;
|
|
118
|
+
return cached?.latest;
|
|
119
|
+
}
|
|
120
|
+
function selectAvailableUpdate(current = VERSION) {
|
|
121
|
+
const latest = selectCachedLatest(current);
|
|
122
|
+
if (!latest || !isNewerVersion(latest, current)) return null;
|
|
123
|
+
return latest;
|
|
124
|
+
}
|
|
125
|
+
function recordLatest(latest, current = VERSION) {
|
|
126
|
+
writeUpdateCheck({
|
|
127
|
+
latest,
|
|
128
|
+
tag: resolveUpdateTag(current),
|
|
129
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function refreshUpdateCheck(current = VERSION) {
|
|
133
|
+
if (process.env.NODE_TEST_CONTEXT) return;
|
|
134
|
+
const tag = resolveUpdateTag(current);
|
|
135
|
+
const cached = readUpdateCheck(tag);
|
|
136
|
+
if ((cached?.checkedAt ? Date.now() - Date.parse(cached.checkedAt) : Infinity) < CHECK_INTERVAL_MS && (cached?.tag ?? "latest") === tag) return;
|
|
137
|
+
pending.push(selectLatestVersion(current).then((version) => {
|
|
138
|
+
if (version) recordLatest(version, current);
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
async function flushUpdateCheck(capMs = 2e3) {
|
|
142
|
+
if (pending.length === 0) return;
|
|
143
|
+
await Promise.race([Promise.allSettled(pending), new Promise((done) => setTimeout(done, capMs).unref())]);
|
|
144
|
+
}
|
|
145
|
+
function resolveUpdateKind(latest, current) {
|
|
146
|
+
const [l = 0, lm = 0] = splitPrerelease(latest)[0].split(".").map((n) => parseInt(n, 10));
|
|
147
|
+
const [c = 0, cm = 0] = splitPrerelease(current)[0].split(".").map((n) => parseInt(n, 10));
|
|
148
|
+
if (l !== c) return "major";
|
|
149
|
+
return lm !== cm ? "minor" : "patch";
|
|
150
|
+
}
|
|
151
|
+
function resolveUpdate(dir = process.cwd(), current = VERSION) {
|
|
152
|
+
const latest = selectAvailableUpdate(current);
|
|
153
|
+
if (!latest) return void 0;
|
|
154
|
+
const project = selectProjectInstall(dir, resolveUpdateTag(current));
|
|
155
|
+
return {
|
|
156
|
+
current,
|
|
157
|
+
latest,
|
|
158
|
+
kind: resolveUpdateKind(latest, current),
|
|
159
|
+
command: project ? project.update : "superwall upgrade",
|
|
160
|
+
notes: `${RELEASE_NOTES_URL}${latest}`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function renderUpdateNotice(update) {
|
|
164
|
+
const { current, latest, command, notes } = update;
|
|
165
|
+
if (update.kind !== "major") return `${pc.yellow("Update available")} ${current} → ${latest} · run ${pc.bold(command)}`;
|
|
166
|
+
return [
|
|
167
|
+
pc.yellow(pc.bold(`Major update available ${current} → ${latest}`)),
|
|
168
|
+
` A major release may contain breaking changes. Read ${pc.cyan(notes)}`,
|
|
169
|
+
` Update: ${pc.bold(command)}`
|
|
170
|
+
].join("\n");
|
|
171
|
+
}
|
|
172
|
+
function maybeNotifyUpdate(stream) {
|
|
173
|
+
const update = resolveUpdate();
|
|
174
|
+
if (update) stream.write(`${renderUpdateNotice(update)}\n`);
|
|
175
|
+
}
|
|
176
|
+
function selectAutoUpdate() {
|
|
177
|
+
if (process.env.NODE_TEST_CONTEXT || !AUTO_UPDATE()) return null;
|
|
178
|
+
const latest = selectAvailableUpdate();
|
|
179
|
+
if (!latest || majorOf(latest) !== majorOf(VERSION)) return null;
|
|
180
|
+
const last = readAutoUpdate();
|
|
181
|
+
if (last?.version === latest && Date.now() - Date.parse(last.startedAt) < CHECK_INTERVAL_MS) return null;
|
|
182
|
+
return latest;
|
|
183
|
+
}
|
|
184
|
+
function recordAutoUpdate(version) {
|
|
185
|
+
writeAutoUpdate({
|
|
186
|
+
version,
|
|
187
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function printAutoUpdate(stream, version) {
|
|
191
|
+
stream.write(`${pc.dim(`Updating ${VERSION} → ${version} in the background`)}\n`);
|
|
192
|
+
}
|
|
193
|
+
function isGlobalInstall(file = fileURLToPath(import.meta.url)) {
|
|
194
|
+
try {
|
|
195
|
+
const root = execSync("npm root --global", {
|
|
196
|
+
encoding: "utf8",
|
|
197
|
+
timeout: 3e3,
|
|
198
|
+
stdio: [
|
|
199
|
+
"ignore",
|
|
200
|
+
"pipe",
|
|
201
|
+
"ignore"
|
|
202
|
+
]
|
|
203
|
+
}).trim();
|
|
204
|
+
return root !== "" && realpathSync(file).startsWith(`${realpathSync(root)}${sep}`);
|
|
205
|
+
} catch {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const SKILLS_OUTCOME = {
|
|
210
|
+
current: "Superwall skills are up to date",
|
|
211
|
+
updated: "Superwall skills updated",
|
|
212
|
+
failed: "Superwall skills not updated"
|
|
213
|
+
};
|
|
214
|
+
async function updateAgentSkills(ctx, work) {
|
|
215
|
+
const spin = ctx.ui.spinner();
|
|
216
|
+
spin.start("Checking Superwall skills");
|
|
217
|
+
const skills = await work().catch(() => "failed");
|
|
218
|
+
spin.stop(SKILLS_OUTCOME[skills]);
|
|
219
|
+
if (skills === "failed") ctx.ui.warn("Couldn't update the Superwall skills. Run `superwall skills --force` to retry.");
|
|
220
|
+
return skills;
|
|
221
|
+
}
|
|
222
|
+
async function updateSkillsInProcess() {
|
|
223
|
+
const { updateSkills } = await import("./skills-MmF7IyTg.js");
|
|
224
|
+
return updateSkills();
|
|
225
|
+
}
|
|
226
|
+
async function updateSkillsWithInstalledCli(version) {
|
|
227
|
+
const prefix = [];
|
|
228
|
+
const { code } = await spawnStream({
|
|
229
|
+
bin: "npm",
|
|
230
|
+
cmdShim: true,
|
|
231
|
+
args: ["prefix", "--global"],
|
|
232
|
+
cwd: process.cwd(),
|
|
233
|
+
onStdoutLine: (line) => prefix.push(line.trim())
|
|
234
|
+
});
|
|
235
|
+
const bin = prefix[0] ? process.platform === "win32" ? join(prefix[0], "superwall.cmd") : join(prefix[0], "bin", "superwall") : void 0;
|
|
236
|
+
if (code !== 0 || !bin || !existsSync(bin)) return "failed";
|
|
237
|
+
const startedAt = Date.now();
|
|
238
|
+
if ((await spawnStream({
|
|
239
|
+
bin,
|
|
240
|
+
cmdShim: true,
|
|
241
|
+
args: [
|
|
242
|
+
"skills",
|
|
243
|
+
"--force",
|
|
244
|
+
"--yes"
|
|
245
|
+
],
|
|
246
|
+
cwd: tmpdir(),
|
|
247
|
+
onStdoutLine: () => {},
|
|
248
|
+
onStderrLine: () => {}
|
|
249
|
+
})).code !== 0) return "failed";
|
|
250
|
+
const sync = readSkillsSync();
|
|
251
|
+
return sync?.cliVersion === version && Date.parse(sync.syncedAt) >= startedAt ? "updated" : "failed";
|
|
252
|
+
}
|
|
253
|
+
async function runUpgrade(ctx, pinned) {
|
|
254
|
+
const { ui } = ctx;
|
|
255
|
+
if (RUNNING_VIA_NPX()) {
|
|
256
|
+
const project$1 = selectProjectInstall(process.cwd(), resolveUpdateTag());
|
|
257
|
+
const latest$1 = project$1 ? pinned ?? await selectLatestVersion() : null;
|
|
258
|
+
const outdated$1 = project$1 ? isOutdated(project$1, latest$1) : false;
|
|
259
|
+
if (project$1 && outdated$1 !== false) ui.warn(renderProjectPin(project$1, latest$1));
|
|
260
|
+
else if (project$1) ui.info(`This project's superwall \`${project$1.version}\` is the latest - nothing to upgrade.`);
|
|
261
|
+
else ui.info("You're running via npx, which always fetches the latest published version - nothing to upgrade.");
|
|
262
|
+
const skills$1 = await updateAgentSkills(ctx, updateSkillsInProcess);
|
|
263
|
+
if (ctx.json) {
|
|
264
|
+
const data = {
|
|
265
|
+
upgraded: false,
|
|
266
|
+
via: "npx",
|
|
267
|
+
skills: skills$1,
|
|
268
|
+
...projectData(project$1, outdated$1)
|
|
269
|
+
};
|
|
270
|
+
return ctx.output.data(data);
|
|
271
|
+
}
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
ui.intro("Superwall upgrade");
|
|
275
|
+
const spin = ui.spinner();
|
|
276
|
+
spin.start("Checking the latest version");
|
|
277
|
+
const latest = pinned ?? await selectLatestVersion();
|
|
278
|
+
if (!latest) {
|
|
279
|
+
spin.stop("Check failed");
|
|
280
|
+
throw new Error("Couldn't reach the npm registry - try again.");
|
|
281
|
+
}
|
|
282
|
+
if (!isNewerVersion(latest, VERSION)) {
|
|
283
|
+
spin.stop(`You're on the latest version (\`${VERSION}\`)`);
|
|
284
|
+
const skills$1 = await updateAgentSkills(ctx, updateSkillsInProcess);
|
|
285
|
+
if (ctx.json) return ctx.output.data({
|
|
286
|
+
upgraded: false,
|
|
287
|
+
version: VERSION,
|
|
288
|
+
skills: skills$1
|
|
289
|
+
});
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
spin.message(`Upgrading \`${VERSION}\` → \`${latest}\``);
|
|
293
|
+
const errors = [];
|
|
294
|
+
const { code } = await spawnStream({
|
|
295
|
+
bin: "npm",
|
|
296
|
+
cmdShim: true,
|
|
297
|
+
args: [
|
|
298
|
+
"install",
|
|
299
|
+
"--global",
|
|
300
|
+
`superwall@${latest}`
|
|
301
|
+
],
|
|
302
|
+
cwd: process.cwd(),
|
|
303
|
+
onStdoutLine: () => {},
|
|
304
|
+
onStderrLine: (line) => errors.push(line)
|
|
305
|
+
});
|
|
306
|
+
if (code !== 0) {
|
|
307
|
+
spin.stop("Upgrade failed");
|
|
308
|
+
const detail = errors.slice(-3).join(" ").trim();
|
|
309
|
+
throw new Error(`npm couldn't upgrade the package${detail ? ` (${detail.slice(0, 200)})` : ""}. Try: npm install --global superwall@${resolveUpdateTag()}`);
|
|
310
|
+
}
|
|
311
|
+
recordLatest(latest);
|
|
312
|
+
spin.stop(`Upgraded \`${VERSION}\` → \`${latest}\``);
|
|
313
|
+
const skills = await updateAgentSkills(ctx, () => updateSkillsWithInstalledCli(latest));
|
|
314
|
+
const project = selectProjectInstall(process.cwd(), resolveUpdateTag());
|
|
315
|
+
const outdated = project ? isOutdated(project, latest) : false;
|
|
316
|
+
if (ctx.json) return ctx.output.data({
|
|
317
|
+
upgraded: true,
|
|
318
|
+
from: VERSION,
|
|
319
|
+
to: latest,
|
|
320
|
+
skills,
|
|
321
|
+
...projectData(project, outdated)
|
|
322
|
+
});
|
|
323
|
+
if (project && outdated) {
|
|
324
|
+
ui.warn(renderProjectPin(project, latest));
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
ui.outro("You're on the latest version.");
|
|
328
|
+
}
|
|
329
|
+
function isOutdated(project, latest) {
|
|
330
|
+
if (latest === null) return null;
|
|
331
|
+
return project.version === void 0 || isNewerVersion(latest, project.version);
|
|
332
|
+
}
|
|
333
|
+
function renderProjectPin(project, latest) {
|
|
334
|
+
return `${`This project runs its own ${project.version === void 0 ? "a superwall of unknown version" : `superwall \`${project.version}\``} from ${project.manifest}`}${latest === null ? ", and the npm registry couldn't be reached to compare it with the latest." : `, not \`${latest}\`.`} Update it: ${project.update}`;
|
|
335
|
+
}
|
|
336
|
+
function projectData(project, outdated) {
|
|
337
|
+
if (!project) return {};
|
|
338
|
+
const { version, manifest, update } = project;
|
|
339
|
+
return { project: {
|
|
340
|
+
version: version ?? null,
|
|
341
|
+
manifest,
|
|
342
|
+
outdated,
|
|
343
|
+
update
|
|
344
|
+
} };
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
//#endregion
|
|
348
|
+
export { printAutoUpdate as a, renderUpdateNotice as c, runUpgrade as d, selectAutoUpdate as f, maybeNotifyUpdate as i, resolveUpdate as l, selectProjectInstall as m, isGlobalInstall as n, recordAutoUpdate as o, selectCachedLatest as p, isNewerVersion as r, refreshUpdateCheck as s, flushUpdateCheck as t, resolveUpdateTag as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superwall/cli",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "The official CLI for managing Superwall from your terminal or coding agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -63,8 +63,7 @@
|
|
|
63
63
|
"clean": "rm -rf dist"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@
|
|
67
|
-
"@superwall/studio": "2.6.0-beta.2",
|
|
66
|
+
"@superwall/studio": "2.6.1",
|
|
68
67
|
"ansi-escapes": "^7.3.0",
|
|
69
68
|
"fast-glob": "^3.3.3",
|
|
70
69
|
"ink": "^5.2.1",
|
|
@@ -75,7 +74,16 @@
|
|
|
75
74
|
"wrap-ansi": "^9.0.2",
|
|
76
75
|
"yargs": "^17.7.2"
|
|
77
76
|
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.201"
|
|
79
|
+
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"@anthropic-ai/claude-agent-sdk": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
78
85
|
"devDependencies": {
|
|
86
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.201",
|
|
79
87
|
"@types/node": "^22.10.0",
|
|
80
88
|
"@types/react": "^18.3.31",
|
|
81
89
|
"@types/yargs": "^17.0.33",
|