@hua-labs/create-hua-ux 0.1.0-alpha.0.1
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/LICENSE +21 -0
- package/README.md +183 -0
- package/dist/bin/create-hua-ux.d.ts +9 -0
- package/dist/bin/create-hua-ux.d.ts.map +1 -0
- package/dist/bin/create-hua-ux.js +37 -0
- package/dist/constants/versions.d.ts +55 -0
- package/dist/constants/versions.d.ts.map +1 -0
- package/dist/constants/versions.js +57 -0
- package/dist/create-project.d.ts +18 -0
- package/dist/create-project.d.ts.map +1 -0
- package/dist/create-project.js +237 -0
- package/dist/doctor.d.ts +21 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +259 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +177 -0
- package/dist/utils.d.ts +108 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +896 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +11 -0
- package/package.json +46 -0
- package/templates/nextjs/.claude/project-context.md +310 -0
- package/templates/nextjs/.claude/skills/hua-ux-framework/SKILL.md +187 -0
- package/templates/nextjs/.cursorrules +302 -0
- package/templates/nextjs/.eslintrc.json +1 -0
- package/templates/nextjs/README.md +431 -0
- package/templates/nextjs/ai-context.md +332 -0
- package/templates/nextjs/app/api/translations/[language]/[namespace]/route.ts +86 -0
- package/templates/nextjs/app/globals.css +24 -0
- package/templates/nextjs/app/layout-with-geo.example.tsx +106 -0
- package/templates/nextjs/app/layout.tsx +30 -0
- package/templates/nextjs/app/page-with-geo.example.tsx +80 -0
- package/templates/nextjs/app/page.tsx +28 -0
- package/templates/nextjs/components/I18nProviderWrapper.tsx +19 -0
- package/templates/nextjs/lib/i18n-setup.ts +11 -0
- package/templates/nextjs/middleware.ts.example +22 -0
- package/templates/nextjs/next.config.ts +36 -0
- package/templates/nextjs/postcss.config.js +6 -0
- package/templates/nextjs/store/useAppStore.ts +8 -0
- package/templates/nextjs/tailwind.config.js +8 -0
- package/templates/nextjs/translations/en/common.json +6 -0
- package/templates/nextjs/translations/ko/common.json +6 -0
- package/templates/nextjs/tsconfig.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 HUA Labs Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# @hua-labs/create-hua-ux
|
|
2
|
+
|
|
3
|
+
**Scaffolding tool for creating hua-ux projects**
|
|
4
|
+
|
|
5
|
+
Quickly create a new Next.js project with hua-ux framework pre-configured.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm create hua-ux my-app
|
|
11
|
+
# or
|
|
12
|
+
npm create hua-ux my-app
|
|
13
|
+
# or
|
|
14
|
+
yarn create hua-ux my-app
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Interactive Mode (Recommended)
|
|
20
|
+
|
|
21
|
+
When you run the CLI, you'll be prompted to select which AI context files to generate:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm create hua-ux my-app
|
|
25
|
+
# or
|
|
26
|
+
npx tsx src/index.ts my-app
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You'll see interactive prompts:
|
|
30
|
+
1. **Select AI context files** (checkboxes):
|
|
31
|
+
- `.cursorrules` (Cursor IDE rules) - default: checked
|
|
32
|
+
- `ai-context.md` (General AI context) - default: checked
|
|
33
|
+
- `.claude/project-context.md` (Claude context) - default: checked
|
|
34
|
+
- `.claude/skills/` (Claude skills) - default: unchecked
|
|
35
|
+
|
|
36
|
+
2. **Documentation language**:
|
|
37
|
+
- Korean only
|
|
38
|
+
- English only
|
|
39
|
+
- Both Korean and English (default)
|
|
40
|
+
|
|
41
|
+
### Non-Interactive Mode
|
|
42
|
+
|
|
43
|
+
For CI/CD or automated scripts, use environment variable:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
NON_INTERACTIVE=1 pnpm create hua-ux my-app
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This will use default options (all files except Claude skills, both languages).
|
|
50
|
+
|
|
51
|
+
### CLI Flags
|
|
52
|
+
|
|
53
|
+
You can also use CLI flags to specify options:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx tsx src/index.ts my-app --claude-skills --lang both
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Available flags:
|
|
60
|
+
- `--claude-skills`: Include Claude skills
|
|
61
|
+
- `--no-cursorrules`: Skip .cursorrules
|
|
62
|
+
- `--no-ai-context`: Skip ai-context.md
|
|
63
|
+
- `--no-claude-context`: Skip .claude/project-context.md
|
|
64
|
+
- `--lang <ko|en|both>`: Set documentation language
|
|
65
|
+
|
|
66
|
+
### After Creation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cd my-app
|
|
70
|
+
pnpm install
|
|
71
|
+
pnpm dev
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## What Gets Created
|
|
75
|
+
|
|
76
|
+
- โ
Next.js 16 project with App Router
|
|
77
|
+
- โ
TypeScript configuration
|
|
78
|
+
- โ
Tailwind CSS setup
|
|
79
|
+
- โ
`@hua-labs/hua-ux` pre-installed and configured
|
|
80
|
+
- โ
Basic project structure (`app/`, `components/`, `lib/`, `store/`)
|
|
81
|
+
- โ
i18n setup with Korean and English translations
|
|
82
|
+
- โ
Example page using `HuaUxLayout` and `HuaUxPage` with translation keys
|
|
83
|
+
- โ
`hua-ux.config.ts` configuration file
|
|
84
|
+
- โ
Dynamic language setting in layout (middleware-ready)
|
|
85
|
+
- โ
Improved error handling in translation API
|
|
86
|
+
- โ
ESLint configuration ready
|
|
87
|
+
|
|
88
|
+
## Project Structure
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
my-app/
|
|
92
|
+
โโโ app/
|
|
93
|
+
โ โโโ layout.tsx # Root layout with HuaUxLayout
|
|
94
|
+
โ โโโ page.tsx # Home page with HuaUxPage
|
|
95
|
+
โ โโโ globals.css # Tailwind CSS
|
|
96
|
+
โ โโโ api/
|
|
97
|
+
โ โโโ translations/ # i18n API route
|
|
98
|
+
โโโ components/ # Your components
|
|
99
|
+
โโโ lib/
|
|
100
|
+
โ โโโ i18n-setup.ts # i18n configuration
|
|
101
|
+
โโโ store/
|
|
102
|
+
โ โโโ useAppStore.ts # Zustand store
|
|
103
|
+
โโโ translations/ # Translation files
|
|
104
|
+
โ โโโ ko/
|
|
105
|
+
โ โโโ en/
|
|
106
|
+
โโโ hua-ux.config.ts # Framework configuration
|
|
107
|
+
โโโ next.config.ts
|
|
108
|
+
โโโ tailwind.config.js
|
|
109
|
+
โโโ tsconfig.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Next Steps
|
|
113
|
+
|
|
114
|
+
1. **Customize configuration**: Edit `hua-ux.config.ts`
|
|
115
|
+
2. **Add translations**: Add more keys to `translations/ko/common.json` and `translations/en/common.json`
|
|
116
|
+
3. **Create pages**: Add new pages in `app/` directory
|
|
117
|
+
4. **Add components**: Create reusable components in `components/` directory
|
|
118
|
+
5. **Optional: Add middleware**: If you need automatic language detection, rename `middleware.ts.example` to `middleware.ts` and uncomment the code (โ ๏ธ Note: Runs on Edge Runtime)
|
|
119
|
+
- The layout will automatically read the language from the `x-language` header set by middleware
|
|
120
|
+
|
|
121
|
+
## Template Features
|
|
122
|
+
|
|
123
|
+
### GEO (Generative Engine Optimization)
|
|
124
|
+
Example files for AI search engine optimization are included:
|
|
125
|
+
- `app/layout-with-geo.example.tsx` - Layout with GEO metadata
|
|
126
|
+
- `app/page-with-geo.example.tsx` - Page with GEO and SEO metadata
|
|
127
|
+
|
|
128
|
+
These examples show how to integrate GEO metadata for better AI discoverability.
|
|
129
|
+
|
|
130
|
+
### Dynamic Language Setting
|
|
131
|
+
The generated `app/layout.tsx` automatically reads the language from middleware headers:
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
// app/layout.tsx
|
|
135
|
+
import { headers } from "next/headers";
|
|
136
|
+
|
|
137
|
+
const headersList = headers();
|
|
138
|
+
const language = headersList.get('x-language') || 'ko';
|
|
139
|
+
|
|
140
|
+
return <html lang={language}>...</html>;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Translation Keys Usage
|
|
144
|
+
The example page uses translation keys instead of hardcoded text:
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
// app/page.tsx
|
|
148
|
+
import { useTranslation } from '@hua-labs/hua-ux';
|
|
149
|
+
|
|
150
|
+
const { t } = useTranslation('common');
|
|
151
|
+
return <h1>{t('title')}</h1>;
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Improved Error Handling
|
|
155
|
+
The translation API route includes proper error handling with type distinction and validation.
|
|
156
|
+
|
|
157
|
+
## Framework Layer
|
|
158
|
+
|
|
159
|
+
์์ฑ๋ ํ๋ก์ ํธ๋ ํ๋ ์์ํฌ ๋ ์ด์ด๋ฅผ ์ฌ์ฉํฉ๋๋ค:
|
|
160
|
+
|
|
161
|
+
- **`HuaUxLayout`**: ์๋์ผ๋ก i18n, motion, state ํ๋ก๋ฐ์ด๋ ์ค์
|
|
162
|
+
- **`HuaUxPage`**: ํ์ด์ง ๋ํผ (์๋ ๋ชจ์
์ ์ฉ)
|
|
163
|
+
- **`hua-ux.config.ts`**: ํ๋ ์์ํฌ ์ค์ ํ์ผ
|
|
164
|
+
|
|
165
|
+
์์ธํ ๋ด์ฉ์ [ํ๋ ์์ํฌ ๋ ์ด์ด ๋ฌธ์](../../packages/hua-ux/src/framework/README.md)๋ฅผ ์ฐธ๊ณ ํ์ธ์.
|
|
166
|
+
|
|
167
|
+
## Troubleshooting
|
|
168
|
+
|
|
169
|
+
### Edge Runtime ์ด์
|
|
170
|
+
|
|
171
|
+
๋ฏธ๋ค์จ์ด๋ฅผ ์ฌ์ฉํ ๋ Edge Runtime ์ ์ฝ์ฌํญ์ด ์์ต๋๋ค:
|
|
172
|
+
- Node.js API ์ฌ์ฉ ๋ถ๊ฐ (fs, path ๋ฑ)
|
|
173
|
+
- ์ผ๋ถ npm ํจํค์ง๊ฐ ํธํ๋์ง ์์ ์ ์์
|
|
174
|
+
|
|
175
|
+
**ํด๊ฒฐ ๋ฐฉ๋ฒ**:
|
|
176
|
+
1. ๋ฏธ๋ค์จ์ด๋ฅผ ์ฌ์ฉํ์ง ์๊ณ API Route๋ ํด๋ผ์ด์ธํธ ์ปดํฌ๋ํธ์์ ์ธ์ด ๊ฐ์ง
|
|
177
|
+
2. Edge Runtime์ ๋ช
์์ ์ผ๋ก ์ค์ : `export const runtime = 'edge';`
|
|
178
|
+
|
|
179
|
+
์์ธํ ๋ด์ฉ์ [ํ๋ ์์ํฌ ๋ ์ด์ด ๋ฌธ์](../../packages/hua-ux/src/framework/README.md)๋ฅผ ์ฐธ๊ณ ํ์ธ์.
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-hua-ux.d.ts","sourceRoot":"","sources":["../../src/bin/create-hua-ux.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* create-hua-ux CLI Entry Point
|
|
5
|
+
*
|
|
6
|
+
* This file is compiled to dist/bin/create-hua-ux.js
|
|
7
|
+
* and used as the executable when the package is installed.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const index_1 = require("../index");
|
|
11
|
+
// Run the main function
|
|
12
|
+
(0, index_1.main)().catch((error) => {
|
|
13
|
+
console.error('\nโ Error:', error.message || String(error));
|
|
14
|
+
// ์๋ฌ ํ์
๋ณ ๊ฐ์ด๋ ์ ๊ณต
|
|
15
|
+
if (error.code === 'EACCES') {
|
|
16
|
+
console.error('\n๐ก Tip: ํด๋ ๊ถํ์ ํ์ธํ์ธ์.');
|
|
17
|
+
console.error(` chmod 755 ${process.cwd()}`);
|
|
18
|
+
}
|
|
19
|
+
else if (error.code === 'ENOENT') {
|
|
20
|
+
console.error('\n๐ก Tip: Node.js๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํ์ธ์.');
|
|
21
|
+
console.error(' node --version');
|
|
22
|
+
}
|
|
23
|
+
else if (error.message?.includes('already exists')) {
|
|
24
|
+
console.error('\n๐ก Tip: ๋ค๋ฅธ ํ๋ก์ ํธ ์ด๋ฆ์ ์ฌ์ฉํ๊ฑฐ๋ ๊ธฐ์กด ํด๋๋ฅผ ์ญ์ ํ์ธ์.');
|
|
25
|
+
}
|
|
26
|
+
else if (error.message?.includes('EADDRINUSE')) {
|
|
27
|
+
console.error('\n๐ก Tip: ํฌํธ๊ฐ ์ด๋ฏธ ์ฌ์ฉ ์ค์
๋๋ค.');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.error('\n๐ก Troubleshooting:');
|
|
31
|
+
console.error(' 1. Node.js ๋ฒ์ ํ์ธ: node --version (>=18.0.0 ๊ถ์ฅ)');
|
|
32
|
+
console.error(' 2. ํด๋ ๊ถํ ํ์ธ');
|
|
33
|
+
console.error(' 3. ๋์คํฌ ๊ณต๊ฐ ํ์ธ');
|
|
34
|
+
console.error(' 4. GitHub Issues: https://github.com/HUA-Labs/HUA-Labs-public/issues');
|
|
35
|
+
}
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework and dependency versions
|
|
3
|
+
*
|
|
4
|
+
* This file centralizes all version numbers used in generated projects.
|
|
5
|
+
* Update versions here when upgrading dependencies.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Next.js version
|
|
9
|
+
*/
|
|
10
|
+
export declare const NEXTJS_VERSION = "16.0.10";
|
|
11
|
+
/**
|
|
12
|
+
* React version
|
|
13
|
+
*/
|
|
14
|
+
export declare const REACT_VERSION = "19.2.1";
|
|
15
|
+
/**
|
|
16
|
+
* React DOM version (should match React version)
|
|
17
|
+
*/
|
|
18
|
+
export declare const REACT_DOM_VERSION = "19.2.1";
|
|
19
|
+
/**
|
|
20
|
+
* Zustand version
|
|
21
|
+
*/
|
|
22
|
+
export declare const ZUSTAND_VERSION = "^5.0.8";
|
|
23
|
+
/**
|
|
24
|
+
* TypeScript version
|
|
25
|
+
*/
|
|
26
|
+
export declare const TYPESCRIPT_VERSION = "^5.9.3";
|
|
27
|
+
/**
|
|
28
|
+
* Node.js types version
|
|
29
|
+
*/
|
|
30
|
+
export declare const TYPES_NODE_VERSION = "^22.0.0";
|
|
31
|
+
/**
|
|
32
|
+
* React types version
|
|
33
|
+
*/
|
|
34
|
+
export declare const TYPES_REACT_VERSION = "^19.2.7";
|
|
35
|
+
/**
|
|
36
|
+
* React DOM types version
|
|
37
|
+
*/
|
|
38
|
+
export declare const TYPES_REACT_DOM_VERSION = "^19.2.3";
|
|
39
|
+
/**
|
|
40
|
+
* Tailwind CSS PostCSS version
|
|
41
|
+
*/
|
|
42
|
+
export declare const TAILWIND_POSTCSS_VERSION = "^4";
|
|
43
|
+
/**
|
|
44
|
+
* Autoprefixer version
|
|
45
|
+
*/
|
|
46
|
+
export declare const AUTOPREFIXER_VERSION = "^10.4.21";
|
|
47
|
+
/**
|
|
48
|
+
* PostCSS version
|
|
49
|
+
*/
|
|
50
|
+
export declare const POSTCSS_VERSION = "^8.5.6";
|
|
51
|
+
/**
|
|
52
|
+
* Tailwind CSS version
|
|
53
|
+
*/
|
|
54
|
+
export declare const TAILWIND_VERSION = "^4.1.13";
|
|
55
|
+
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/constants/versions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,gBAAgB,YAAY,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Framework and dependency versions
|
|
4
|
+
*
|
|
5
|
+
* This file centralizes all version numbers used in generated projects.
|
|
6
|
+
* Update versions here when upgrading dependencies.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TAILWIND_VERSION = exports.POSTCSS_VERSION = exports.AUTOPREFIXER_VERSION = exports.TAILWIND_POSTCSS_VERSION = exports.TYPES_REACT_DOM_VERSION = exports.TYPES_REACT_VERSION = exports.TYPES_NODE_VERSION = exports.TYPESCRIPT_VERSION = exports.ZUSTAND_VERSION = exports.REACT_DOM_VERSION = exports.REACT_VERSION = exports.NEXTJS_VERSION = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Next.js version
|
|
12
|
+
*/
|
|
13
|
+
exports.NEXTJS_VERSION = '16.0.10';
|
|
14
|
+
/**
|
|
15
|
+
* React version
|
|
16
|
+
*/
|
|
17
|
+
exports.REACT_VERSION = '19.2.1';
|
|
18
|
+
/**
|
|
19
|
+
* React DOM version (should match React version)
|
|
20
|
+
*/
|
|
21
|
+
exports.REACT_DOM_VERSION = '19.2.1';
|
|
22
|
+
/**
|
|
23
|
+
* Zustand version
|
|
24
|
+
*/
|
|
25
|
+
exports.ZUSTAND_VERSION = '^5.0.8';
|
|
26
|
+
/**
|
|
27
|
+
* TypeScript version
|
|
28
|
+
*/
|
|
29
|
+
exports.TYPESCRIPT_VERSION = '^5.9.3';
|
|
30
|
+
/**
|
|
31
|
+
* Node.js types version
|
|
32
|
+
*/
|
|
33
|
+
exports.TYPES_NODE_VERSION = '^22.0.0';
|
|
34
|
+
/**
|
|
35
|
+
* React types version
|
|
36
|
+
*/
|
|
37
|
+
exports.TYPES_REACT_VERSION = '^19.2.7';
|
|
38
|
+
/**
|
|
39
|
+
* React DOM types version
|
|
40
|
+
*/
|
|
41
|
+
exports.TYPES_REACT_DOM_VERSION = '^19.2.3';
|
|
42
|
+
/**
|
|
43
|
+
* Tailwind CSS PostCSS version
|
|
44
|
+
*/
|
|
45
|
+
exports.TAILWIND_POSTCSS_VERSION = '^4';
|
|
46
|
+
/**
|
|
47
|
+
* Autoprefixer version
|
|
48
|
+
*/
|
|
49
|
+
exports.AUTOPREFIXER_VERSION = '^10.4.21';
|
|
50
|
+
/**
|
|
51
|
+
* PostCSS version
|
|
52
|
+
*/
|
|
53
|
+
exports.POSTCSS_VERSION = '^8.5.6';
|
|
54
|
+
/**
|
|
55
|
+
* Tailwind CSS version
|
|
56
|
+
*/
|
|
57
|
+
exports.TAILWIND_VERSION = '^4.1.13';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create-hua-ux - Project Creation
|
|
3
|
+
*
|
|
4
|
+
* Creates a new hua-ux project from template
|
|
5
|
+
*/
|
|
6
|
+
import { type AiContextOptions } from './utils';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve project path
|
|
9
|
+
*
|
|
10
|
+
* If running from within the monorepo (packages/create-hua-ux), create project in monorepo root.
|
|
11
|
+
* Otherwise, create in current working directory.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveProjectPath(projectName: string): string;
|
|
14
|
+
export declare function createProject(projectName: string, aiContextOptions?: AiContextOptions, options?: {
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
skipPrerequisites?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=create-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../src/create-project.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAuG,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErJ;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAe9D;AAED,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1D,OAAO,CAAC,IAAI,CAAC,CAsKf"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* create-hua-ux - Project Creation
|
|
4
|
+
*
|
|
5
|
+
* Creates a new hua-ux project from template
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.resolveProjectPath = resolveProjectPath;
|
|
45
|
+
exports.createProject = createProject;
|
|
46
|
+
const fs = __importStar(require("fs-extra"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
49
|
+
const utils_1 = require("./utils");
|
|
50
|
+
/**
|
|
51
|
+
* Resolve project path
|
|
52
|
+
*
|
|
53
|
+
* If running from within the monorepo (packages/create-hua-ux), create project in monorepo root.
|
|
54
|
+
* Otherwise, create in current working directory.
|
|
55
|
+
*/
|
|
56
|
+
function resolveProjectPath(projectName) {
|
|
57
|
+
const cwd = process.cwd();
|
|
58
|
+
// Check if we're running from packages/create-hua-ux directory
|
|
59
|
+
// More robust check: look for both 'packages' and 'create-hua-ux' in path
|
|
60
|
+
const normalizedCwd = path.normalize(cwd).replace(/\\/g, '/');
|
|
61
|
+
if (normalizedCwd.includes('/packages/') && normalizedCwd.includes('/create-hua-ux')) {
|
|
62
|
+
// Find the packages directory and go up one level to monorepo root
|
|
63
|
+
const packagesIndex = normalizedCwd.indexOf('/packages/');
|
|
64
|
+
const monorepoRoot = normalizedCwd.substring(0, packagesIndex);
|
|
65
|
+
return path.resolve(monorepoRoot, projectName);
|
|
66
|
+
}
|
|
67
|
+
// Default: create in current working directory
|
|
68
|
+
return path.resolve(cwd, projectName);
|
|
69
|
+
}
|
|
70
|
+
async function createProject(projectName, aiContextOptions, options) {
|
|
71
|
+
const projectPath = resolveProjectPath(projectName);
|
|
72
|
+
const isDryRun = options?.dryRun ?? false;
|
|
73
|
+
// Debug: log the resolved path (only in development)
|
|
74
|
+
if (process.env.NODE_ENV !== 'production' && !isDryRun) {
|
|
75
|
+
console.log(chalk_1.default.gray(`Project will be created at: ${projectPath}`));
|
|
76
|
+
}
|
|
77
|
+
// Check if directory already exists
|
|
78
|
+
if (!isDryRun && await fs.pathExists(projectPath)) {
|
|
79
|
+
const isEn = process.env.LANG === 'en' || process.env.CLI_LANG === 'en' || process.argv.includes('--english-only');
|
|
80
|
+
console.error(chalk_1.default.red(isEn
|
|
81
|
+
? `Directory "${projectPath}" already exists`
|
|
82
|
+
: `๋๋ ํ ๋ฆฌ "${projectPath}"๊ฐ ์ด๋ฏธ ์กด์ฌํฉ๋๋ค`));
|
|
83
|
+
console.error(chalk_1.default.yellow(isEn
|
|
84
|
+
? '๐ก Try a different project name or remove the existing directory'
|
|
85
|
+
: '๐ก ๋ค๋ฅธ ํ๋ก์ ํธ ์ด๋ฆ์ ์ฌ์ฉํ๊ฑฐ๋ ๊ธฐ์กด ๋๋ ํ ๋ฆฌ๋ฅผ ์ญ์ ํ์ธ์'));
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
// Prerequisites check (skip in dry-run mode)
|
|
89
|
+
if (!isDryRun && !options?.skipPrerequisites) {
|
|
90
|
+
const { checkPrerequisites } = await Promise.resolve().then(() => __importStar(require('./utils')));
|
|
91
|
+
try {
|
|
92
|
+
await checkPrerequisites();
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.error(chalk_1.default.red('\nโ Prerequisites check failed'));
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (isDryRun) {
|
|
100
|
+
console.log(chalk_1.default.blue(`\n๐ Dry-run mode: Preview of project creation for "${projectName}"\n`));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
console.log(chalk_1.default.blue(`\n๐ Creating hua-ux project: ${projectName}...\n`));
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
// Step 1/5: Creating project structure
|
|
107
|
+
console.log(chalk_1.default.blue('๐ฆ Step 1/5: Creating project structure...'));
|
|
108
|
+
if (!isDryRun) {
|
|
109
|
+
await fs.ensureDir(projectPath);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
console.log(chalk_1.default.gray(` Would create directory: ${projectPath}`));
|
|
113
|
+
}
|
|
114
|
+
console.log(chalk_1.default.green('โ
Project structure ready'));
|
|
115
|
+
// Step 2/5: Copying template files
|
|
116
|
+
console.log(chalk_1.default.blue('\n๐ Step 2/5: Copying template files...'));
|
|
117
|
+
if (!isDryRun) {
|
|
118
|
+
// Determine if we should skip AI context files during copy
|
|
119
|
+
// If user explicitly disabled all AI context, skip them during copy for performance
|
|
120
|
+
// Note: We still copy them and delete later for safety, but this optimization
|
|
121
|
+
// can be enabled if all AI context is explicitly disabled
|
|
122
|
+
const shouldSkipAiContext = aiContextOptions
|
|
123
|
+
? !aiContextOptions.cursorrules && !aiContextOptions.aiContext && !aiContextOptions.claudeContext && !aiContextOptions.claudeSkills
|
|
124
|
+
: false;
|
|
125
|
+
await (0, utils_1.copyTemplate)(projectPath, { skipAiContext: shouldSkipAiContext });
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
console.log(chalk_1.default.gray(' Would copy template files from templates/nextjs/'));
|
|
129
|
+
if (aiContextOptions) {
|
|
130
|
+
const aiFiles = [];
|
|
131
|
+
if (aiContextOptions.cursorrules)
|
|
132
|
+
aiFiles.push('.cursorrules');
|
|
133
|
+
if (aiContextOptions.aiContext)
|
|
134
|
+
aiFiles.push('ai-context.md');
|
|
135
|
+
if (aiContextOptions.claudeContext)
|
|
136
|
+
aiFiles.push('.claude/project-context.md');
|
|
137
|
+
if (aiContextOptions.claudeSkills)
|
|
138
|
+
aiFiles.push('.claude/skills/');
|
|
139
|
+
if (aiFiles.length > 0) {
|
|
140
|
+
console.log(chalk_1.default.gray(` Would include AI context files: ${aiFiles.join(', ')}`));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
console.log(chalk_1.default.green('โ
Template files copied'));
|
|
145
|
+
// Step 3/5: Generating configuration
|
|
146
|
+
console.log(chalk_1.default.blue('\nโ๏ธ Step 3/5: Generating configuration...'));
|
|
147
|
+
if (!isDryRun) {
|
|
148
|
+
await (0, utils_1.generatePackageJson)(projectPath, projectName);
|
|
149
|
+
await (0, utils_1.generateConfig)(projectPath);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
console.log(chalk_1.default.gray(' Would generate package.json'));
|
|
153
|
+
console.log(chalk_1.default.gray(' Would generate hua-ux.config.ts'));
|
|
154
|
+
}
|
|
155
|
+
console.log(chalk_1.default.green('โ
Configuration generated'));
|
|
156
|
+
// Step 4/5: Generating AI context files
|
|
157
|
+
console.log(chalk_1.default.blue('\n๐ค Step 4/5: Generating AI context files...'));
|
|
158
|
+
if (!isDryRun) {
|
|
159
|
+
await (0, utils_1.generateAiContextFiles)(projectPath, projectName, aiContextOptions);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
const aiFiles = [];
|
|
163
|
+
if (aiContextOptions?.cursorrules)
|
|
164
|
+
aiFiles.push('.cursorrules');
|
|
165
|
+
if (aiContextOptions?.aiContext)
|
|
166
|
+
aiFiles.push('ai-context.md');
|
|
167
|
+
if (aiContextOptions?.claudeContext)
|
|
168
|
+
aiFiles.push('.claude/project-context.md');
|
|
169
|
+
if (aiContextOptions?.claudeSkills)
|
|
170
|
+
aiFiles.push('.claude/skills/');
|
|
171
|
+
if (aiFiles.length > 0) {
|
|
172
|
+
console.log(chalk_1.default.gray(` Would generate: ${aiFiles.join(', ')}`));
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
console.log(chalk_1.default.gray(' No AI context files selected'));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
console.log(chalk_1.default.green('โ
AI context files generated'));
|
|
179
|
+
// Step 5/5: Validating project
|
|
180
|
+
console.log(chalk_1.default.blue('\nโ
Step 5/5: Validating project...'));
|
|
181
|
+
if (!isDryRun) {
|
|
182
|
+
await (0, utils_1.validateGeneratedProject)(projectPath);
|
|
183
|
+
// Validate translation files
|
|
184
|
+
const { validateTranslationFiles } = await Promise.resolve().then(() => __importStar(require('./utils')));
|
|
185
|
+
await validateTranslationFiles(projectPath);
|
|
186
|
+
console.log(chalk_1.default.green('โ
Project validation passed'));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
console.log(chalk_1.default.gray(' Would validate: package.json, tsconfig.json, required directories'));
|
|
190
|
+
console.log(chalk_1.default.green('โ
Validation would pass'));
|
|
191
|
+
}
|
|
192
|
+
if (isDryRun) {
|
|
193
|
+
console.log(chalk_1.default.green(`\nโ
Dry-run completed successfully!`));
|
|
194
|
+
console.log(chalk_1.default.cyan(`\n๐ Preview Summary:`));
|
|
195
|
+
console.log(chalk_1.default.white(` Project name: ${projectName}`));
|
|
196
|
+
console.log(chalk_1.default.white(` Location: ${projectPath}`));
|
|
197
|
+
if (aiContextOptions) {
|
|
198
|
+
const aiFiles = [];
|
|
199
|
+
if (aiContextOptions.cursorrules)
|
|
200
|
+
aiFiles.push('.cursorrules');
|
|
201
|
+
if (aiContextOptions.aiContext)
|
|
202
|
+
aiFiles.push('ai-context.md');
|
|
203
|
+
if (aiContextOptions.claudeContext)
|
|
204
|
+
aiFiles.push('.claude/project-context.md');
|
|
205
|
+
if (aiContextOptions.claudeSkills)
|
|
206
|
+
aiFiles.push('.claude/skills/');
|
|
207
|
+
console.log(chalk_1.default.white(` AI Context: ${aiFiles.length > 0 ? aiFiles.join(', ') : 'None'}`));
|
|
208
|
+
console.log(chalk_1.default.white(` Language: ${aiContextOptions.language}`));
|
|
209
|
+
}
|
|
210
|
+
console.log(chalk_1.default.cyan(`\n๐ก Run without --dry-run to create the project`));
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
// Generate and display summary
|
|
214
|
+
const { generateSummary, displaySummary, displayNextSteps } = await Promise.resolve().then(() => __importStar(require('./utils')));
|
|
215
|
+
const summary = await generateSummary(projectPath, aiContextOptions);
|
|
216
|
+
console.log(chalk_1.default.green(`\nโ
Project created successfully!`));
|
|
217
|
+
displaySummary(summary);
|
|
218
|
+
displayNextSteps(projectPath, aiContextOptions);
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
// Log error details
|
|
222
|
+
const isEn = process.env.LANG === 'en' || process.env.CLI_LANG === 'en' || process.argv.includes('--english-only');
|
|
223
|
+
console.error(chalk_1.default.red(`\nโ ${isEn ? 'Error creating project' : 'ํ๋ก์ ํธ ์์ฑ ์ค ์ค๋ฅ ๋ฐ์'}:`));
|
|
224
|
+
if (error instanceof Error) {
|
|
225
|
+
console.error(chalk_1.default.red(error.message));
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
console.error(error);
|
|
229
|
+
}
|
|
230
|
+
// Cleanup on error
|
|
231
|
+
if (!isDryRun && await fs.pathExists(projectPath)) {
|
|
232
|
+
console.log(chalk_1.default.yellow('\n๐งน Cleaning up...'));
|
|
233
|
+
await fs.remove(projectPath);
|
|
234
|
+
}
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
}
|
package/dist/doctor.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create-hua-ux - Doctor Command
|
|
3
|
+
*
|
|
4
|
+
* Diagnoses project health and provides solutions
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Diagnose project health
|
|
8
|
+
*/
|
|
9
|
+
export declare function diagnoseProject(projectPath: string): Promise<{
|
|
10
|
+
healthy: boolean;
|
|
11
|
+
issues: Array<{
|
|
12
|
+
type: 'error' | 'warning';
|
|
13
|
+
message: string;
|
|
14
|
+
solution?: string;
|
|
15
|
+
}>;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Run doctor command
|
|
19
|
+
*/
|
|
20
|
+
export declare function runDoctor(projectPath: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH;;GAEG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAClE,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClF,CAAC,CAgJD;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2DlE"}
|