create-ait-app 0.0.1 → 0.0.3

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 (112) hide show
  1. package/README.md +35 -49
  2. package/package.json +2 -6
  3. package/src/cli.js +52 -0
  4. package/src/main.js +88 -396
  5. package/src/sample-configs.js +140 -0
  6. package/src/sample-inject.js +65 -0
  7. package/src/scaffold.js +111 -0
  8. package/src/skills.js +66 -0
  9. package/src/templates.js +88 -0
  10. package/src/utils/copy-dir.js +19 -0
  11. package/src/utils/fetch-text.js +47 -0
  12. package/src/utils/package-name.js +26 -0
  13. package/templates/js/eslint.config.js +14 -0
  14. package/templates/js/index.html +12 -0
  15. package/templates/js/package.json +20 -0
  16. package/templates/js/samples/iaa/src/lib/inAppAds.js +119 -0
  17. package/templates/js/samples/iaa/src/pages/InAppAdsPage.js +83 -0
  18. package/templates/js/samples/iap/src/lib/inAppPurchase.js +105 -0
  19. package/templates/js/samples/iap/src/pages/InAppPurchasePage.js +102 -0
  20. package/templates/js/src/app.js +58 -0
  21. package/templates/js/src/main.js +2 -0
  22. package/templates/js/vite.config.js +3 -0
  23. package/templates/react/README.md +26 -0
  24. package/templates/react/eslint.config.js +30 -0
  25. package/templates/react/granite.config.ts +20 -0
  26. package/templates/react/index.html +12 -0
  27. package/templates/react/package.json +27 -0
  28. package/templates/react/public/appsintoss-logo.png +0 -0
  29. package/templates/react/samples/iaa/src/hooks/useInAppAds.js +102 -0
  30. package/templates/react/samples/iaa/src/pages/InAppAdsPage.css +72 -0
  31. package/templates/react/samples/iaa/src/pages/InAppAdsPage.jsx +75 -0
  32. package/templates/react/samples/iap/public/icon-document.png +0 -0
  33. package/templates/react/samples/iap/src/hooks/useInAppPurchase.js +95 -0
  34. package/templates/react/samples/iap/src/pages/InAppPurchasePage.css +115 -0
  35. package/templates/react/samples/iap/src/pages/InAppPurchasePage.jsx +115 -0
  36. package/templates/react/src/App.css +104 -0
  37. package/templates/react/src/App.jsx +45 -0
  38. package/templates/react/src/index.css +27 -0
  39. package/templates/react/src/main.jsx +10 -0
  40. package/templates/react/vite.config.js +6 -0
  41. package/templates/react-ts/README.md +26 -0
  42. package/templates/react-ts/eslint.config.js +28 -0
  43. package/templates/react-ts/granite.config.ts +20 -0
  44. package/templates/react-ts/index.html +12 -0
  45. package/templates/react-ts/public/appsintoss-logo.png +0 -0
  46. package/templates/react-ts/samples/iaa/src/pages/InAppAdsPage.css +72 -0
  47. package/templates/react-ts/samples/iap/public/icon-document.png +0 -0
  48. package/templates/react-ts/samples/iap/src/pages/InAppPurchasePage.css +115 -0
  49. package/templates/react-ts/src/App.css +104 -0
  50. package/templates/react-ts/src/index.css +27 -0
  51. package/templates/react-ts/src/vite-env.d.ts +6 -0
  52. package/templates/react-ts/tsconfig.app.json +22 -0
  53. package/templates/react-ts/tsconfig.json +7 -0
  54. package/templates/react-ts/tsconfig.node.json +20 -0
  55. package/templates/react-ts/vite.config.ts +6 -0
  56. package/templates/react-ts-tds/README.md +26 -0
  57. package/templates/react-ts-tds/granite.config.ts +20 -0
  58. package/templates/react-ts-tds/package.json +35 -0
  59. package/templates/react-ts-tds/public/appsintoss-logo.png +0 -0
  60. package/templates/ts/README.md +26 -0
  61. package/templates/ts/eslint.config.js +15 -0
  62. package/templates/ts/granite.config.ts +20 -0
  63. package/templates/ts/index.html +12 -0
  64. package/templates/ts/package.json +22 -0
  65. package/templates/ts/public/appsintoss-logo.png +0 -0
  66. package/templates/ts/samples/iaa/src/lib/inAppAds.ts +132 -0
  67. package/templates/ts/samples/iaa/src/pages/InAppAdsPage.css +72 -0
  68. package/templates/ts/samples/iaa/src/pages/InAppAdsPage.ts +85 -0
  69. package/templates/ts/samples/iap/public/icon-document.png +0 -0
  70. package/templates/ts/samples/iap/src/lib/inAppPurchase.ts +114 -0
  71. package/templates/ts/samples/iap/src/pages/InAppPurchasePage.css +115 -0
  72. package/templates/ts/samples/iap/src/pages/InAppPurchasePage.ts +105 -0
  73. package/templates/ts/src/App.css +104 -0
  74. package/templates/ts/src/app.ts +60 -0
  75. package/templates/ts/src/index.css +27 -0
  76. package/templates/ts/src/main.ts +2 -0
  77. package/templates/ts/src/vite-env.d.ts +1 -0
  78. package/templates/ts/tsconfig.app.json +22 -0
  79. package/templates/ts/tsconfig.json +7 -0
  80. package/templates/ts/tsconfig.node.json +20 -0
  81. package/templates/ts/vite.config.ts +3 -0
  82. /package/{template → templates/js}/README.md +0 -0
  83. /package/{template → templates/js}/granite.config.ts +0 -0
  84. /package/{template → templates/js}/public/appsintoss-logo.png +0 -0
  85. /package/{template/__default/__samples → templates/js/samples}/iaa/src/pages/InAppAdsPage.css +0 -0
  86. /package/{template/__default/__samples → templates/js/samples}/iap/public/icon-document.png +0 -0
  87. /package/{template/__default/__samples → templates/js/samples}/iap/src/pages/InAppPurchasePage.css +0 -0
  88. /package/{template/__default → templates/js}/src/App.css +0 -0
  89. /package/{template/__default → templates/js}/src/index.css +0 -0
  90. /package/{template → templates/react-ts}/package.json +0 -0
  91. /package/{template/__default/__samples → templates/react-ts/samples}/iaa/src/hooks/useInAppAds.tsx +0 -0
  92. /package/{template/__default/__samples → templates/react-ts/samples}/iaa/src/pages/InAppAdsPage.tsx +0 -0
  93. /package/{template/__default/__samples → templates/react-ts/samples}/iap/src/hooks/useInAppPurchase.ts +0 -0
  94. /package/{template/__default/__samples → templates/react-ts/samples}/iap/src/pages/InAppPurchasePage.tsx +0 -0
  95. /package/{template/__default → templates/react-ts}/src/App.tsx +0 -0
  96. /package/{template/__default → templates/react-ts}/src/main.tsx +0 -0
  97. /package/{template → templates/react-ts-tds}/eslint.config.js +0 -0
  98. /package/{template → templates/react-ts-tds}/index.html +0 -0
  99. /package/{template/__tds/__samples → templates/react-ts-tds/samples}/iaa/src/hooks/useInAppAds.tsx +0 -0
  100. /package/{template/__tds/__samples → templates/react-ts-tds/samples}/iaa/src/pages/InAppAdsPage.tsx +0 -0
  101. /package/{template/__tds/__samples → templates/react-ts-tds/samples}/iap/public/icon-document.png +0 -0
  102. /package/{template/__tds/__samples → templates/react-ts-tds/samples}/iap/src/hooks/useInAppPurchase.ts +0 -0
  103. /package/{template/__tds/__samples → templates/react-ts-tds/samples}/iap/src/pages/InAppPurchasePage.tsx +0 -0
  104. /package/{template/__tds → templates/react-ts-tds}/src/App.css +0 -0
  105. /package/{template/__tds → templates/react-ts-tds}/src/App.tsx +0 -0
  106. /package/{template/__tds → templates/react-ts-tds}/src/index.css +0 -0
  107. /package/{template/__tds → templates/react-ts-tds}/src/main.tsx +0 -0
  108. /package/{template → templates/react-ts-tds}/src/vite-env.d.ts +0 -0
  109. /package/{template → templates/react-ts-tds}/tsconfig.app.json +0 -0
  110. /package/{template → templates/react-ts-tds}/tsconfig.json +0 -0
  111. /package/{template → templates/react-ts-tds}/tsconfig.node.json +0 -0
  112. /package/{template → templates/react-ts-tds}/vite.config.ts +0 -0
