@superwall/cli 2.6.0-beta.1 → 2.6.0
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-Bmt_iywx.js → apple-D-rfsuDA.js} +17 -19
- package/dist/{approve-D2UgqaRx.js → approve-aPc5RoXB.js} +14 -13
- package/dist/{assets-B_quADds.js → assets-PyuXe45Y.js} +3 -3
- package/dist/auth.d.ts +11 -4
- package/dist/auth.js +4 -5
- package/dist/base-CAU0hWoI.js +82 -0
- package/dist/{billing-ZIETn0j4.js → billing-Dt6L_l9R.js} +3 -3
- package/dist/{build-BWjXurjs.js → build-CY5FnMNY.js} +35 -16
- package/dist/config-DOp5oChe.js +377 -0
- package/dist/{create-C3uklw-U.js → create-BZL5VH4L.js} +41 -41
- package/dist/{create-BCIgjRHn.js → create-D6w3UL0m.js} +9 -9
- package/dist/create-DM5Y1Pyk.js +18 -0
- package/dist/{doctor-D2Q1EZe8.js → doctor-C9FR0qw3.js} +50 -10
- package/dist/entry.js +45 -40
- package/dist/{environment-BocmdvZ-.js → environment-sE2wZYdg.js} +1 -1
- package/dist/{drivers-BQkO5tHs.js → existing--peXpOZj.js} +305 -8
- package/dist/framework-DW5fqjh4.js +65 -0
- package/dist/{source-BccdO4aL.js → git-Hf9Wc7Hp.js} +34 -92
- package/dist/{held-Bykbwy-m.js → held-CUBCOCGP.js} +8 -8
- package/dist/held-DVxvPMSG.js +15 -0
- package/dist/{install-dXZZ79Oe.js → install-C5d82gZF.js} +15 -17
- package/dist/{integrate-DiSjlOjC.js → integrate-D8J_X1bj.js} +33 -38
- package/dist/{login-5sWIKDI2.js → login-C6X7JrhM.js} +8 -9
- package/dist/{login-Jp6E6d2e.js → login-DXhm9L0F.js} +3 -3
- package/dist/login-et319ESO.js +13 -0
- package/dist/{lookup-CWzVfPpq.js → lookup-DqmIbUkv.js} +28 -4
- package/dist/{migrate-BKiOUsMY.js → migrate-BYF6hKZ2.js} +66 -45
- package/dist/{notification-url-BDBxbwZq.js → notification-url-Bo54nkXv.js} +4 -4
- package/dist/{open-DNd49kT-.js → open-xdgXUzaF.js} +2 -2
- package/dist/{org-Dud1rF9f.js → org-BD8U3D1_.js} +4 -4
- package/dist/{organization-7vJA3uy1.js → organization-D-ZlB3qU.js} +4 -4
- package/dist/{orgs-Z0H9WOs1.js → orgs-DQQJ3sw_.js} +1 -2
- package/dist/{paths-CzTJVpfi.js → paths-CIlyzF2I.js} +1 -1
- package/dist/{playbook-DJ__edOW.js → playbook-ecggWGFi.js} +10 -14
- package/dist/{products-Cqq59DBQ.js → products-CJq_iXv5.js} +1 -1
- package/dist/{promote-DLtPSvmL.js → promote-QVMLGYlU.js} +27 -28
- package/dist/{pull-AoUmaiMK.js → pull-CCXhb2a7.js} +72 -26
- package/dist/{pull-D-YuT3e0.js → pull-CrdsfsAl.js} +33 -39
- package/dist/pull-h71pL3r_.js +30 -0
- package/dist/push-BIq6R8Ro.js +29 -0
- package/dist/push-D6pJM_vv.js +21 -0
- package/dist/{push-BMblzg_6.js → push-DJMGG7zW.js} +23 -12
- package/dist/{push-BrzMFd4Z.js → push-DiMDwGfe.js} +15 -8
- package/dist/{registry-DDU10_Ix.js → registry-BSnQXft4.js} +1288 -901
- package/dist/registry-YwzTfCNc.js +22 -0
- package/dist/{resolve-DpOSDDdr.js → resolve-DO7bPota.js} +52 -6
- package/dist/{resources-CptT7HD6.js → resources-XwvXA20E.js} +15 -2
- package/dist/{run-r3foWfhV.js → run-B-YvxfRc.js} +15 -17
- package/dist/scan-B36wkZmI.js +4 -0
- package/dist/{scan-nVQO7JLx.js → scan-ViBhmrB7.js} +1 -1
- package/dist/{scope-l1qGLsgz.js → scope-BLLUxbrA.js} +24 -18
- package/dist/{scope-ehZ7L1nj.js → scope-Cg1AdAfO.js} +33 -3
- package/dist/screenshot-file-Dix2Qynm.js +127 -0
- package/dist/{sdk-DEfQttek.js → sdk-BFunw4Hc.js} +1 -1
- package/dist/{framework-CLmf4swr.js → selection-C07e_GGY.js} +4 -54
- package/dist/{series-D2ZpZ8cx.js → series-B8NJK4yS.js} +1 -1
- package/dist/{server-DLARhh1k.js → server-CBtHzl9y.js} +40 -18
- package/dist/server-CZwSfzKe.js +33 -0
- package/dist/{base-ChTi42M0.js → session-BfVx50iA.js} +8 -83
- package/dist/{session-Z0BeaJPf.js → session-BlrwAdGN.js} +1 -1
- package/dist/session-Cip4j99n.js +5 -0
- package/dist/{migration-Z69tLeHC.js → setup-a4B72xJ8.js} +290 -28
- 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-artifacts/SKILL.md +7 -2
- package/dist/skills/superwall-artifacts/references/cli.md +4 -1
- package/dist/skills/superwall-framework/SKILL.md +197 -14
- 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/migrate-from-editor.md +5 -0
- package/dist/skills/superwall-framework/references/migrate-from-native.md +5 -0
- package/dist/{skills-421SFEyF.js → skills-BB1uIt8t.js} +139 -9
- package/dist/{skills-CdKwaTRS.js → skills-SnxFa2in.js} +8 -12
- package/dist/source-DQs6iLtC.js +82 -0
- package/dist/{source-push-B4s6r9bB.js → source-push-w7miTr6m.js} +38 -14
- package/dist/{spinner-DPdBlZe2.js → spinner-BQp7fQvK.js} +7 -5
- package/dist/{starter-0OdVPH4l.js → starter-BlJ_InZJ.js} +16 -6
- package/dist/{status-Dsc7d3z2.js → status-DxsIw9zq.js} +9 -11
- package/dist/{output-Ggzq5_-t.js → storage-BR6imSqm.js} +40 -1
- package/dist/storekit-BqyujKQ_.js +203 -0
- package/dist/storekit-ELVCMF0X.js +15 -0
- package/dist/{bind-ClFjTt0U.js → theme-Ed0gz6hr.js} +29 -6
- package/dist/token-CWQ6tdva.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.d.ts +6 -1
- package/dist/tools.js +1290 -747
- package/dist/{try-B8FYkTvQ.js → try-C3HW3hPZ.js} +20 -22
- package/dist/{lock-DgSx-p8Y.js → types-Dc9U_4kp.js} +86 -80
- package/dist/upgrade-Cw9jVt-r.js +348 -0
- package/dist/upgrade-DVsonzDF.js +27 -0
- package/package.json +11 -3
- package/dist/client-CyrYJzBF.js +0 -180
- package/dist/config-CGcG7GOt.js +0 -113
- package/dist/create-7HDW3DCl.js +0 -20
- package/dist/existing-Cl5x6_5u.js +0 -97
- package/dist/held-Chw3BtBV.js +0 -17
- package/dist/log-C0MDCfA2.js +0 -62
- package/dist/login-DZ8Pipf6.js +0 -17
- package/dist/pull-C1xm2zqG.js +0 -36
- package/dist/push-B42D8fKf.js +0 -22
- package/dist/push-Co5jk6Kr.js +0 -30
- package/dist/run-c1O2_8pp.js +0 -100
- package/dist/scan-D86kLtM7.js +0 -4
- package/dist/screenshot-file-XAS0Xy0e.js +0 -16
- package/dist/server-BEcsQaPu.js +0 -29
- package/dist/session-Csuaw6RU.js +0 -6
- package/dist/setup-C6NFy14d.js +0 -217
- package/dist/spawn-DmmmHIP-.js +0 -71
- package/dist/storage-DT_wxwJ8.js +0 -41
- package/dist/storekit-B9M2raxe.js +0 -47
- package/dist/storekit-BWZf-fNE.js +0 -17
- package/dist/telemetry-ovPiseFm.js +0 -56
- package/dist/theme-DUsCh-Vd.js +0 -25
- package/dist/token-Bu3FaRkv.js +0 -70
- package/dist/upgrade-B7TmvEPP.js +0 -206
- package/dist/upgrade-CAHyrWUL.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,12 +1,11 @@
|
|
|
1
|
-
import { n as ui } from "./ui-
|
|
2
|
-
import {
|
|
3
|
-
import { a as classifyPath, c as isSurfaceRoot, i as LOCK_FILE
|
|
1
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
2
|
+
import { t as TYPES_FILE } from "./types-Dc9U_4kp.js";
|
|
3
|
+
import { a as classifyPath, c as isSurfaceRoot, i as LOCK_FILE, l as mergeLockText, o as derivedFilesOf, r as DERIVED_FILES, s as isOtherSurfaceDir } from "./scope-Cg1AdAfO.js";
|
|
4
4
|
import { execFile } from "node:child_process";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as os$1 from "node:os";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
import { promisify } from "node:util";
|
|
9
|
-
import fg from "fast-glob";
|
|
10
9
|
|
|
11
10
|
//#region src/core/paywalls/source/commit.ts
|
|
12
11
|
const noteBody = (note) => {
|
|
@@ -88,11 +87,15 @@ const ISOLATION = [
|
|
|
88
87
|
"-c",
|
|
89
88
|
"core.autocrlf=false"
|
|
90
89
|
];
|
|
90
|
+
const englishEnv = (env = process.env) => ({
|
|
91
|
+
...Object.fromEntries(Object.entries(env).filter(([key]) => key !== "LANGUAGE")),
|
|
92
|
+
LC_ALL: "C"
|
|
93
|
+
});
|
|
91
94
|
async function git(args, options = {}) {
|
|
92
95
|
try {
|
|
93
96
|
const { stdout } = await run("git", [...ISOLATION, ...args], {
|
|
94
97
|
cwd: options.cwd,
|
|
95
|
-
env: options.env,
|
|
98
|
+
env: englishEnv(options.env),
|
|
96
99
|
maxBuffer: 64 * 1024 * 1024,
|
|
97
100
|
timeout: GIT_TIMEOUT_MS
|
|
98
101
|
});
|
|
@@ -159,8 +162,14 @@ function materializeSourceTree(dir, files, scope, options = {}) {
|
|
|
159
162
|
for (const file of files) {
|
|
160
163
|
if (classifyPath(file.path, scope) === "other") continue;
|
|
161
164
|
if (file.content.byteLength > LARGE_FILE_BYTES) large.push(file.path);
|
|
162
|
-
if (file.path === LOCK_FILE
|
|
163
|
-
|
|
165
|
+
if (file.path === LOCK_FILE && scope.kind !== "artifact") {
|
|
166
|
+
const repoLock = theirs.get(LOCK_FILE)?.toString("utf8");
|
|
167
|
+
write(file.path, mergeLockText(repoLock, file.content.toString("utf8"), scope, {
|
|
168
|
+
replaceUnreadable: options.overwrite,
|
|
169
|
+
base: keepShared ? void 0 : repoLock,
|
|
170
|
+
application: options.application
|
|
171
|
+
}));
|
|
172
|
+
} else write(file.path, file.content);
|
|
164
173
|
theirs.delete(file.path);
|
|
165
174
|
}
|
|
166
175
|
for (const [derived, content] of theirs) write(derived, content);
|
|
@@ -252,6 +261,7 @@ async function pushSourceTree(input) {
|
|
|
252
261
|
kind: input.message.kind,
|
|
253
262
|
id: input.message.surface
|
|
254
263
|
};
|
|
264
|
+
const application = input.message.kind === "artifact" ? void 0 : input.message.applicationId;
|
|
255
265
|
const head = await revParse("HEAD");
|
|
256
266
|
const base = input.base && head && !input.overwrite ? await revParse(input.base) : void 0;
|
|
257
267
|
if (base && base !== head) await run$1([
|
|
@@ -267,7 +277,8 @@ async function pushSourceTree(input) {
|
|
|
267
277
|
const unsynced = onRemote && scope.kind === "project";
|
|
268
278
|
materializeSourceTree(dir, input.files, scope, {
|
|
269
279
|
onRemote: onRemote && scope.kind !== "artifact",
|
|
270
|
-
overwrite: input.overwrite
|
|
280
|
+
overwrite: input.overwrite,
|
|
281
|
+
application
|
|
271
282
|
});
|
|
272
283
|
await run$1(["add", "-A"]);
|
|
273
284
|
const dirty = (await run$1(["status", "--porcelain"])).trim();
|
|
@@ -345,7 +356,9 @@ async function pushSourceTree(input) {
|
|
|
345
356
|
committing,
|
|
346
357
|
dir,
|
|
347
358
|
own,
|
|
348
|
-
scope
|
|
359
|
+
scope,
|
|
360
|
+
base,
|
|
361
|
+
application
|
|
349
362
|
});
|
|
350
363
|
await confirmIncoming(parent ?? own, upstream);
|
|
351
364
|
}
|
|
@@ -467,7 +480,7 @@ async function cloneSource(access, dir, options) {
|
|
|
467
480
|
}
|
|
468
481
|
throw first;
|
|
469
482
|
}
|
|
470
|
-
async function mergeUpstream(upstream, messageFile, { run: run$1, committing, dir, own, scope }) {
|
|
483
|
+
async function mergeUpstream(upstream, messageFile, { run: run$1, committing, dir, own, scope, base, application }) {
|
|
471
484
|
let failure;
|
|
472
485
|
await run$1([
|
|
473
486
|
"merge",
|
|
@@ -500,11 +513,15 @@ async function mergeUpstream(upstream, messageFile, { run: run$1, committing, di
|
|
|
500
513
|
if (!merging) return;
|
|
501
514
|
const show = (ref, file) => run$1(["show", `${ref}:${file}`]).then((text) => text, () => void 0);
|
|
502
515
|
if (scope.kind !== "artifact") {
|
|
503
|
-
const theirsLock = await show(upstream, LOCK_FILE
|
|
504
|
-
const mineLock = await show(own, LOCK_FILE
|
|
505
|
-
|
|
516
|
+
const theirsLock = await show(upstream, LOCK_FILE);
|
|
517
|
+
const mineLock = await show(own, LOCK_FILE);
|
|
518
|
+
const baseLock = base === void 0 ? void 0 : await show(base, LOCK_FILE);
|
|
519
|
+
await settle(run$1, dir, LOCK_FILE, mineLock === void 0 ? theirsLock : mergeLockText(theirsLock, mineLock, scope, {
|
|
520
|
+
base: baseLock,
|
|
521
|
+
application
|
|
522
|
+
}));
|
|
506
523
|
}
|
|
507
|
-
for (const file of derived) if (file !== LOCK_FILE
|
|
524
|
+
for (const file of derived) if (file !== LOCK_FILE) await settle(run$1, dir, file, await show(own, file));
|
|
508
525
|
await run$1([
|
|
509
526
|
"commit",
|
|
510
527
|
"--quiet",
|
|
@@ -665,7 +682,8 @@ async function pullSourceTree(input) {
|
|
|
665
682
|
status: "pulled",
|
|
666
683
|
head,
|
|
667
684
|
changes,
|
|
668
|
-
lock: await shown(LOCK_FILE
|
|
685
|
+
lock: await shown(LOCK_FILE),
|
|
686
|
+
baseLock: base ? await run$1(["show", `${base}:${LOCK_FILE}`]).then((text) => text, () => void 0) : void 0,
|
|
669
687
|
types: await shown(TYPES_FILE)
|
|
670
688
|
};
|
|
671
689
|
} finally {
|
|
@@ -690,80 +708,4 @@ function replaceTree(dir, files) {
|
|
|
690
708
|
const isRejected = (error) => error instanceof GitError && /rejected|non-fast-forward|fetch first|stale info|failed to push some refs/i.test(error.message);
|
|
691
709
|
|
|
692
710
|
//#endregion
|
|
693
|
-
|
|
694
|
-
const HARD_EXCLUDES = [
|
|
695
|
-
".superwall/**",
|
|
696
|
-
"**/node_modules/**",
|
|
697
|
-
".git/**",
|
|
698
|
-
"**/.env*",
|
|
699
|
-
"**/.DS_Store",
|
|
700
|
-
"**/.npmrc",
|
|
701
|
-
"**/.netrc",
|
|
702
|
-
"**/*.pem",
|
|
703
|
-
"**/*.p8",
|
|
704
|
-
"**/*.p12",
|
|
705
|
-
"**/*.key",
|
|
706
|
-
"**/*.keystore",
|
|
707
|
-
"**/*.jks",
|
|
708
|
-
"**/google-services.json",
|
|
709
|
-
"**/GoogleService-Info.plist"
|
|
710
|
-
];
|
|
711
|
-
const LOCK_FILE = "superwall.lock";
|
|
712
|
-
const SOURCE_LIMIT_BYTES = 250 * 1024 * 1024;
|
|
713
|
-
const LARGEST_SHOWN = 3;
|
|
714
|
-
const megabytes = (bytes) => `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
715
|
-
function gitignoreExcludes(superwallDir) {
|
|
716
|
-
let text;
|
|
717
|
-
try {
|
|
718
|
-
text = fs.readFileSync(path.join(superwallDir, ".gitignore"), "utf8");
|
|
719
|
-
} catch {
|
|
720
|
-
return [];
|
|
721
|
-
}
|
|
722
|
-
const excludes = [];
|
|
723
|
-
for (const raw of text.split("\n")) {
|
|
724
|
-
const line = raw.trim();
|
|
725
|
-
if (line === "" || line.startsWith("#") || line.startsWith("!")) continue;
|
|
726
|
-
const anchored = line.startsWith("/");
|
|
727
|
-
const body = (anchored ? line.slice(1) : line).replace(/\/+$/, "");
|
|
728
|
-
if (body === "") continue;
|
|
729
|
-
const base = anchored || body.includes("/") ? body : `**/${body}`;
|
|
730
|
-
excludes.push(base, `${base}/**`);
|
|
731
|
-
}
|
|
732
|
-
return excludes;
|
|
733
|
-
}
|
|
734
|
-
const readFramework = (superwallDir, relative$1) => relative$1 === LOCK_FILE ? Buffer.from(formatSharedLock(superwallDir)) : fs.readFileSync(path.join(superwallDir, relative$1));
|
|
735
|
-
async function collectSourceFiles(superwallDir, read = readFramework) {
|
|
736
|
-
const entries = await fg("**/*", {
|
|
737
|
-
cwd: superwallDir,
|
|
738
|
-
dot: true,
|
|
739
|
-
onlyFiles: true,
|
|
740
|
-
followSymbolicLinks: false,
|
|
741
|
-
ignore: [...HARD_EXCLUDES, ...gitignoreExcludes(superwallDir)]
|
|
742
|
-
});
|
|
743
|
-
if (entries.length === 0) return {
|
|
744
|
-
ok: false,
|
|
745
|
-
reason: `No source files found in ${superwallDir}.`
|
|
746
|
-
};
|
|
747
|
-
const sizes = entries.map((relative$1) => ({
|
|
748
|
-
path: relative$1,
|
|
749
|
-
bytes: fs.statSync(path.join(superwallDir, relative$1)).size
|
|
750
|
-
}));
|
|
751
|
-
const total = sizes.reduce((sum, entry) => sum + entry.bytes, 0);
|
|
752
|
-
if (total > SOURCE_LIMIT_BYTES) {
|
|
753
|
-
const largest = sizes.sort((a, b) => b.bytes - a.bytes).slice(0, LARGEST_SHOWN).map((entry) => `${entry.path} (${megabytes(entry.bytes)})`).join(", ");
|
|
754
|
-
return {
|
|
755
|
-
ok: false,
|
|
756
|
-
reason: `The source in ${superwallDir} is ${megabytes(total)}, over the ${SOURCE_LIMIT_BYTES / 1024 / 1024} MB limit. Largest: ${largest}. Add what doesn't belong to .gitignore, then push again.`
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
return {
|
|
760
|
-
ok: true,
|
|
761
|
-
files: entries.sort().map((relative$1) => ({
|
|
762
|
-
path: relative$1,
|
|
763
|
-
content: read(superwallDir, relative$1)
|
|
764
|
-
}))
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
//#endregion
|
|
769
|
-
export { statIfPresent as a, pushSourceTree as i, gitAvailable as n, pullSourceTree as r, collectSourceFiles as t };
|
|
711
|
+
export { statIfPresent as i, pullSourceTree as n, pushSourceTree as r, gitAvailable as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as orgForNewProject } from "./org-
|
|
6
|
-
import { n as findApplication } from "./lookup-
|
|
7
|
-
import { r as pickOrganization } from "./scope-
|
|
8
|
-
import { a as listAscConfigs, c as replaceAppPurchaseKey, l as replaceAscConfig, r as createAscConfig, s as replaceAppAscKey, t as ascProxy } from "./client-
|
|
1
|
+
import { h as cache, v as readJson } from "./storage-BR6imSqm.js";
|
|
2
|
+
import { y as ApiError } from "./config-DOp5oChe.js";
|
|
3
|
+
import { A as listField, M as textField, O as field, c as createProject, k as isRecord, m as listProjects, r as createApplication } from "./resources-XwvXA20E.js";
|
|
4
|
+
import { d as readInput, t as apiCall } from "./spinner-BQp7fQvK.js";
|
|
5
|
+
import { n as orgForNewProject } from "./org-BD8U3D1_.js";
|
|
6
|
+
import { n as findApplication } from "./lookup-DqmIbUkv.js";
|
|
7
|
+
import { r as pickOrganization } from "./scope-BLLUxbrA.js";
|
|
8
|
+
import { a as listAscConfigs, c as replaceAppPurchaseKey, l as replaceAscConfig, r as createAscConfig, s as replaceAppAscKey, t as ascProxy } from "./client-BwYhzITp.js";
|
|
9
9
|
|
|
10
10
|
//#region src/core/app-store-connect/api/spec.ts
|
|
11
11
|
const REFRESH_TTL_MS = 10080 * 60 * 1e3;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import "./storage-BR6imSqm.js";
|
|
3
|
+
import "./environment-sE2wZYdg.js";
|
|
4
|
+
import "./config-DOp5oChe.js";
|
|
5
|
+
import { t as upsertHeldKey } from "./held-CUBCOCGP.js";
|
|
6
|
+
import "./resources-XwvXA20E.js";
|
|
7
|
+
import "./orgs-DQQJ3sw_.js";
|
|
8
|
+
import "./ui-hFgji1e8.js";
|
|
9
|
+
import "./spinner-BQp7fQvK.js";
|
|
10
|
+
import "./org-BD8U3D1_.js";
|
|
11
|
+
import "./lookup-DqmIbUkv.js";
|
|
12
|
+
import "./scope-BLLUxbrA.js";
|
|
13
|
+
import "./client-BwYhzITp.js";
|
|
14
|
+
|
|
15
|
+
export { upsertHeldKey };
|
|
@@ -1,20 +1,18 @@
|
|
|
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 { C as
|
|
14
|
-
import { t as ArtifactError } from "./project-
|
|
15
|
-
import "./
|
|
16
|
-
import "./scope-ehZ7L1nj.js";
|
|
17
|
-
import { n as resolveOrganization, t as resolveAppScope } from "./organization-7vJA3uy1.js";
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import "./storage-BR6imSqm.js";
|
|
3
|
+
import "./environment-sE2wZYdg.js";
|
|
4
|
+
import "./config-DOp5oChe.js";
|
|
5
|
+
import "./resources-XwvXA20E.js";
|
|
6
|
+
import "./orgs-DQQJ3sw_.js";
|
|
7
|
+
import "./ui-hFgji1e8.js";
|
|
8
|
+
import "./spinner-BQp7fQvK.js";
|
|
9
|
+
import "./lookup-DqmIbUkv.js";
|
|
10
|
+
import "./types-Dc9U_4kp.js";
|
|
11
|
+
import { n as openBrowser } from "./browser-BVjaf98V.js";
|
|
12
|
+
import "./scope-Cg1AdAfO.js";
|
|
13
|
+
import { C as listInstallations, O as setInstallation, S as listArtifacts, T as listVersions, a as latestManifest, c as openLink, d as resolveArtifact, m as readBinding, t as appEntrypointUrl, u as projectRoot, y as deleteInstallation } from "./resolve-DO7bPota.js";
|
|
14
|
+
import { t as ArtifactError } from "./project-BomArwSj.js";
|
|
15
|
+
import { n as resolveOrganization, t as resolveAppScope } from "./organization-D-ZlB3qU.js";
|
|
18
16
|
|
|
19
17
|
//#region src/core/artifacts/install.ts
|
|
20
18
|
const whereLabel = (application) => application === null || application === void 0 ? "the whole organization" : `app ${application}`;
|
|
@@ -1,36 +1,28 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import {
|
|
3
|
-
import { d as DASHBOARD_URL, x as VERSION } from "./environment-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import { n as
|
|
10
|
-
import { n as
|
|
11
|
-
import "./
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import { t as detectExisting } from "./existing
|
|
15
|
-
import { r as expandHome } from "./paths-
|
|
16
|
-
import "./
|
|
17
|
-
import
|
|
18
|
-
import "./
|
|
19
|
-
import "./
|
|
20
|
-
import "./
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import "./
|
|
24
|
-
import {
|
|
25
|
-
import "./
|
|
26
|
-
import { s as ensureSkillsCurrent } from "./skills-421SFEyF.js";
|
|
27
|
-
import "./browser-Bp3yRKlU.js";
|
|
28
|
-
import { a as copyToClipboard, r as buildCopyPrompt, t as runAction } from "./run-c1O2_8pp.js";
|
|
29
|
-
import { n as selectHostedStatus, t as detectDrivers } from "./drivers-BQkO5tHs.js";
|
|
30
|
-
import { n as performLoginWithUi, t as createLoginGate } from "./login-Jp6E6d2e.js";
|
|
31
|
-
import { t as generateStoreKit } from "./storekit-B9M2raxe.js";
|
|
32
|
-
import { r as actionById, t as detectBilling } from "./billing-ZIETn0j4.js";
|
|
33
|
-
import { n as writeReport, t as readReport } from "./reports-HYVp169R.js";
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import { f as formatJson, i as removeSession, n as readSession, s as sessionOrgName, u as blocks } from "./storage-BR6imSqm.js";
|
|
3
|
+
import { d as DASHBOARD_URL, x as VERSION } from "./environment-sE2wZYdg.js";
|
|
4
|
+
import { S as superwallApi, i as readOnboardedApp } from "./config-DOp5oChe.js";
|
|
5
|
+
import { S as updateTelemetryTags, s as ensureSkillsCurrent } from "./skills-BB1uIt8t.js";
|
|
6
|
+
import { n as SUPPORTED_LABEL, t as scanProject } from "./scan-ViBhmrB7.js";
|
|
7
|
+
import { A as listField, O as field, T as rowName, h as listResource, p as listApplications, s as createProduct, y as platformLabel } from "./resources-XwvXA20E.js";
|
|
8
|
+
import "./orgs-DQQJ3sw_.js";
|
|
9
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
10
|
+
import { n as withSpinner } from "./spinner-BQp7fQvK.js";
|
|
11
|
+
import "./org-BD8U3D1_.js";
|
|
12
|
+
import { a as resolveScopeFromKey, i as resolveAppBinding, r as platformForIntegration } from "./theme-Ed0gz6hr.js";
|
|
13
|
+
import "./lookup-DqmIbUkv.js";
|
|
14
|
+
import { a as runAction, d as superwallDriver, f as selectHostedStatus, l as detectDrivers, n as stripReport, p as copyToClipboard, s as buildCopyPrompt, t as detectExisting, u as AGENT_SDK_INSTALL_MESSAGE } from "./existing--peXpOZj.js";
|
|
15
|
+
import { r as expandHome } from "./paths-CIlyzF2I.js";
|
|
16
|
+
import "./login-C6X7JrhM.js";
|
|
17
|
+
import "./browser-BVjaf98V.js";
|
|
18
|
+
import { n as performLoginWithUi, t as createLoginGate } from "./login-DXhm9L0F.js";
|
|
19
|
+
import "./scope-BLLUxbrA.js";
|
|
20
|
+
import { a as listAscConfigs, r as createAscConfig } from "./client-BwYhzITp.js";
|
|
21
|
+
import { i as listUnimportedAscProducts, n as findAscAppId, r as listAscApps, t as ascTypeDisplay } from "./products-CJq_iXv5.js";
|
|
22
|
+
import "./input-DOT_2Zvb.js";
|
|
23
|
+
import { n as generateStoreKit, t as describeSkipped } from "./storekit-BqyujKQ_.js";
|
|
24
|
+
import { r as actionById, t as detectBilling } from "./billing-Dt6L_l9R.js";
|
|
25
|
+
import { n as writeReport, t as readReport } from "./reports-hbxsd3Zo.js";
|
|
34
26
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
35
27
|
import { basename } from "node:path";
|
|
36
28
|
import fg from "fast-glob";
|
|
@@ -131,7 +123,7 @@ async function runProductsStage(ctx) {
|
|
|
131
123
|
let result = "done";
|
|
132
124
|
if (how === "asc") result = await ascFlow(ctx, products, teamId);
|
|
133
125
|
else if (how === "storekit") result = await importFromStoreKit(ctx, products, storeKitFiles);
|
|
134
|
-
else if (how === "export") writeStoreKit(products);
|
|
126
|
+
else if (how === "export") writeStoreKit(products, teamId);
|
|
135
127
|
if (result === "back") continue;
|
|
136
128
|
return;
|
|
137
129
|
}
|
|
@@ -383,10 +375,12 @@ function renderCheck(ok, text) {
|
|
|
383
375
|
if (ok) ui.success(text);
|
|
384
376
|
else ui.warn(text);
|
|
385
377
|
}
|
|
386
|
-
function writeStoreKit(products) {
|
|
378
|
+
function writeStoreKit(products, teamId) {
|
|
387
379
|
const out = "Superwall.storekit";
|
|
388
|
-
|
|
389
|
-
|
|
380
|
+
const { file, written, skipped } = generateStoreKit(products, { teamId: teamId || void 0 });
|
|
381
|
+
writeFileSync(out, `${formatJson(file)}\n`);
|
|
382
|
+
ui.success(`Wrote \`${out}\` with ${formatCount(written, "product")}.`);
|
|
383
|
+
for (const line of describeSkipped(skipped)) ui.warn(`${line}.`);
|
|
390
384
|
}
|
|
391
385
|
|
|
392
386
|
//#endregion
|
|
@@ -608,12 +602,13 @@ async function runIntegrate(ctx) {
|
|
|
608
602
|
ui.intro(`Superwall v${VERSION}`);
|
|
609
603
|
const drivers = await withSpinner("Checking your setup", () => detectDrivers());
|
|
610
604
|
const [first] = drivers;
|
|
605
|
+
const wanted = ctx.driver;
|
|
606
|
+
if (wanted === superwallDriver.id && !drivers.some((d) => d.driver.id === wanted)) throw new Error(AGENT_SDK_INSTALL_MESSAGE);
|
|
611
607
|
if (!first) {
|
|
612
608
|
ui.warn("No coding agent found.");
|
|
613
609
|
await runFallback(installDir);
|
|
614
610
|
return;
|
|
615
611
|
}
|
|
616
|
-
const wanted = ctx.driver;
|
|
617
612
|
const picked = wanted ? drivers.find((d) => d.driver.id === wanted) : first;
|
|
618
613
|
if (!picked) throw new Error(`Driver "${wanted}" not available. Detected: ${drivers.map((d) => d.driver.id).join(", ")}.`);
|
|
619
614
|
const driver = picked.driver;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as readOnboardedOrg, m as writeOnboardedOrg, o as readOnboardingIdempotencyKey, p as writeOnboardedApp } from "./config-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as ui } from "./ui-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as openBrowser, t as BROWSER_UNAVAILABLE } from "./browser-Bp3yRKlU.js";
|
|
1
|
+
import { c as writePendingLogin, l as writeSession, o as serializeSession, r as removePendingLogin, t as readPendingLogin } from "./storage-BR6imSqm.js";
|
|
2
|
+
import { g as OAUTH_SCOPE, h as Integration, i as AUTH_HOST, l as CLI_CLIENT_ID, t as API_HOST } from "./environment-sE2wZYdg.js";
|
|
3
|
+
import { a as readOnboardedOrg, m as writeOnboardedOrg, o as readOnboardingIdempotencyKey, p as writeOnboardedApp } from "./config-DOp5oChe.js";
|
|
4
|
+
import { s as ensureSkillsCurrent, x as track } from "./skills-BB1uIt8t.js";
|
|
5
|
+
import { t as scanProject } from "./scan-ViBhmrB7.js";
|
|
6
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
7
|
+
import { r as UsageError } from "./spinner-BQp7fQvK.js";
|
|
8
|
+
import { n as openBrowser, t as BROWSER_UNAVAILABLE } from "./browser-BVjaf98V.js";
|
|
10
9
|
import { setTimeout } from "node:timers/promises";
|
|
11
10
|
|
|
12
11
|
//#region src/core/account/onboarding.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as ui } from "./ui-
|
|
2
|
-
import { a as onboardingHooks, t as performLogin } from "./login-
|
|
3
|
-
import { t as BROWSER_UNAVAILABLE } from "./browser-
|
|
1
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
2
|
+
import { a as onboardingHooks, t as performLogin } from "./login-C6X7JrhM.js";
|
|
3
|
+
import { t as BROWSER_UNAVAILABLE } from "./browser-BVjaf98V.js";
|
|
4
4
|
|
|
5
5
|
//#region src/core/workflows/login.ts
|
|
6
6
|
async function performLoginWithUi(app, onProvisioned) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import "./storage-BR6imSqm.js";
|
|
3
|
+
import "./environment-sE2wZYdg.js";
|
|
4
|
+
import "./config-DOp5oChe.js";
|
|
5
|
+
import "./skills-BB1uIt8t.js";
|
|
6
|
+
import "./scan-ViBhmrB7.js";
|
|
7
|
+
import "./ui-hFgji1e8.js";
|
|
8
|
+
import "./spinner-BQp7fQvK.js";
|
|
9
|
+
import "./paths-CIlyzF2I.js";
|
|
10
|
+
import { i as startLogin, n as pollLogin, r as runLogin, t as performLogin } from "./login-C6X7JrhM.js";
|
|
11
|
+
import "./browser-BVjaf98V.js";
|
|
12
|
+
|
|
13
|
+
export { performLogin, pollLogin, runLogin, startLogin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { y as ApiError } from "./config-DOp5oChe.js";
|
|
2
|
+
import { m as listProjects } from "./resources-XwvXA20E.js";
|
|
3
|
+
import { a as orgProjects, s as rememberOrg } from "./orgs-DQQJ3sw_.js";
|
|
4
4
|
|
|
5
5
|
//#region src/core/api/lookup.ts
|
|
6
6
|
const DASHBOARD_PATH = /^\/(\d+)(?:\/(\d+))?(?:\/|$)/;
|
|
@@ -64,9 +64,33 @@ async function findApplication(api, ref, known) {
|
|
|
64
64
|
if (found) rememberOrg(found.project);
|
|
65
65
|
return found;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* A custom store is a CUSTOM application that `/v2/projects` leaves out of `applications`, so
|
|
69
|
+
* `findApplication` never sees one. This finds it by id, name or dashboard link among the
|
|
70
|
+
* projects' custom stores, as an application of platform `custom`.
|
|
71
|
+
*/
|
|
72
|
+
async function findCustomStore(api, ref, projects) {
|
|
73
|
+
const id = parseDashboardUrl(ref)?.applicationId ?? ref;
|
|
74
|
+
const perProject = await Promise.all(projects.map((project) => api.list(`/v2/projects/${encodeURIComponent(String(project.id))}/custom-stores`).catch((error) => {
|
|
75
|
+
if (notFound(error)) return [];
|
|
76
|
+
throw error;
|
|
77
|
+
})));
|
|
78
|
+
for (const [index, stores] of perProject.entries()) {
|
|
79
|
+
const project = projects[index];
|
|
80
|
+
const store = stores.find((candidate) => String(candidate.id) === id || candidate.name === ref);
|
|
81
|
+
if (project && store) return {
|
|
82
|
+
project,
|
|
83
|
+
app: {
|
|
84
|
+
id: String(store.id),
|
|
85
|
+
name: store.name,
|
|
86
|
+
platform: "custom"
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
67
91
|
function appNotFound(ref) {
|
|
68
92
|
return /* @__PURE__ */ new Error(`No app ${ref} that this account can open. Pass its dashboard link instead — https://app.superwall.com/<org>/<app>/… names the organization, which finds apps that have no paywalls yet.`);
|
|
69
93
|
}
|
|
70
94
|
|
|
71
95
|
//#endregion
|
|
72
|
-
export { parseDashboardUrl as i, findApplication as n,
|
|
96
|
+
export { parseDashboardUrl as a, findProject as i, findApplication as n, findCustomStore as r, appNotFound as t };
|
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
import "./token-
|
|
2
|
-
import {
|
|
3
|
-
import { d as DASHBOARD_URL, x as VERSION } from "./environment-
|
|
4
|
-
import
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import
|
|
11
|
-
import "./
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import "./
|
|
16
|
-
import "./
|
|
17
|
-
import "./
|
|
18
|
-
import "./
|
|
19
|
-
import "./
|
|
20
|
-
import "./
|
|
21
|
-
import "./browser-
|
|
22
|
-
import "./
|
|
23
|
-
import "./
|
|
24
|
-
import
|
|
25
|
-
import "./
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import "./source-
|
|
31
|
-
import "./
|
|
32
|
-
import "./
|
|
33
|
-
import "./
|
|
34
|
-
import {
|
|
35
|
-
import { r as actionById, t as detectBilling } from "./billing-ZIETn0j4.js";
|
|
36
|
-
import { n as writeReport } from "./reports-HYVp169R.js";
|
|
1
|
+
import "./token-CWQ6tdva.js";
|
|
2
|
+
import { n as readSession, s as sessionOrgName, u as blocks } from "./storage-BR6imSqm.js";
|
|
3
|
+
import { d as DASHBOARD_URL, x as VERSION } from "./environment-sE2wZYdg.js";
|
|
4
|
+
import "./config-DOp5oChe.js";
|
|
5
|
+
import "./skills-BB1uIt8t.js";
|
|
6
|
+
import { t as scanProject } from "./scan-ViBhmrB7.js";
|
|
7
|
+
import "./resources-XwvXA20E.js";
|
|
8
|
+
import "./orgs-DQQJ3sw_.js";
|
|
9
|
+
import { n as ui } from "./ui-hFgji1e8.js";
|
|
10
|
+
import "./spinner-BQp7fQvK.js";
|
|
11
|
+
import "./org-BD8U3D1_.js";
|
|
12
|
+
import "./theme-Ed0gz6hr.js";
|
|
13
|
+
import "./lookup-DqmIbUkv.js";
|
|
14
|
+
import "./types-Dc9U_4kp.js";
|
|
15
|
+
import { n as requireApi } from "./session-BfVx50iA.js";
|
|
16
|
+
import { a as runAction, l as detectDrivers, n as stripReport, t as detectExisting } from "./existing--peXpOZj.js";
|
|
17
|
+
import "./paths-CIlyzF2I.js";
|
|
18
|
+
import { S as screenNameOf, _ as scaffoldFromPaywall, b as findScreenCandidates, d as buildMigrationCopyPrompt, f as hasOriginal, g as projectDirOf, h as offerMigration, m as migrationSource, p as migrationFor, v as scaffoldFromScreen, x as placementOfName, y as screenMigrationFor } from "./setup-a4B72xJ8.js";
|
|
19
|
+
import "./framework-DW5fqjh4.js";
|
|
20
|
+
import "./login-C6X7JrhM.js";
|
|
21
|
+
import "./browser-BVjaf98V.js";
|
|
22
|
+
import { n as performLoginWithUi } from "./login-DXhm9L0F.js";
|
|
23
|
+
import "./git-Hf9Wc7Hp.js";
|
|
24
|
+
import "./scope-Cg1AdAfO.js";
|
|
25
|
+
import "./upgrade-Cw9jVt-r.js";
|
|
26
|
+
import "./base-CAU0hWoI.js";
|
|
27
|
+
import "./selection-C07e_GGY.js";
|
|
28
|
+
import "./source-DQs6iLtC.js";
|
|
29
|
+
import "./assets-PyuXe45Y.js";
|
|
30
|
+
import "./source-push-w7miTr6m.js";
|
|
31
|
+
import "./server-CBtHzl9y.js";
|
|
32
|
+
import { i as startStudio, n as migrationNextSteps, r as screenNextSteps, t as askStudio } from "./open-xdgXUzaF.js";
|
|
33
|
+
import { r as actionById, t as detectBilling } from "./billing-Dt6L_l9R.js";
|
|
34
|
+
import { n as writeReport } from "./reports-hbxsd3Zo.js";
|
|
37
35
|
import { execFile } from "node:child_process";
|
|
38
36
|
import * as fs from "node:fs";
|
|
39
37
|
import * as os$1 from "node:os";
|
|
@@ -99,7 +97,7 @@ async function askForScreenshot(ui$1, runtime = createSimulator()) {
|
|
|
99
97
|
//#endregion
|
|
100
98
|
//#region src/core/workflows/migrate.ts
|
|
101
99
|
async function runPaywallMigration(ctx, paywallId, skill) {
|
|
102
|
-
const { installDir, interactive } = ctx;
|
|
100
|
+
const { installDir, interactive, dryRun } = ctx;
|
|
103
101
|
if (!skill) ui.intro(`Superwall migrate v${VERSION}`);
|
|
104
102
|
const existingDir = projectDirOf(installDir);
|
|
105
103
|
let migration = existingDir === void 0 ? void 0 : migrationFor(existingDir, paywallId);
|
|
@@ -112,14 +110,26 @@ async function runPaywallMigration(ctx, paywallId, skill) {
|
|
|
112
110
|
const api = await requireApi(interactive);
|
|
113
111
|
const target = existingDir ?? path.join(installDir, "superwall");
|
|
114
112
|
if (existingDir === void 0 && fs.existsSync(path.join(target, "package.json"))) throw new Error(`\`${target}\` already has a package.json that isn't a superwall project — move it aside first.`);
|
|
115
|
-
|
|
113
|
+
const origin = await scaffoldFromPaywall(ui, api, {
|
|
116
114
|
root: installDir,
|
|
117
115
|
target,
|
|
118
116
|
paywallId,
|
|
119
|
-
newProject: existingDir === void 0
|
|
120
|
-
|
|
117
|
+
newProject: existingDir === void 0,
|
|
118
|
+
dryRun
|
|
119
|
+
});
|
|
120
|
+
if (dryRun && origin.url !== void 0) {
|
|
121
|
+
ui.outro("Dry run - no changes made.");
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
migration = dryRun ? void 0 : migrationFor(target, origin.id);
|
|
121
125
|
if (migration === void 0) throw new Error(`Paywall ${paywallId} has no served document to rebuild from — nothing was recorded in superwall.lock.`);
|
|
122
|
-
} else
|
|
126
|
+
} else {
|
|
127
|
+
ui.info(`\`paywalls/${migration.surfaceId}\` was scaffolded from paywall ${paywallId} — picking up the rebuild.`);
|
|
128
|
+
if (dryRun) {
|
|
129
|
+
ui.outro("Dry run - no changes made.");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
123
133
|
const choice = await offerMigration(ui, interactive, migration);
|
|
124
134
|
const opening = choice === "agent" && await askStudio(ui, interactive, migration.surfaceId);
|
|
125
135
|
ctx.output.render(blocks.nextSteps(migrationNextSteps(opening, path.relative(installDir, migration.superwallDir) || ".", paywallId, choice)), blocks.outro(`Done. ${DASHBOARD_URL}`));
|
|
@@ -147,7 +157,7 @@ async function pickScreen(ctx) {
|
|
|
147
157
|
}) ?? void 0;
|
|
148
158
|
}
|
|
149
159
|
async function runScreenMigration(ctx, screen, skill) {
|
|
150
|
-
const { installDir, interactive } = ctx;
|
|
160
|
+
const { installDir, interactive, dryRun } = ctx;
|
|
151
161
|
if (!skill) ui.intro(`Superwall migrate v${VERSION}`);
|
|
152
162
|
const existingDir = projectDirOf(installDir);
|
|
153
163
|
let file = screen.path === "" ? void 0 : path.resolve(screen.path);
|
|
@@ -169,17 +179,28 @@ async function runScreenMigration(ctx, screen, skill) {
|
|
|
169
179
|
if (existingDir === void 0 && fs.existsSync(path.join(target, "package.json"))) throw new Error(`\`${target}\` already has a package.json that isn't a superwall project — move it aside first.`);
|
|
170
180
|
let screenshot = screen.screenshot === void 0 ? void 0 : path.resolve(screen.screenshot);
|
|
171
181
|
if (screenshot !== void 0 && !fs.existsSync(screenshot)) throw new Error(`No screenshot at \`${screen.screenshot}\`.`);
|
|
172
|
-
if (screenshot === void 0 && interactive) screenshot = await askForScreenshot(ui);
|
|
182
|
+
if (screenshot === void 0 && interactive && !dryRun) screenshot = await askForScreenshot(ui);
|
|
173
183
|
scaffoldFromScreen(ui, {
|
|
174
184
|
root: installDir,
|
|
175
185
|
target,
|
|
176
186
|
file,
|
|
177
187
|
newProject: existingDir === void 0,
|
|
178
|
-
screenshot
|
|
188
|
+
screenshot,
|
|
189
|
+
dryRun
|
|
179
190
|
});
|
|
191
|
+
if (dryRun) {
|
|
192
|
+
ui.outro("Dry run - no changes made.");
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
180
195
|
migration = screenMigrationFor(target, file);
|
|
181
196
|
if (migration === void 0) throw new Error(`\`${shown}\` was not recorded in superwall.lock — nothing to rebuild.`);
|
|
182
|
-
} else
|
|
197
|
+
} else {
|
|
198
|
+
ui.info(`\`paywalls/${migration.surfaceId}\` was scaffolded from \`${shown}\` — picking up the rebuild.`);
|
|
199
|
+
if (dryRun) {
|
|
200
|
+
ui.outro("Dry run - no changes made.");
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
183
204
|
const choice = await offerMigration(ui, interactive, migration);
|
|
184
205
|
const original = hasOriginal(migration);
|
|
185
206
|
const opening = choice === "agent" && await askStudio(ui, interactive, migration.surfaceId, original);
|