ingeniuscliq-core 0.0.12 → 0.1.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/core/commands/common/constants.js +10 -0
- package/core/commands/create-core-module.js +288 -0
- package/core/commands/create-module.js +288 -0
- package/core/commands/helpers/index.js +15 -0
- package/core/commands/helpers/strings.js +4 -0
- package/core/commands/rollback-core-module.js +195 -0
- package/core/commands/rollback-module.js +208 -0
- package/core/commands/templates/locale.js +14 -0
- package/core/commands/templates/service.js +12 -0
- package/core/commands/templates/type.js +10 -0
- package/dist/assets/index.d.ts +4 -0
- package/dist/classes/CoreBuilder.d.ts +3 -0
- package/dist/classes/index.d.ts +1 -0
- package/dist/components/customs/carousel/CustomCarousel.d.ts +7 -0
- package/dist/components/customs/carousel/CustomCarouselSection.d.ts +11 -0
- package/dist/components/customs/carousel/index.d.ts +2 -0
- package/dist/components/customs/form/CustomFormField.d.ts +12 -0
- package/dist/components/customs/form/FormInput.d.ts +16 -0
- package/dist/components/customs/form/FormTextArea.d.ts +9 -0
- package/dist/components/customs/form/FormWrapper.d.ts +8 -0
- package/dist/components/customs/form/index.d.ts +4 -0
- package/dist/components/customs/index.d.ts +6 -0
- package/dist/components/customs/logo/Logo.d.ts +6 -0
- package/dist/components/customs/pagination/CustomPagination.d.ts +7 -0
- package/dist/components/customs/select/CustomSelect.d.ts +10 -0
- package/dist/components/customs/spinner/Spinner.d.ts +7 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/layouts/CoreBaseLayout.d.ts +9 -0
- package/dist/components/templates/CoreHomeLayout.d.ts +5 -0
- package/dist/components/templates/CorePreviewLayout.d.ts +2 -0
- package/dist/components/templates/partials/CoreFooter.d.ts +1 -0
- package/dist/components/templates/partials/CoreHeader.d.ts +6 -0
- package/dist/components/templates/partials/CoreMainSearch.d.ts +8 -0
- package/dist/components/templates/partials/CoreNavbar.d.ts +8 -0
- package/dist/components/templates/partials/CoreSubMenu.d.ts +6 -0
- package/dist/components/templates/partials/CoreSubMenuHeader.d.ts +7 -0
- package/dist/components/templates/partials/DynamicHeader.d.ts +7 -0
- package/dist/components/templates/partials/DynamicMain.d.ts +5 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/alert-dialog.d.ts +14 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/calendar.d.ts +4 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/carousel.d.ts +19 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/form.d.ts +24 -0
- package/dist/components/ui/index.d.ts +34 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/pagination.d.ts +13 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +13 -0
- package/dist/components/ui/sidebar.d.ts +69 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/stepper.d.ts +18 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/menu.d.ts +2 -0
- package/dist/helpers/axiosGlobal.d.ts +7 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/strings.d.ts +1 -0
- package/dist/helpers/template.d.ts +3 -0
- package/dist/helpers/tenant.d.ts +3 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/useI18n.d.ts +5 -0
- package/dist/hooks/useNotification.d.ts +6 -0
- package/dist/i18n/config.d.ts +130 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/utils/loadModuleTranslations.d.ts +8 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +18852 -1490
- package/dist/lib/utils.d.ts +2 -0
- package/dist/modules/CoreAuth/components/layouts/partials/AuthDecorator.d.ts +1 -0
- package/dist/modules/CoreAuth/components/layouts/partials/AuthProfileDeleteAccountForm.d.ts +1 -0
- package/dist/modules/CoreAuth/components/layouts/partials/AuthProfileForm.d.ts +1 -0
- package/dist/modules/CoreAuth/components/layouts/partials/AuthProfileUpdatePassForm.d.ts +1 -0
- package/dist/modules/CoreAuth/components/layouts/partials/AuthUserMenu.d.ts +1 -0
- package/dist/modules/CoreAuth/constants/auth.d.ts +5 -0
- package/dist/modules/CoreAuth/hooks/useAuth.d.ts +18 -0
- package/dist/modules/CoreAuth/index.d.ts +1 -0
- package/dist/modules/CoreAuth/services/base.d.ts +23 -0
- package/dist/modules/CoreAuth/stores/authStore.d.ts +22 -0
- package/dist/modules/CoreAuth/types/CoreAuth.d.ts +25 -0
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.d.ts +30 -0
- package/dist/modules/CoreCustomization/index.d.ts +1 -0
- package/dist/modules/CoreCustomization/services/base.d.ts +10 -0
- package/dist/modules/CoreCustomization/types/CoreCustomization.d.ts +22 -0
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.d.ts +23 -0
- package/dist/modules/CoreOrder/index.d.ts +1 -0
- package/dist/modules/CoreOrder/services/base.d.ts +7 -0
- package/dist/modules/CoreOrder/types/CoreOrder.d.ts +41 -0
- package/dist/modules/CoreOrder/types/interfaces/OrderActions.d.ts +14 -0
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.d.ts +23 -0
- package/dist/modules/CorePayForm/index.d.ts +1 -0
- package/dist/modules/CorePayForm/services/base.d.ts +7 -0
- package/dist/modules/CorePayForm/types/CorePayForm.d.ts +19 -0
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.d.ts +25 -0
- package/dist/modules/CoreProduct/components/layouts/partials/TabHead.d.ts +6 -0
- package/dist/modules/CoreProduct/components/ui/cards/CoreProductCard.d.ts +15 -0
- package/dist/modules/CoreProduct/components/ui/cards/CoreProductCardActions.d.ts +18 -0
- package/dist/modules/CoreProduct/components/ui/cards/CoreProductCartItemAsideCard.d.ts +7 -0
- package/dist/modules/CoreProduct/components/ui/cards/CoreProductCartItemCard.d.ts +8 -0
- package/dist/modules/CoreProduct/components/ui/cards/CoreProductCartSummaryCard.d.ts +7 -0
- package/dist/modules/CoreProduct/components/ui/cards/addons/WarrantyLabel.d.ts +10 -0
- package/dist/modules/CoreProduct/components/ui/cards/skeletons/CoreProductCardSkeleton.d.ts +5 -0
- package/dist/modules/CoreProduct/components/ui/cards/skeletons/CoreProductCartItemCardSkeleton.d.ts +1 -0
- package/dist/modules/CoreProduct/components/ui/cards/skeletons/index.d.ts +2 -0
- package/dist/modules/CoreProduct/components/ui/carousels/CoreProductImageCarousel.d.ts +8 -0
- package/dist/modules/CoreProduct/components/ui/containers/CoreProductGrid.d.ts +19 -0
- package/dist/modules/CoreProduct/index.d.ts +1 -0
- package/dist/modules/CoreProduct/services/base.d.ts +7 -0
- package/dist/modules/CoreProduct/types/CoreProduct.d.ts +33 -0
- package/dist/modules/CoreProduct/types/CoreProductCategory.d.ts +10 -0
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.d.ts +25 -0
- package/dist/modules/CoreShopCart/components/layouts/partials/CoreShopCartAside.d.ts +12 -0
- package/dist/modules/CoreShopCart/components/layouts/partials/CoreShopCartIcon.d.ts +7 -0
- package/dist/modules/CoreShopCart/components/ui/cards/CoreCartItemAsideCard.d.ts +9 -0
- package/dist/modules/CoreShopCart/components/ui/cards/skeletons/CoreCartItemAsideCardSkeleton.d.ts +4 -0
- package/dist/modules/CoreShopCart/components/ui/empty/EmptyCartItems.d.ts +1 -0
- package/dist/modules/CoreShopCart/components/ui/texts/CoreCartHintTitle.d.ts +8 -0
- package/dist/modules/CoreShopCart/components/ui/texts/CoreCartSubtotalText.d.ts +7 -0
- package/dist/modules/CoreShopCart/components/ui/texts/CoreCartSummaryHead.d.ts +6 -0
- package/dist/modules/CoreShopCart/components/ui/texts/CoreCartSummaryText.d.ts +7 -0
- package/dist/modules/CoreShopCart/constants/shopCart.d.ts +6 -0
- package/dist/modules/CoreShopCart/index.d.ts +1 -0
- package/dist/modules/CoreShopCart/services/base.d.ts +16 -0
- package/dist/modules/CoreShopCart/types/CoreShopCart.d.ts +32 -0
- package/dist/modules/CoreShopCart/types/interfaces/CartActions.d.ts +23 -0
- package/dist/modules/index.d.ts +0 -0
- package/dist/services/base.d.ts +38 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/stores/customizationStore.d.ts +21 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/types/BaseStore.d.ts +7 -0
- package/dist/types/BaseType.d.ts +5 -0
- package/dist/types/CoreImage.d.ts +5 -0
- package/dist/types/CoreMenu.d.ts +6 -0
- package/dist/types/contracts/BaseApiResponse.d.ts +7 -0
- package/dist/types/contracts/BasePagination.d.ts +9 -0
- package/dist/types/contracts/index.d.ts +2 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/interfaces/BaseImageType.d.ts +7 -0
- package/dist/types/interfaces/BaseSlugType.d.ts +3 -0
- package/dist/types/interfaces/BaseVisibleType.d.ts +3 -0
- package/dist/types/interfaces/index.d.ts +3 -0
- package/dist/types/ui/carousel.d.ts +5 -0
- package/dist/types/ui/index.d.ts +3 -0
- package/dist/types/ui/main.d.ts +8 -0
- package/dist/types/ui/template.d.ts +19 -0
- package/package.json +12 -3
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createBaseDir, joinPaths } from './helpers/index.js';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import enquirer from 'enquirer';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
|
|
9
|
+
const { prompt } = enquirer;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Removes the module import from the modules/index.ts file
|
|
13
|
+
* @param {string} moduleName The name of the module to remove
|
|
14
|
+
*/
|
|
15
|
+
function removeModuleImport(moduleName) {
|
|
16
|
+
const modulesDir = createBaseDir('modules', ['src', 'core']);
|
|
17
|
+
const indexPath = joinPaths(modulesDir, 'index.ts');
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
if (fs.existsSync(indexPath)) {
|
|
21
|
+
let content = fs.readFileSync(indexPath, 'utf8');
|
|
22
|
+
const importStatement = `import './${moduleName}'`;
|
|
23
|
+
|
|
24
|
+
// Remove the import line if it exists
|
|
25
|
+
const lines = content.split('\n').filter(line => !line.includes(importStatement));
|
|
26
|
+
|
|
27
|
+
// Clean up empty lines between imports
|
|
28
|
+
let cleanedLines = [];
|
|
29
|
+
let lastLineWasEmpty = false;
|
|
30
|
+
|
|
31
|
+
for (const line of lines) {
|
|
32
|
+
if (line.trim() === '') {
|
|
33
|
+
if (!lastLineWasEmpty) {
|
|
34
|
+
cleanedLines.push(line);
|
|
35
|
+
lastLineWasEmpty = true;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
cleanedLines.push(line);
|
|
39
|
+
lastLineWasEmpty = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
content = cleanedLines.join('\n');
|
|
44
|
+
|
|
45
|
+
fs.writeFileSync(indexPath, content);
|
|
46
|
+
console.log(chalk.green(`✓ Removed module import from ${chalk.bold('modules/index.ts')}`));
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error(chalk.yellow(`⚠️ Warning: Could not update modules index: ${error.message}`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Recursively removes a directory and its contents
|
|
55
|
+
* @param {string} dirPath The path to the directory to remove
|
|
56
|
+
*/
|
|
57
|
+
function removeDirectory(dirPath) {
|
|
58
|
+
if (fs.existsSync(dirPath)) {
|
|
59
|
+
fs.readdirSync(dirPath).forEach((file) => {
|
|
60
|
+
const curPath = path.join(dirPath, file);
|
|
61
|
+
if (fs.lstatSync(curPath).isDirectory()) {
|
|
62
|
+
removeDirectory(curPath);
|
|
63
|
+
} else {
|
|
64
|
+
fs.unlinkSync(curPath);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
fs.rmdirSync(dirPath);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Rolls back a core module creation
|
|
73
|
+
* @param {string} moduleName The name of the module to roll back
|
|
74
|
+
*/
|
|
75
|
+
async function rollbackModule(moduleName) {
|
|
76
|
+
if (!moduleName) {
|
|
77
|
+
console.error(chalk.red.bold('❌ Error: Core module name is required'));
|
|
78
|
+
console.log(chalk.yellow('⚠️ Usage: npm run rollback:core-module <module-name>'));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const baseDir = createBaseDir(moduleName, ['src', 'core', 'modules']);
|
|
83
|
+
|
|
84
|
+
// Check if module exists
|
|
85
|
+
if (!fs.existsSync(baseDir)) {
|
|
86
|
+
console.error(chalk.red.bold(`❌ Error: Core module '${moduleName}' does not exist`));
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
// Ask for confirmation
|
|
92
|
+
const response = await prompt({
|
|
93
|
+
type: 'confirm',
|
|
94
|
+
name: 'confirm',
|
|
95
|
+
message: chalk.yellow(`⚠️ Are you sure you want to delete the module '${moduleName}'? This action cannot be undone.`),
|
|
96
|
+
initial: false
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (!response.confirm) {
|
|
100
|
+
console.log(chalk.yellow('Operation cancelled.'));
|
|
101
|
+
process.exit(0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Remove the module directory
|
|
105
|
+
removeDirectory(baseDir);
|
|
106
|
+
console.log(chalk.green(`✓ Removed module directory: ${chalk.bold(moduleName)}`));
|
|
107
|
+
|
|
108
|
+
// Remove the module import from index.ts
|
|
109
|
+
removeModuleImport(moduleName);
|
|
110
|
+
|
|
111
|
+
console.log(chalk.green.bold(`\n✨ Module '${moduleName}' successfully removed`));
|
|
112
|
+
} catch (error) {
|
|
113
|
+
if (error.message !== 'USER_CANCELLED') {
|
|
114
|
+
console.error(chalk.red.bold(`❌ Error rolling back module: ${error.message}`));
|
|
115
|
+
}
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Lists all available core modules
|
|
122
|
+
* @returns {string[]} Array of module names
|
|
123
|
+
*/
|
|
124
|
+
function listAvailableModules() {
|
|
125
|
+
const modulesDir = createBaseDir('modules', ['src', 'core']);
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
if (fs.existsSync(modulesDir)) {
|
|
129
|
+
return fs.readdirSync(modulesDir, { withFileTypes: true })
|
|
130
|
+
.filter(dirent => dirent.isDirectory())
|
|
131
|
+
.map(dirent => dirent.name);
|
|
132
|
+
}
|
|
133
|
+
} catch (error) {
|
|
134
|
+
console.error(chalk.yellow(`⚠️ Warning: Could not read modules directory: ${error.message}`));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Prompts the user to select a module to roll back
|
|
142
|
+
*/
|
|
143
|
+
async function promptModuleSelection() {
|
|
144
|
+
const modules = listAvailableModules();
|
|
145
|
+
|
|
146
|
+
if (modules.length === 0) {
|
|
147
|
+
console.error(chalk.red.bold('❌ Error: No core modules found'));
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
const response = await prompt({
|
|
153
|
+
type: 'select',
|
|
154
|
+
name: 'moduleName',
|
|
155
|
+
message: 'Select the module to roll back:',
|
|
156
|
+
choices: modules.map(module => ({
|
|
157
|
+
name: module,
|
|
158
|
+
value: module,
|
|
159
|
+
message: module
|
|
160
|
+
})),
|
|
161
|
+
styles: {
|
|
162
|
+
primary: chalk.cyan,
|
|
163
|
+
highlight: chalk.cyan.bold,
|
|
164
|
+
selected: chalk.red.bold
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
return response.moduleName;
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.log(chalk.yellow('⚠️ Operation cancelled.'));
|
|
171
|
+
process.exit(0);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Get module name from command line arguments or prompt
|
|
176
|
+
const moduleNameArg = process.argv[2];
|
|
177
|
+
|
|
178
|
+
async function main() {
|
|
179
|
+
console.log(chalk.red.bold('\n==================================='));
|
|
180
|
+
console.log(chalk.red.bold(' Rollback Core Module'));
|
|
181
|
+
console.log(chalk.red.bold('===================================\n'));
|
|
182
|
+
|
|
183
|
+
let moduleName = moduleNameArg;
|
|
184
|
+
|
|
185
|
+
if (!moduleName) {
|
|
186
|
+
moduleName = await promptModuleSelection();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
await rollbackModule(moduleName);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
main().catch(error => {
|
|
193
|
+
console.error(chalk.red.bold(`❌ Unexpected error: ${error.message}`));
|
|
194
|
+
process.exit(1);
|
|
195
|
+
});
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createBaseDir, joinPaths } from './helpers/index.js';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import enquirer from 'enquirer';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
|
|
9
|
+
const { prompt } = enquirer;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Removes the module import from the modules/index.ts file if it exists
|
|
13
|
+
* @param {string} moduleName The name of the module to remove
|
|
14
|
+
*/
|
|
15
|
+
function removeModuleImport(moduleName) {
|
|
16
|
+
const modulesDir = createBaseDir('modules', ['src']);
|
|
17
|
+
const indexPath = joinPaths(modulesDir, 'index.ts');
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
if (fs.existsSync(indexPath)) {
|
|
21
|
+
let content = fs.readFileSync(indexPath, 'utf8');
|
|
22
|
+
const importStatement = `import './${moduleName}'`;
|
|
23
|
+
|
|
24
|
+
// Remove the import line if it exists
|
|
25
|
+
const lines = content.split('\n').filter(line => !line.includes(importStatement));
|
|
26
|
+
|
|
27
|
+
// Clean up empty lines between imports
|
|
28
|
+
let cleanedLines = [];
|
|
29
|
+
let lastLineWasEmpty = false;
|
|
30
|
+
|
|
31
|
+
for (const line of lines) {
|
|
32
|
+
if (line.trim() === '') {
|
|
33
|
+
if (!lastLineWasEmpty) {
|
|
34
|
+
cleanedLines.push(line);
|
|
35
|
+
lastLineWasEmpty = true;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
cleanedLines.push(line);
|
|
39
|
+
lastLineWasEmpty = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
content = cleanedLines.join('\n');
|
|
44
|
+
|
|
45
|
+
fs.writeFileSync(indexPath, content);
|
|
46
|
+
console.log(chalk.green(`✓ Removed module import from ${chalk.bold('modules/index.ts')}`));
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error(chalk.yellow(`⚠️ Warning: Could not update modules index: ${error.message}`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Recursively removes a directory and its contents
|
|
55
|
+
* @param {string} dirPath The path to the directory to remove
|
|
56
|
+
*/
|
|
57
|
+
function removeDirectory(dirPath) {
|
|
58
|
+
if (fs.existsSync(dirPath)) {
|
|
59
|
+
fs.readdirSync(dirPath).forEach((file) => {
|
|
60
|
+
const curPath = path.join(dirPath, file);
|
|
61
|
+
if (fs.lstatSync(curPath).isDirectory()) {
|
|
62
|
+
removeDirectory(curPath);
|
|
63
|
+
} else {
|
|
64
|
+
fs.unlinkSync(curPath);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
fs.rmdirSync(dirPath);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Rolls back a module creation
|
|
73
|
+
* @param {string} moduleName The name of the module to roll back
|
|
74
|
+
*/
|
|
75
|
+
async function rollbackModule(moduleName) {
|
|
76
|
+
if (!moduleName) {
|
|
77
|
+
console.error(chalk.red.bold('❌ Error: Module name is required'));
|
|
78
|
+
console.log(chalk.yellow('⚠️ Usage: npm run rollback:module <module-name>'));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const baseDir = createBaseDir(moduleName, ['src', 'modules']);
|
|
83
|
+
|
|
84
|
+
// Check if module exists
|
|
85
|
+
if (!fs.existsSync(baseDir)) {
|
|
86
|
+
console.error(chalk.red.bold(`❌ Error: Module '${moduleName}' does not exist`));
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
// Ask for confirmation with module details
|
|
92
|
+
console.log(chalk.yellow('\nModule details:'));
|
|
93
|
+
console.log(chalk.yellow('─────────────────'));
|
|
94
|
+
console.log(chalk.yellow(`Location: ${baseDir}`));
|
|
95
|
+
|
|
96
|
+
// Show module contents
|
|
97
|
+
const contents = fs.readdirSync(baseDir, { withFileTypes: true });
|
|
98
|
+
console.log(chalk.yellow('Contents:'));
|
|
99
|
+
contents.forEach(item => {
|
|
100
|
+
const prefix = item.isDirectory() ? '📁' : '📄';
|
|
101
|
+
console.log(chalk.yellow(` ${prefix} ${item.name}`));
|
|
102
|
+
});
|
|
103
|
+
console.log(chalk.yellow('─────────────────\n'));
|
|
104
|
+
|
|
105
|
+
const response = await prompt({
|
|
106
|
+
type: 'confirm',
|
|
107
|
+
name: 'confirm',
|
|
108
|
+
message: chalk.yellow(`⚠️ Are you sure you want to delete this module? This action cannot be undone.`),
|
|
109
|
+
initial: false
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
if (!response.confirm) {
|
|
113
|
+
console.log(chalk.yellow('Operation cancelled.'));
|
|
114
|
+
process.exit(0);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Remove the module directory
|
|
118
|
+
removeDirectory(baseDir);
|
|
119
|
+
console.log(chalk.green(`✓ Removed module directory: ${chalk.bold(moduleName)}`));
|
|
120
|
+
|
|
121
|
+
// Remove the module import from index.ts
|
|
122
|
+
removeModuleImport(moduleName);
|
|
123
|
+
|
|
124
|
+
console.log(chalk.green.bold(`\n✨ Module '${moduleName}' successfully removed`));
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error.message !== 'USER_CANCELLED') {
|
|
127
|
+
console.error(chalk.red.bold(`❌ Error rolling back module: ${error.message}`));
|
|
128
|
+
}
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Lists all available modules
|
|
135
|
+
* @returns {string[]} Array of module names
|
|
136
|
+
*/
|
|
137
|
+
function listAvailableModules() {
|
|
138
|
+
const modulesDir = createBaseDir('modules', ['src']);
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
if (fs.existsSync(modulesDir)) {
|
|
142
|
+
return fs.readdirSync(modulesDir, { withFileTypes: true })
|
|
143
|
+
.filter(dirent => dirent.isDirectory())
|
|
144
|
+
.map(dirent => dirent.name);
|
|
145
|
+
}
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error(chalk.yellow(`⚠️ Warning: Could not read modules directory: ${error.message}`));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return [];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Prompts the user to select a module to roll back
|
|
155
|
+
*/
|
|
156
|
+
async function promptModuleSelection() {
|
|
157
|
+
const modules = listAvailableModules();
|
|
158
|
+
|
|
159
|
+
if (modules.length === 0) {
|
|
160
|
+
console.error(chalk.red.bold('❌ Error: No modules found'));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const response = await prompt({
|
|
166
|
+
type: 'select',
|
|
167
|
+
name: 'moduleName',
|
|
168
|
+
message: 'Select the module to roll back:',
|
|
169
|
+
choices: modules.map(module => ({
|
|
170
|
+
name: module,
|
|
171
|
+
value: module,
|
|
172
|
+
message: module
|
|
173
|
+
})),
|
|
174
|
+
styles: {
|
|
175
|
+
primary: chalk.cyan,
|
|
176
|
+
highlight: chalk.cyan.bold,
|
|
177
|
+
selected: chalk.red.bold
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
return response.moduleName;
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.log(chalk.yellow('⚠️ Operation cancelled.'));
|
|
184
|
+
process.exit(0);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Get module name from command line arguments or prompt
|
|
189
|
+
const moduleNameArg = process.argv[2];
|
|
190
|
+
|
|
191
|
+
async function main() {
|
|
192
|
+
console.log(chalk.red.bold('\n==================================='));
|
|
193
|
+
console.log(chalk.red.bold(' Rollback Module'));
|
|
194
|
+
console.log(chalk.red.bold('===================================\n'));
|
|
195
|
+
|
|
196
|
+
let moduleName = moduleNameArg;
|
|
197
|
+
|
|
198
|
+
if (!moduleName) {
|
|
199
|
+
moduleName = await promptModuleSelection();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
await rollbackModule(moduleName);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
main().catch(error => {
|
|
206
|
+
console.error(chalk.red.bold(`❌ Unexpected error: ${error.message}`));
|
|
207
|
+
process.exit(1);
|
|
208
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function localeTemplate(moduleName){
|
|
2
|
+
return `// ${moduleName} module exports
|
|
3
|
+
|
|
4
|
+
import { loadModuleTranslations } from '@/i18n/utils/loadModuleTranslations';
|
|
5
|
+
import enTranslations from './locale/en.json';
|
|
6
|
+
import esTranslations from './locale/es.json';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Load module translations
|
|
10
|
+
loadModuleTranslations('${moduleName}', {
|
|
11
|
+
en: enTranslations,
|
|
12
|
+
es: esTranslations
|
|
13
|
+
});`
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function serviceTemplate(moduleName) {
|
|
2
|
+
return `import { BaseService } from '@/services/base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base class that can be extended by concrete services
|
|
6
|
+
*/
|
|
7
|
+
export class ${moduleName}BaseService extends BaseService {
|
|
8
|
+
constructor() {
|
|
9
|
+
super('${moduleName}')
|
|
10
|
+
}
|
|
11
|
+
}`
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CoreBuilder';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
import { CoreImage } from '../../../types/CoreImage';
|
|
3
|
+
import { BaseCarousel } from '../../../types/ui/carousel';
|
|
4
|
+
interface CustomCarouselProps extends BaseStyleProps, BaseCarousel<CoreImage> {
|
|
5
|
+
}
|
|
6
|
+
export declare function CustomCarousel({ items, withoutControls, className }: CustomCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
import { BaseType } from '../../../types/BaseType';
|
|
3
|
+
import { BaseCarousel } from '../../../types/ui/carousel';
|
|
4
|
+
interface CustomCarouselSectionProps<T extends Record<string, any> & BaseType> extends BaseStyleProps, BaseCarousel<T> {
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
title: string;
|
|
7
|
+
renderActions?: React.ReactNode;
|
|
8
|
+
itemComponent: React.ComponentType<T>;
|
|
9
|
+
}
|
|
10
|
+
export declare function CustomCarouselSection<T extends Record<string, any> & BaseType>({ className, subtitle, title, renderActions, itemComponent: ItemComponent, items, withoutControls }: CustomCarouselSectionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Control, FieldValues, Path } from 'react-hook-form';
|
|
2
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
3
|
+
interface CustomFormFieldProps<T extends FieldValues = FieldValues> extends BaseStyleProps {
|
|
4
|
+
readonly control: Control<T>;
|
|
5
|
+
readonly name: Path<T>;
|
|
6
|
+
readonly label?: string;
|
|
7
|
+
readonly render: (field: FieldValues) => React.ReactNode;
|
|
8
|
+
readonly withinLabel?: boolean;
|
|
9
|
+
readonly withinMessage?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function CustomFormField<T extends FieldValues = FieldValues>({ control, name, label, render, className, withinLabel, withinMessage }: CustomFormFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
import { Control, FieldValues, Path } from 'react-hook-form';
|
|
3
|
+
declare enum SUPPORTED_INPUT_TYPES {
|
|
4
|
+
text = "text",
|
|
5
|
+
number = "number",
|
|
6
|
+
password = "password",
|
|
7
|
+
email = "email"
|
|
8
|
+
}
|
|
9
|
+
interface FormInputProps<T extends FieldValues = FieldValues> extends BaseStyleProps {
|
|
10
|
+
readonly control: Control<T>;
|
|
11
|
+
readonly name: Path<T>;
|
|
12
|
+
readonly placeholder?: string;
|
|
13
|
+
readonly type?: keyof typeof SUPPORTED_INPUT_TYPES;
|
|
14
|
+
}
|
|
15
|
+
export declare function FormInput<T extends FieldValues = FieldValues>({ control, name, placeholder, type, className }: FormInputProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
import { Control, FieldValues, Path } from 'react-hook-form';
|
|
3
|
+
interface FormInputProps<T extends FieldValues = FieldValues> extends BaseStyleProps {
|
|
4
|
+
readonly control: Control<T>;
|
|
5
|
+
readonly name: Path<T>;
|
|
6
|
+
readonly placeholder?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function FormTextArea<T extends FieldValues = FieldValues>({ control, name, placeholder, className }: FormInputProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseProps } from '../../../types/ui/main';
|
|
2
|
+
import { FormEvent } from 'react';
|
|
3
|
+
interface FormWrapperProps extends BaseProps {
|
|
4
|
+
readonly noValidate?: boolean;
|
|
5
|
+
readonly onSubmit?: (e: FormEvent) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function FormWrapper({ children, className, noValidate, onSubmit }: FormWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface CustomPaginationProps {
|
|
2
|
+
readonly currentPage: number;
|
|
3
|
+
readonly totalPages: number;
|
|
4
|
+
readonly onPageChange: (page: number) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function CustomPagination({ currentPage, totalPages, onPageChange }: CustomPaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
interface CustomSelectProps extends BaseStyleProps {
|
|
3
|
+
readonly options: {
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly label: string | React.ReactNode;
|
|
6
|
+
}[];
|
|
7
|
+
readonly placeholder?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function CustomSelect({ options, placeholder, className }: CustomSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
interface SpinnerProps extends BaseStyleProps {
|
|
3
|
+
readonly color?: string;
|
|
4
|
+
readonly size?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function Spinner({ color, className, size }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface CoreBaseLayoutProps extends React.PropsWithChildren {
|
|
2
|
+
readonly headerChildren?: React.ReactNode;
|
|
3
|
+
readonly footerChildren?: React.ReactNode;
|
|
4
|
+
readonly headerClassName?: string;
|
|
5
|
+
readonly mainClassName?: string;
|
|
6
|
+
readonly footerClassName?: string;
|
|
7
|
+
readonly styles?: any;
|
|
8
|
+
}
|
|
9
|
+
export declare function CoreBaseLayout({ headerChildren, footerChildren, headerClassName, mainClassName, footerClassName, children, styles }: CoreBaseLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CoreBaseLayoutProps } from '../layouts/CoreBaseLayout';
|
|
2
|
+
export interface CoreHomeLayoutProps extends CoreBaseLayoutProps {
|
|
3
|
+
readonly styles?: any;
|
|
4
|
+
}
|
|
5
|
+
export declare function CoreHomeLayout({ styles, children }: CoreHomeLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CoreFooter(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface CoreHeaderProps {
|
|
2
|
+
readonly renderNavbar?: React.ReactNode;
|
|
3
|
+
readonly renderSubMenuHeader?: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function CoreHeader({ renderNavbar, renderSubMenuHeader }: CoreHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface CoreMainSearchProps {
|
|
2
|
+
readonly left?: React.ReactNode;
|
|
3
|
+
readonly right?: React.ReactNode;
|
|
4
|
+
readonly renderInput?: React.ReactNode;
|
|
5
|
+
readonly renderSearchButton?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function CoreMainSearch({ left, right, renderInput, renderSearchButton }: CoreMainSearchProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
interface CoreNavbarProps extends BaseStyleProps {
|
|
3
|
+
readonly center?: React.ReactNode;
|
|
4
|
+
readonly right?: React.ReactNode;
|
|
5
|
+
readonly renderLogo?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function CoreNavbar({ className, renderLogo, center, right }: CoreNavbarProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
interface CoreSubMenuProps extends BaseStyleProps {
|
|
3
|
+
classNameItems?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function CoreSubMenu({ className, classNameItems }: CoreSubMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseStyleProps } from '../../../types/ui/main';
|
|
2
|
+
interface CoreSubMenuHeaderProps extends BaseStyleProps {
|
|
3
|
+
readonly subMenuHeaderLeft?: React.ReactNode;
|
|
4
|
+
readonly subMenuHeaderRight?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export default function CoreSubMenuHeader({ className, subMenuHeaderLeft, subMenuHeaderRight }: CoreSubMenuHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|