kcachat 0.1.3 → 0.1.5

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 (3) hide show
  1. package/README.md +5 -9
  2. package/cli.mjs +40 -20
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -7,16 +7,12 @@ npx kcachat@latest "./KakaoTalk_Chat_....csv" --local
7
7
  npx kcachat@latest "./KakaoTalk_Chat_....csv"
8
8
  ```
9
9
 
10
- ### `npx`가 예전 버전처럼 보일 때
10
+ ### `npx`·버전
11
11
 
12
- - **설치 확인 문구가 뜨는 것**은 대부분 정상입니다. 한 번 받아 패키지는 `~/.npm/_npx`에 캐시되어 **다음부터는 바로 실행**합니다.
13
- - `kcachat@latest`는 **래퍼 패키지** 최신(예: `0.1.2`)만 가리킵니다. 본체(`kakaotalk-chat-analyzer`)는 래퍼가 설치될 때 함께 깔리며, **그때의 캐시 폴더에 고정**될 수 있습니다.
14
- - 최신 본체를 강제로 받으려면:
15
- ```bash
16
- npx --yes --prefer-online kcachat@latest --version
17
- npx --yes --prefer-online kakaotalk-chat-analyzer@latest "./파일.csv" --local
18
- ```
19
- - 설치된 버전 확인: `npx kcachat@latest --version` → `kcachat` / `kakaotalk-chat-analyzer` 두 줄이 출력됩니다.
12
+ - **0.1.4부터** `kcachat`는 실행할 때마다 `npx kakaotalk-chat-analyzer@latest`로 **본체 최신**을 받아 실행합니다(네트워크 필요).
13
+ - 오프라인·고정 버전만 쓰려면 `--bundled` 또는 환경 변수 `KCA_BUNDLED=1` (설치 함께 깔린 본체 사용).
14
+ - 설치 확인 문구가 안 뜨는 것은 `~/.npm/_npx` 캐시 때문일 수 있습니다.
15
+ - 버전 확인: `npx kcachat@latest --version` → `kcachat` 줄 + registry 최신 본체 버전.
20
16
 
21
17
  - 전체 패키지명: [kakaotalk-chat-analyzer](https://www.npmjs.com/package/kakaotalk-chat-analyzer)
22
18
  - 소개·시작 가이드(랜딩): [GitHub Pages](https://claudianus.github.io/kakaotalk-chat-analyzer/)
package/cli.mjs CHANGED
@@ -7,8 +7,14 @@ import { fileURLToPath } from "node:url";
7
7
 
8
8
  const require = createRequire(import.meta.url);
9
9
  const kcachatRoot = dirname(fileURLToPath(import.meta.url));
10
+ const wrapperVersion = JSON.parse(readFileSync(join(kcachatRoot, "package.json"), "utf8")).version;
10
11
 
11
- function resolveMain() {
12
+ const rawArgs = process.argv.slice(2);
13
+ const useBundled =
14
+ process.env.KCA_BUNDLED === "1" || rawArgs.includes("--bundled");
15
+ const args = rawArgs.filter((a) => a !== "--bundled");
16
+
17
+ function resolveBundled() {
12
18
  const pkgPath = require.resolve("kakaotalk-chat-analyzer/package.json");
13
19
  const root = dirname(pkgPath);
14
20
  return {
@@ -17,31 +23,45 @@ function resolveMain() {
17
23
  };
18
24
  }
19
25
 
20
- const args = process.argv.slice(2);
21
- if (args.includes("--version") || args.includes("-V")) {
22
- let main;
26
+ function spawnNpxLatest(forwardArgs) {
27
+ const npx = process.platform === "win32" ? "npx.cmd" : "npx";
28
+ return spawnSync(npx, ["--yes", "--prefer-online", "kakaotalk-chat-analyzer@latest", ...forwardArgs], {
29
+ stdio: "inherit",
30
+ env: process.env,
31
+ shell: process.platform === "win32",
32
+ });
33
+ }
34
+
35
+ function runBundled(forwardArgs) {
36
+ let target;
23
37
  try {
24
- main = resolveMain();
38
+ target = resolveBundled().cli;
25
39
  } catch {
26
- console.error('[kcachat] "kakaotalk-chat-analyzer"를 불러오지 못했습니다.');
40
+ console.error(
41
+ '[kcachat] 번들된 "kakaotalk-chat-analyzer"를 찾지 못했습니다. npm i kcachat 후 다시 시도하거나 --bundled 없이 실행해 주세요.',
42
+ );
27
43
  process.exit(1);
28
44
  }
29
- const wrapper = JSON.parse(readFileSync(join(kcachatRoot, "package.json"), "utf8")).version;
30
- console.log(`kcachat ${wrapper}`);
31
- console.log(`kakaotalk-chat-analyzer ${main.version}`);
32
- process.exit(0);
45
+ return spawnSync(process.execPath, [target, ...forwardArgs], {
46
+ stdio: "inherit",
47
+ env: process.env,
48
+ });
33
49
  }
34
50
 
35
- let target;
36
- try {
37
- target = resolveMain().cli;
38
- } catch {
39
- console.error('[kcachat] "kakaotalk-chat-analyzer"를 불러오지 못했습니다. npm i kcachat 후 다시 실행해 주세요.');
40
- process.exit(1);
51
+ if (args.includes("--version") || args.includes("-V")) {
52
+ console.log(`kcachat ${wrapperVersion}`);
53
+ if (useBundled) {
54
+ try {
55
+ console.log(`kakaotalk-chat-analyzer ${resolveBundled().version} (bundled)`);
56
+ } catch {
57
+ console.error('[kcachat] bundled 본체를 찾지 못했습니다.');
58
+ process.exit(1);
59
+ }
60
+ process.exit(0);
61
+ }
62
+ const result = spawnNpxLatest(["--version"]);
63
+ process.exit(result.status ?? 1);
41
64
  }
42
65
 
43
- const result = spawnSync(process.execPath, [target, ...args], {
44
- stdio: "inherit",
45
- env: process.env,
46
- });
66
+ const result = useBundled ? runBundled(args) : spawnNpxLatest(args);
47
67
  process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcachat",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "짧은 npx 이름으로 kakaotalk-chat-analyzer(kca) CLI를 실행합니다.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,7 @@
12
12
  "LICENSE"
13
13
  ],
14
14
  "dependencies": {
15
- "kakaotalk-chat-analyzer": "^0.2.7"
15
+ "kakaotalk-chat-analyzer": "0.2.21"
16
16
  },
17
17
  "keywords": [
18
18
  "kakaotalk",