package/README.md CHANGED
@@ -1,75 +1,57 @@
1
1
  # create-ait-app
2
2
 
3
3
  앱인토스(Apps in Toss) 프로젝트를 빠르게 시작할 수 있는 CLI 도구예요.
4
- Vite 기반 React + TypeScript 프로젝트를 생성하고, TDS/인앱결제/인앱광고 등을 선택적으로 구성할 수 있어요.
4
+ Vite 기반 **React** 또는 **Vanilla** 프로젝트를 생성하고, TDS·인앱결제·인앱광고 예제 등을 선택적으로 추가할 수 있어요.
5
5
 
6
- ## 사용법
6
+ ## 빠르게 시작하기
7
7
 
8
8
  ```bash
9
9
  npx create-ait-app my-app
10
+ cd my-app
11
+ npm run dev
10
12
  ```
11
13
 
12
- 실행하면 대화형 프롬프트로 아래 항목을 선택할 있어요.
14
+ 패키지 매니저는 생성 선택한 값에 맞게 `yarn dev`, `pnpm dev` 등으로 실행하면 돼요.
13
15
 
14
- 1. **패키지 매니저** — npm, yarn, pnpm 중 선택
15
- 2. **TDS (Toss Design System)** — TDS 패키지 설치 여부
16
- 3. **AI Skills** AI 도구를 위한 SDK 문서 파일 추가 여부 (Cursor / Claude Code / Codex / 선택안함)
17
- 4. **예제 코드** — 인앱결제, 인앱광고 샘플 코드 추가 (복수 선택 가능)
16
+ ## 대화형 설정
17
+
18
+ `npx create-ait-app`을 실행하면 아래 항목을 순서대로 선택할 있어요.
19
+
20
+ 1. **패키지 매니저** — npm, yarn, pnpm
21
+ 2. **프로젝트 템플릿** — `react-ts` / `react` / `js` / `ts`
22
+ 3. **TDS (Toss Design System)** — `react-ts` 선택 시에만 표시돼요 (선택, 기본값: 사용 안 함)
23
+ 4. **AI Skills** — Cursor / Claude Code / Codex용 SDK 문서 파일 추가 여부
24
+ 5. **예제 코드** — 인앱결제(`iap`), 인앱광고(`iaa`) 샘플 추가 (복수 선택 가능)
18
25
 
