@superwall/cli 2.5.0 → 2.5.2

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.
Files changed (103) hide show
  1. package/README.md +7 -0
  2. package/dist/{apple-Dyr7OFBx.js → apple-D2z3tALE.js} +14 -14
  3. package/dist/{approve-Czs1-JO9.js → approve-I-lvTanp.js} +35 -28
  4. package/dist/{assets-BrB9jQPQ.js → assets-oo93EFou.js} +3 -3
  5. package/dist/auth.d.ts +1 -1
  6. package/dist/auth.js +3 -3
  7. package/dist/{session-D3fgXQBt.js → base-Cft9NZfU.js} +35 -35
  8. package/dist/{billing-D5qqIlVb.js → billing-Bo1UEKqV.js} +3 -3
  9. package/dist/{bind-B3eEcRyp.js → bind-BvScWziR.js} +4 -4
  10. package/dist/{build-DD9pSwHX.js → build-Co487gha.js} +11 -9
  11. package/dist/{client-AI9H4GGB.js → client-Tp6iD66_.js} +55 -5
  12. package/dist/create-CHIPz5vb.js +20 -0
  13. package/dist/{create-ChfgWpiM.js → create-G3HuOHZ4.js} +31 -31
  14. package/dist/{create-B4m-IKlr.js → create-uA3nrMIa.js} +6 -6
  15. package/dist/design-lint-CiFc78aM.js +158 -0
  16. package/dist/{doctor-XtXW6tKE.js → doctor-CHF9aNFc.js} +6 -6
  17. package/dist/{drivers-CMEL13gp.js → drivers-YZEcBiSV.js} +3 -3
  18. package/dist/entry.js +20 -20
  19. package/dist/{environment-BWT2S4qC.js → environment-EU7Mrk7j.js} +3 -3
  20. package/dist/{existing-b0GxFcnc.js → existing-DV_6NLfW.js} +2 -2
  21. package/dist/{selection-BltBpyp5.js → framework-b-Yf8sP1.js} +50 -50
  22. package/dist/held-Dd19AduK.js +17 -0
  23. package/dist/{held-D3PUNky2.js → held-L0vz0_hA.js} +6 -6
  24. package/dist/install-CXfLcLhU.js +109 -0
  25. package/dist/{integrate-qvKd9pVW.js → integrate-DS2YGLsM.js} +23 -23
  26. package/dist/{types-JdxmnCko.js → lock-DgSx-p8Y.js} +79 -79
  27. package/dist/login-C0BjJmFy.js +17 -0
  28. package/dist/{login-PMoXUGqq.js → login-Ca6FhI6R.js} +6 -6
  29. package/dist/{login-COmGHrU5.js → login-DoMmU3Bq.js} +1 -1
  30. package/dist/{lookup-gjcKIZvh.js → lookup-DhMLZmdW.js} +3 -3
  31. package/dist/{migrate-SkkLLdmr.js → migrate-CoQWqzhJ.js} +29 -29
  32. package/dist/{migration-DS44-3Zr.js → migration-C22iQzAW.js} +29 -11
  33. package/dist/{notification-url-BjQPLf4-.js → notification-url-CqnXE9yB.js} +2 -2
  34. package/dist/{open-DQpm2yVs.js → open-DriuY3di.js} +2 -2
  35. package/dist/{org-C04eAO-j.js → org-D7LQrg3k.js} +3 -3
  36. package/dist/{organization-BOECL3vZ.js → organization-DDidaGRK.js} +8 -8
  37. package/dist/{orgs-D6Kk96mG.js → orgs-CYXjVdxM.js} +1 -1
  38. package/dist/{paths-REb-GrbX.js → paths-Bf3othB-.js} +1 -1
  39. package/dist/{playbook-Du4Oydbf.js → playbook-K7vmAUsu.js} +10 -10
  40. package/dist/{project-CP6hiHra.js → project-NoMtbMyl.js} +9 -9
  41. package/dist/{promote-Dm2_b1WK.js → promote-DXxxj4BU.js} +23 -22
  42. package/dist/pull-Bfa3_SBt.js +106 -0
  43. package/dist/pull-DGrlBSAG.js +36 -0
  44. package/dist/{pull-F6pvO4To.js → pull-DuFUkP7t.js} +8 -8
  45. package/dist/{push-D_l9KJZN.js → push-CrowxhpU.js} +54 -48
  46. package/dist/push-DPZdch2W.js +30 -0
  47. package/dist/push-DV-kJZdw.js +22 -0
  48. package/dist/{push-BIFLhAiO.js → push-Dk5x2xP3.js} +122 -22
  49. package/dist/{registry-DIJB0mJa.js → registry-HhZVRBqY.js} +178 -155
  50. package/dist/resolve-D3RBtfkI.js +242 -0
  51. package/dist/{resources-BaP3p_LY.js → resources-CkG6SCia.js} +2 -2
  52. package/dist/{run-C5OPwhvS.js → run-CL5ZnujW.js} +2 -2
  53. package/dist/{run-CgLmD2vR.js → run-Co8u_BkN.js} +93 -70
  54. package/dist/scan-BQmjhs3g.js +4 -0
  55. package/dist/{scan-Bj5y0zTZ.js → scan-DhmGH1rF.js} +1 -1
  56. package/dist/{scope-Bp_zwJOo.js → scope-D0XpYMn4.js} +5 -5
  57. package/dist/{scope-CCb_7UvN.js → scope-ehZ7L1nj.js} +25 -11
  58. package/dist/{sdk-TvT0p_nO.js → sdk-DEfQttek.js} +7 -7
  59. package/dist/{series-TAixFBWW.js → series-D2ZpZ8cx.js} +96 -63
  60. package/dist/server-4ZK_1Off.js +29 -0
  61. package/dist/{server-CdVIboQn.js → server-DamMN_ig.js} +9 -9
  62. package/dist/session-4F_YWSul.js +6 -0
  63. package/dist/{session-Ywim-P8M.js → session-G1uwJI8L.js} +1 -1
  64. package/dist/{setup-zzjtTy8k.js → setup-BFTSxEWU.js} +9 -9
  65. package/dist/skills/index.json +2 -2
  66. package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
  67. package/dist/skills/{superwall-workspaces → superwall-artifacts}/SKILL.md +47 -32
  68. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/cli.md +35 -29
  69. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/slots.md +9 -9
  70. package/dist/{skills-2qYaUXGE.js → skills-CE4c9eHX.js} +4 -4
  71. package/dist/{skills-8um2fBPS.js → skills-ClEVgXUB.js} +8 -8
  72. package/dist/{git-D7AVdugb.js → source-BccdO4aL.js} +111 -102
  73. package/dist/{source-push-kAep4gPe.js → source-push-EyF02ekO.js} +43 -26
  74. package/dist/{spinner-BANVLncC.js → spinner-mWZnJCkN.js} +3 -3
  75. package/dist/{starter-CiLrp1cN.js → starter-BtUUQWhd.js} +38 -28
  76. package/dist/{status-CoYMK7QL.js → status-SAZxltzW.js} +42 -39
  77. package/dist/{storage-DzP22xKn.js → storage-R5-qDvHq.js} +1 -1
  78. package/dist/{storekit-n1x0bWkQ.js → storekit-CQHVFTOC.js} +3 -3
  79. package/dist/storekit-DK3xXKoY.js +17 -0
  80. package/dist/{telemetry-CXN6f-ZX.js → telemetry-B-uKuu49.js} +1 -1
  81. package/dist/{token-FmeHywYt.js → token-C2kzntVM.js} +1 -1
  82. package/dist/tools.d.ts +6 -1
  83. package/dist/tools.js +208 -130
  84. package/dist/{try-BWbzgelb.js → try-BrJJyXgq.js} +32 -32
  85. package/dist/{upgrade-CoWCEnoi.js → upgrade-g_Bd9oJe.js} +2 -2
  86. package/dist/{upgrade-Bk5boOgW.js → upgrade-zOXTIaAZ.js} +2 -2
  87. package/package.json +2 -2
  88. package/dist/create-CJljlkJK.js +0 -20
  89. package/dist/held-CX7Zf8u-.js +0 -17
  90. package/dist/install-CVUXsx8c.js +0 -103
  91. package/dist/login-ClnJi1Ea.js +0 -17
  92. package/dist/pull-DsdOoG-D.js +0 -36
  93. package/dist/pull-zYAbqo9n.js +0 -106
  94. package/dist/push-CJVfvFZq.js +0 -29
  95. package/dist/push-SVzv7fzE.js +0 -22
  96. package/dist/resolve--GsHj0Q1.js +0 -171
  97. package/dist/scan-v_WTE722.js +0 -4
  98. package/dist/server-CvJVusw3.js +0 -29
  99. package/dist/session-B8JNXkwN.js +0 -6
  100. package/dist/storekit-D5eopLM0.js +0 -17
  101. /package/dist/{download-2Zu2I_Og.js → download-DhGd4hOB.js} +0 -0
  102. /package/dist/{reports-CuhB1_ub.js → reports-HYVp169R.js} +0 -0
  103. /package/dist/{storage-BjQCiTuz.d.ts → storage-Bdz5AmqS.d.ts} +0 -0
