@applift/core 0.7.0 → 0.7.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.
package/dist/index.mjs CHANGED
@@ -285,13 +285,14 @@ async function loadProjectConfig(cwd) {
285
285
  packageJson: false,
286
286
  defaults: ProjectConfigSchema.parse({})
287
287
  });
288
- const parsed = ProjectConfigSchema.safeParse(result.config ?? {});
288
+ const raw = result.config ?? {};
289
+ const parsed = ProjectConfigSchema.safeParse(raw);
289
290
  if (!parsed.success) {
290
291
  const details = parsed.error.issues.map((i) => `${i.path.join(".") || "(根)"}: ${i.message}`).join(";");
291
292
  throw new Error(`applift.config.ts 字段校验失败 → ${details}`);
292
293
  }
293
294
  const config = parsed.data;
294
- const rawRec = result.config ?? {};
295
+ const rawRec = raw;
295
296
  const deprecated = [];
296
297
  if ("build" in rawRec) deprecated.push({
297
298
  key: "build",
@@ -311,7 +312,7 @@ async function loadProjectConfig(cwd) {
311
312
  }
312
313
  return {
313
314
  config,
314
- raw: result.config ?? {},
315
+ raw,
315
316
  cwd: result.cwd ?? cwd
316
317
  };
317
318
  }
@@ -65,7 +65,8 @@ interface RnUpdateOptions {
65
65
  ios?: number;
66
66
  /** 补丁目录(patch-package 约定默认 patches/,项目可覆盖) */
67
67
  patchDir?: string;
68
- /** 正式发布默认灰度比例 */
68
+ /** 正式发布默认灰度比例(缺省 100 全量——promote 语义是"验证后发正式",灰度是显式选择;
69
+ * 优先级:--rollout 旗标 > 此配置 > 内置默认) */
69
70
  defaultRollout?: number;
70
71
  }
71
72
  /**
@@ -367,6 +367,9 @@ function judgeDelivery(diff, ctx, opts) {
367
367
  }
368
368
  /** pushy 官方测试包约定:与正式同源码、仅版本号偏移(major+1000,如 1.6.0→1001.6.0) */
369
369
  const TEST_VERSION_OFFSET = 1e3;
370
+ /** 正式 promote 的内置默认灰度比例(100 = 全量)。promote 语义是"测试通道已验证、发正式",
371
+ * 全量是常态、灰度是显式选择(--rollout 或 rnUpdate({ defaultRollout })),不藏在配置后面 */
372
+ const DEFAULT_ROLLOUT = 100;
370
373
  /** 生成测试包偏移版本号(major+1000);非数字开头版本号无法偏移,显式报错 */
371
374
  function testPackageVersion(versionName) {
372
375
  const m = /^(\d+)(\..+)?$/.exec(versionName);
@@ -437,7 +440,7 @@ function makeRnUpdateProvider(opts, cli = createPushyCli()) {
437
440
  const patchNames = existing.map((v) => v.name).filter((n) => /-patch\.\d+$/.test(n)).slice(0, 5);
438
441
  throw new Error(`测试通道没有 ${versionName}-patch.N 热更版本可供 promote${patchNames.length > 0 ? `(现存:${patchNames.join(", ")}${existing.length > 5 ? " …" : ""})` : ""}:先 applift beta 发布测试热更并验证`);
439
442
  }
440
- const rollout = ctx.rollout ?? opts.defaultRollout;
443
+ const rollout = ctx.rollout ?? opts.defaultRollout ?? DEFAULT_ROLLOUT;
441
444
  await cli.rebind({
442
445
  appId,
443
446
  versionId: latest.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applift/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/hcg1023/applift.git",