19
26
  ## CLI 옵션
20
27
 
21
- 프롬프트 없이 한 줄로 설정할 수도 있어요.
28
+ 프롬프트 없이 한 줄로 생성할 수도 있어요.
22
29
 
23
30
  ```bash
24
- create-ait-app my-app --inline --pm yarn --tds --skills --ai cursor --sample iap,iaa
31
+ create-ait-app my-app --inline --pm yarn --sample iap,iaa
25
32
  ```
26
33
 
27
- | 옵션 | 설명 |
28
- | ----------------- | --------------------------------------------------------------- |
29
- | `--inline` | 대화형 질문을 생략하고 옵션만으로 설정 (미지정 항목은 모두 `n`) |
30
- | `--pm <name>` | 패키지 매니저 지정 (`npm`, `yarn`, `pnpm`) |
31
- | `--tds` | TDS 패키지 설치 |
32
- | `--skills` | AI Skills 파일 추가 |
33
- | `--ai <name>` | AI 도구 지정 (`cursor`, `claude`, `codex`) |
34
- | `--sample <name>` | 예제 코드 추가 (`iap`, `iaa` / 복수: `iap,iaa`) |
35
- | `--help` | 도움말 출력 |
34
+ | 옵션 | 설명 |
35
+ | --- | --- |
36
+ | `--inline` | 대화형 질문을 생략하고 옵션만으로 설정해요 (미지정 항목은 모두 `n`이에요) |
37
+ | `--pm <name>` | 패키지 매니저를 지정해요 (`npm`, `yarn`, `pnpm`) |
38
+ | `--template <name>` | 템플릿을 지정해요 (`js`, `ts`, `react`, `react-ts` / 기본값: `react-ts`) |
39
+ | `--tds` | `react-ts` 템플릿에서 TDS를 사용해요 (다른 템플릿에서는 무시돼요) |
40
+ | `--skills` | AI 위한 Skills 파일을 추가해요 |
41
+ | `--ai <name>` | 사용할 AI 도구를 지정해요 (`cursor`, `claude`, `codex`) |
42
+ | `--sample <name>` | 예제 코드를 추가해요 (`iap`, `iaa` / 복수: `iap,iaa`) |
43
+ | `--help` | 도움말을 출력해요 |
36
44
 
37
- ## 생성되는 프로젝트 구조
45
+ ### TDS (Toss Design System)
38
46
 
39
- - 기본 템플릿은 최소 구성(헤더, 개발자센터/커뮤니티 링크 등)만 포함합니다.
40
- - **예제 코드**를 선택한 경우에만 `src/hooks/`, `src/pages/` 및 해당 파일들이 추가됩니다.
47
+ TDS는 토스에서 제공하는 디자인 시스템 컴포넌트 모음이에요. React를 필수로 사용해야 해요.
41
48
 
42
- ```
43
- my-app/
44
- ├── src/
45
- │ ├── App.tsx
46
- │ ├── App.css
47
- │ ├── main.tsx
48
- │ ├── index.css
49
- │ ├── vite-env.d.ts
50
- │ ├── hooks/ # --sample iap/iaa 선택 시에만 추가
51
- │ └── pages/ # --sample iap/iaa 선택 시에만 추가
52
- ├── public/
53
- ├── granite.config.ts
54
- ├── package.json
55
- ├── vite.config.ts
56
- ├── tsconfig.json
57
- └── README.md
58
- ```
49
+ TDS 사용은 앱인토스 개발에 필수가 아니에요. `react-ts` 템플릿을 선택한 경우에만 `--tds` 옵션이나 대화형 프롬프트에서 TDS 사용 여부를 물어봐요.
59
50
 
