kcachat 0.1.1 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +11 -0
  2. package/cli.mjs +30 -4
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -7,5 +7,16 @@ npx kcachat@latest "./KakaoTalk_Chat_....csv" --local
7
7
  npx kcachat@latest "./KakaoTalk_Chat_....csv"
8
8
  ```
9
9
 
10
+ ### `npx`가 예전 버전처럼 보일 때
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` 두 줄이 출력됩니다.
20
+
10
21
  - 전체 패키지명: [kakaotalk-chat-analyzer](https://www.npmjs.com/package/kakaotalk-chat-analyzer)
11
22
  - 소개·시작 가이드(랜딩): [GitHub Pages](https://claudianus.github.io/kakaotalk-chat-analyzer/)
package/cli.mjs CHANGED
@@ -1,20 +1,46 @@
1
1
  #!/usr/bin/env node
2
+ import { readFileSync } from "node:fs";
2
3
  import { spawnSync } from "node:child_process";
3
4
  import { createRequire } from "node:module";
4
5
  import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
5
7
 
6
8
  const require = createRequire(import.meta.url);
7
- let target;
8
- try {
9
+ const kcachatRoot = dirname(fileURLToPath(import.meta.url));
10
+
11
+ function resolveMain() {
9
12
  const pkgPath = require.resolve("kakaotalk-chat-analyzer/package.json");
10
13
  const root = dirname(pkgPath);
11
- target = join(root, "dist", "src", "cli.js");
14
+ return {
15
+ version: JSON.parse(readFileSync(pkgPath, "utf8")).version,
16
+ cli: join(root, "dist", "src", "cli.js"),
17
+ };
18
+ }
19
+
20
+ const args = process.argv.slice(2);
21
+ if (args.includes("--version") || args.includes("-V")) {
22
+ let main;
23
+ try {
24
+ main = resolveMain();
25
+ } catch {
26
+ console.error('[kcachat] "kakaotalk-chat-analyzer"를 불러오지 못했습니다.');
27
+ process.exit(1);
28
+ }
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);
33
+ }
34
+
35
+ let target;
36
+ try {
37
+ target = resolveMain().cli;
12
38
  } catch {
13
39
  console.error('[kcachat] "kakaotalk-chat-analyzer"를 불러오지 못했습니다. npm i kcachat 후 다시 실행해 주세요.');
14
40
  process.exit(1);
15
41
  }
16
42
 
17
- const result = spawnSync(process.execPath, [target, ...process.argv.slice(2)], {
43
+ const result = spawnSync(process.execPath, [target, ...args], {
18
44
  stdio: "inherit",
19
45
  env: process.env,
20
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcachat",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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.5"
15
+ "kakaotalk-chat-analyzer": "^0.2.7"
16
16
  },
17
17
  "keywords": [
18
18
  "kakaotalk",