@superwall/cli 2.5.0 → 2.6.0-beta.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 +7 -0
- package/dist/{apple-Dyr7OFBx.js → apple-Bmt_iywx.js} +14 -14
- package/dist/{approve-Czs1-JO9.js → approve-D2UgqaRx.js} +31 -27
- package/dist/{assets-BrB9jQPQ.js → assets-B_quADds.js} +3 -3
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +3 -3
- package/dist/{session-D3fgXQBt.js → base-ChTi42M0.js} +35 -35
- package/dist/{billing-D5qqIlVb.js → billing-ZIETn0j4.js} +3 -3
- package/dist/{bind-B3eEcRyp.js → bind-ClFjTt0U.js} +4 -4
- package/dist/{build-DD9pSwHX.js → build-BWjXurjs.js} +11 -9
- package/dist/{client-AI9H4GGB.js → client-CyrYJzBF.js} +3 -3
- package/dist/create-7HDW3DCl.js +20 -0
- package/dist/{create-B4m-IKlr.js → create-BCIgjRHn.js} +6 -6
- package/dist/{create-ChfgWpiM.js → create-C3uklw-U.js} +31 -31
- package/dist/design-lint-CiFc78aM.js +158 -0
- package/dist/{doctor-XtXW6tKE.js → doctor-D2Q1EZe8.js} +6 -6
- package/dist/{drivers-CMEL13gp.js → drivers-BQkO5tHs.js} +3 -3
- package/dist/entry.js +20 -20
- package/dist/{environment-BWT2S4qC.js → environment-BocmdvZ-.js} +3 -3
- package/dist/{existing-b0GxFcnc.js → existing-Cl5x6_5u.js} +2 -2
- package/dist/{selection-BltBpyp5.js → framework-CLmf4swr.js} +50 -50
- package/dist/{held-D3PUNky2.js → held-Bykbwy-m.js} +6 -6
- package/dist/held-Chw3BtBV.js +17 -0
- package/dist/install-dXZZ79Oe.js +109 -0
- package/dist/{integrate-qvKd9pVW.js → integrate-DiSjlOjC.js} +23 -23
- package/dist/{types-JdxmnCko.js → lock-DgSx-p8Y.js} +79 -79
- package/dist/{login-PMoXUGqq.js → login-5sWIKDI2.js} +6 -6
- package/dist/login-DZ8Pipf6.js +17 -0
- package/dist/{login-COmGHrU5.js → login-Jp6E6d2e.js} +1 -1
- package/dist/{lookup-gjcKIZvh.js → lookup-CWzVfPpq.js} +3 -3
- package/dist/{migrate-SkkLLdmr.js → migrate-BKiOUsMY.js} +29 -29
- package/dist/{migration-DS44-3Zr.js → migration-Z69tLeHC.js} +29 -11
- package/dist/{notification-url-BjQPLf4-.js → notification-url-BDBxbwZq.js} +2 -2
- package/dist/{open-DQpm2yVs.js → open-DNd49kT-.js} +2 -2
- package/dist/{org-C04eAO-j.js → org-Dud1rF9f.js} +3 -3
- package/dist/{organization-BOECL3vZ.js → organization-7vJA3uy1.js} +8 -8
- package/dist/{orgs-D6Kk96mG.js → orgs-Z0H9WOs1.js} +1 -1
- package/dist/{paths-REb-GrbX.js → paths-CzTJVpfi.js} +1 -1
- package/dist/{playbook-Du4Oydbf.js → playbook-DJ__edOW.js} +10 -10
- package/dist/{project-CP6hiHra.js → project-NoMtbMyl.js} +9 -9
- package/dist/{promote-Dm2_b1WK.js → promote-DLtPSvmL.js} +23 -22
- package/dist/{pull-F6pvO4To.js → pull-AoUmaiMK.js} +8 -8
- package/dist/pull-C1xm2zqG.js +36 -0
- package/dist/pull-D-YuT3e0.js +106 -0
- package/dist/push-B42D8fKf.js +22 -0
- package/dist/{push-BIFLhAiO.js → push-BMblzg_6.js} +122 -22
- package/dist/{push-D_l9KJZN.js → push-BrzMFd4Z.js} +47 -47
- package/dist/push-Co5jk6Kr.js +30 -0
- package/dist/{registry-DIJB0mJa.js → registry-DDU10_Ix.js} +176 -155
- package/dist/resolve-DpOSDDdr.js +196 -0
- package/dist/{resources-BaP3p_LY.js → resources-CptT7HD6.js} +2 -2
- package/dist/{run-C5OPwhvS.js → run-c1O2_8pp.js} +2 -2
- package/dist/{run-CgLmD2vR.js → run-r3foWfhV.js} +93 -70
- package/dist/scan-D86kLtM7.js +4 -0
- package/dist/{scan-Bj5y0zTZ.js → scan-nVQO7JLx.js} +1 -1
- package/dist/{scope-CCb_7UvN.js → scope-ehZ7L1nj.js} +25 -11
- package/dist/{scope-Bp_zwJOo.js → scope-l1qGLsgz.js} +5 -5
- package/dist/{sdk-TvT0p_nO.js → sdk-DEfQttek.js} +7 -7
- package/dist/{series-TAixFBWW.js → series-D2ZpZ8cx.js} +96 -63
- package/dist/server-BEcsQaPu.js +29 -0
- package/dist/{server-CdVIboQn.js → server-DLARhh1k.js} +9 -9
- package/dist/session-Csuaw6RU.js +6 -0
- package/dist/{session-Ywim-P8M.js → session-Z0BeaJPf.js} +1 -1
- package/dist/{setup-zzjtTy8k.js → setup-C6NFy14d.js} +9 -9
- package/dist/skills/index.json +2 -2
- package/dist/skills/{superwall-workspaces → superwall-artifacts}/SKILL.md +41 -31
- package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/cli.md +31 -28
- package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/slots.md +9 -9
- package/dist/{skills-2qYaUXGE.js → skills-421SFEyF.js} +4 -4
- package/dist/{skills-8um2fBPS.js → skills-CdKwaTRS.js} +8 -8
- package/dist/{git-D7AVdugb.js → source-BccdO4aL.js} +111 -102
- package/dist/{source-push-kAep4gPe.js → source-push-B4s6r9bB.js} +43 -26
- package/dist/{spinner-BANVLncC.js → spinner-DPdBlZe2.js} +3 -3
- package/dist/{starter-CiLrp1cN.js → starter-0OdVPH4l.js} +27 -27
- package/dist/{status-CoYMK7QL.js → status-Dsc7d3z2.js} +42 -39
- package/dist/{storage-DzP22xKn.js → storage-DT_wxwJ8.js} +1 -1
- package/dist/{storekit-n1x0bWkQ.js → storekit-B9M2raxe.js} +3 -3
- package/dist/storekit-BWZf-fNE.js +17 -0
- package/dist/{telemetry-CXN6f-ZX.js → telemetry-ovPiseFm.js} +1 -1
- package/dist/{token-FmeHywYt.js → token-Bu3FaRkv.js} +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +148 -128
- package/dist/{try-BWbzgelb.js → try-B8FYkTvQ.js} +29 -29
- package/dist/{upgrade-Bk5boOgW.js → upgrade-B7TmvEPP.js} +2 -2
- package/dist/{upgrade-CoWCEnoi.js → upgrade-CAHyrWUL.js} +2 -2
- package/package.json +2 -2
- package/dist/create-CJljlkJK.js +0 -20
- package/dist/held-CX7Zf8u-.js +0 -17
- package/dist/install-CVUXsx8c.js +0 -103
- package/dist/login-ClnJi1Ea.js +0 -17
- package/dist/pull-DsdOoG-D.js +0 -36
- package/dist/pull-zYAbqo9n.js +0 -106
- package/dist/push-CJVfvFZq.js +0 -29
- package/dist/push-SVzv7fzE.js +0 -22
- package/dist/resolve--GsHj0Q1.js +0 -171
- package/dist/scan-v_WTE722.js +0 -4
- package/dist/server-CvJVusw3.js +0 -29
- package/dist/session-B8JNXkwN.js +0 -6
- package/dist/storekit-D5eopLM0.js +0 -17
- /package/dist/{download-2Zu2I_Og.js → download-DhGd4hOB.js} +0 -0
- /package/dist/{reports-CuhB1_ub.js → reports-HYVp169R.js} +0 -0
- /package/dist/{storage-BjQCiTuz.d.ts → storage-Bdz5AmqS.d.ts} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import "./token-Bu3FaRkv.js";
|
|
2
|
+
import "./output-Ggzq5_-t.js";
|
|
3
|
+
import "./environment-BocmdvZ-.js";
|
|
4
|
+
import "./storage-DT_wxwJ8.js";
|
|
5
|
+
import "./client-CyrYJzBF.js";
|
|
6
|
+
import "./config-CGcG7GOt.js";
|
|
7
|
+
import "./telemetry-ovPiseFm.js";
|
|
8
|
+
import "./spawn-DmmmHIP-.js";
|
|
9
|
+
import "./spinner-DPdBlZe2.js";
|
|
10
|
+
import "./ui-D_qf3Gvw.js";
|
|
11
|
+
import "./theme-DUsCh-Vd.js";
|
|
12
|
+
import "./log-C0MDCfA2.js";
|
|
13
|
+
import "./scan-nVQO7JLx.js";
|
|
14
|
+
import "./existing-Cl5x6_5u.js";
|
|
15
|
+
import "./paths-CzTJVpfi.js";
|
|
16
|
+
import "./orgs-Z0H9WOs1.js";
|
|
17
|
+
import "./resources-CptT7HD6.js";
|
|
18
|
+
import "./org-Dud1rF9f.js";
|
|
19
|
+
import "./lookup-CWzVfPpq.js";
|
|
20
|
+
import "./bind-ClFjTt0U.js";
|
|
21
|
+
import "./login-5sWIKDI2.js";
|
|
22
|
+
import "./skills-421SFEyF.js";
|
|
23
|
+
import "./browser-Bp3yRKlU.js";
|
|
24
|
+
import { c as projectRoot, f as readBinding, l as resolveArtifact, m as writeBinding, p as readSourceFile, w as mintSourceAccess } from "./resolve-DpOSDDdr.js";
|
|
25
|
+
import { t as ArtifactError } from "./project-NoMtbMyl.js";
|
|
26
|
+
import "./lock-DgSx-p8Y.js";
|
|
27
|
+
import { t as ARTIFACT_DERIVED_FILES } from "./scope-ehZ7L1nj.js";
|
|
28
|
+
import "./organization-7vJA3uy1.js";
|
|
29
|
+
import "./download-DhGd4hOB.js";
|
|
30
|
+
import "./sdk-DEfQttek.js";
|
|
31
|
+
import "./base-ChTi42M0.js";
|
|
32
|
+
import "./framework-CLmf4swr.js";
|
|
33
|
+
import "./run-c1O2_8pp.js";
|
|
34
|
+
import "./drivers-BQkO5tHs.js";
|
|
35
|
+
import "./migration-Z69tLeHC.js";
|
|
36
|
+
import "./login-Jp6E6d2e.js";
|
|
37
|
+
import { r as pullSourceTree, t as collectSourceFiles } from "./source-BccdO4aL.js";
|
|
38
|
+
import "./setup-C6NFy14d.js";
|
|
39
|
+
import { n as applyPulledChanges } from "./pull-AoUmaiMK.js";
|
|
40
|
+
import { a as toSourceAccess } from "./push-BrzMFd4Z.js";
|
|
41
|
+
import * as fs from "node:fs";
|
|
42
|
+
import * as path from "node:path";
|
|
43
|
+
|
|
44
|
+
//#region src/core/artifacts/pull.ts
|
|
45
|
+
const NOT_PUSHED = "Its source repo is empty: nobody has pushed yet. Run `superwall artifacts push` first.";
|
|
46
|
+
function report(ctx, slug, head, written, skipped) {
|
|
47
|
+
if (ctx.json) {
|
|
48
|
+
ctx.output.data({
|
|
49
|
+
slug,
|
|
50
|
+
head,
|
|
51
|
+
written,
|
|
52
|
+
skipped
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
ctx.ui.success(written.length === 0 ? "Already up to date." : `Pulled ${written.length} ${written.length === 1 ? "file" : "files"} of \`${slug}\`.`);
|
|
57
|
+
if (written.length > 0) ctx.ui.list({ items: written.map((label) => ({ label })) });
|
|
58
|
+
if (skipped.length > 0) ctx.ui.warn(`Not pulled, because a file of yours that git doesn't track is in the way: ${skipped.join(", ")}. Move it, then pull again.`);
|
|
59
|
+
}
|
|
60
|
+
function assertCloneTarget(root) {
|
|
61
|
+
if (!fs.existsSync(root)) return;
|
|
62
|
+
if (fs.readdirSync(root).length > 0) throw new ArtifactError(`${root} already has files and isn't linked to this artifact. Pick an empty directory.`);
|
|
63
|
+
}
|
|
64
|
+
async function runArtifactPull(ctx, input) {
|
|
65
|
+
const root = projectRoot(input.dir);
|
|
66
|
+
const linked = readBinding(root);
|
|
67
|
+
const artifact = await resolveArtifact(ctx, input);
|
|
68
|
+
if (linked && linked.artifactId !== String(artifact.id)) throw new ArtifactError(`This project is linked to artifact ${linked.artifactId}, not ${artifact.id}. Pull into an empty directory instead.`);
|
|
69
|
+
if (!linked) assertCloneTarget(root);
|
|
70
|
+
fs.mkdirSync(root, { recursive: true });
|
|
71
|
+
const collected = linked ? await collectSourceFiles(root, readSourceFile) : {
|
|
72
|
+
ok: true,
|
|
73
|
+
files: []
|
|
74
|
+
};
|
|
75
|
+
if (!collected.ok) throw new ArtifactError(collected.reason);
|
|
76
|
+
const pulled = await pullSourceTree({
|
|
77
|
+
access: toSourceAccess(await mintSourceAccess(ctx.api, artifact.id)),
|
|
78
|
+
files: collected.files,
|
|
79
|
+
base: linked?.syncedCommit,
|
|
80
|
+
theirs: input.theirs,
|
|
81
|
+
derived: ARTIFACT_DERIVED_FILES
|
|
82
|
+
});
|
|
83
|
+
if (pulled.status === "empty") throw new ArtifactError(NOT_PUSHED);
|
|
84
|
+
const { written, skipped } = applyPulledChanges(root, pulled.changes, new Set(collected.files.map((file) => file.path)));
|
|
85
|
+
writeBinding(root, {
|
|
86
|
+
artifactId: String(artifact.id),
|
|
87
|
+
organizationId: String(artifact.organization_id),
|
|
88
|
+
slug: artifact.slug,
|
|
89
|
+
...skipped.length > 0 ? {
|
|
90
|
+
syncedCommit: linked?.syncedCommit,
|
|
91
|
+
reviewedCommit: linked?.reviewedCommit
|
|
92
|
+
} : {
|
|
93
|
+
syncedCommit: pulled.head,
|
|
94
|
+
reviewedCommit: pulled.head
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
report(ctx, artifact.slug, pulled.head, written, skipped);
|
|
98
|
+
if (linked && written.length > 0 && !ctx.json) ctx.ui.info("Read what came in before you push: your own copy runs all of it with your reads.");
|
|
99
|
+
if (!linked && !ctx.json) {
|
|
100
|
+
const where = path.relative(process.cwd(), root) || ".";
|
|
101
|
+
ctx.ui.info(`Next: cd ${where} && npm install && superwall artifacts dev`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { runArtifactPull };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "./token-Bu3FaRkv.js";
|
|
2
|
+
import "./output-Ggzq5_-t.js";
|
|
3
|
+
import "./environment-BocmdvZ-.js";
|
|
4
|
+
import "./storage-DT_wxwJ8.js";
|
|
5
|
+
import "./client-CyrYJzBF.js";
|
|
6
|
+
import "./config-CGcG7GOt.js";
|
|
7
|
+
import "./spinner-DPdBlZe2.js";
|
|
8
|
+
import "./ui-D_qf3Gvw.js";
|
|
9
|
+
import "./orgs-Z0H9WOs1.js";
|
|
10
|
+
import "./resources-CptT7HD6.js";
|
|
11
|
+
import "./lookup-CWzVfPpq.js";
|
|
12
|
+
import "./resolve-DpOSDDdr.js";
|
|
13
|
+
import "./project-NoMtbMyl.js";
|
|
14
|
+
import "./lock-DgSx-p8Y.js";
|
|
15
|
+
import "./scope-ehZ7L1nj.js";
|
|
16
|
+
import "./organization-7vJA3uy1.js";
|
|
17
|
+
import "./download-DhGd4hOB.js";
|
|
18
|
+
import "./sdk-DEfQttek.js";
|
|
19
|
+
import "./source-BccdO4aL.js";
|
|
20
|
+
import { a as toSourceAccess, i as slugOfName, n as namesOf, o as waitForBuild, r as runArtifactPush, t as IncomingCommitsRefused } from "./push-BrzMFd4Z.js";
|
|
21
|
+
|
|
22
|
+
export { IncomingCommitsRefused, namesOf, runArtifactPush, slugOfName, toSourceAccess, waitForBuild };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { x as VERSION } from "./environment-
|
|
1
|
+
import { x as VERSION } from "./environment-BocmdvZ-.js";
|
|
2
2
|
import { n as ui } from "./ui-D_qf3Gvw.js";
|
|
3
|
-
import { C as pushPaywallVersion, D as versionProducts, b as platformStore, g as livePaywall, w as pushedProducts, x as promotePaywallVersion, y as platformLabel } from "./resources-
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import { a as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { C as pushPaywallVersion, D as versionProducts, b as platformStore, g as livePaywall, w as pushedProducts, x as promotePaywallVersion, y as platformLabel } from "./resources-CptT7HD6.js";
|
|
4
|
+
import { b as writeProjectTypes, g as writeSnapshot, l as readLock, n as describeBindings, p as writeBindings, u as removeBinding, y as collectProjectDeclarations } from "./lock-DgSx-p8Y.js";
|
|
5
|
+
import { c as planTargets, d as wantedPlatforms, h as resolveApps, i as requireApi, l as surfaceKey, o as writeProjectScaffold, p as platformFor, s as parsePlatformFlags, u as targetLabel } from "./base-ChTi42M0.js";
|
|
6
|
+
import { _ as took, a as requireClean, d as BIND_VERB, g as resolveNote, h as pushedLine, l as selectSurfaces, m as pendingPromoteWarning, n as resolveFramework, o as requireProject, p as kb, r as needsWork, s as resolveProjectDir, t as frameworkVersion, u as storesDiffer, v as transition, y as weight } from "./framework-CLmf4swr.js";
|
|
7
|
+
import { t as collectSourceFiles } from "./source-BccdO4aL.js";
|
|
8
|
+
import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-B_quADds.js";
|
|
9
|
+
import { n as lintDesignTokens, t as formatTokenFinding } from "./design-lint-CiFc78aM.js";
|
|
10
|
+
import { c as projectForApplication, i as warnNotPortable, l as requireProducts, n as pushProjectSource, o as listProjectCatalogue, r as pushSource, t as assertGit, u as resolveBinding } from "./source-push-B4s6r9bB.js";
|
|
10
11
|
import { cpus } from "node:os";
|
|
11
12
|
import pc from "picocolors";
|
|
12
13
|
|
|
@@ -244,21 +245,74 @@ function summary(outcomes, skipped, promoted) {
|
|
|
244
245
|
ui.outro(`${count} ${noun(count)} pushed${unchanged} · run \`superwall promote\` to publish ${count === 1 ? "it" : "them"}.`);
|
|
245
246
|
}
|
|
246
247
|
const BUILD_CONCURRENCY = Math.max(2, Math.min(8, cpus().length - 1));
|
|
248
|
+
const isBound = (lock, target) => {
|
|
249
|
+
return (target.surface.kind === "paywall" ? lock.paywalls : lock.funnels)[target.surface.id]?.[target.platform] !== void 0;
|
|
250
|
+
};
|
|
251
|
+
function boundScope(lock, surfaces, declared, only) {
|
|
252
|
+
const allowed = only.map((entry) => platformFor(lock.apps, entry) ?? entry);
|
|
253
|
+
const wanted = (platform) => only.length === 0 || allowed.includes(platform);
|
|
254
|
+
const apps = Object.fromEntries(Object.entries(lock.apps).filter(([platform]) => wanted(platform)));
|
|
255
|
+
const scoped = [];
|
|
256
|
+
const narrowed = { ...declared };
|
|
257
|
+
const unbound = [];
|
|
258
|
+
for (const surface of surfaces) {
|
|
259
|
+
const platforms = declared[surfaceKey(surface)];
|
|
260
|
+
if (platforms === void 0) {
|
|
261
|
+
if (Object.keys(lock.apps).length > 1) planTargets({
|
|
262
|
+
surfaces: [surface],
|
|
263
|
+
declared,
|
|
264
|
+
apps: lock.apps
|
|
265
|
+
});
|
|
266
|
+
if (Object.keys(apps).length > 0) scoped.push(surface);
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const kept = [];
|
|
270
|
+
for (const platform of platforms) {
|
|
271
|
+
if (!wanted(platform)) continue;
|
|
272
|
+
if (isBound(lock, {
|
|
273
|
+
surface,
|
|
274
|
+
platform
|
|
275
|
+
})) kept.push(platform);
|
|
276
|
+
else unbound.push({
|
|
277
|
+
surface,
|
|
278
|
+
platform
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
narrowed[surfaceKey(surface)] = kept;
|
|
282
|
+
if (kept.length > 0) scoped.push(surface);
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
surfaces: scoped,
|
|
286
|
+
declared: narrowed,
|
|
287
|
+
apps,
|
|
288
|
+
unbound
|
|
289
|
+
};
|
|
290
|
+
}
|
|
247
291
|
async function prepare(context, input) {
|
|
248
|
-
const { framework, project
|
|
249
|
-
const
|
|
292
|
+
const { framework, project } = input;
|
|
293
|
+
const only = parsePlatformFlags(input.platforms);
|
|
294
|
+
const lock = readLock(project.superwallDir);
|
|
295
|
+
const scope = input.existing ? boundScope(lock, input.surfaces, input.declared, only) : {
|
|
296
|
+
surfaces: input.surfaces,
|
|
297
|
+
declared: input.declared,
|
|
298
|
+
apps: void 0,
|
|
299
|
+
unbound: []
|
|
300
|
+
};
|
|
301
|
+
const apps = scope.apps ?? await resolveApps({
|
|
250
302
|
api: context.api,
|
|
251
303
|
superwallDir: project.superwallDir,
|
|
252
|
-
wanted: wantedPlatforms(surfaces, declared),
|
|
304
|
+
wanted: wantedPlatforms(scope.surfaces, scope.declared),
|
|
253
305
|
pickApplication: context.interactive ? pickApplicationOption : void 0
|
|
254
306
|
});
|
|
255
|
-
const multi = Object.keys(apps).length > 1;
|
|
256
|
-
const
|
|
257
|
-
surfaces,
|
|
258
|
-
declared,
|
|
307
|
+
const multi = Object.keys(input.existing ? lock.apps : apps).length > 1;
|
|
308
|
+
const planned = scope.surfaces.length === 0 ? [] : planTargets({
|
|
309
|
+
surfaces: scope.surfaces,
|
|
310
|
+
declared: scope.declared,
|
|
259
311
|
apps,
|
|
260
|
-
only:
|
|
312
|
+
only: input.existing ? [] : only
|
|
261
313
|
});
|
|
314
|
+
const targets = input.existing ? planned.filter((target) => isBound(lock, target)) : planned;
|
|
315
|
+
const unbound = [...scope.unbound, ...planned.filter((target) => !targets.includes(target))];
|
|
262
316
|
const spin = context.outputMode === "rich" ? ui.spinner() : void 0;
|
|
263
317
|
const label = targets.length === 1 && targets[0] !== void 0 ? targetLabel(targets[0], multi) : `${targets.length} paywalls`;
|
|
264
318
|
spin?.start(`Building ${label}`);
|
|
@@ -307,8 +361,8 @@ async function prepare(context, input) {
|
|
|
307
361
|
if (!bind || !build) throw new Error(`Missing binding for ${target.surface.id}`);
|
|
308
362
|
requireAssets(build);
|
|
309
363
|
const live = await livePaywall(context.api, bind.paywallId);
|
|
310
|
-
const
|
|
311
|
-
const recorded = (target.surface.kind === "paywall" ?
|
|
364
|
+
const current = readLock(project.superwallDir);
|
|
365
|
+
const recorded = (target.surface.kind === "paywall" ? current.paywalls : current.funnels)[target.surface.id]?.[target.platform];
|
|
312
366
|
const stores = catalogueOf(target)?.stores ?? {};
|
|
313
367
|
const unsourced = recorded?.snapshot === build.snapshotId ? recorded.sourcePending : void 0;
|
|
314
368
|
const stale = needsWork(build.snapshotId, recorded?.snapshot, live.snapshotId);
|
|
@@ -329,7 +383,8 @@ async function prepare(context, input) {
|
|
|
329
383
|
spin?.stop(`${pc.bold(`Built ${label}`)} ${pc.dim(`${modified} modified · ${prepared.length - modified} unchanged`)} ${took(at)}`);
|
|
330
384
|
return {
|
|
331
385
|
prepared,
|
|
332
|
-
multi
|
|
386
|
+
multi,
|
|
387
|
+
unbound
|
|
333
388
|
};
|
|
334
389
|
} catch (error) {
|
|
335
390
|
spin?.stop(pc.red(`Building ${label} failed`));
|
|
@@ -399,13 +454,16 @@ async function runPushPipeline(context, options) {
|
|
|
399
454
|
const source = await collectSourceFiles(project.superwallDir);
|
|
400
455
|
const outcomes = [];
|
|
401
456
|
const external = /* @__PURE__ */ new Set();
|
|
402
|
-
const
|
|
457
|
+
for (const finding of lintDesignTokens(project, surfaces)) ui.warn(formatTokenFinding(finding));
|
|
458
|
+
const { prepared, multi, unbound } = await prepare(context, {
|
|
403
459
|
framework,
|
|
404
460
|
project,
|
|
405
461
|
surfaces,
|
|
406
462
|
declared: declarations.platforms,
|
|
407
|
-
platforms: options.platforms ?? []
|
|
463
|
+
platforms: options.platforms ?? [],
|
|
464
|
+
existing: options.existing === true
|
|
408
465
|
});
|
|
466
|
+
for (const target of unbound) ui.step(`${targetLabel(target, multi)} skipped ${pc.dim("(not on Superwall yet; --existing never creates one)")}`);
|
|
409
467
|
for (const entry of prepared) for (const source$1 of entry.build.externalSources ?? []) external.add(source$1);
|
|
410
468
|
const changed = prepared.filter((entry) => entry.changed);
|
|
411
469
|
const skipped = prepared.length - changed.length;
|
|
@@ -476,9 +534,49 @@ async function runPushPipeline(context, options) {
|
|
|
476
534
|
live
|
|
477
535
|
});
|
|
478
536
|
}
|
|
537
|
+
if (options.source) await pushSourceAlone(context, {
|
|
538
|
+
project,
|
|
539
|
+
prepared,
|
|
540
|
+
synced: new Set(changed.map((entry) => entry.bind.applicationId)),
|
|
541
|
+
multi,
|
|
542
|
+
files: source,
|
|
543
|
+
framework: installed,
|
|
544
|
+
note: publishNote,
|
|
545
|
+
overwrite: options.overwriteSource
|
|
546
|
+
});
|
|
479
547
|
warnNotPortable(external);
|
|
480
548
|
summary(outcomes, skipped, options.promote);
|
|
481
549
|
}
|
|
550
|
+
async function pushSourceAlone(context, input) {
|
|
551
|
+
if (input.prepared.length === 0) throw new Error("--source needs a paywall that is already on Superwall to push the source through.");
|
|
552
|
+
const through = /* @__PURE__ */ new Map();
|
|
553
|
+
for (const entry of input.prepared) {
|
|
554
|
+
const { applicationId } = entry.bind;
|
|
555
|
+
if (!input.synced.has(applicationId) && !through.has(applicationId)) through.set(applicationId, entry);
|
|
556
|
+
}
|
|
557
|
+
if (through.size === 0) return;
|
|
558
|
+
if (!input.files.ok) throw new Error(input.files.reason);
|
|
559
|
+
await assertGit();
|
|
560
|
+
const files = input.files.files;
|
|
561
|
+
for (const { bind, target } of through.values()) {
|
|
562
|
+
const label = input.multi ? `Project source · ${target.platform}` : "Project source";
|
|
563
|
+
await group(context.outputMode, label, async () => {
|
|
564
|
+
const pushed = await timed(() => pushProjectSource({
|
|
565
|
+
api: context.api,
|
|
566
|
+
superwallDir: input.project.superwallDir,
|
|
567
|
+
paywallId: bind.paywallId,
|
|
568
|
+
applicationId: bind.applicationId,
|
|
569
|
+
files,
|
|
570
|
+
framework: input.framework,
|
|
571
|
+
cli: VERSION,
|
|
572
|
+
note: input.note,
|
|
573
|
+
overwrite: input.overwrite
|
|
574
|
+
}));
|
|
575
|
+
const sha = pc.dim(pushed.value.commitSha.slice(0, 7));
|
|
576
|
+
return [`Source ${pushed.value.status === "unchanged" ? "unchanged" : "pushed"} ${sha} ${pushed.took}`];
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
}
|
|
482
580
|
async function runPush(ctx, { args, flags }, promote) {
|
|
483
581
|
await runPushPipeline({
|
|
484
582
|
api: await requireApi(ctx.interactive),
|
|
@@ -491,7 +589,9 @@ async function runPush(ctx, { args, flags }, promote) {
|
|
|
491
589
|
platforms: flags.platform,
|
|
492
590
|
renames: flags.rename,
|
|
493
591
|
message: flags.message,
|
|
494
|
-
overwriteSource: flags.overwriteSource
|
|
592
|
+
overwriteSource: flags.overwriteSource,
|
|
593
|
+
existing: flags.existing,
|
|
594
|
+
source: flags.source
|
|
495
595
|
});
|
|
496
596
|
}
|
|
497
597
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { x as VERSION } from "./environment-
|
|
2
|
-
import { n as ApiUnreachableError, t as ApiError } from "./client-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { i as
|
|
1
|
+
import { x as VERSION } from "./environment-BocmdvZ-.js";
|
|
2
|
+
import { n as ApiUnreachableError, t as ApiError } from "./client-CyrYJzBF.js";
|
|
3
|
+
import { D as startBuild, b as listArtifacts, d as visibilityOf, f as readBinding, g as createArtifact, m as writeBinding, o as openLink, p as readSourceFile, v as getBuild, w as mintSourceAccess, y as getMe } from "./resolve-DpOSDDdr.js";
|
|
4
|
+
import { s as readProject, t as ArtifactError } from "./project-NoMtbMyl.js";
|
|
5
|
+
import { n as resolveOrganization } from "./organization-7vJA3uy1.js";
|
|
6
|
+
import { i as warnIfSdkBehind, r as vendoredVersion } from "./sdk-DEfQttek.js";
|
|
7
|
+
import { i as pushSourceTree, n as gitAvailable, t as collectSourceFiles } from "./source-BccdO4aL.js";
|
|
8
8
|
import { setTimeout } from "node:timers/promises";
|
|
9
9
|
|
|
10
|
-
//#region src/core/
|
|
10
|
+
//#region src/core/artifacts/push.ts
|
|
11
11
|
const PUSH_ATTEMPTS = 3;
|
|
12
12
|
const POLL_INTERVAL_MS = 2e3;
|
|
13
13
|
const POLL_TIMEOUT_MS = 1200 * 1e3;
|
|
@@ -25,28 +25,28 @@ const toSourceAccess = (access) => ({
|
|
|
25
25
|
function slugOfName(name) {
|
|
26
26
|
const slug = name.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63).replace(/-+$/, "");
|
|
27
27
|
if (/^[a-z][a-z0-9-]+$/.test(slug)) return slug;
|
|
28
|
-
return `ws-${slug || "
|
|
28
|
+
return `ws-${slug || "artifact"}`.slice(0, 63).replace(/-+$/, "");
|
|
29
29
|
}
|
|
30
30
|
const isConflict = (error) => error instanceof ApiError && error.status === 409;
|
|
31
|
-
async function
|
|
31
|
+
async function linkedArtifact(ctx, project, org) {
|
|
32
32
|
const existing = readBinding(project.root);
|
|
33
33
|
if (existing) return existing;
|
|
34
34
|
const organizationId = await resolveOrganization(ctx, org);
|
|
35
35
|
const slug = slugOfName(project.manifest.name);
|
|
36
|
-
const find = async () => (await
|
|
37
|
-
let
|
|
38
|
-
if (
|
|
36
|
+
const find = async () => (await listArtifacts(ctx.api, organizationId, slug))[0];
|
|
37
|
+
let artifact = await find();
|
|
38
|
+
if (artifact) ctx.ui.info(`Using the existing artifact \`${artifact.slug}\` in organization ${organizationId}.`);
|
|
39
39
|
else try {
|
|
40
|
-
|
|
41
|
-
ctx.ui.success(`Created the
|
|
40
|
+
artifact = await createArtifact(ctx.api, organizationId, project.manifest.name, slug);
|
|
41
|
+
ctx.ui.success(`Created the artifact \`${artifact.slug}\`.`);
|
|
42
42
|
} catch (error) {
|
|
43
|
-
|
|
44
|
-
if (!
|
|
43
|
+
artifact = isConflict(error) ? await find() : void 0;
|
|
44
|
+
if (!artifact) throw error;
|
|
45
45
|
}
|
|
46
46
|
const binding = {
|
|
47
|
-
|
|
48
|
-
organizationId: String(
|
|
49
|
-
slug:
|
|
47
|
+
artifactId: String(artifact.id),
|
|
48
|
+
organizationId: String(artifact.organization_id),
|
|
49
|
+
slug: artifact.slug
|
|
50
50
|
};
|
|
51
51
|
writeBinding(project.root, binding);
|
|
52
52
|
return binding;
|
|
@@ -102,19 +102,19 @@ function retryAfterOf(error) {
|
|
|
102
102
|
return DEFAULT_RETRY_AFTER_SECONDS;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
async function startBuildWhenThereIsRoom(ctx,
|
|
105
|
+
async function startBuildWhenThereIsRoom(ctx, artifactId, commitSha, tokenId, seams) {
|
|
106
106
|
const wait = seams.sleep ?? setTimeout;
|
|
107
107
|
const now = seams.now ?? Date.now;
|
|
108
108
|
const deadline = now() + POLL_TIMEOUT_MS;
|
|
109
109
|
let told = false;
|
|
110
110
|
for (;;) try {
|
|
111
|
-
return await startBuild(ctx.api,
|
|
111
|
+
return await startBuild(ctx.api, artifactId, commitSha, tokenId);
|
|
112
112
|
} catch (error) {
|
|
113
113
|
const seconds = retryAfterOf(error);
|
|
114
114
|
if (seconds === void 0) throw error;
|
|
115
115
|
const { message } = error;
|
|
116
|
-
if (seconds > LONGEST_WAIT_SECONDS) throw new
|
|
117
|
-
if (now() >= deadline) throw new
|
|
116
|
+
if (seconds > LONGEST_WAIT_SECONDS) throw new ArtifactError(`${message} Trying again soon won't help, because the limit covers the last day. Your source is pushed, so run \`superwall artifacts push\` again later.`);
|
|
117
|
+
if (now() >= deadline) throw new ArtifactError(`${message} There's still no room after 20 minutes. Your source is pushed, so run \`superwall artifacts push\` again later.`);
|
|
118
118
|
if (!told) ctx.ui.info(`${message} This will keep trying on its own, with nothing to push again.`);
|
|
119
119
|
told = true;
|
|
120
120
|
await wait(seconds * 1e3);
|
|
@@ -126,7 +126,7 @@ async function pushAndBuild(ctx, root, binding, files, input, seams) {
|
|
|
126
126
|
const incoming = [];
|
|
127
127
|
const author = await signedInAuthor(ctx.api);
|
|
128
128
|
for (let attempt = 1;; attempt++) {
|
|
129
|
-
const access = await mintSourceAccess(ctx.api, current.
|
|
129
|
+
const access = await mintSourceAccess(ctx.api, current.artifactId);
|
|
130
130
|
const pushed = await pushSourceTree({
|
|
131
131
|
access: toSourceAccess(access),
|
|
132
132
|
base: current.syncedCommit,
|
|
@@ -136,9 +136,9 @@ async function pushAndBuild(ctx, root, binding, files, input, seams) {
|
|
|
136
136
|
...author ? { author } : {},
|
|
137
137
|
files,
|
|
138
138
|
message: {
|
|
139
|
-
kind: "
|
|
139
|
+
kind: "artifact",
|
|
140
140
|
surface: current.slug,
|
|
141
|
-
|
|
141
|
+
artifactId: current.artifactId,
|
|
142
142
|
sdk: vendoredVersion(root),
|
|
143
143
|
cli: VERSION,
|
|
144
144
|
note: input.m
|
|
@@ -152,7 +152,7 @@ async function pushAndBuild(ctx, root, binding, files, input, seams) {
|
|
|
152
152
|
};
|
|
153
153
|
writeBinding(root, current);
|
|
154
154
|
try {
|
|
155
|
-
const build = await startBuildWhenThereIsRoom(ctx, current.
|
|
155
|
+
const build = await startBuildWhenThereIsRoom(ctx, current.artifactId, pushed.commitSha, access.token_id, seams);
|
|
156
156
|
return {
|
|
157
157
|
pushed: {
|
|
158
158
|
...pushed,
|
|
@@ -176,7 +176,7 @@ async function waitForBuild(api, first, seams, onProgress) {
|
|
|
176
176
|
for (;;) {
|
|
177
177
|
await wait(POLL_INTERVAL_MS);
|
|
178
178
|
try {
|
|
179
|
-
build = await getBuild(api, build.
|
|
179
|
+
build = await getBuild(api, build.artifact_id, build.version_id);
|
|
180
180
|
failures = 0;
|
|
181
181
|
} catch (error) {
|
|
182
182
|
failures += 1;
|
|
@@ -193,9 +193,9 @@ async function waitForBuild(api, first, seams, onProgress) {
|
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
const buildSummary = (
|
|
197
|
-
|
|
198
|
-
slug:
|
|
196
|
+
const buildSummary = (artifact, pushed, build, url) => ({
|
|
197
|
+
artifact_id: Number(artifact.artifactId),
|
|
198
|
+
slug: artifact.slug,
|
|
199
199
|
version_id: build.version_id,
|
|
200
200
|
commit_sha: build.commit_sha,
|
|
201
201
|
source: pushed.status,
|
|
@@ -213,20 +213,20 @@ function refusedPush(ctx, { commits, reason }) {
|
|
|
213
213
|
merged_commits: commits
|
|
214
214
|
});
|
|
215
215
|
else if (reason === "declined") {
|
|
216
|
-
ctx.ui.outro("Nothing was pushed. Run `superwall
|
|
216
|
+
ctx.ui.outro("Nothing was pushed. Run `superwall artifacts pull` to read them first.");
|
|
217
217
|
return;
|
|
218
|
-
} else ctx.ui.error(`Nothing was pushed. Your copy would run commits from ${namesOf(commits)} with your reads. Run \`superwall
|
|
218
|
+
} else ctx.ui.error(`Nothing was pushed. Your copy would run commits from ${namesOf(commits)} with your reads. Run \`superwall artifacts pull\` to read them first, or pass --accept-merged-commits.`);
|
|
219
219
|
ctx.fail();
|
|
220
220
|
}
|
|
221
|
-
async function
|
|
221
|
+
async function runArtifactPush(ctx, input, seams = {}) {
|
|
222
222
|
const project = readProject(input.dir);
|
|
223
223
|
await warnIfSdkBehind(ctx.ui, project.root, seams.fetchVersion);
|
|
224
|
-
if (!await (seams.hasGit ?? gitAvailable)()) throw new
|
|
224
|
+
if (!await (seams.hasGit ?? gitAvailable)()) throw new ArtifactError("`superwall artifacts push` uses git to send your source. Install git, then try again.");
|
|
225
225
|
const checked = await collectSourceFiles(project.root, readSourceFile);
|
|
226
|
-
if (!checked.ok) throw new
|
|
227
|
-
const linked = await
|
|
226
|
+
if (!checked.ok) throw new ArtifactError(checked.reason);
|
|
227
|
+
const linked = await linkedArtifact(ctx, project, input.org);
|
|
228
228
|
const collected = await collectSourceFiles(project.root, readSourceFile);
|
|
229
|
-
if (!collected.ok) throw new
|
|
229
|
+
if (!collected.ok) throw new ArtifactError(collected.reason);
|
|
230
230
|
let result;
|
|
231
231
|
try {
|
|
232
232
|
result = await pushAndBuild(ctx, project.root, linked, collected.files, input, seams);
|
|
@@ -237,7 +237,7 @@ async function runWorkspacePush(ctx, input, seams = {}) {
|
|
|
237
237
|
}
|
|
238
238
|
const { pushed, build: started, binding } = result;
|
|
239
239
|
const link = await openLink(ctx, {
|
|
240
|
-
id: Number(binding.
|
|
240
|
+
id: Number(binding.artifactId),
|
|
241
241
|
organization_id: Number(binding.organizationId),
|
|
242
242
|
slug: binding.slug
|
|
243
243
|
}, project.manifest);
|
|
@@ -255,7 +255,7 @@ async function runWorkspacePush(ctx, input, seams = {}) {
|
|
|
255
255
|
if (!wait.finished) {
|
|
256
256
|
spin.stop(`Version ${build.version_id} is still building`);
|
|
257
257
|
if (ctx.json) ctx.output.data(summary);
|
|
258
|
-
else ctx.ui.warn("It's taking longer than expected. Check it with `superwall
|
|
258
|
+
else ctx.ui.warn("It's taking longer than expected. Check it with `superwall artifacts status`.");
|
|
259
259
|
ctx.fail();
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
@@ -265,13 +265,13 @@ async function runWorkspacePush(ctx, input, seams = {}) {
|
|
|
265
265
|
else {
|
|
266
266
|
const where = build.step ? ` at ${build.step}` : "";
|
|
267
267
|
ctx.ui.error(`The build failed${where}: ${build.failure?.message ?? "the builder gave no reason."}`);
|
|
268
|
-
ctx.ui.info(build.failure && RETRY_LATER_CODES.has(build.failure.code) ? "It isn't your code. Run `superwall
|
|
268
|
+
ctx.ui.info(build.failure && RETRY_LATER_CODES.has(build.failure.code) ? "It isn't your code. Run `superwall artifacts push` again in a few minutes, and it retries this version." : "See its log with `superwall artifacts logs`.");
|
|
269
269
|
}
|
|
270
270
|
ctx.fail();
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
273
|
spin.stop(`Built version ${build.version_id}`);
|
|
274
|
-
const { visibleTo, sentence } = await visibilityOf(ctx, binding.
|
|
274
|
+
const { visibleTo, sentence } = await visibilityOf(ctx, binding.artifactId, build.version_id, project.manifest);
|
|
275
275
|
if (ctx.json) {
|
|
276
276
|
ctx.output.data({
|
|
277
277
|
...summary,
|
|
@@ -280,11 +280,11 @@ async function runWorkspacePush(ctx, input, seams = {}) {
|
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
282
|
ctx.ui.success(sentence);
|
|
283
|
-
if (pushed.incoming?.length) ctx.ui.warn(`It runs commits from ${namesOf(pushed.incoming)} with your reads, and they aren't in this project yet. Run \`superwall
|
|
283
|
+
if (pushed.incoming?.length) ctx.ui.warn(`It runs commits from ${namesOf(pushed.incoming)} with your reads, and they aren't in this project yet. Run \`superwall artifacts pull\` to get them.`);
|
|
284
284
|
ctx.ui.info(link.app ? `Open ${url} (in ${link.app})` : `Open ${url}`);
|
|
285
|
-
if (link.otherApps) ctx.ui.info(
|
|
286
|
-
ctx.ui.info("To ask for review, run `superwall
|
|
285
|
+
if (link.otherApps) ctx.ui.info("Each of your other apps has the same page.");
|
|
286
|
+
ctx.ui.info("To ask for review, run `superwall artifacts share`.");
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
//#endregion
|
|
290
|
-
export { toSourceAccess as a, slugOfName as i, namesOf as n, waitForBuild as o,
|
|
290
|
+
export { toSourceAccess as a, slugOfName as i, namesOf as n, waitForBuild as o, runArtifactPush as r, IncomingCommitsRefused as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "./token-Bu3FaRkv.js";
|
|
2
|
+
import "./output-Ggzq5_-t.js";
|
|
3
|
+
import "./environment-BocmdvZ-.js";
|
|
4
|
+
import "./storage-DT_wxwJ8.js";
|
|
5
|
+
import "./client-CyrYJzBF.js";
|
|
6
|
+
import "./config-CGcG7GOt.js";
|
|
7
|
+
import "./telemetry-ovPiseFm.js";
|
|
8
|
+
import "./spawn-DmmmHIP-.js";
|
|
9
|
+
import "./spinner-DPdBlZe2.js";
|
|
10
|
+
import "./ui-D_qf3Gvw.js";
|
|
11
|
+
import "./scan-nVQO7JLx.js";
|
|
12
|
+
import "./paths-CzTJVpfi.js";
|
|
13
|
+
import "./orgs-Z0H9WOs1.js";
|
|
14
|
+
import "./resources-CptT7HD6.js";
|
|
15
|
+
import "./lookup-CWzVfPpq.js";
|
|
16
|
+
import "./login-5sWIKDI2.js";
|
|
17
|
+
import "./skills-421SFEyF.js";
|
|
18
|
+
import "./browser-Bp3yRKlU.js";
|
|
19
|
+
import "./lock-DgSx-p8Y.js";
|
|
20
|
+
import "./scope-ehZ7L1nj.js";
|
|
21
|
+
import "./base-ChTi42M0.js";
|
|
22
|
+
import "./framework-CLmf4swr.js";
|
|
23
|
+
import "./login-Jp6E6d2e.js";
|
|
24
|
+
import "./source-BccdO4aL.js";
|
|
25
|
+
import "./assets-B_quADds.js";
|
|
26
|
+
import "./design-lint-CiFc78aM.js";
|
|
27
|
+
import "./source-push-B4s6r9bB.js";
|
|
28
|
+
import { i as timed, n as runPush, r as runPushPipeline, t as group } from "./push-BMblzg_6.js";
|
|
29
|
+
|
|
30
|
+
export { group, runPush, runPushPipeline, timed };
|