connectbase-client 6.3.2 → 6.3.4

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/CHANGELOG.md CHANGED
@@ -3,6 +3,34 @@
3
3
  본 SDK 의 모든 주요 변경사항을 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/) 형식으로 기록합니다.
4
4
  버전은 [Semantic Versioning](https://semver.org/lang/ko/) 을 따릅니다.
5
5
 
6
+ ## [6.3.4] - 2026-09-08
7
+
8
+ ### Fixed — deploy 스크립트가 `npx` 로 CLI 를 부르면 6.3.3 의 "스크립트 안" 판정이 빠지던 문제
9
+
10
+ 6.3.3 은 `npm_lifecycle_event` 가 package.json scripts 의 이름이면 스크립트 안으로 봤습니다. 그런데
11
+ `"deploy": "vite build && npx -y -p connectbase-client@latest connectbase deploy ./dist"` 처럼 npx 로
12
+ CLI 를 부르는 스크립트(예전 init 이 만들던 형태)에서는 npx 가 `npm_lifecycle_event` 를 "npx" 로,
13
+ `npm_lifecycle_script` 도 덮어써 `npm run deploy → npx` 와 직접 `npx` 의 환경변수가 완전히 같아집니다.
14
+ 그래서 여전히 "deploy 스크립트를 쓰세요" 안내가 그 스크립트 안에서 찍혔습니다.
15
+
16
+ 이제 (1) pnpm 은 npx 가 덮어쓰지 않는 `PNPM_SCRIPT_SRC_DIR` 로, (2) npm / yarn / bun 은 부모 프로세스
17
+ 명령줄(Linux `/proc`, macOS `ps`)에서 `<pm> run <스크립트>` 를 찾아 스크립트 안임을 판정합니다.
18
+ `npm-cli.js exec …` 나 스크립트 본문 자체에는 맞지 않는 패턴이라 직접 `npx connectbase-client deploy`
19
+ 를 친 경우엔 종전대로 안내합니다. 판정에 실패해도 안내 한 줄이 더 나올 뿐 배포에는 영향이 없습니다.
20
+
21
+ ## [6.3.3] - 2026-09-08
22
+
23
+ ### Fixed — `deploy` 가 방금 빌드한 직후에도 "배포 전 빌드를 먼저 실행하세요" 를 찍던 문제
24
+
25
+ package.json 에 build 스크립트만 있으면 무조건 경고했습니다. `pnpm run deploy`(= `vite build &&
26
+ connectbase deploy`) 처럼 빌드를 끝낸 직후 실행돼도 "먼저 빌드하라" 가 찍혀, 방금 올린 배포가
27
+ 낡은 것처럼 보였습니다. 명령도 `npm run build` 로 고정돼 있었습니다.
28
+
29
+ 이제 npm / pnpm / yarn / bun 이 스크립트 실행 시 넣어 주는 `npm_lifecycle_event` 가 package.json
30
+ scripts 의 이름이면(=그 스크립트 안에서 실행 중) 안내를 생략합니다. 빌드가 포함된 deploy
31
+ 스크립트가 있는데 직접 `connectbase deploy` 를 친 경우엔 그 스크립트를 쓰라고만 안내하고,
32
+ 그 외에는 감지된 패키지 매니저의 `run build` 명령으로 안내합니다.
33
+
6
34
  ## [6.3.2] - 2026-09-08
7
35
 
8
36
  ### Fixed — `init` 이 pnpm / yarn / bun 프로젝트에도 npm 명령을 안내하던 문제
package/dist/cli.js CHANGED
@@ -32,7 +32,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  var cli_exports = {};
33
33
  __export(cli_exports, {
34
34
  TunnelConnectSelector: () => TunnelConnectSelector,
35
+ ancestorCommandLines: () => ancestorCommandLines,
35
36
  apiErrorMessage: () => apiErrorMessage,
37
+ buildFirstHint: () => buildFirstHint,
36
38
  computeDeployDiff: () => computeDeployDiff,
37
39
  detectPackageManager: () => detectPackageManager,
38
40
  getTunnelConnectCandidates: () => getTunnelConnectCandidates,
@@ -42,8 +44,10 @@ __export(cli_exports, {
42
44
  makeRequest: () => makeRequest,
43
45
  normalizeRelativePath: () => normalizeRelativePath,
44
46
  packageManagerCommands: () => packageManagerCommands,
47
+ packageScriptInvocationPattern: () => packageScriptInvocationPattern,
45
48
  parseArgs: () => parseArgs,
46
49
  registerEndpointBinding: () => registerEndpointBinding,
50
+ runningInsidePackageScript: () => runningInsidePackageScript,
47
51
  sha256Hex: () => sha256Hex,
48
52
  storageAdminHeaders: () => storageAdminHeaders
49
53
  });
@@ -150,7 +154,7 @@ function handleTunnelError(msg, appId, localPort) {
150
154
  }
151
155
 
152
156
  // src/cli.ts
153
- var VERSION = "6.3.2" ? "6.3.2" : getPackageVersion();
157
+ var VERSION = "6.3.4" ? "6.3.4" : getPackageVersion();
154
158
  var DEFAULT_BASE_URL = "https://api.connectbase.world";
155
159
  var colors = {
156
160
  reset: "\x1B[0m",
@@ -678,14 +682,9 @@ async function deploy(directory, config, isDev = false, deployOpts = {}) {
678
682
  if (fs2.existsSync(pkgPath)) {
679
683
  try {
680
684
  const pkg = JSON.parse(fs2.readFileSync(pkgPath, "utf-8"));
681
- if (pkg.scripts?.build) {
682
- warn(
683
- `\uBC30\uD3EC \uC804 \uBE4C\uB4DC\uB97C \uBA3C\uC800 \uC2E4\uD589\uD558\uC138\uC694: ${colors.cyan}npm run build && npx connectbase-client deploy${colors.reset}`
684
- );
685
- warn(
686
- `\uB610\uB294 package.json\uC5D0 deploy \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uB4F1\uB85D\uD558\uC138\uC694: ${colors.cyan}npx connectbase-client init${colors.reset}`
687
- );
688
- }
685
+ const pm = packageManagerCommands(detectPackageManager(process.cwd()));
686
+ const inside = runningInsidePackageScript(pkg.scripts ?? {});
687
+ for (const line of buildFirstHint(pkg, pm, inside)) warn(line);
689
688
  } catch {
690
689
  }
691
690
  }
@@ -1647,6 +1646,73 @@ ${entry}
1647
1646
  success(".gitignore \uC0DD\uC131 \uC644\uB8CC");
1648
1647
  }
1649
1648
  }
1649
+ function runningInsidePackageScript(scripts, env = process.env, ancestors = ancestorCommandLines) {
1650
+ const names = Object.keys(scripts);
1651
+ if (names.length === 0) return false;
1652
+ if (env.npm_lifecycle_event && names.includes(env.npm_lifecycle_event)) {
1653
+ return true;
1654
+ }
1655
+ if (env.PNPM_SCRIPT_SRC_DIR) return true;
1656
+ if (env.npm_lifecycle_event !== "npx") return false;
1657
+ const pattern = packageScriptInvocationPattern(names);
1658
+ return ancestors().some((cmd) => pattern.test(cmd));
1659
+ }
1660
+ function packageScriptInvocationPattern(names) {
1661
+ const alt = names.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
1662
+ return new RegExp(
1663
+ `^(?:\\S*node(?:\\.exe)?\\s+)?\\S*(?:npm(?:-cli)?|pnpm|yarn|bun)(?:\\.c?js)?\\s+(?:run(?:-script)?\\s+)?(?:-\\S+\\s+)*(?:${alt})(?:\\s|$)`
1664
+ );
1665
+ }
1666
+ function ancestorCommandLines(maxDepth = 8) {
1667
+ const lines = [];
1668
+ let pid = process.ppid;
1669
+ for (let i = 0; i < maxDepth && pid > 1; i++) {
1670
+ let cmd = "";
1671
+ let ppid = 0;
1672
+ try {
1673
+ if (process.platform === "linux") {
1674
+ cmd = fs2.readFileSync(`/proc/${pid}/cmdline`).toString("utf8").replace(/\0/g, " ").trim();
1675
+ const stat = fs2.readFileSync(`/proc/${pid}/stat`, "utf8");
1676
+ ppid = parseInt(
1677
+ stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1],
1678
+ 10
1679
+ );
1680
+ } else if (process.platform === "darwin") {
1681
+ const { execSync } = require("child_process");
1682
+ const out = execSync(`ps -o ppid=,args= -p ${pid}`, {
1683
+ encoding: "utf-8",
1684
+ stdio: ["ignore", "pipe", "ignore"]
1685
+ }).trim();
1686
+ const m = out.match(/^\s*(\d+)\s+(.*)$/);
1687
+ if (!m) break;
1688
+ ppid = parseInt(m[1], 10);
1689
+ cmd = m[2];
1690
+ } else {
1691
+ break;
1692
+ }
1693
+ } catch {
1694
+ break;
1695
+ }
1696
+ lines.push(cmd);
1697
+ if (!Number.isFinite(ppid)) break;
1698
+ pid = ppid;
1699
+ }
1700
+ return lines;
1701
+ }
1702
+ function buildFirstHint(pkg, pm, insideScript) {
1703
+ const scripts = pkg?.scripts ?? {};
1704
+ if (!scripts.build) return [];
1705
+ if (insideScript) return [];
1706
+ if (typeof scripts.deploy === "string" && scripts.deploy.includes("build")) {
1707
+ return [
1708
+ `\uBE4C\uB4DC\uAE4C\uC9C0 \uD55C \uBC88\uC5D0 \uD558\uB824\uBA74 deploy \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uC4F0\uC138\uC694: ${pm.run("deploy")}`
1709
+ ];
1710
+ }
1711
+ return [
1712
+ `\uBC30\uD3EC \uC804 \uBE4C\uB4DC\uB97C \uBA3C\uC800 \uC2E4\uD589\uD558\uC138\uC694: ${pm.run("build")} && npx connectbase-client deploy`,
1713
+ "\uB610\uB294 package.json\uC5D0 deploy \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uB4F1\uB85D\uD558\uC138\uC694: npx connectbase-client init"
1714
+ ];
1715
+ }
1650
1716
  function detectPackageManager(startDir = process.cwd()) {
1651
1717
  try {
1652
1718
  const pkg = JSON.parse(
@@ -3811,7 +3877,9 @@ main().catch((err) => {
3811
3877
  // Annotate the CommonJS export names for ESM import in node:
3812
3878
  0 && (module.exports = {
3813
3879
  TunnelConnectSelector,
3880
+ ancestorCommandLines,
3814
3881
  apiErrorMessage,
3882
+ buildFirstHint,
3815
3883
  computeDeployDiff,
3816
3884
  detectPackageManager,
3817
3885
  getTunnelConnectCandidates,
@@ -3821,8 +3889,10 @@ main().catch((err) => {
3821
3889
  makeRequest,
3822
3890
  normalizeRelativePath,
3823
3891
  packageManagerCommands,
3892
+ packageScriptInvocationPattern,
3824
3893
  parseArgs,
3825
3894
  registerEndpointBinding,
3895
+ runningInsidePackageScript,
3826
3896
  sha256Hex,
3827
3897
  storageAdminHeaders
3828
3898
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "6.3.2",
3
+ "version": "6.3.4",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",