create-ait-app 0.0.1 → 0.0.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 +2 -16
  2. package/package.json +3 -4
  3. package/src/main.js +50 -9
package/README.md CHANGED
@@ -47,8 +47,8 @@ my-app/
47
47
  │ ├── main.tsx
48
48
  │ ├── index.css
49
49
  │ ├── vite-env.d.ts
50
- │ ├── hooks/ # --sample iap/iaa 선택 시에만 추가
51
- │ └── pages/ # --sample iap/iaa 선택 시에만 추가
50
+ │ ├── hooks/ # --sample 선택 시에만 추가
51
+ │ └── pages/ # --sample 선택 시에만 추가
52
52
  ├── public/
53
53
  ├── granite.config.ts
54
54
  ├── package.json
@@ -57,20 +57,6 @@ my-app/
57
57
  └── README.md
58
58
  ```
59
59
 
60
- ## 개발 (이 CLI 도구 자체)
61
-
62
- ```bash
63
- # 의존성 설치
64
- npm install
65
-
66
- # 로컬에서 CLI 테스트
67
- npm link
68
- create-ait-app test-project
69
-
70
- # 링크 해제
71
- npm unlink -g create-ait-app
72
- ```
73
-
74
60
  ## 관련 링크
75
61
 
76
62
  - [앱인토스 콘솔](https://apps-in-toss.toss.im/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ait-app",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Create AIT App scaffolding tool",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -15,7 +15,7 @@
15
15
  "ait"
16
16
  ],
17
17
  "bin": {
18
- "create-ait-app": "./bin/index.js"
18
+ "create-ait-app": "bin/index.js"
19
19
  },
20
20
  "scripts": {
21
21
  "test": "node -c ./bin/index.js && node -c ./src/main.js",
@@ -28,6 +28,5 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@inquirer/prompts": "^7.10.1"
31
- },
32
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
31
+ }
33
32
  }
package/src/main.js CHANGED
@@ -131,6 +131,41 @@ function fetchText(url) {
131
131
  });
132
132
  }
133
133
 
134
+ /**
135
+ * npm create / yarn create / pnpm create 로 실행된 경우 호출한 패키지 매니저를 추론합니다.
136
+ */
137
+ function detectPackageManagerFromInvokingTool() {
138
+ const ua = process.env.npm_config_user_agent || "";
139
+ const execpath = (process.env.npm_execpath || "").replace(/\\/g, "/");
140
+
141
+ // pnpm: execpath 또는 UA (경로에 /pnpm/ segment 또는 실행 파일名 pnpm)
142
+ if (
143
+ /pnpm\//i.test(ua) ||
144
+ /\/pnpm\//i.test(execpath) ||
145
+ /(^|\/)pnpm(\.cjs|\.mjs|\.exe|\.cmd)?$/i.test(execpath)
146
+ ) {
147
+ return "pnpm";
148
+ }
149
+
150
+ // Yarn — Corepack yarn.js, Berry .yarn/releases, 글로벌/툴 shim(…/bin/yarn) 등
151
+ if (
152
+ /\.yarn\/releases\/yarn-/i.test(execpath) ||
153
+ /\/corepack\/v\d+\/yarn\//i.test(execpath) ||
154
+ /\/node_modules\/yarn\//i.test(execpath) ||
155
+ /\/yarn\/\d+\.\d+\.\d+\//i.test(execpath) ||
156
+ /\/yarn\/bin\/yarn\.js$/i.test(execpath) ||
157
+ /\/yarn\.js$/i.test(execpath) ||
158
+ /(^|\/)yarn(\.cmd|\.exe)?$/i.test(execpath) ||
159
+ /yarn\//i.test(ua)
160
+ ) {
161
+ return "yarn";
162
+ }
163
+
164
+ if (/npm\//i.test(ua)) return "npm";
165
+
166
+ return null;
167
+ }
168
+
134
169
  function parseArgs(argv) {
135
170
  const args = { _: [], sample: [] };
136
171
  for (let i = 0; i < argv.length; i++) {
@@ -159,7 +194,8 @@ function printHelp() {
159
194
 
160
195
  options:
161
196
  --inline 질문을 생략하고 옵션만으로 설정합니다 (옵션 미지정 시 모두 n)
162
- --pm <name> 패키지 매니저를 지정합니다 (npm, yarn, pnpm)
197
+ --pm <name> 패키지 매니저를 지정합니다 (npm, yarn, pnpm).
198
+ npm/yarn/pnpm create 로 실행한 경우 해당 매니저를 씁니다
163
199
  --tds TDS(Toss Design System) 패키지를 설치합니다
164
200
  --skills AI를 위한 skills 파일을 추가합니다
165
201
  --ai <name> AI 도구를 지정합니다 (cursor, claude, codex)
@@ -214,14 +250,19 @@ async function main() {
214
250
  }
215
251
  packageManager = cliArgs.pm;
216
252
  } else {
217
- packageManager = await select({
218
- message: "사용할 패키지 매니저를 선택하세요:",
219
- choices: [
220
- { name: "npm", value: "npm" },
221
- { name: "yarn", value: "yarn" },
222
- { name: "pnpm", value: "pnpm" },
223
- ],
224
- });
253
+ const detected = detectPackageManagerFromInvokingTool();
254
+ if (detected && validPms.includes(detected)) {
255
+ packageManager = detected;
256
+ } else {
257
+ packageManager = await select({
258
+ message: "사용할 패키지 매니저를 선택하세요:",
259
+ choices: [
260
+ { name: "npm", value: "npm" },
261
+ { name: "yarn", value: "yarn" },
262
+ { name: "pnpm", value: "pnpm" },
263
+ ],
264
+ });
265
+ }
225
266
  }
226
267
 
227
268
  // --- 3. TDS ---