@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/dist/doctor.js
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* create-hua-ux - Doctor Command
|
|
4
|
+
*
|
|
5
|
+
* Diagnoses project health and provides solutions
|
|
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.diagnoseProject = diagnoseProject;
|
|
45
|
+
exports.runDoctor = runDoctor;
|
|
46
|
+
const fs = __importStar(require("fs-extra"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
49
|
+
const child_process_1 = require("child_process");
|
|
50
|
+
const utils_1 = require("./utils");
|
|
51
|
+
/**
|
|
52
|
+
* Check if English-only mode is enabled
|
|
53
|
+
*/
|
|
54
|
+
function isEnglishOnly() {
|
|
55
|
+
return process.env.LANG === 'en' || process.env.CLI_LANG === 'en' || process.argv.includes('--english-only');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Diagnose project health
|
|
59
|
+
*/
|
|
60
|
+
async function diagnoseProject(projectPath) {
|
|
61
|
+
const isEn = isEnglishOnly();
|
|
62
|
+
const issues = [];
|
|
63
|
+
// Check if project directory exists
|
|
64
|
+
if (!(await fs.pathExists(projectPath))) {
|
|
65
|
+
return {
|
|
66
|
+
healthy: false,
|
|
67
|
+
issues: [{
|
|
68
|
+
type: 'error',
|
|
69
|
+
message: isEn
|
|
70
|
+
? `Project directory not found: ${projectPath}`
|
|
71
|
+
: `νλ‘μ νΈ λλ ν 리λ₯Ό μ°Ύμ μ μμ΅λλ€: ${projectPath}`,
|
|
72
|
+
solution: isEn
|
|
73
|
+
? 'Make sure you are in the correct directory or provide the correct path'
|
|
74
|
+
: 'μ¬λ°λ₯Έ λλ ν 리μ μλμ§ νμΈνκ±°λ μ¬λ°λ₯Έ κ²½λ‘λ₯Ό μ 곡νμΈμ',
|
|
75
|
+
}],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Check package.json
|
|
79
|
+
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
80
|
+
if (!(await fs.pathExists(packageJsonPath))) {
|
|
81
|
+
issues.push({
|
|
82
|
+
type: 'error',
|
|
83
|
+
message: isEn ? 'package.json not found' : 'package.jsonμ μ°Ύμ μ μμ΅λλ€',
|
|
84
|
+
solution: isEn
|
|
85
|
+
? 'This might not be a valid hua-ux project. Run create-hua-ux to initialize.'
|
|
86
|
+
: 'μ ν¨ν hua-ux νλ‘μ νΈκ° μλ μ μμ΅λλ€. create-hua-uxλ₯Ό μ€ννμ¬ μ΄κΈ°ννμΈμ.',
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
try {
|
|
91
|
+
const packageJson = await fs.readJSON(packageJsonPath);
|
|
92
|
+
// Check for hua-ux dependency
|
|
93
|
+
if (!packageJson.dependencies?.['@hua-labs/hua-ux']) {
|
|
94
|
+
issues.push({
|
|
95
|
+
type: 'error',
|
|
96
|
+
message: isEn ? '@hua-labs/hua-ux not found in dependencies' : 'μμ‘΄μ±μ @hua-labs/hua-uxκ° μμ΅λλ€',
|
|
97
|
+
solution: isEn
|
|
98
|
+
? 'Run: pnpm install @hua-labs/hua-ux'
|
|
99
|
+
: 'μ€ν: pnpm install @hua-labs/hua-ux',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
issues.push({
|
|
105
|
+
type: 'error',
|
|
106
|
+
message: isEn
|
|
107
|
+
? `Failed to parse package.json: ${error instanceof Error ? error.message : String(error)}`
|
|
108
|
+
: `package.json νμ± μ€ν¨: ${error instanceof Error ? error.message : String(error)}`,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Check hua-ux.config.ts
|
|
113
|
+
const configPath = path.join(projectPath, 'hua-ux.config.ts');
|
|
114
|
+
if (!(await fs.pathExists(configPath))) {
|
|
115
|
+
issues.push({
|
|
116
|
+
type: 'error',
|
|
117
|
+
message: isEn ? 'hua-ux.config.ts not found' : 'hua-ux.config.tsλ₯Ό μ°Ύμ μ μμ΅λλ€',
|
|
118
|
+
solution: isEn
|
|
119
|
+
? 'This file is required for hua-ux framework. Re-run create-hua-ux.'
|
|
120
|
+
: 'μ΄ νμΌμ hua-ux νλ μμν¬μ νμν©λλ€. create-hua-uxλ₯Ό λ€μ μ€ννμΈμ.',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// Check required directories
|
|
124
|
+
const requiredDirs = ['app', 'lib', 'store', 'translations'];
|
|
125
|
+
for (const dir of requiredDirs) {
|
|
126
|
+
const dirPath = path.join(projectPath, dir);
|
|
127
|
+
if (!(await fs.pathExists(dirPath))) {
|
|
128
|
+
issues.push({
|
|
129
|
+
type: 'warning',
|
|
130
|
+
message: isEn ? `Required directory missing: ${dir}` : `νμ λλ ν 리 λλ½: ${dir}`,
|
|
131
|
+
solution: isEn
|
|
132
|
+
? 'Re-run create-hua-ux to restore project structure'
|
|
133
|
+
: 'νλ‘μ νΈ κ΅¬μ‘°λ₯Ό 볡μνλ €λ©΄ create-hua-uxλ₯Ό λ€μ μ€ννμΈμ',
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Check translation files
|
|
138
|
+
try {
|
|
139
|
+
await (0, utils_1.validateTranslationFiles)(projectPath);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
issues.push({
|
|
143
|
+
type: 'error',
|
|
144
|
+
message: isEn
|
|
145
|
+
? `Translation files validation failed: ${error instanceof Error ? error.message : String(error)}`
|
|
146
|
+
: `λ²μ νμΌ κ²μ¦ μ€ν¨: ${error instanceof Error ? error.message : String(error)}`,
|
|
147
|
+
solution: isEn
|
|
148
|
+
? 'Check translations/ko/common.json and translations/en/common.json for JSON syntax errors'
|
|
149
|
+
: 'translations/ko/common.jsonκ³Ό translations/en/common.jsonμ JSON λ¬Έλ² μ€λ₯λ₯Ό νμΈνμΈμ',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// Check Node.js and pnpm
|
|
153
|
+
try {
|
|
154
|
+
const nodeVersion = process.version;
|
|
155
|
+
const requiredVersion = '18.0.0';
|
|
156
|
+
const parseVersion = (v) => {
|
|
157
|
+
return v.replace(/^v/, '').split('.').map(Number);
|
|
158
|
+
};
|
|
159
|
+
const compareVersions = (v1, v2) => {
|
|
160
|
+
const v1Parts = parseVersion(v1);
|
|
161
|
+
const v2Parts = parseVersion(v2);
|
|
162
|
+
for (let i = 0; i < 3; i++) {
|
|
163
|
+
if (v1Parts[i] > v2Parts[i])
|
|
164
|
+
return 1;
|
|
165
|
+
if (v1Parts[i] < v2Parts[i])
|
|
166
|
+
return -1;
|
|
167
|
+
}
|
|
168
|
+
return 0;
|
|
169
|
+
};
|
|
170
|
+
if (compareVersions(nodeVersion, requiredVersion) < 0) {
|
|
171
|
+
issues.push({
|
|
172
|
+
type: 'warning',
|
|
173
|
+
message: isEn
|
|
174
|
+
? `Node.js ${requiredVersion}+ recommended. Current: ${nodeVersion}`
|
|
175
|
+
: `Node.js ${requiredVersion}+ κΆμ₯. νμ¬: ${nodeVersion}`,
|
|
176
|
+
solution: isEn
|
|
177
|
+
? 'Update Node.js: https://nodejs.org/'
|
|
178
|
+
: 'Node.js μ
λ°μ΄νΈ: https://nodejs.org/',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
// Ignore
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
(0, child_process_1.execSync)('pnpm --version', { stdio: 'ignore' });
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
issues.push({
|
|
190
|
+
type: 'warning',
|
|
191
|
+
message: isEn ? 'pnpm not found' : 'pnpmμ μ°Ύμ μ μμ΅λλ€',
|
|
192
|
+
solution: isEn
|
|
193
|
+
? 'Install pnpm: npm install -g pnpm'
|
|
194
|
+
: 'pnpm μ€μΉ: npm install -g pnpm',
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
healthy: issues.filter(i => i.type === 'error').length === 0,
|
|
199
|
+
issues,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Run doctor command
|
|
204
|
+
*/
|
|
205
|
+
async function runDoctor(projectPath) {
|
|
206
|
+
const isEn = isEnglishOnly();
|
|
207
|
+
console.log(chalk_1.default.blue(`\nπ Diagnosing project: ${projectPath}\n`));
|
|
208
|
+
try {
|
|
209
|
+
// Check prerequisites
|
|
210
|
+
console.log(chalk_1.default.blue('π Checking prerequisites...'));
|
|
211
|
+
try {
|
|
212
|
+
await (0, utils_1.checkPrerequisites)();
|
|
213
|
+
console.log(chalk_1.default.green('β
Prerequisites OK'));
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
console.log(chalk_1.default.yellow('β οΈ Prerequisites check failed (non-critical)'));
|
|
217
|
+
}
|
|
218
|
+
// Diagnose project
|
|
219
|
+
console.log(chalk_1.default.blue('\n㪠Diagnosing project structure...'));
|
|
220
|
+
const diagnosis = await diagnoseProject(projectPath);
|
|
221
|
+
if (diagnosis.healthy && diagnosis.issues.length === 0) {
|
|
222
|
+
console.log(chalk_1.default.green('\nβ
Project is healthy! No issues found.'));
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
// Display issues
|
|
226
|
+
const errors = diagnosis.issues.filter(i => i.type === 'error');
|
|
227
|
+
const warnings = diagnosis.issues.filter(i => i.type === 'warning');
|
|
228
|
+
if (errors.length > 0) {
|
|
229
|
+
console.log(chalk_1.default.red(`\nβ Found ${errors.length} error(s):`));
|
|
230
|
+
errors.forEach((issue, index) => {
|
|
231
|
+
console.log(chalk_1.default.red(` ${index + 1}. ${issue.message}`));
|
|
232
|
+
if (issue.solution) {
|
|
233
|
+
console.log(chalk_1.default.yellow(` π‘ ${issue.solution}`));
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
if (warnings.length > 0) {
|
|
238
|
+
console.log(chalk_1.default.yellow(`\nβ οΈ Found ${warnings.length} warning(s):`));
|
|
239
|
+
warnings.forEach((issue, index) => {
|
|
240
|
+
console.log(chalk_1.default.yellow(` ${index + 1}. ${issue.message}`));
|
|
241
|
+
if (issue.solution) {
|
|
242
|
+
console.log(chalk_1.default.cyan(` π‘ ${issue.solution}`));
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (!diagnosis.healthy) {
|
|
247
|
+
console.log(chalk_1.default.red('\nβ Project has critical issues that need to be fixed.'));
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
console.log(chalk_1.default.yellow('\nβ οΈ Project has warnings but should work.'));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
console.error(chalk_1.default.red('\nβ Doctor command failed:'));
|
|
256
|
+
console.error(error);
|
|
257
|
+
process.exit(1);
|
|
258
|
+
}
|
|
259
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA4DjD,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAqF1C;AAGD,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* create-hua-ux - Main Logic
|
|
4
|
+
*
|
|
5
|
+
* Project creation logic
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.createProject = void 0;
|
|
42
|
+
exports.main = main;
|
|
43
|
+
const create_project_1 = require("./create-project");
|
|
44
|
+
Object.defineProperty(exports, "createProject", { enumerable: true, get: function () { return create_project_1.createProject; } });
|
|
45
|
+
const utils_1 = require("./utils");
|
|
46
|
+
/**
|
|
47
|
+
* Parse CLI arguments for AI context options and other flags
|
|
48
|
+
*/
|
|
49
|
+
function parseAiContextOptions() {
|
|
50
|
+
const args = process.argv.slice(2);
|
|
51
|
+
const flags = {
|
|
52
|
+
'--no-cursorrules': false,
|
|
53
|
+
'--no-ai-context': false,
|
|
54
|
+
'--no-claude-context': false,
|
|
55
|
+
'--claude-skills': false,
|
|
56
|
+
'--lang': 'both',
|
|
57
|
+
'--dry-run': false,
|
|
58
|
+
'--install': false,
|
|
59
|
+
};
|
|
60
|
+
// Simple flag parsing
|
|
61
|
+
if (args.includes('--no-cursorrules'))
|
|
62
|
+
flags['--no-cursorrules'] = true;
|
|
63
|
+
if (args.includes('--no-ai-context'))
|
|
64
|
+
flags['--no-ai-context'] = true;
|
|
65
|
+
if (args.includes('--no-claude-context'))
|
|
66
|
+
flags['--no-claude-context'] = true;
|
|
67
|
+
if (args.includes('--claude-skills'))
|
|
68
|
+
flags['--claude-skills'] = true;
|
|
69
|
+
if (args.includes('--dry-run'))
|
|
70
|
+
flags['--dry-run'] = true;
|
|
71
|
+
if (args.includes('--install'))
|
|
72
|
+
flags['--install'] = true;
|
|
73
|
+
const langIndex = args.indexOf('--lang');
|
|
74
|
+
if (langIndex !== -1 && args[langIndex + 1]) {
|
|
75
|
+
const lang = args[langIndex + 1];
|
|
76
|
+
if (['ko', 'en', 'both'].includes(lang)) {
|
|
77
|
+
flags['--lang'] = lang;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const result = {};
|
|
81
|
+
// If any flags are set, return parsed options
|
|
82
|
+
if (args.some(arg => arg.startsWith('--'))) {
|
|
83
|
+
result.options = {
|
|
84
|
+
cursorrules: !flags['--no-cursorrules'],
|
|
85
|
+
aiContext: !flags['--no-ai-context'],
|
|
86
|
+
claudeContext: !flags['--no-claude-context'],
|
|
87
|
+
claudeSkills: flags['--claude-skills'],
|
|
88
|
+
language: flags['--lang'],
|
|
89
|
+
};
|
|
90
|
+
result.dryRun = flags['--dry-run'];
|
|
91
|
+
result.install = flags['--install'];
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
async function main() {
|
|
96
|
+
// Check for doctor command
|
|
97
|
+
const args = process.argv.slice(2);
|
|
98
|
+
if (args[0] === 'doctor') {
|
|
99
|
+
const { runDoctor } = await Promise.resolve().then(() => __importStar(require('./doctor')));
|
|
100
|
+
const projectPath = args[1] || process.cwd();
|
|
101
|
+
await runDoctor(projectPath);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Get project name from args (first non-flag argument)
|
|
105
|
+
const projectName = args.find(arg => !arg.startsWith('--'));
|
|
106
|
+
if (!projectName) {
|
|
107
|
+
try {
|
|
108
|
+
const name = await (0, utils_1.promptProjectName)();
|
|
109
|
+
if (!name) {
|
|
110
|
+
const isEn = process.env.LANG === 'en' || process.env.CLI_LANG === 'en' || process.argv.includes('--english-only');
|
|
111
|
+
console.error(isEn ? 'Project name is required' : 'Project name is required / νλ‘μ νΈ μ΄λ¦μ΄ νμν©λλ€');
|
|
112
|
+
console.error('Usage: npx tsx src/index.ts <project-name> [--claude-skills] [--lang ko|en|both] [--dry-run] [--install] [--english-only]');
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
// AI context generation options
|
|
116
|
+
const aiContextOptions = await (0, utils_1.promptAiContextOptions)();
|
|
117
|
+
const parsed = parseAiContextOptions();
|
|
118
|
+
await (0, create_project_1.createProject)(name, aiContextOptions, {
|
|
119
|
+
dryRun: parsed.dryRun,
|
|
120
|
+
skipPrerequisites: parsed.dryRun, // Skip prerequisites in dry-run
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
const isEn = process.env.LANG === 'en' || process.env.CLI_LANG === 'en' || process.argv.includes('--english-only');
|
|
126
|
+
console.error(isEn ? 'Project name is required' : 'Project name is required / νλ‘μ νΈ μ΄λ¦μ΄ νμν©λλ€');
|
|
127
|
+
console.error('Usage: npx tsx src/index.ts <project-name> [--claude-skills] [--lang ko|en|both] [--dry-run] [--install] [--english-only]');
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Parse CLI options or prompt
|
|
132
|
+
const parsed = parseAiContextOptions();
|
|
133
|
+
let aiContextOptions;
|
|
134
|
+
if (parsed.options) {
|
|
135
|
+
// Use CLI options if provided
|
|
136
|
+
aiContextOptions = parsed.options;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// Try to prompt, fallback to defaults if not interactive
|
|
140
|
+
try {
|
|
141
|
+
aiContextOptions = await (0, utils_1.promptAiContextOptions)();
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
console.warn('Failed to get interactive options, using defaults');
|
|
145
|
+
aiContextOptions = {
|
|
146
|
+
cursorrules: true,
|
|
147
|
+
aiContext: true,
|
|
148
|
+
claudeContext: true,
|
|
149
|
+
claudeSkills: false,
|
|
150
|
+
language: 'both',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
await (0, create_project_1.createProject)(projectName, aiContextOptions, {
|
|
155
|
+
dryRun: parsed.dryRun,
|
|
156
|
+
skipPrerequisites: parsed.dryRun,
|
|
157
|
+
});
|
|
158
|
+
// Auto-install if --install flag is set
|
|
159
|
+
if (parsed.install && !parsed.dryRun) {
|
|
160
|
+
const { execSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
|
|
161
|
+
const { resolveProjectPath } = await Promise.resolve().then(() => __importStar(require('./create-project')));
|
|
162
|
+
const projectPath = resolveProjectPath(projectName);
|
|
163
|
+
const chalk = (await Promise.resolve().then(() => __importStar(require('chalk')))).default;
|
|
164
|
+
console.log(chalk.blue('\nπ¦ Installing dependencies...'));
|
|
165
|
+
try {
|
|
166
|
+
execSync('pnpm install', {
|
|
167
|
+
cwd: projectPath,
|
|
168
|
+
stdio: 'inherit',
|
|
169
|
+
});
|
|
170
|
+
console.log(chalk.green('β
Dependencies installed'));
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
console.error(chalk.red('β Failed to install dependencies'));
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create-hua-ux - Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utility functions for project creation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* AI context generation options
|
|
8
|
+
*/
|
|
9
|
+
export interface AiContextOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Generate .cursorrules file
|
|
12
|
+
*/
|
|
13
|
+
cursorrules: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Generate ai-context.md file
|
|
16
|
+
*/
|
|
17
|
+
aiContext: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Generate .claude/project-context.md file
|
|
20
|
+
*/
|
|
21
|
+
claudeContext: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Generate .claude/skills/ files
|
|
24
|
+
*/
|
|
25
|
+
claudeSkills: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Language for documentation (ko, en, both)
|
|
28
|
+
*/
|
|
29
|
+
language: 'ko' | 'en' | 'both';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Prompt for project name
|
|
33
|
+
*/
|
|
34
|
+
export declare function promptProjectName(): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Prompt for AI context generation options
|
|
37
|
+
*/
|
|
38
|
+
export declare function promptAiContextOptions(): Promise<AiContextOptions>;
|
|
39
|
+
/**
|
|
40
|
+
* Copy template files to project directory
|
|
41
|
+
*
|
|
42
|
+
* @param projectPath - Target project directory
|
|
43
|
+
* @param options - Copy options
|
|
44
|
+
* @param options.skipAiContext - Skip AI context files (.cursorrules, ai-context.md, .claude/)
|
|
45
|
+
*/
|
|
46
|
+
export declare function copyTemplate(projectPath: string, options?: {
|
|
47
|
+
skipAiContext?: boolean;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Generate package.json
|
|
51
|
+
*/
|
|
52
|
+
export declare function generatePackageJson(projectPath: string, projectName: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Generate hua-ux.config.ts
|
|
55
|
+
*/
|
|
56
|
+
export declare function generateConfig(projectPath: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Generate AI context files
|
|
59
|
+
*
|
|
60
|
+
* Cursor, Claude λ± λ€μν AI λꡬλ₯Ό μν 컨ν
μ€νΈ νμΌ μμ±
|
|
61
|
+
* ν
νλ¦Ώ νμΌμ 볡μ¬ν ν νλ‘μ νΈλ³ μ 보λ₯Ό λμ μΌλ‘ μΆκ°ν©λλ€.
|
|
62
|
+
*/
|
|
63
|
+
export declare function generateAiContextFiles(projectPath: string, projectName?: string, options?: AiContextOptions): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Check prerequisites before project creation
|
|
66
|
+
*
|
|
67
|
+
* Verifies Node.js version, pnpm installation, and template integrity
|
|
68
|
+
*/
|
|
69
|
+
export declare function checkPrerequisites(): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Validate template files integrity
|
|
72
|
+
*
|
|
73
|
+
* Checks if all required template files exist before project creation
|
|
74
|
+
*/
|
|
75
|
+
export declare function validateTemplate(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Validate generated project
|
|
78
|
+
*
|
|
79
|
+
* νλ‘μ νΈ μμ± ν νμ νμΌκ³Ό μ€μ μ΄ μ¬λ°λ₯΄κ² μμ±λμλμ§ κ²μ¦
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateGeneratedProject(projectPath: string): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Validate translation files JSON syntax
|
|
84
|
+
*/
|
|
85
|
+
export declare function validateTranslationFiles(projectPath: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Generate installation summary
|
|
88
|
+
*/
|
|
89
|
+
export declare function generateSummary(projectPath: string, aiContextOptions?: AiContextOptions): Promise<{
|
|
90
|
+
directories: number;
|
|
91
|
+
files: number;
|
|
92
|
+
aiContextFiles: string[];
|
|
93
|
+
languages: string[];
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Display installation summary
|
|
97
|
+
*/
|
|
98
|
+
export declare function displaySummary(summary: {
|
|
99
|
+
directories: number;
|
|
100
|
+
files: number;
|
|
101
|
+
aiContextFiles: string[];
|
|
102
|
+
languages: string[];
|
|
103
|
+
}): void;
|
|
104
|
+
/**
|
|
105
|
+
* Display next steps with customized guidance
|
|
106
|
+
*/
|
|
107
|
+
export declare function displayNextSteps(projectPath: string, aiContextOptions?: AiContextOptions): void;
|
|
108
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4BH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;CAChC;AAiCD;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAqBzD;AAoCD;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CA2ExE;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAqBf;AAuFD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAyCf;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiHvE;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAiHf;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAqExD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CA0CtD;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoEjF;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCjF;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,gBAAgB,GAClC,OAAO,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC,CAqDD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,IAAI,CAgBP;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,gBAAgB,GAClC,IAAI,CA2BN"}
|