@@ -1,12 +1,13 @@
1
- import { x as VERSION } from "./environment-BWT2S4qC.js";
1
+ import { x as VERSION } from "./environment-EU7Mrk7j.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-BaP3p_LY.js";
4
- import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-BrB9jQPQ.js";
5
- import { _ as weight, a as resolveProjectDir, c as storesDiffer, d as kb, f as pendingPromoteWarning, g as transition, h as took, i as requireProject, l as BIND_VERB, m as resolveNote, p as pushedLine, r as requireClean, s as selectSurfaces, t as needsWork, v as frameworkVersion, y as resolveFramework } from "./selection-BltBpyp5.js";
6
- import { a as describeBindings, f as readLock, g as writeBindings, n as collectProjectDeclarations, p as removeBinding, r as writeProjectTypes, y as writeSnapshot } from "./types-JdxmnCko.js";
7
- import { c as planTargets, l as targetLabel, n as requireApi, o as writeProjectScaffold, p as resolveApps, s as parsePlatformFlags, u as wantedPlatforms } from "./session-D3fgXQBt.js";
8
- import { a as listProjectCatalogue, c as requireProducts, l as resolveBinding, n as pushSource, r as warnNotPortable, s as projectForApplication, t as assertGit } from "./source-push-kAep4gPe.js";
9
- import { a as collectSourceFiles } from "./git-D7AVdugb.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-CkG6SCia.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-Cft9NZfU.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-b-Yf8sP1.js";
7
+ import { t as collectSourceFiles } from "./source-BccdO4aL.js";
8
+ import { n as requireAssets, r as syncAssets, t as assetBaseUrl } from "./assets-oo93EFou.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-EyF02ekO.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, surfaces, declared } = input;
249
- const apps = await resolveApps({
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 targets = planTargets({
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: parsePlatformFlags(input.platforms)
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 lock = readLock(project.superwallDir);
311
- const recorded = (target.surface.kind === "paywall" ? lock.paywalls : lock.funnels)[target.surface.id]?.[target.platform];
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 { prepared, multi } = await prepare(context, {
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