connectbase-client 6.3.3 → 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,21 @@
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
+
6
21
  ## [6.3.3] - 2026-09-08
7
22
 
8
23
  ### Fixed — `deploy` 가 방금 빌드한 직후에도 "배포 전 빌드를 먼저 실행하세요" 를 찍던 문제
package/dist/cli.js CHANGED
@@ -32,6 +32,7 @@ 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,
36
37
  buildFirstHint: () => buildFirstHint,
37
38
  computeDeployDiff: () => computeDeployDiff,
@@ -43,8 +44,10 @@ __export(cli_exports, {
43
44
  makeRequest: () => makeRequest,
44
45
  normalizeRelativePath: () => normalizeRelativePath,
45
46
  packageManagerCommands: () => packageManagerCommands,
47
+ packageScriptInvocationPattern: () => packageScriptInvocationPattern,
46
48
  parseArgs: () => parseArgs,
47
49
  registerEndpointBinding: () => registerEndpointBinding,
50
+ runningInsidePackageScript: () => runningInsidePackageScript,
48
51
  sha256Hex: () => sha256Hex,
49
52
  storageAdminHeaders: () => storageAdminHeaders
50
53
  });
@@ -151,7 +154,7 @@ function handleTunnelError(msg, appId, localPort) {
151
154
  }
152
155
 
153
156
  // src/cli.ts
154
- var VERSION = "6.3.3" ? "6.3.3" : getPackageVersion();
157
+ var VERSION = "6.3.4" ? "6.3.4" : getPackageVersion();
155
158
  var DEFAULT_BASE_URL = "https://api.connectbase.world";
156
159
  var colors = {
157
160
  reset: "\x1B[0m",
@@ -680,7 +683,8 @@ async function deploy(directory, config, isDev = false, deployOpts = {}) {
680
683
  try {
681
684
  const pkg = JSON.parse(fs2.readFileSync(pkgPath, "utf-8"));
682
685
  const pm = packageManagerCommands(detectPackageManager(process.cwd()));
683
- for (const line of buildFirstHint(pkg, pm)) warn(line);
686
+ const inside = runningInsidePackageScript(pkg.scripts ?? {});
687
+ for (const line of buildFirstHint(pkg, pm, inside)) warn(line);
684
688
  } catch {
685
689
  }
686
690
  }
@@ -1642,12 +1646,63 @@ ${entry}
1642
1646
  success(".gitignore \uC0DD\uC131 \uC644\uB8CC");
1643
1647
  }
1644
1648
  }
1645
- function buildFirstHint(pkg, pm, lifecycleEvent = process.env.npm_lifecycle_event) {
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) {
1646
1703
  const scripts = pkg?.scripts ?? {};
1647
1704
  if (!scripts.build) return [];
1648
- if (lifecycleEvent && Object.keys(scripts).includes(lifecycleEvent)) {
1649
- return [];
1650
- }
1705
+ if (insideScript) return [];
1651
1706
  if (typeof scripts.deploy === "string" && scripts.deploy.includes("build")) {
1652
1707
  return [
1653
1708
  `\uBE4C\uB4DC\uAE4C\uC9C0 \uD55C \uBC88\uC5D0 \uD558\uB824\uBA74 deploy \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uC4F0\uC138\uC694: ${pm.run("deploy")}`
@@ -3822,6 +3877,7 @@ main().catch((err) => {
3822
3877
  // Annotate the CommonJS export names for ESM import in node:
3823
3878
  0 && (module.exports = {
3824
3879
  TunnelConnectSelector,
3880
+ ancestorCommandLines,
3825
3881
  apiErrorMessage,
3826
3882
  buildFirstHint,
3827
3883
  computeDeployDiff,
@@ -3833,8 +3889,10 @@ main().catch((err) => {
3833
3889
  makeRequest,
3834
3890
  normalizeRelativePath,
3835
3891
  packageManagerCommands,
3892
+ packageScriptInvocationPattern,
3836
3893
  parseArgs,
3837
3894
  registerEndpointBinding,
3895
+ runningInsidePackageScript,
3838
3896
  sha256Hex,
3839
3897
  storageAdminHeaders
3840
3898
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "6.3.3",
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",