create-disposabl-app 0.20.17 → 0.20.19

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 (32) hide show
  1. package/dist/disposabl.js +1 -1
  2. package/dist/index.js +3 -1
  3. package/dist/templates/default/.github/scripts/release.sh +33 -5
  4. package/dist/templates/default/.github/workflows/pipeline.yml +1 -1
  5. package/dist/templates/default/apps/docs/content/mobile.mdx +2 -0
  6. package/dist/templates/default/apps/docs/content/publishing/apple.mdx +12 -0
  7. package/dist/templates/default/apps/docs/content/publishing/google-play.mdx +12 -0
  8. package/dist/templates/default/apps/docs/content/publishing/index.mdx +23 -0
  9. package/dist/templates/default/apps/mobile/package.json +1 -0
  10. package/dist/templates/default/apps/mobile/scripts/android-release-verify.mjs +51 -6
  11. package/dist/templates/default/apps/mobile/scripts/play-aab.mjs +4 -0
  12. package/dist/templates/default/apps/mobile/scripts/verify-play-aab.mjs +48 -0
  13. package/dist/templates/default/bun.lock +8 -0
  14. package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +2 -0
  15. package/dist/templates/default/packages/disposabl-kit/client/components/cookie-consent.tsx +117 -0
  16. package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +15 -0
  17. package/dist/templates/default/packages/disposabl-kit/client/styles/cookie-consent.css +54 -0
  18. package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +168 -99
  19. package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +9 -21
  20. package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +52 -20
  21. package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +13 -4
  22. package/dist/templates/default/packages/disposabl-kit/package.json +7 -2
  23. package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +15 -3
  24. package/dist/templates/default/packages/disposabl-kit/server/billing-native-capability.ts +33 -6
  25. package/dist/templates/default/packages/disposabl-kit/server/billing.ts +11 -3
  26. package/dist/templates/default/packages/tests/billing.test.ts +22 -0
  27. package/dist/templates/default/packages/tests/components/mobile-account-billing.test.mjs +149 -0
  28. package/dist/templates/default/packages/tests/ios-ota.test.ts +13 -10
  29. package/dist/templates/default/packages/tests/mobile-account-billing.test.ts +19 -0
  30. package/dist/templates/default/packages/tests/native-billing.test.ts +71 -0
  31. package/dist/templates/default/packages/tests/package-release.test.ts +37 -5
  32. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import { SymbolView } from "./design/nativewind";
2
+ import { KeyboardProvider } from "react-native-keyboard-controller";
1
3
  import { ConvexAuthProvider, useAuthToken } from "@convex-dev/auth/react";
2
4
  import { ConvexProvider, ConvexReactClient, useConvexAuth } from "convex/react";
3
5
  import { Redirect, Stack, router, usePathname } from "expo-router";
@@ -34,9 +36,11 @@ export function MobileLayout({
34
36
  telemetry?: TelemetryOverride;
35
37
  }) {
36
38
  return (
37
- <ThemeProvider>
38
- <BackendLayout telemetry={telemetry}>{children}</BackendLayout>
39
- </ThemeProvider>
39
+ <KeyboardProvider>
40
+ <ThemeProvider>
41
+ <BackendLayout telemetry={telemetry}>{children}</BackendLayout>
42
+ </ThemeProvider>
43
+ </KeyboardProvider>
40
44
  );
41
45
  }
42
46
 
@@ -146,6 +150,7 @@ export function AuthLayout() {
146
150
  }
147
151
 
