mimi-seed 0.2.7 → 0.2.8

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 (2) hide show
  1. package/dist/index.js +39 -34
  2. package/package.json +6 -3
package/dist/index.js CHANGED
@@ -913,32 +913,34 @@ async function ghTriggerWorkflow(cfg, workflow, ref, inputs = {}) {
913
913
  if (!run) return null;
914
914
  return { runId: run.id, url: run.html_url };
915
915
  }
916
- async function ghPollRun(cfg, runId, onTick, timeoutMs = 30 * 60 * 1e3) {
916
+ async function ghPollRun(cfg, runId, onTick, timeoutMs = 30 * 60 * 1e3, intervalMs = 15e3) {
917
917
  const start = Date.now();
918
918
  let consecutiveErrors = 0;
919
919
  while (Date.now() - start < timeoutMs) {
920
- await new Promise((r) => setTimeout(r, 15e3));
920
+ await new Promise((r) => setTimeout(r, intervalMs));
921
+ let res;
921
922
  try {
922
- const res = await fetch(
923
+ res = await fetch(
923
924
  `${ghBase(cfg)}/repos/${cfg.owner}/${cfg.repo}/actions/runs/${runId}`,
924
925
  { headers: ghHeaders(cfg.token) }
925
926
  );
926
- if (!res.ok) {
927
- consecutiveErrors++;
928
- if (consecutiveErrors >= 3) throw new Error("GitHub API \uC5F0\uC18D \uC624\uB958");
929
- continue;
930
- }
931
- consecutiveErrors = 0;
932
- const data = await res.json();
933
- onTick?.(data.status);
934
- if (data.status === "completed") {
935
- if (data.conclusion === "success") return "success";
936
- if (data.conclusion === "cancelled") return "cancelled";
937
- return "failure";
938
- }
939
927
  } catch {
940
928
  consecutiveErrors++;
941
929
  if (consecutiveErrors >= 3) throw new Error("GitHub API \uC5F0\uC18D \uC624\uB958 3\uD68C");
930
+ continue;
931
+ }
932
+ if (!res.ok) {
933
+ consecutiveErrors++;
934
+ if (consecutiveErrors >= 3) throw new Error(`GitHub API \uC5F0\uC18D \uC624\uB958 (HTTP ${res.status})`);
935
+ continue;
936
+ }
937
+ consecutiveErrors = 0;
938
+ const data = await res.json();
939
+ onTick?.(data.status);
940
+ if (data.status === "completed") {
941
+ if (data.conclusion === "success") return "success";
942
+ if (data.conclusion === "cancelled") return "cancelled";
943
+ return "failure";
942
944
  }
943
945
  }
944
946
  return "timeout";
@@ -962,31 +964,33 @@ async function glTriggerPipeline(cfg, ref, variables = {}) {
962
964
  const data = await res.json();
963
965
  return { pipelineId: data.id, url: data.web_url };
964
966
  }
965
- async function glPollPipeline(cfg, pipelineId, onTick, timeoutMs = 30 * 60 * 1e3) {
967
+ async function glPollPipeline(cfg, pipelineId, onTick, timeoutMs = 30 * 60 * 1e3, intervalMs = 15e3) {
966
968
  const start = Date.now();
967
969
  let consecutiveErrors = 0;
968
970
  while (Date.now() - start < timeoutMs) {
969
- await new Promise((r) => setTimeout(r, 15e3));
971
+ await new Promise((r) => setTimeout(r, intervalMs));
972
+ let res;
970
973
  try {
971
- const res = await fetch(
974
+ res = await fetch(
972
975
  `${glBase(cfg)}/projects/${glProjectId(cfg)}/pipelines/${pipelineId}`,
973
976
  { headers: { "PRIVATE-TOKEN": cfg.token } }
974
977
  );
975
- if (!res.ok) {
976
- consecutiveErrors++;
977
- if (consecutiveErrors >= 3) throw new Error("GitLab API \uC5F0\uC18D \uC624\uB958");
978
- continue;
979
- }
980
- consecutiveErrors = 0;
981
- const data = await res.json();
982
- onTick?.(data.status);
983
- if (data.status === "success") return "success";
984
- if (data.status === "failed") return "failure";
985
- if (data.status === "canceled" || data.status === "skipped") return "cancelled";
986
978
  } catch {
987
979
  consecutiveErrors++;
988
980
  if (consecutiveErrors >= 3) throw new Error("GitLab API \uC5F0\uC18D \uC624\uB958 3\uD68C");
981
+ continue;
989
982
  }
983
+ if (!res.ok) {
984
+ consecutiveErrors++;
985
+ if (consecutiveErrors >= 3) throw new Error(`GitLab API \uC5F0\uC18D \uC624\uB958 (HTTP ${res.status})`);
986
+ continue;
987
+ }
988
+ consecutiveErrors = 0;
989
+ const data = await res.json();
990
+ onTick?.(data.status);
991
+ if (data.status === "success") return "success";
992
+ if (data.status === "failed") return "failure";
993
+ if (data.status === "canceled" || data.status === "skipped") return "cancelled";
990
994
  }
991
995
  return "timeout";
992
996
  }
@@ -1301,10 +1305,11 @@ async function cmdDeploy(argv) {
1301
1305
  }
1302
1306
  const buildId = await runGitProviderBuild(ciProvider, args);
1303
1307
  if (!versionCode) {
1304
- versionCode = buildId;
1305
- log2(kleur6.dim(` versionCode = build id (${versionCode})`));
1306
- log2(kleur6.dim(` \uC8FC\uC758: GitHub run ID / GitLab pipeline ID\uB294 versionCode\uB85C \uC801\uD569\uD558\uC9C0 \uC54A\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`));
1307
- log2(kleur6.dim(` --version-code <N> \uB85C \uBA85\uC2DC \uAD8C\uC7A5.`));
1308
+ log2(kleur6.red(`\u2717 versionCode \uBBF8\uC9C0\uC815 (${kind} run_id ${buildId}\uB294 versionCode\uB85C \uBD80\uC801\uD569)`));
1309
+ log2(kleur6.dim(" \uAD8C\uC7A5 \uC0AC\uD56D:"));
1310
+ log2(kleur6.dim(" \u2022 CI \uC6CC\uD06C\uD50C\uB85C \uC548\uC5D0\uC11C versionCode\uB97C \uACB0\uC815\uD558\uACE0 \uACB0\uACFC\uB97C \uCD9C\uB825"));
1311
+ log2(kleur6.dim(" \u2022 \uB2E4\uC74C \uC2E4\uD589: mimi-seed deploy --skip-build --version-code <N>"));
1312
+ process.exit(1);
1308
1313
  }
1309
1314
  }
1310
1315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mimi-seed",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Mimi Seed CLI — Claude Code에서 앱 출시 운영을 관리합니다.",
5
5
  "bin": {
6
6
  "mimi-seed": "dist/index.js"
@@ -13,7 +13,9 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "build": "tsup",
16
- "dev": "tsx src/index.ts"
16
+ "dev": "tsx src/index.ts",
17
+ "test": "vitest run",
18
+ "test:watch": "vitest"
17
19
  },
18
20
  "engines": {
19
21
  "node": ">=18"
@@ -27,7 +29,8 @@
27
29
  "@types/node": "^20.11.0",
28
30
  "tsup": "^8.0.0",
29
31
  "tsx": "^4.7.0",
30
- "typescript": "^5.4.0"
32
+ "typescript": "^5.4.0",
33
+ "vitest": "^4.1.5"
31
34
  },
32
35
  "publishConfig": {
33
36
  "access": "public"