60
- ## 개발 (이 CLI 도구 자체)
51
+ ## 생성되는 프로젝트
61
52
 
62
- ```bash
63
- # 의존성 설치
64
- npm install
53
+ 기본 템플릿은 헤더, 개발자센터·커뮤니티 링크 등 최소 구성만 포함해요. `--sample`로 예제를 선택한 경우 `src/pages/`가 추가되고, React 템플릿은 `src/hooks/`, Vanilla(`js`/`ts`) 템플릿은 `src/lib/`가 추가돼요.
65
54
 
66
- # 로컬에서 CLI 테스트
67
- npm link
68
- create-ait-app test-project
69
-
70
- # 링크 해제
71
- npm unlink -g create-ait-app
72
- ```
73
55
 
74
56
  ## 관련 링크
75
57
 
@@ -77,3 +59,7 @@ npm unlink -g create-ait-app
77
59
  - [앱인토스 개발자센터](https://developers-apps-in-toss.toss.im/)
78
60
  - [앱인토스 개발자 커뮤니티](https://techchat-apps-in-toss.toss.im/)
79
61
  - [AI를 위한 LLMs 문서](https://developers-apps-in-toss.toss.im/development/llms.html)
62
+
63
+ ---
64
+
65
+ 이 CLI 도구에 기여하고 싶다면 [CONTRIBUTING.md](./CONTRIBUTING.md)를 참고해 주세요.
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.3",
4
4
  "description": "Create AIT App scaffolding tool",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -17,14 +17,10 @@
17
17
  "bin": {
18
18
  "create-ait-app": "./bin/index.js"
19
19
  },
20
- "scripts": {
21
- "test": "node -c ./bin/index.js && node -c ./src/main.js",
22
- "prepublishOnly": "npm run test"
23
- },
24
20
  "files": [
25
21
  "bin",
26
22
  "src",
27
- "template"
23
+ "templates"
28
24
  ],
29
25
  "dependencies": {
30
26
  "@inquirer/prompts": "^7.10.1"
package/src/cli.js ADDED
@@ -0,0 +1,52 @@
1
+ function parseArgs(argv) {
2
+ const args = { _: [], sample: [] };
3
+ for (let i = 0; i < argv.length; i++) {
4
+ if (argv[i] === "--pm" && argv[i + 1]) {
5
+ args.pm = argv[++i];
6
+ } else if (argv[i] === "--ai" && argv[i + 1]) {
7
+ args.ai = argv[++i];
8
+ } else if (
9
+ argv[i] === "--sample" &&
10
+ argv[i + 1] &&
11
+ !argv[i + 1].startsWith("--")
12
+ ) {
13
+ args.sample.push(...argv[++i].split(","));
14
+ } else if (argv[i] === "--template" && argv[i + 1]) {
15
+ args.template = argv[++i];
16
+ } else if (argv[i].startsWith("--")) {
17
+ args[argv[i].slice(2)] = true;
18
+ } else {
19
+ args._.push(argv[i]);
20
+ }
21
+ }
22
+ return args;
23
+ }
24
+
25
+ function printHelp() {
26
+ console.log(`
27
+ 사용법: create-ait-app [project-name] [options]
28
+
29
+ options:
30
+ --inline 질문을 생략하고 옵션만으로 설정합니다 (옵션 미지정 시 모두 n)
31
+ --pm <name> 패키지 매니저를 지정합니다 (npm, yarn, pnpm)
32
+ --template <name> 템플릿을 지정합니다 (기본값: react-ts)
33
+ --tds react-ts 템플릿에서 TDS를 사용합니다 (다른 템플릿에서는 무시)
34
+ --skills AI를 위한 skills 파일을 추가합니다
35
+ --ai <name> AI 도구를 지정합니다 (cursor, claude, codex)
36
+ --sample <name> 예제 코드를 추가합니다 (iap, iaa / 복수선택: iap,iaa)
37
+ --help 이 도움말을 출력합니다
38
+
39
+ templates:
40
+ react-ts React + TypeScript (기본)
41
+ react React + JavaScript
42
+ js Vanilla JavaScript
43
+ ts Vanilla TypeScript
44
+
45
+ links:
46
+ 앱인토스 콘솔 https://apps-in-toss.toss.im/
47
+ 앱인토스 개발자센터 https://developers-apps-in-toss.toss.im/
48
+ 앱인토스 개발자 커뮤니티 https://techchat-apps-in-toss.toss.im/
49
+ `);
50
+ }
51
+
52
+ module.exports = { parseArgs, printHelp };