148
152
  function CloseAuth() {
153
+ const colors = useTheme();
149
154
  return (
150
155
  <Pressable
151
156
  accessibilityRole="button"
@@ -153,7 +158,11 @@ function CloseAuth() {
153
158
  onPress={() => router.dismissTo("/")}
154
159
  className="p-[10px]"
155
160
  >
156
- <Text className="text-foreground text-[18px]">✕</Text>
161
+ <SymbolView
162
+ name={{ ios: "xmark", android: "close" }}
163
+ size={20}
164
+ tintColor={colors.foreground}
165
+ />
157
166
  </Pressable>
158
167
  );
159
168
  }
@@ -25,7 +25,8 @@
25
25
  "react": "catalog:",
26
26
  "react-dom": "catalog:",
27
27
  "shadcn": "^4.23.0",
28
- "tw-animate-css": "^1.4.0"
28
+ "tw-animate-css": "^1.4.0",
29
+ "vanilla-cookieconsent": "3.1.0"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@tailwindcss/vite": "^4.3.5",
@@ -78,7 +79,8 @@
78
79
  "react-native-css": "3.1.0-rc.1",
79
80
  "@expo/ui": "~58.0.28",
80
81
  "expo-glass-effect": "~58.0.5",
81
- "react-native-purchases-ui": "10.16.0"
82
+ "react-native-purchases-ui": "10.16.0",
83
+ "react-native-keyboard-controller": "1.22.7"
82
84
  },
83
85
  "peerDependenciesMeta": {
84
86
  "expo-clipboard": {
@@ -119,6 +121,9 @@
119
121
  },
120
122
  "react-native-purchases-ui": {
121
123
  "optional": true
124
+ },
125
+ "react-native-keyboard-controller": {
126
+ "optional": true
122
127
  }
123
128
  }
124
129
  }
@@ -11,7 +11,10 @@ import {
11
11
  } from "../../backend/convex/_generated/server";
12
12
  import { paymentsEnabled } from "../features";
13
13
  import { setupBilling } from "./billing-setup";
