runcloud 0.2.233 → 0.2.235

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.
@@ -3,7 +3,7 @@ import { evaluateCompliance, renderEvaluation } from './appStoreEvaluate.js';
3
3
  const STATUSES = new Set(['pass', 'warning', 'fail', 'info']);
4
4
  const EVIDENCE_REQUIRED = new Set(['pass', 'warning', 'fail']);
5
5
  function activeItems(manifest) {
6
- return manifest.items.filter((item) => !item.deferred && item.resolvedBy !== 'card');
6
+ return manifest.items.filter((item) => !item.deferred && item.resolvedBy !== 'card' && !item.rollout);
7
7
  }
8
8
  export function loadComplianceManifest(path) {
9
9
  const manifestPath = path ?? process.env.NEWLY_APP_STORE_COMPLIANCE_MANIFEST;
@@ -155,7 +155,7 @@ export function evaluateCompliance(manifest, projectDir, options = {}) {
155
155
  const targetPlatforms = dynamicConfig ? ['ios', 'android'] : targetPlatformsFromAppJson(appJson);
156
156
  const items = [];
157
157
  const unresolved = [];
158
- for (const item of activeItems(manifest)) {
158
+ for (const item of activeItems(manifest, options.rollouts)) {
159
159
  if (!targetsItem(item, targetPlatforms)) {
160
160
  items.push(makeItem(item, 'info', `Not targeting ${platformNames(item.platform)}.`, 'app.json target platform detection'));
161
161
  continue;
@@ -206,8 +206,8 @@ export function renderEvaluation(result) {
206
206
  lines.push('', 'JSON shape: { "items": [...deterministic report_compliance rows...], "unresolved": [...] }');
207
207
  return lines.join('\n');
208
208
  }
209
- function activeItems(manifest) {
210
- return manifest.items.filter((item) => !item.deferred && item.resolvedBy !== 'card');
209
+ function activeItems(manifest, rollouts = []) {
210
+ return manifest.items.filter((item) => !item.deferred && item.resolvedBy !== 'card' && (!item.rollout || rollouts.includes(item.rollout)));
211
211
  }
212
212
  function evaluateLocalItem(root, appJson, item) {
213
213
  if (item.id === 'scheme')
@@ -263,6 +263,8 @@ function evaluateLocalItem(root, appJson, item) {
263
263
  return evaluatePrivacyManifest(root, appJson, item);
264
264
  case 'rating_prompt':
265
265
  return evaluateRatingPrompt(root, item);
266
+ case 'release_backend_target':
267
+ return evaluateReleaseBackendTarget(root, item);
266
268
  default:
267
269
  if (STORE_REMINDER_IDS.has(item.id)) {
268
270
  return makeItem(item, 'info', 'Complete this declaration in Google Play Console.', 'Play Console questionnaire');
@@ -312,6 +314,26 @@ function evaluateRestorePurchases(root, item) {
312
314
  return makeItem(item, 'pass', 'Restore purchases flow appears in source.', evidence(restore));
313
315
  return makeItem(item, 'fail', 'IAP APIs found but no restore purchases flow was found.', evidence(iap));
314
316
  }
317
+ const NON_RELEASE_BACKEND = /[a-z0-9]+-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-dev\.api\.newlyapp\.com|\.api-dev\.newlyapp\.com|\b[a-z0-9-]+\.(?:ngrok(?:-free)?\.(?:app|dev|io)|loca\.lt|trycloudflare\.com)\b|\b10\.0\.2\.2\b/i;
318
+ const RELEASE_ENV_FILES = ['.env', '.env.production', '.env.production.local', '.env.local'];
319
+ const TEST_FILE = /(^|\/)(__tests__|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$/;
320
+ function evaluateReleaseBackendTarget(root, item) {
321
+ const matches = [
322
+ ...scan(root, NON_RELEASE_BACKEND, { dirs: ['app', 'src', 'components', 'lib', 'app.json'], filter: (match) => !TEST_FILE.test(match.file) }),
323
+ ...scanFiles(root, RELEASE_ENV_FILES, NON_RELEASE_BACKEND),
324
+ ];
325
+ if (!matches.length)
326
+ return makeItem(item, 'pass', 'The release talks to no development backend or tunnel.', `scan: no matches for ${NON_RELEASE_BACKEND.source.slice(0, 60)}…`);
327
+ return makeItem(item, 'fail', 'The release still talks to a development backend or a tunnel. App Review uses the build as it ships, so a dev server that is paused, reset or rate-limited during review leaves the reviewer with an app that cannot load. Deploy the backend to production and point the app at its production address before you submit.', matches.slice(0, 5).map(({ file, line }) => `${file}:${line}`).join('\n'));
328
+ }
329
+ function scanFiles(root, names, regex) {
330
+ return names.flatMap((name) => {
331
+ const content = readText(path.join(root, name));
332
+ if (content == null)
333
+ return [];
334
+ return content.split(/\r?\n/).flatMap((line, index) => (regex.test(line) ? [{ file: name, line: index + 1, text: compact(line) }] : []));
335
+ });
336
+ }
315
337
  function evaluateRatingPrompt(root, item) {
316
338
  const asks = scan(root, /expo-store-review|react-native-in-app-review|requestReview|SKStoreReviewController/);
317
339
  if (asks.length)
@@ -178,6 +178,12 @@ export async function runFlagSet(client, projectId, env, key, options, log) {
178
178
  const { flag } = (await client.patch(flagPath(projectId, env, key), fields));
179
179
  log(`Saved ${key} in ${envWord(env)}: ${flag.enabled ? 'on' : 'off'}. Who gets it: ${whoGetsIt(flag)}.`);
180
180
  }
181
+ export async function runFlagPromote(client, projectId, key, yes, log) {
182
+ if (!yes)
183
+ throw new Error(`Copying ${key} to production changes who gets it there and what they see, at once if it is on. Run again with --yes to copy it.`);
184
+ const { flag } = (await client.post(`${base(projectId)}/flags/${encodeURIComponent(key)}/promote`));
185
+ log(`Copied ${key} to production: ${flag.enabled ? 'on' : 'off'}. Who gets it: ${whoGetsIt(flag)}.${flag.enabled ? '' : ` Turn it on with: newly flags on ${key} --env prod`}`);
186
+ }
181
187
  export async function runFlagDelete(client, projectId, env, key, yes, log) {
182
188
  if (env === 'production' && !yes)
183
189
  throw new Error(`Deleting ${key} turns it off for every live user. Run again with --yes to delete it from production.`);
@@ -289,6 +295,8 @@ export function registerFlags(program) {
289
295
  const c = ctx(o.project);
290
296
  await runFlagSet(c.client, c.projectId, flagEnv(o.env), key, { ...o, on: o.on ? true : o.off ? false : undefined }, log);
291
297
  }));
298
+ flags.command('promote <key>').description("Copy a Development flag's groups, value and variants to Production (its on/off stays)").option('--yes', 'confirm changing production').option('--project <id>')
299
+ .action((key, o) => run(async () => { const c = ctx(o.project); await runFlagPromote(c.client, c.projectId, key, Boolean(o.yes), log); }));
292
300
  flags.command('delete <key>').option('--yes', 'confirm deleting from production').option(...envOption).option('--project <id>')
293
301
  .action((key, o) => run(async () => { const c = ctx(o.project); await runFlagDelete(c.client, c.projectId, flagEnv(o.env), key, Boolean(o.yes), log); }));
294
302
  flags.command('log <key>').description("Who changed a flag (in Newly, the agent or the CLI), and what").option(...envOption).option('--project <id>')
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.233';
1
+ export const CLI_VERSION = '0.2.235';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.233",
3
+ "version": "0.2.235",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file