create-nexo 1.0.0
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 +185 -0
- package/dist/api/index.d.ts +196 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +390 -0
- package/dist/api/index.js.map +1 -0
- package/dist/bin/nexo.d.ts +3 -0
- package/dist/bin/nexo.d.ts.map +1 -0
- package/dist/bin/nexo.js +427 -0
- package/dist/bin/nexo.js.map +1 -0
- package/dist/configurators/core/framework.d.ts +3 -0
- package/dist/configurators/core/framework.d.ts.map +1 -0
- package/dist/configurators/core/framework.js +56 -0
- package/dist/configurators/core/framework.js.map +1 -0
- package/dist/configurators/core/index.d.ts +4 -0
- package/dist/configurators/core/index.d.ts.map +1 -0
- package/dist/configurators/core/index.js +4 -0
- package/dist/configurators/core/index.js.map +1 -0
- package/dist/configurators/core/language.d.ts +3 -0
- package/dist/configurators/core/language.d.ts.map +1 -0
- package/dist/configurators/core/language.js +59 -0
- package/dist/configurators/core/language.js.map +1 -0
- package/dist/configurators/core/variant.d.ts +3 -0
- package/dist/configurators/core/variant.d.ts.map +1 -0
- package/dist/configurators/core/variant.js +22 -0
- package/dist/configurators/core/variant.js.map +1 -0
- package/dist/configurators/index.d.ts +5 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +6 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/project/auth.d.ts +3 -0
- package/dist/configurators/project/auth.d.ts.map +1 -0
- package/dist/configurators/project/auth.js +82 -0
- package/dist/configurators/project/auth.js.map +1 -0
- package/dist/configurators/project/cicd.d.ts +30 -0
- package/dist/configurators/project/cicd.d.ts.map +1 -0
- package/dist/configurators/project/cicd.js +289 -0
- package/dist/configurators/project/cicd.js.map +1 -0
- package/dist/configurators/project/i18n.d.ts +3 -0
- package/dist/configurators/project/i18n.d.ts.map +1 -0
- package/dist/configurators/project/i18n.js +67 -0
- package/dist/configurators/project/i18n.js.map +1 -0
- package/dist/configurators/project/index.d.ts +6 -0
- package/dist/configurators/project/index.d.ts.map +1 -0
- package/dist/configurators/project/index.js +6 -0
- package/dist/configurators/project/index.js.map +1 -0
- package/dist/configurators/project/mandatory.d.ts +3 -0
- package/dist/configurators/project/mandatory.d.ts.map +1 -0
- package/dist/configurators/project/mandatory.js +167 -0
- package/dist/configurators/project/mandatory.js.map +1 -0
- package/dist/configurators/project/structure.d.ts +3 -0
- package/dist/configurators/project/structure.d.ts.map +1 -0
- package/dist/configurators/project/structure.js +34 -0
- package/dist/configurators/project/structure.js.map +1 -0
- package/dist/configurators/state/dataFetching.d.ts +3 -0
- package/dist/configurators/state/dataFetching.d.ts.map +1 -0
- package/dist/configurators/state/dataFetching.js +23 -0
- package/dist/configurators/state/dataFetching.js.map +1 -0
- package/dist/configurators/state/forms.d.ts +3 -0
- package/dist/configurators/state/forms.d.ts.map +1 -0
- package/dist/configurators/state/forms.js +35 -0
- package/dist/configurators/state/forms.js.map +1 -0
- package/dist/configurators/state/index.d.ts +5 -0
- package/dist/configurators/state/index.d.ts.map +1 -0
- package/dist/configurators/state/index.js +5 -0
- package/dist/configurators/state/index.js.map +1 -0
- package/dist/configurators/state/routing.d.ts +3 -0
- package/dist/configurators/state/routing.d.ts.map +1 -0
- package/dist/configurators/state/routing.js +23 -0
- package/dist/configurators/state/routing.js.map +1 -0
- package/dist/configurators/state/state.d.ts +3 -0
- package/dist/configurators/state/state.d.ts.map +1 -0
- package/dist/configurators/state/state.js +91 -0
- package/dist/configurators/state/state.js.map +1 -0
- package/dist/configurators/styling/icons.d.ts +3 -0
- package/dist/configurators/styling/icons.d.ts.map +1 -0
- package/dist/configurators/styling/icons.js +27 -0
- package/dist/configurators/styling/icons.js.map +1 -0
- package/dist/configurators/styling/index.d.ts +4 -0
- package/dist/configurators/styling/index.d.ts.map +1 -0
- package/dist/configurators/styling/index.js +4 -0
- package/dist/configurators/styling/index.js.map +1 -0
- package/dist/configurators/styling/styling.d.ts +3 -0
- package/dist/configurators/styling/styling.d.ts.map +1 -0
- package/dist/configurators/styling/styling.js +62 -0
- package/dist/configurators/styling/styling.js.map +1 -0
- package/dist/configurators/styling/ui.d.ts +3 -0
- package/dist/configurators/styling/ui.d.ts.map +1 -0
- package/dist/configurators/styling/ui.js +188 -0
- package/dist/configurators/styling/ui.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +7 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/lazy-loader.d.ts +57 -0
- package/dist/core/lazy-loader.d.ts.map +1 -0
- package/dist/core/lazy-loader.js +231 -0
- package/dist/core/lazy-loader.js.map +1 -0
- package/dist/core/parallel.d.ts +29 -0
- package/dist/core/parallel.d.ts.map +1 -0
- package/dist/core/parallel.js +127 -0
- package/dist/core/parallel.js.map +1 -0
- package/dist/core/presets.d.ts +10 -0
- package/dist/core/presets.d.ts.map +1 -0
- package/dist/core/presets.js +73 -0
- package/dist/core/presets.js.map +1 -0
- package/dist/core/prompts/core.d.ts +18 -0
- package/dist/core/prompts/core.d.ts.map +1 -0
- package/dist/core/prompts/core.js +420 -0
- package/dist/core/prompts/core.js.map +1 -0
- package/dist/core/prompts/filter.d.ts +34 -0
- package/dist/core/prompts/filter.d.ts.map +1 -0
- package/dist/core/prompts/filter.js +48 -0
- package/dist/core/prompts/filter.js.map +1 -0
- package/dist/core/prompts/index.d.ts +10 -0
- package/dist/core/prompts/index.d.ts.map +1 -0
- package/dist/core/prompts/index.js +16 -0
- package/dist/core/prompts/index.js.map +1 -0
- package/dist/core/prompts/optional.d.ts +15 -0
- package/dist/core/prompts/optional.d.ts.map +1 -0
- package/dist/core/prompts/optional.js +228 -0
- package/dist/core/prompts/optional.js.map +1 -0
- package/dist/core/prompts/utils.d.ts +37 -0
- package/dist/core/prompts/utils.d.ts.map +1 -0
- package/dist/core/prompts/utils.js +72 -0
- package/dist/core/prompts/utils.js.map +1 -0
- package/dist/core/prompts.d.ts +6 -0
- package/dist/core/prompts.d.ts.map +1 -0
- package/dist/core/prompts.js +6 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/setup.d.ts +28 -0
- package/dist/core/setup.d.ts.map +1 -0
- package/dist/core/setup.js +96 -0
- package/dist/core/setup.js.map +1 -0
- package/dist/core/wizard.d.ts +39 -0
- package/dist/core/wizard.d.ts.map +1 -0
- package/dist/core/wizard.js +259 -0
- package/dist/core/wizard.js.map +1 -0
- package/dist/errors/index.d.ts +67 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +253 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/messages.d.ts +56 -0
- package/dist/errors/messages.d.ts.map +1 -0
- package/dist/errors/messages.js +234 -0
- package/dist/errors/messages.js.map +1 -0
- package/dist/generators/index.d.ts +86 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +441 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/index.d.ts +48 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +49 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +38 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +229 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manager.d.ts +32 -0
- package/dist/plugins/manager.d.ts.map +1 -0
- package/dist/plugins/manager.js +220 -0
- package/dist/plugins/manager.js.map +1 -0
- package/dist/plugins/types.d.ts +186 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +5 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/security/index.d.ts +59 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +230 -0
- package/dist/security/index.js.map +1 -0
- package/dist/templates/entry.d.ts +9 -0
- package/dist/templates/entry.d.ts.map +1 -0
- package/dist/templates/entry.js +24 -0
- package/dist/templates/entry.js.map +1 -0
- package/dist/templates/index.d.ts +7 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +10 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/main.d.ts +6 -0
- package/dist/templates/main.d.ts.map +1 -0
- package/dist/templates/main.js +72 -0
- package/dist/templates/main.js.map +1 -0
- package/dist/templates/readme.d.ts +3 -0
- package/dist/templates/readme.d.ts.map +1 -0
- package/dist/templates/readme.js +127 -0
- package/dist/templates/readme.js.map +1 -0
- package/dist/templates/styles.d.ts +6 -0
- package/dist/templates/styles.d.ts.map +1 -0
- package/dist/templates/styles.js +212 -0
- package/dist/templates/styles.js.map +1 -0
- package/dist/templates/welcome.d.ts +10 -0
- package/dist/templates/welcome.d.ts.map +1 -0
- package/dist/templates/welcome.js +322 -0
- package/dist/templates/welcome.js.map +1 -0
- package/dist/types/index.d.ts +46 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/batch-writer.d.ts +101 -0
- package/dist/utils/batch-writer.d.ts.map +1 -0
- package/dist/utils/batch-writer.js +232 -0
- package/dist/utils/batch-writer.js.map +1 -0
- package/dist/utils/cache.d.ts +60 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +119 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/fileTree.d.ts +3 -0
- package/dist/utils/fileTree.d.ts.map +1 -0
- package/dist/utils/fileTree.js +71 -0
- package/dist/utils/fileTree.js.map +1 -0
- package/dist/utils/fs.d.ts +22 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +75 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/helpers.d.ts +91 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +192 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/progress.d.ts +85 -0
- package/dist/utils/progress.d.ts.map +1 -0
- package/dist/utils/progress.js +142 -0
- package/dist/utils/progress.js.map +1 -0
- package/dist/utils/spinner.d.ts +9 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +56 -0
- package/dist/utils/spinner.js.map +1 -0
- package/dist/validation/index.d.ts +63 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +262 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import pc from 'picocolors';
|
|
2
|
+
// ============================================
|
|
3
|
+
// NEXO Error Classes
|
|
4
|
+
// ============================================
|
|
5
|
+
/**
|
|
6
|
+
* Base error class for all NEXO errors
|
|
7
|
+
*/
|
|
8
|
+
export class NexoError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
context;
|
|
11
|
+
constructor(message, code, context) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.context = context;
|
|
15
|
+
this.name = 'NexoError';
|
|
16
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validation errors - invalid user input or selections
|
|
21
|
+
*/
|
|
22
|
+
export class ValidationError extends NexoError {
|
|
23
|
+
constructor(message, context) {
|
|
24
|
+
super(message, 'VALIDATION_ERROR', context);
|
|
25
|
+
this.name = 'ValidationError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* File system errors - file operations failed
|
|
30
|
+
*/
|
|
31
|
+
export class FileSystemError extends NexoError {
|
|
32
|
+
constructor(message, filePath, originalError) {
|
|
33
|
+
super(message, 'FS_ERROR', {
|
|
34
|
+
path: filePath,
|
|
35
|
+
originalError: originalError?.message
|
|
36
|
+
});
|
|
37
|
+
this.name = 'FileSystemError';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Configurator errors - configuration step failed
|
|
42
|
+
*/
|
|
43
|
+
export class ConfiguratorError extends NexoError {
|
|
44
|
+
constructor(configuratorName, message, originalError) {
|
|
45
|
+
super(message, 'CONFIGURATOR_ERROR', {
|
|
46
|
+
configurator: configuratorName,
|
|
47
|
+
originalError: originalError?.message
|
|
48
|
+
});
|
|
49
|
+
this.name = 'ConfiguratorError';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Dependency errors - package installation/resolution failed
|
|
54
|
+
*/
|
|
55
|
+
export class DependencyError extends NexoError {
|
|
56
|
+
constructor(dependency, message) {
|
|
57
|
+
super(message, 'DEPENDENCY_ERROR', { dependency });
|
|
58
|
+
this.name = 'DependencyError';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compatibility errors - incompatible selections
|
|
63
|
+
*/
|
|
64
|
+
export class CompatibilityError extends NexoError {
|
|
65
|
+
constructor(message, selections) {
|
|
66
|
+
super(message, 'COMPATIBILITY_ERROR', { selections });
|
|
67
|
+
this.name = 'CompatibilityError';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Security errors - security violation detected
|
|
72
|
+
*/
|
|
73
|
+
export class SecurityError extends NexoError {
|
|
74
|
+
constructor(message, context) {
|
|
75
|
+
super(message, 'SECURITY_ERROR', context);
|
|
76
|
+
this.name = 'SecurityError';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const errorMessages = {
|
|
80
|
+
ENOENT: {
|
|
81
|
+
title: 'File not found',
|
|
82
|
+
description: 'The specified file or directory does not exist.',
|
|
83
|
+
suggestions: [
|
|
84
|
+
'Check if the path is correct',
|
|
85
|
+
'Ensure you have the necessary permissions',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
EACCES: {
|
|
89
|
+
title: 'Permission denied',
|
|
90
|
+
description: 'You do not have permission to access this file.',
|
|
91
|
+
suggestions: [
|
|
92
|
+
'Try running with administrator/sudo privileges',
|
|
93
|
+
'Check file permissions',
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
EEXIST: {
|
|
97
|
+
title: 'Directory already exists',
|
|
98
|
+
description: (ctx) => `A directory named "${ctx.projectName || 'unknown'}" already exists.`,
|
|
99
|
+
suggestions: [
|
|
100
|
+
'Choose a different project name',
|
|
101
|
+
'Delete the existing directory first',
|
|
102
|
+
'Use --force to overwrite',
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
VALIDATION_ERROR: {
|
|
106
|
+
title: 'Validation Error',
|
|
107
|
+
description: 'The provided input is invalid.',
|
|
108
|
+
suggestions: [
|
|
109
|
+
'Check your input values',
|
|
110
|
+
'Run with --help to see available options',
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
COMPATIBILITY_ERROR: {
|
|
114
|
+
title: 'Compatibility Error',
|
|
115
|
+
description: 'The selected options are not compatible with each other.',
|
|
116
|
+
suggestions: [
|
|
117
|
+
'Review your selections',
|
|
118
|
+
'Check the documentation for compatible options',
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
FS_ERROR: {
|
|
122
|
+
title: 'File System Error',
|
|
123
|
+
description: 'An error occurred while performing file operations.',
|
|
124
|
+
suggestions: [
|
|
125
|
+
'Check disk space',
|
|
126
|
+
'Ensure you have write permissions',
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
CONFIGURATOR_ERROR: {
|
|
130
|
+
title: 'Configuration Error',
|
|
131
|
+
description: 'An error occurred during project configuration.',
|
|
132
|
+
suggestions: [
|
|
133
|
+
'Try running the command again',
|
|
134
|
+
'Check if all dependencies are available',
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
SECURITY_ERROR: {
|
|
138
|
+
title: 'Security Error',
|
|
139
|
+
description: 'A security violation was detected.',
|
|
140
|
+
suggestions: [
|
|
141
|
+
'Check the target path',
|
|
142
|
+
'Ensure input values are safe',
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
// ============================================
|
|
147
|
+
// Error Formatting & Handling
|
|
148
|
+
// ============================================
|
|
149
|
+
/**
|
|
150
|
+
* Format and display an error with helpful information
|
|
151
|
+
*/
|
|
152
|
+
export const formatError = (error, context) => {
|
|
153
|
+
console.log();
|
|
154
|
+
if (error instanceof NexoError) {
|
|
155
|
+
const info = errorMessages[error.code] || {
|
|
156
|
+
title: error.name,
|
|
157
|
+
description: error.message,
|
|
158
|
+
};
|
|
159
|
+
// Title
|
|
160
|
+
console.log(pc.bgRed(pc.white(pc.bold(` ${info.title} `))));
|
|
161
|
+
console.log();
|
|
162
|
+
// Description
|
|
163
|
+
const description = typeof info.description === 'function'
|
|
164
|
+
? info.description({ ...error.context, ...context })
|
|
165
|
+
: info.description;
|
|
166
|
+
console.log(pc.red(description));
|
|
167
|
+
// Context details
|
|
168
|
+
if (error.context && Object.keys(error.context).length > 0) {
|
|
169
|
+
console.log();
|
|
170
|
+
console.log(pc.dim('Details:'));
|
|
171
|
+
Object.entries(error.context).forEach(([key, value]) => {
|
|
172
|
+
if (value !== undefined) {
|
|
173
|
+
console.log(pc.dim(` ${key}: ${value}`));
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
// Suggestions
|
|
178
|
+
if (info.suggestions && info.suggestions.length > 0) {
|
|
179
|
+
console.log();
|
|
180
|
+
console.log(pc.yellow('Suggestions:'));
|
|
181
|
+
info.suggestions.forEach((s) => console.log(pc.dim(` • ${s}`)));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else if (error instanceof Error) {
|
|
185
|
+
// Handle standard errors
|
|
186
|
+
const nodeError = error;
|
|
187
|
+
const info = errorMessages[nodeError.code || ''] || {
|
|
188
|
+
title: 'Unexpected Error',
|
|
189
|
+
description: error.message,
|
|
190
|
+
};
|
|
191
|
+
console.log(pc.bgRed(pc.white(pc.bold(` ${info.title} `))));
|
|
192
|
+
console.log();
|
|
193
|
+
console.log(pc.red(typeof info.description === 'function'
|
|
194
|
+
? info.description(context || {})
|
|
195
|
+
: info.description));
|
|
196
|
+
if (info.suggestions) {
|
|
197
|
+
console.log();
|
|
198
|
+
console.log(pc.yellow('Suggestions:'));
|
|
199
|
+
info.suggestions.forEach((s) => console.log(pc.dim(` • ${s}`)));
|
|
200
|
+
}
|
|
201
|
+
// Show stack trace in debug mode
|
|
202
|
+
if (process.env.DEBUG) {
|
|
203
|
+
console.log();
|
|
204
|
+
console.log(pc.dim('Stack trace:'));
|
|
205
|
+
console.log(pc.dim(error.stack || 'No stack trace available'));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
// Unknown error type
|
|
210
|
+
console.log(pc.bgRed(pc.white(pc.bold(' Unknown Error '))));
|
|
211
|
+
console.log();
|
|
212
|
+
console.log(pc.red('An unexpected error occurred'));
|
|
213
|
+
console.log(pc.dim(String(error)));
|
|
214
|
+
}
|
|
215
|
+
console.log();
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Global error handler - use at CLI entry point
|
|
219
|
+
*/
|
|
220
|
+
export const handleError = (error, context) => {
|
|
221
|
+
formatError(error, context);
|
|
222
|
+
process.exit(1);
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Wrap an async function with error handling
|
|
226
|
+
*/
|
|
227
|
+
export const withErrorHandling = (fn, errorContext) => {
|
|
228
|
+
return async (...args) => {
|
|
229
|
+
try {
|
|
230
|
+
return await fn(...args);
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
// handleError calls process.exit(1), so this never returns
|
|
234
|
+
return handleError(error, errorContext);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
export const tryExecute = async (fn, errorClass = NexoError, ...errorArgs) => {
|
|
239
|
+
try {
|
|
240
|
+
const data = await fn();
|
|
241
|
+
return { success: true, data };
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
245
|
+
return {
|
|
246
|
+
success: false,
|
|
247
|
+
error: new errorClass(message, ...errorArgs),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
// Re-export messages module
|
|
252
|
+
export * from './messages.js';
|
|
253
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,+CAA+C;AAC/C,qBAAqB;AACrB,+CAA+C;AAE/C;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAGzB;IACA;IAHT,YACE,OAAe,EACR,IAAY,EACZ,OAAiC;QAExC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAA0B;QAGxC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,YAAY,OAAe,EAAE,QAAgB,EAAE,aAAqB;QAClE,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE;YACzB,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,aAAa,EAA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AAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,2DAA2D;YAC3D,OAAO,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAWF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,EAAoB,EACpB,aAAqE,SAAmE,EACxI,GAAG,SAAoB,EACH,EAAE;IACtB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,EAAE,CAAC;QACxB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI,UAAU,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC;SAC7C,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,4BAA4B;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXO CLI - Error Messages
|
|
3
|
+
*
|
|
4
|
+
* User-friendly error messages with suggestions and context.
|
|
5
|
+
*/
|
|
6
|
+
export interface ErrorMessage {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string | ((context?: Record<string, unknown>) => string);
|
|
9
|
+
suggestions?: string[];
|
|
10
|
+
docs?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FormattedError {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
suggestions: string[];
|
|
16
|
+
docs?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const errorMessages: Record<string, ErrorMessage>;
|
|
19
|
+
/**
|
|
20
|
+
* Get error message info by code
|
|
21
|
+
*/
|
|
22
|
+
export declare const getErrorMessage: (code: string, context?: Record<string, unknown>) => FormattedError;
|
|
23
|
+
/**
|
|
24
|
+
* Format error for console output
|
|
25
|
+
*/
|
|
26
|
+
export declare const formatErrorMessage: (code: string, context?: Record<string, unknown>) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Print formatted error to console
|
|
29
|
+
*/
|
|
30
|
+
export declare const printError: (code: string, context?: Record<string, unknown>) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Get error code from Error object
|
|
33
|
+
*/
|
|
34
|
+
export declare const getErrorCode: (error: Error & {
|
|
35
|
+
code?: string;
|
|
36
|
+
}) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Handle and print an error
|
|
39
|
+
*/
|
|
40
|
+
export declare const handleErrorWithMessage: (error: Error & {
|
|
41
|
+
code?: string;
|
|
42
|
+
}, context?: Record<string, unknown>) => void;
|
|
43
|
+
declare const _default: {
|
|
44
|
+
errorMessages: Record<string, ErrorMessage>;
|
|
45
|
+
getErrorMessage: (code: string, context?: Record<string, unknown>) => FormattedError;
|
|
46
|
+
formatErrorMessage: (code: string, context?: Record<string, unknown>) => string;
|
|
47
|
+
printError: (code: string, context?: Record<string, unknown>) => void;
|
|
48
|
+
getErrorCode: (error: Error & {
|
|
49
|
+
code?: string;
|
|
50
|
+
}) => string;
|
|
51
|
+
handleErrorWithMessage: (error: Error & {
|
|
52
|
+
code?: string;
|
|
53
|
+
}, context?: Record<string, unknown>) => void;
|
|
54
|
+
};
|
|
55
|
+
export default _default;
|
|
56
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/errors/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OA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G;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,MAAM;oCA4B7D,KAAK,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,YACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,IAAI;;AAWP,wBAOE"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXO CLI - Error Messages
|
|
3
|
+
*
|
|
4
|
+
* User-friendly error messages with suggestions and context.
|
|
5
|
+
*/
|
|
6
|
+
import pc from 'picocolors';
|
|
7
|
+
// ============================================
|
|
8
|
+
// Error Message Registry
|
|
9
|
+
// ============================================
|
|
10
|
+
export const errorMessages = {
|
|
11
|
+
// File System Errors
|
|
12
|
+
ENOENT: {
|
|
13
|
+
title: 'File not found',
|
|
14
|
+
description: 'The specified file or directory does not exist.',
|
|
15
|
+
suggestions: [
|
|
16
|
+
'Check if the path is correct',
|
|
17
|
+
'Ensure you have the necessary permissions',
|
|
18
|
+
'Make sure the file hasn\'t been moved or deleted',
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
EACCES: {
|
|
22
|
+
title: 'Permission denied',
|
|
23
|
+
description: 'You do not have permission to access this file or directory.',
|
|
24
|
+
suggestions: [
|
|
25
|
+
'Try running with administrator/sudo privileges',
|
|
26
|
+
'Check file and directory permissions',
|
|
27
|
+
'Ensure the path is not read-only',
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
EEXIST: {
|
|
31
|
+
title: 'Directory already exists',
|
|
32
|
+
description: (ctx) => `A directory named "${ctx?.projectName || 'the specified name'}" already exists.`,
|
|
33
|
+
suggestions: [
|
|
34
|
+
'Choose a different project name',
|
|
35
|
+
'Delete the existing directory first',
|
|
36
|
+
'Use --force to overwrite (use with caution)',
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
ENOSPC: {
|
|
40
|
+
title: 'No space left on device',
|
|
41
|
+
description: 'There is not enough disk space to complete this operation.',
|
|
42
|
+
suggestions: [
|
|
43
|
+
'Free up disk space',
|
|
44
|
+
'Try a different drive or directory',
|
|
45
|
+
'Check for large temporary files',
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
EMFILE: {
|
|
49
|
+
title: 'Too many open files',
|
|
50
|
+
description: 'The system limit for open files has been reached.',
|
|
51
|
+
suggestions: [
|
|
52
|
+
'Close some applications',
|
|
53
|
+
'Increase the file descriptor limit (ulimit -n)',
|
|
54
|
+
'Restart your terminal',
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
// Network Errors
|
|
58
|
+
ENOTFOUND: {
|
|
59
|
+
title: 'Network error',
|
|
60
|
+
description: 'Could not connect to the server. DNS lookup failed.',
|
|
61
|
+
suggestions: [
|
|
62
|
+
'Check your internet connection',
|
|
63
|
+
'Verify the server address is correct',
|
|
64
|
+
'Try again later',
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
ECONNREFUSED: {
|
|
68
|
+
title: 'Connection refused',
|
|
69
|
+
description: 'The server refused the connection.',
|
|
70
|
+
suggestions: [
|
|
71
|
+
'Check if the server is running',
|
|
72
|
+
'Verify the port number is correct',
|
|
73
|
+
'Check firewall settings',
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
ETIMEDOUT: {
|
|
77
|
+
title: 'Connection timed out',
|
|
78
|
+
description: 'The connection took too long to establish.',
|
|
79
|
+
suggestions: [
|
|
80
|
+
'Check your internet connection',
|
|
81
|
+
'Try again later',
|
|
82
|
+
'Increase timeout settings if possible',
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
// Validation Errors
|
|
86
|
+
INVALID_PROJECT_NAME: {
|
|
87
|
+
title: 'Invalid project name',
|
|
88
|
+
description: (ctx) => `"${ctx?.name || 'The project name'}" is not a valid project name.`,
|
|
89
|
+
suggestions: [
|
|
90
|
+
'Use only lowercase letters, numbers, hyphens, and underscores',
|
|
91
|
+
'Start with a letter or number',
|
|
92
|
+
'Avoid reserved names like "test", "node_modules"',
|
|
93
|
+
],
|
|
94
|
+
docs: 'https://docs.npmjs.com/cli/v8/configuring-npm/package-json#name',
|
|
95
|
+
},
|
|
96
|
+
INCOMPATIBLE_OPTIONS: {
|
|
97
|
+
title: 'Incompatible options',
|
|
98
|
+
description: (ctx) => ctx?.message || 'The selected options are not compatible.',
|
|
99
|
+
suggestions: [
|
|
100
|
+
'Review the compatibility requirements',
|
|
101
|
+
'Use the wizard mode for guided selection',
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
// Configurator Errors
|
|
105
|
+
CONFIGURATOR_FAILED: {
|
|
106
|
+
title: 'Configurator failed',
|
|
107
|
+
description: (ctx) => `The "${ctx?.configurator || 'configurator'}" step failed.`,
|
|
108
|
+
suggestions: [
|
|
109
|
+
'Check the error details above',
|
|
110
|
+
'Ensure all dependencies are installed',
|
|
111
|
+
'Try running with --verbose for more details',
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
// Plugin Errors
|
|
115
|
+
PLUGIN_LOAD_FAILED: {
|
|
116
|
+
title: 'Failed to load plugin',
|
|
117
|
+
description: (ctx) => `Could not load plugin "${ctx?.plugin || 'unknown'}".`,
|
|
118
|
+
suggestions: [
|
|
119
|
+
'Check if the plugin is installed',
|
|
120
|
+
'Verify the plugin path is correct',
|
|
121
|
+
'Ensure the plugin exports a valid configuration',
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
PLUGIN_INVALID: {
|
|
125
|
+
title: 'Invalid plugin',
|
|
126
|
+
description: (ctx) => `The plugin "${ctx?.plugin || 'unknown'}" is not valid.`,
|
|
127
|
+
suggestions: [
|
|
128
|
+
'Ensure the plugin has name and version properties',
|
|
129
|
+
'Check for syntax errors in the plugin file',
|
|
130
|
+
'Refer to the plugin documentation',
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
// Generic Errors
|
|
134
|
+
UNKNOWN_ERROR: {
|
|
135
|
+
title: 'Unexpected error',
|
|
136
|
+
description: 'An unexpected error occurred.',
|
|
137
|
+
suggestions: [
|
|
138
|
+
'Try running the command again',
|
|
139
|
+
'Check the error details above',
|
|
140
|
+
'Report this issue if it persists',
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
// ============================================
|
|
145
|
+
// Formatting Functions
|
|
146
|
+
// ============================================
|
|
147
|
+
/**
|
|
148
|
+
* Get error message info by code
|
|
149
|
+
*/
|
|
150
|
+
export const getErrorMessage = (code, context) => {
|
|
151
|
+
const info = errorMessages[code] || errorMessages.UNKNOWN_ERROR;
|
|
152
|
+
const description = typeof info.description === 'function'
|
|
153
|
+
? info.description(context)
|
|
154
|
+
: info.description;
|
|
155
|
+
return {
|
|
156
|
+
title: info.title,
|
|
157
|
+
description,
|
|
158
|
+
suggestions: info.suggestions || [],
|
|
159
|
+
docs: info.docs,
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Format error for console output
|
|
164
|
+
*/
|
|
165
|
+
export const formatErrorMessage = (code, context) => {
|
|
166
|
+
const { title, description, suggestions, docs } = getErrorMessage(code, context);
|
|
167
|
+
let output = '\n';
|
|
168
|
+
output += pc.bgRed(pc.white(` ${title} `));
|
|
169
|
+
output += '\n\n';
|
|
170
|
+
output += pc.red(description);
|
|
171
|
+
if (suggestions.length > 0) {
|
|
172
|
+
output += '\n\n';
|
|
173
|
+
output += pc.yellow('Suggestions:');
|
|
174
|
+
suggestions.forEach(s => {
|
|
175
|
+
output += `\n ${pc.dim('•')} ${s}`;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (docs) {
|
|
179
|
+
output += '\n\n';
|
|
180
|
+
output += pc.dim(`Documentation: ${docs}`);
|
|
181
|
+
}
|
|
182
|
+
output += '\n';
|
|
183
|
+
return output;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Print formatted error to console
|
|
187
|
+
*/
|
|
188
|
+
export const printError = (code, context) => {
|
|
189
|
+
console.error(formatErrorMessage(code, context));
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Get error code from Error object
|
|
193
|
+
*/
|
|
194
|
+
export const getErrorCode = (error) => {
|
|
195
|
+
if (error.code && errorMessages[error.code]) {
|
|
196
|
+
return error.code;
|
|
197
|
+
}
|
|
198
|
+
// Try to detect common errors
|
|
199
|
+
const message = error.message.toLowerCase();
|
|
200
|
+
if (message.includes('no such file') || message.includes('enoent')) {
|
|
201
|
+
return 'ENOENT';
|
|
202
|
+
}
|
|
203
|
+
if (message.includes('permission denied') || message.includes('eacces')) {
|
|
204
|
+
return 'EACCES';
|
|
205
|
+
}
|
|
206
|
+
if (message.includes('already exists') || message.includes('eexist')) {
|
|
207
|
+
return 'EEXIST';
|
|
208
|
+
}
|
|
209
|
+
if (message.includes('incompatible')) {
|
|
210
|
+
return 'INCOMPATIBLE_OPTIONS';
|
|
211
|
+
}
|
|
212
|
+
return 'UNKNOWN_ERROR';
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Handle and print an error
|
|
216
|
+
*/
|
|
217
|
+
export const handleErrorWithMessage = (error, context) => {
|
|
218
|
+
const code = getErrorCode(error);
|
|
219
|
+
printError(code, { ...context, originalError: error.message });
|
|
220
|
+
// Print stack trace in debug mode
|
|
221
|
+
if (process.env.DEBUG === 'true') {
|
|
222
|
+
console.error(pc.dim('\nStack trace:'));
|
|
223
|
+
console.error(pc.dim(error.stack));
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
export default {
|
|
227
|
+
errorMessages,
|
|
228
|
+
getErrorMessage,
|
|
229
|
+
formatErrorMessage,
|
|
230
|
+
printError,
|
|
231
|
+
getErrorCode,
|
|
232
|
+
handleErrorWithMessage,
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/errors/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MA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AO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrE,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACrC,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAgC,EAChC,OAAiC,EAC3B,EAAE;IACR,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,UAAU,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAE/D,kCAAkC;IAClC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACxC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC;AACH,CAAC,CAAC;AAEF,eAAe;IACb,aAAa;IACb,eAAe;IACf,kBAAkB;IAClB,UAAU;IACV,YAAY;IACZ,sBAAsB;CACvB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXO CLI - Component Generators
|
|
3
|
+
*
|
|
4
|
+
* Generate components, hooks, pages, and features with consistent patterns.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```bash
|
|
8
|
+
* nexo generate component Button
|
|
9
|
+
* nexo generate hook useAuth
|
|
10
|
+
* nexo generate page Dashboard
|
|
11
|
+
* nexo generate feature auth
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type GeneratorType = 'component' | 'hook' | 'page' | 'feature';
|
|
15
|
+
export interface GeneratorOptions {
|
|
16
|
+
/** Name of the item to generate */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Type of generator */
|
|
19
|
+
type: GeneratorType;
|
|
20
|
+
/** Target directory (default: src/) */
|
|
21
|
+
targetDir?: string;
|
|
22
|
+
/** Use TypeScript (default: true) */
|
|
23
|
+
typescript?: boolean;
|
|
24
|
+
/** Add tests file */
|
|
25
|
+
withTests?: boolean;
|
|
26
|
+
/** Add styles file */
|
|
27
|
+
withStyles?: boolean;
|
|
28
|
+
/** Styling solution */
|
|
29
|
+
styling?: 'css' | 'scss' | 'tailwind' | 'css-modules';
|
|
30
|
+
/** Export from index */
|
|
31
|
+
withIndex?: boolean;
|
|
32
|
+
/** Silent mode */
|
|
33
|
+
silent?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface GeneratorResult {
|
|
36
|
+
success: boolean;
|
|
37
|
+
files: string[];
|
|
38
|
+
errors: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Convert name to PascalCase
|
|
42
|
+
*/
|
|
43
|
+
declare const toPascalCase: (str: string) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Convert name to camelCase
|
|
46
|
+
*/
|
|
47
|
+
declare const toCamelCase: (str: string) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Ensure hook name starts with 'use'
|
|
50
|
+
*/
|
|
51
|
+
declare const ensureHookName: (name: string) => string;
|
|
52
|
+
/**
|
|
53
|
+
* Generate a component
|
|
54
|
+
*/
|
|
55
|
+
declare const generateComponent: (options: GeneratorOptions) => Promise<GeneratorResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Generate a hook
|
|
58
|
+
*/
|
|
59
|
+
declare const generateHook: (options: GeneratorOptions) => Promise<GeneratorResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Generate a page
|
|
62
|
+
*/
|
|
63
|
+
declare const generatePage: (options: GeneratorOptions) => Promise<GeneratorResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Generate a feature (FSD-style)
|
|
66
|
+
*/
|
|
67
|
+
declare const generateFeature: (options: GeneratorOptions) => Promise<GeneratorResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Generate code based on type and options
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { generate } from 'nexo-cli';
|
|
74
|
+
*
|
|
75
|
+
* await generate({
|
|
76
|
+
* type: 'component',
|
|
77
|
+
* name: 'Button',
|
|
78
|
+
* typescript: true,
|
|
79
|
+
* withTests: true
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare const generate: (options: GeneratorOptions) => Promise<GeneratorResult>;
|
|
84
|
+
export { ensureHookName, generateComponent, generateFeature, generateHook, generatePage, toCamelCase, toPascalCase };
|
|
85
|
+
export default generate;
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB;IACvB,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC;IACtD,wBAAwB;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB;IAClB,MAAM,CAAC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