14
- import { nativeTopupRoutes } from "./billing-native-capability";
14
+ import {
15
+ nativeTopupRoutes,
16
+ reviewerNativeSubscriptionsEnabled,
17
+ } from "./billing-native-capability";
15
18
  import {
16
19
  balanceFromCustomer,
17
20
  monthlyPlanFromCustomer,
@@ -242,8 +245,17 @@ export const createSnapshot = (eligibility?: BillingEligibility) =>
242
245
  balance: balanceFromCustomer(customer),
243
246
  hasMonthlyPlan: monthlyPlanFromCustomer(customer),
244
247
  nativeSubscriptionsEnabled:
245
- process.env.REVENUECAT_SYNC_ENABLED === "true",
246
- nativeTopupRoutes: nativeTopupRoutes(paymentsEnabled, process.env),
248
+ process.env.REVENUECAT_SYNC_ENABLED === "true" ||
249
+ reviewerNativeSubscriptionsEnabled(
250
+ paymentsEnabled,
251
+ process.env,
252
+ userId,
253
+ ),
254
+ nativeTopupRoutes: nativeTopupRoutes(
255
+ paymentsEnabled,
256
+ process.env,
257
+ userId,
258
+ ),
247
259
  mobileWebCheckoutEnabled: mobileWebCheckoutConfigured(
248
260
  paymentsEnabled,
249
261
  process.env,
@@ -1,12 +1,39 @@
1
1
  import { revenueCatConfigs } from "./revenuecat-contract";
2
2
 
3
- /** Expose only non-secret routing metadata after an operator verifies the integration. */
4
- export function nativeTopupRoutes(
3
+ type Environment = Record<string, string | undefined>;
4
+
5
+ /** Server-derived user IDs only; the route configuration validates the allowlist. */
6
+ export function reviewerNativeSubscriptionsEnabled(
5
7
  enabled: boolean,
6
- env: Record<string, string | undefined>,
8
+ env: Environment,
9
+ userId?: string,
7
10
  ) {
8
- if (env.REVENUECAT_CONSUMABLE_INTEGRATION_VERIFIED !== "true") return [];
9
- return (revenueCatConfigs(enabled, env) ?? []).map(
10
- ({ app, store, product }) => ({ app, store, product }),
11
+ return (
12
+ !!userId &&
13
+ (revenueCatConfigs(enabled, env) ?? []).some(
14
+ (route) =>
15
+ route.reviewerMonthly && route.reviewerCustomers?.includes(userId),
16
+ )
11
17
  );
12
18
  }
19
+
20
+ /** Expose non-secret consumable routes after verification or for a qualified test account. */
21
+ export function nativeTopupRoutes(
22
+ enabled: boolean,
23
+ env: Environment,
24
+ userId?: string,
25
+ ) {
26
+ const configs = revenueCatConfigs(enabled, env) ?? [];
27
+ const globallyVerified =
28
+ env.REVENUECAT_CONSUMABLE_INTEGRATION_VERIFIED === "true";
29
+ const eligible = reviewerNativeSubscriptionsEnabled(enabled, env, userId);
30
+ return configs
31
+ .filter(
32
+ (route) =>
33
+ !route.reviewerMonthly &&
34
+ (globallyVerified
35
+ ? !route.reviewerCustomers
36
+ : eligible && route.reviewerCustomers?.includes(userId!)),
37
+ )
38
+ .map(({ app, store, product }) => ({ app, store, product }));
39
+ }
@@ -120,9 +120,17 @@ export function balanceFromCustomer(
120
120
  customer: Record<string, unknown>,
121
121
  config: Pricing = pricing,
122
122
  ): number | null {
123
- const balances = customer.balances as
124
- Record<string, { remaining?: unknown }> | undefined;
125
- const remaining = balances?.[config.featureId]?.remaining;
123
+ const plainObject = (value: unknown): value is Record<string, unknown> =>
124
+ value !== null &&
125
+ typeof value === "object" &&
126
+ (Object.getPrototypeOf(value) === Object.prototype ||
127
+ Object.getPrototypeOf(value) === null);
128
+ const balances = customer.balances;
129
+ if (!plainObject(balances) || !Object.values(balances).every(plainObject))
130
+ return null;
131
+ if (!Object.hasOwn(balances, config.featureId)) return 0;
132
+ const remaining = (balances[config.featureId] as Record<string, unknown>)
133
+ .remaining;
126
134
  return typeof remaining === "number" && Number.isFinite(remaining)
127
135
  ? remaining
128
136
  : null;
@@ -172,6 +172,28 @@ describe("billing boundary", () => {
172
172
  }),
173
173
  750,
174
174
  );
175
+ assert.equal(balanceFromCustomer({ balances: {} }), 0);
176
+ assert.equal(
177
+ balanceFromCustomer({
178
+ balances: {
179
+ [`${pricing.featureId}_other`]: { remaining: 900 },
180
+ [`${pricing.featureId}_seats`]: { remaining: 5 },
181
+ },
182
+ }),
183
+ 0,
184
+ );
185
+ for (const balances of [
186
+ undefined,
187
+ null,
188
+ [],
189
+ "invalid",
190
+ { other: null },
191
+ { [pricing.featureId]: null },
192
+ { [pricing.featureId]: {} },
193
+ { [pricing.featureId]: { remaining: "750" } },
194
+ { [pricing.featureId]: { remaining: Infinity } },
195
+ ])
196
+ assert.equal(balanceFromCustomer({ balances }), null);
175
197
  assert.equal(balanceFromCustomer({}), null);
176
198
  const mock = (() =>
177
199
  Promise.resolve(
@@ -0,0 +1,149 @@
1
+ import { afterEach, expect, mock, test } from "bun:test";
2
+ import { createElement } from "react";
3
+ import { act, create } from "react-test-renderer";
4
+
5
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true;
6
+ process.env.EXPO_PUBLIC_REVENUECAT_IOS_API_KEY = "test-key";
7
+ process.env.EXPO_PUBLIC_REVENUECAT_IOS_MONTHLY_PRODUCT = "test-monthly";
8
+ let snapshotFails = false;
9
+ let offeringFails = false;
10
+ let renderer;
11
+ const snapshot = {
12
+ balance: 1000,
13
+ customerId: "customer",
14
+ hasMonthlyPlan: false,
15
+ monthlyCheckoutPending: false,
16
+ nativeSubscriptionsEnabled: true,
17
+ nativeTopupRoutes: [],
18
+ mobileWebCheckoutEnabled: false,
19
+ };
20
+ const sdk = {
21
+ canMakePayments: async () => true,
22
+ getStorefront: async () => ({ countryCode: "USA" }),
23
+ getOfferings: async () => {
24
+ if (offeringFails) throw new Error("BILLING_UNAVAILABLE");
25
+ return {
26
+ current: {
27
+ availablePackages: [
28
+ {
29
+ product: {
30
+ identifier: "test-monthly",
31
+ subscriptionPeriod: "P1M",
32
+ priceString: "$5.00",
33
+ },
34
+ },
35
+ ],
36
+ },
37
+ all: {},
38
+ };
39
+ },
40
+ };
41
+ mock.module("react-native", () => ({
42
+ AppState: { addEventListener: () => ({ remove() {} }) },
43
+ Linking: { openURL: async () => {} },
44
+ Platform: { OS: "ios" },
45
+ Pressable: "Pressable",
46
+ Text: "Text",
47
+ View: "View",
48
+ }));
49
+ const getSnapshot = async () => {
50
+ if (snapshotFails) throw new Error("backend unavailable");
51
+ return snapshot;
52
+ };
53
+ mock.module("convex/react", () => ({ useAction: () => getSnapshot }));
54
+ mock.module("../../../packages/disposabl-kit/mobile/billing/session", () => ({
55
+ billingSession: {
56
+ acquire: () => 1,
57
+ release() {},
58
+ current: () => true,
59
+ run: async (_id, _version, _key, action) => action(sdk),
60
+ },
61
+ }));
62
+ mock.module(
63
+ "../../../packages/disposabl-kit/mobile/billing/web-checkout",
64
+ () => ({
65
+ useWebCheckout: () => ({
66
+ available: false,
67
+ topupAvailable: false,
68
+ busy: false,
69
+ open: async () => {},
70
+ error: "",
71
+ }),
72
+ }),
73
+ );
74
+ mock.module("../../../packages/disposabl-kit/mobile/billing/use-topup", () => ({
75
+ useTopup: () => ({
76
+ product: null,
77
+ busy: false,
78
+ purchase: async () => {},
79
+ message: "",
80
+ }),
81
+ }));
82
+ const { AccountBilling } =
83
+ await import("../../../packages/disposabl-kit/mobile/billing/account-billing");
84
+ const mount = async () => {
85
+ await act(async () => {
86
+ renderer = create(
87
+ createElement(AccountBilling, { customerId: "customer" }),
88
+ );
89
+ });
90
+ };
91
+ const texts = () =>
92
+ renderer.root
93
+ .findAllByType("Text")
94
+ .flatMap((node) => [
95
+ node.children
96
+ .filter(
97
+ (child) => typeof child === "string" || typeof child === "number",
98
+ )
99
+ .join(""),
100
+ ]);
101
+ const contains = (text) => texts().some((value) => value.includes(text));
102
+ const refresh = async () => {
103
+ const button = renderer.root
104
+ .findAllByType("Pressable")
105
+ .find((node) =>
106
+ node
107
+ .findAllByType("Text")
108
+ .some((text) => text.children.includes("Refresh")),
109
+ );
110
+ expect(button).toBeDefined();
111
+ await act(async () => {
112
+ button.props.onPress();
113
+ });
114
+ };
115
+ afterEach(async () => {
116
+ await act(async () => renderer?.unmount());
117
+ renderer = undefined;
118
+ snapshotFails = false;
119
+ offeringFails = false;
120
+ });
121
+
122
+ test("a store offerings failure preserves a verified balance and does not offer a purchase", async () => {
123
+ offeringFails = true;
124
+ await mount();
125
+ expect(contains("1,000 credits")).toBe(true);
126
+ expect(contains("Store subscriptions unavailable.")).toBe(true);
127
+ expect(contains("750 credits / month")).toBe(false);
128
+ });
129
+
130
+ test("a failed backend refresh clears a previously verified balance and offering", async () => {
131
+ await mount();
132
+ expect(contains("1,000 credits")).toBe(true);
133
+ expect(contains("750 credits / month")).toBe(true);
134
+ snapshotFails = true;
135
+ await refresh();
136
+ expect(contains("1,000 credits")).toBe(false);
137
+ expect(contains("Unavailable")).toBe(true);
138
+ expect(contains("750 credits / month")).toBe(false);
139
+ });
140
+
141
+ test("refresh recovers balance and offering when the store comes back", async () => {
142
+ offeringFails = true;
143
+ await mount();
144
+ offeringFails = false;
145
+ await refresh();
146
+ expect(contains("1,000 credits")).toBe(true);
147
+ expect(contains("750 credits / month")).toBe(true);
148
+ expect(contains("$5.00 / mo")).toBe(true);
149
+ });
@@ -167,21 +167,24 @@ test("iOS reuses only a matching finished production binary", async () => {
167
167
  assert.match(result.trace, /"--build-profile","ios-production"/);
168
168
  assert.match(result.trace, /"--channel","production"/);
169
169
  assert.match(result.trace, /"--app-identifier","app.test"/);
170
- for (const candidate of [
171
- null,
172
- { ...build, runtime: { version: "different" } },
173
- { ...build, isForIosSimulator: true },
174
- { ...build, app: { id: "other" } },
175
- { ...build, updateChannel: { name: "preview" } },
176
- { ...build, artifacts: {} },
177
- ]) {
170
+ });
171
+
172
+ for (const [reason, candidate] of [
173
+ ["no binary", null],
174
+ ["different runtime", { ...build, runtime: { version: "different" } }],
175
+ ["simulator", { ...build, isForIosSimulator: true }],
176
+ ["different project", { ...build, app: { id: "other" } }],
177
+ ["preview channel", { ...build, updateChannel: { name: "preview" } }],
178
+ ["missing archive", { ...build, artifacts: {} }],
179
+ ] as const) {
180
+ test(`iOS requests a build for ${reason}`, async () => {
178
181
  const mismatch = await run("ota-plan", {
179
182
  BUILDS: JSON.stringify(candidate ? [candidate] : []),
180
183
  });
181
184
  assert.equal(mismatch.status, 0, mismatch.stderr);
182
185
  assert.match(mismatch.output, /action=build/);
183
- }
184
- });
186
+ });
187
+ }
185
188
 
186
189
  test("iOS build lookup errors do not trigger a replacement build", async () => {
187
190
  for (const values of [
@@ -0,0 +1,19 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { spawnSync } from "node:child_process";
4
+ import { join } from "node:path";
5
+
6
+ test("mobile billing preserves the balance across store failures", () => {
7
+ const result = spawnSync(
8
+ process.execPath,
9
+ [
10
+ "test",
11
+ join(import.meta.dirname, "components/mobile-account-billing.test.mjs"),
12
+ ],
13
+ {
14
+ encoding: "utf8",
15
+ env: { ...process.env, E2E_TELEMETRY_DISABLED: "1", DO_NOT_TRACK: "1" },
16
+ },
17
+ );
18
+ assert.equal(result.status, 0, result.stdout + result.stderr);
19
+ });
@@ -1,3 +1,4 @@
1
+ import { creditQuantity } from "../disposabl-kit/payments/config";
1
2
  import { test } from "node:test";
2
3
  import assert from "node:assert/strict";
3
4
  import { BillingSession } from "../disposabl-kit/mobile/billing/session";
@@ -845,3 +846,73 @@ test("web handoff rechecks the storefront and account after link creation", asyn
845
846
  );
846
847
  }
847
848
  });
849
+
850
+ test("reviewer qualification exposes only configured top-ups to the authenticated allowlist", async () => {
851
+ const { nativeTopupRoutes, reviewerNativeSubscriptionsEnabled } =
852
+ await import("../disposabl-kit/server/billing-native-capability");
853
+ const reviewer = "a".repeat(32);
854
+ const env = {
855
+ REVENUECAT_CONSUMABLE_OWNER: "custom",
856
+ REVENUECAT_WEBHOOK_AUTH: "fixture",
857
+ REVENUECAT_PROJECT_ID: "project",
858
+ AUTUMN_SECRET_KEY: "am_sk_live_fixture",
859
+ REVENUECAT_ENVIRONMENT: "PRODUCTION",
860
+ REVENUECAT_ROUTES: JSON.stringify([
861
+ { app: "apple", store: "APP_STORE", product: "coins" },
862
+ ]),
863
+ REVENUECAT_MANAGED_MONTHLY_ROUTES: JSON.stringify([
864
+ { app: "apple", store: "APP_STORE", product: "monthly" },
865
+ ]),
866
+ REVENUECAT_REVIEWER_USERS: JSON.stringify([reviewer]),
867
+ };
868
+ const expected = [{ app: "apple", store: "APP_STORE", product: "coins" }];
869
+ assert.equal(reviewerNativeSubscriptionsEnabled(true, env, reviewer), true);
870
+ assert.deepEqual(nativeTopupRoutes(true, env, reviewer), expected);
871
+ for (const userId of [
872
+ undefined,
873
+ "b".repeat(32),
874
+ "",
875
+ "$RCAnonymousID:foreign",
876
+ ]) {
877
+ assert.equal(reviewerNativeSubscriptionsEnabled(true, env, userId), false);
878
+ assert.deepEqual(nativeTopupRoutes(true, env, userId), []);
879
+ }
880
+ for (const changes of [
881
+ { REVENUECAT_ROUTES: "[]" },
882
+ { REVENUECAT_REVIEWER_USERS: "bad" },
883
+ { REVENUECAT_WEBHOOK_AUTH: "" },
884
+ { REVENUECAT_MANAGED_MONTHLY_ROUTES: "[]" },
885
+ ]) {
886
+ assert.equal(
887
+ reviewerNativeSubscriptionsEnabled(
888
+ true,
889
+ { ...env, ...changes },
890
+ reviewer,
891
+ ),
892
+ false,
893
+ );
894
+ assert.deepEqual(
895
+ nativeTopupRoutes(true, { ...env, ...changes }, reviewer),
896
+ [],
897
+ );
898
+ }
899
+ assert.equal(reviewerNativeSubscriptionsEnabled(false, env, reviewer), false);
900
+ assert.deepEqual(
901
+ nativeTopupRoutes(
902
+ true,
903
+ { ...env, REVENUECAT_CONSUMABLE_INTEGRATION_VERIFIED: "true" },
904
+ "b".repeat(32),
905
+ ),
906
+ expected,
907
+ );
908
+ assert.deepEqual(
909
+ nativeTopupRoutes(
910
+ true,
911
+ { ...env, REVENUECAT_CONSUMABLE_INTEGRATION_VERIFIED: "true" },
912
+ reviewer,
913
+ ),
914
+ expected,
915
+ );
916
+ assert.equal(creditQuantity("monthly"), 750);
917
+ assert.equal(creditQuantity("topup"), 500);
918
+ });
@@ -17,6 +17,8 @@ function release(options: {
17
17
  prepared?: string;
18
18
  available?: string;
19
19
  failure?: boolean;
20
+ visibleAfter?: number;
21
+ tag?: string;
20
22
  }) {
21
23
  const directory = mkdtempSync(join(tmpdir(), "package-release-"));
22
24
  try {
@@ -49,9 +51,13 @@ fi`,
49
51
  executable(
50
52
  "npm",
51
53
  `echo "npm $*" >> calls
54
+ count=$(grep -c "^npm " calls)
55
+ (( count > VISIBLE_AFTER )) || exit 1
52
56
  [[ -n "$AVAILABLE" ]] || { echo 'E404 or registry unavailable' >&2; exit 1; }
53
57
  printf '%s\\n' "$AVAILABLE"`,
54
58
  );
59
+ executable("sleep", ":");
60
+ executable("git", `printf '%s\\n' "$TAG"`);
55
61
  executable(
56
62
  "node",
57
63
  `if [[ "$1" == -p ]]; then
@@ -73,6 +79,8 @@ fi`,
73
79
  PREPARED: options.prepared ?? "",
74
80
  AVAILABLE: options.available ?? "",
75
81
  FAIL_RELEASE: String(options.failure ?? false),
82
+ VISIBLE_AFTER: String(options.visibleAfter ?? 0),
83
+ TAG: options.tag ?? "@fixture/sdk@1.2.3",
76
84
  },
77
85
  });
78
86
  const calls = join(directory, "calls");
@@ -99,7 +107,7 @@ test("first publication runs before any registry lookup", () => {
99
107
  test("no new release reports the existing public version", () => {
100
108
  const result = release({ available: "1.2.3" });
101
109
  assert.equal(result.status, 0, result.stderr);
102
- assert.match(result.calls, /npm view @fixture\/sdk version/);
110
+ assert.match(result.calls, /npm view @fixture\/sdk@1\.2\.3 version/);
103
111
  assert.match(result.calls, /ready version=1\.2\.3/);
104
112
  });
105
113
 
@@ -110,15 +118,15 @@ test("release authorization failure is a failed job, not a successful skip", ()
110
118
  assert.doesNotMatch(result.calls, /npm view| ready /);
111
119
  });
112
120
 
113
- test("unavailable registry or no public version cannot report ready", () => {
114
- for (const prepared of [undefined, "1.0.0"]) {
121
+ for (const prepared of [undefined, "1.0.0"]) {
122
+ test(`unavailable registry cannot report ${prepared ? "new" : "existing"} release ready`, () => {
115
123
  const result = release({ prepared });
116
124
  assert.equal(result.status, 1);
117
125
  assert.match(result.calls, /release\n/);
118
126
  assert.match(result.calls, /availability could not be verified/);
119
127
  assert.doesNotMatch(result.calls, / ready /);
120
- }
121
- });
128
+ });
129
+ }
122
130
 
123
131
  test("a mismatched registry version cannot report ready", () => {
124
132
  const result = release({ prepared: "1.0.0", available: "0.9.0" });
@@ -126,3 +134,27 @@ test("a mismatched registry version cannot report ready", () => {
126
134
  assert.match(result.calls, /no matching published version/);
127
135
  assert.doesNotMatch(result.calls, / ready /);
128
136
  });
137
+
138
+ test("new publication waits for delayed registry visibility", () => {
139
+ const result = release({
140
+ prepared: "1.0.0",
141
+ available: "1.0.0",
142
+ visibleAfter: 2,
143
+ });
144
+ assert.equal(result.status, 0, result.stderr);
145
+ assert.equal((result.calls.match(/npm view/g) ?? []).length, 3);
146
+ assert.match(result.calls, /report typescript-sdk ready version=1\.0\.0/);
147
+ });
148
+
149
+ test("a stale registry version cannot satisfy a newer existing tag", () => {
150
+ const result = release({ tag: "@fixture/sdk@1.0.0", available: "0.0.1" });
151
+ assert.equal(result.status, 1);
152
+ assert.match(result.calls, /npm view @fixture\/sdk@1\.0\.0 version/);
153
+ assert.doesNotMatch(result.calls, / ready /);
154
+ });
155
+
156
+ test("no release tag fails closed", () => {
157
+ const result = release({ tag: "", available: "1.0.0" });
158
+ assert.equal(result.status, 1);
159
+ assert.doesNotMatch(result.calls, /npm view| ready /);
160
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.20.17",
3
+ "version": "0.20.19",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",