slicejs-cli 2.1.8 → 2.1.9
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.
|
@@ -19,7 +19,8 @@ const COMPONENTS_REGISTRY_URL = 'https://raw.githubusercontent.com/VKneider/slic
|
|
|
19
19
|
*/
|
|
20
20
|
const loadConfig = () => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
// ✅ CORREGIDO: Usar 4 niveles como en listComponents para compatibilidad con node_modules
|
|
23
|
+
const configPath = path.join(__dirname, '../../../../src/sliceConfig.json');
|
|
23
24
|
if (!fs.existsSync(configPath)) {
|
|
24
25
|
throw new Error('sliceConfig.json not found in src folder');
|
|
25
26
|
}
|
|
@@ -67,8 +68,8 @@ class ComponentRegistry {
|
|
|
67
68
|
|
|
68
69
|
async getLocalComponents() {
|
|
69
70
|
try {
|
|
70
|
-
// ✅
|
|
71
|
-
const componentsPath = path.join(__dirname, '
|
|
71
|
+
// ✅ CORREGIDO: Usar 4 niveles como en listComponents para compatibilidad con node_modules
|
|
72
|
+
const componentsPath = path.join(__dirname, '../../../../src/Components/components.js');
|
|
72
73
|
|
|
73
74
|
if (!await fs.pathExists(componentsPath)) {
|
|
74
75
|
return {};
|
|
@@ -98,11 +99,11 @@ class ComponentRegistry {
|
|
|
98
99
|
// Check if local component directory exists using dynamic paths
|
|
99
100
|
const categoryPath = validations.getCategoryPath(category);
|
|
100
101
|
|
|
101
|
-
// ✅
|
|
102
|
+
// ✅ CORREGIDO: Usar 4 niveles para compatibilidad con node_modules
|
|
102
103
|
const isProduction = this.config?.production?.enabled === true;
|
|
103
104
|
const folderSuffix = isProduction ? 'dist' : 'src';
|
|
104
105
|
|
|
105
|
-
const componentPath = path.join(__dirname,
|
|
106
|
+
const componentPath = path.join(__dirname, `../../../../${folderSuffix}`, categoryPath, name);
|
|
106
107
|
|
|
107
108
|
if (fs.pathExistsSync(componentPath)) {
|
|
108
109
|
updatableComponents.push({
|
|
@@ -207,8 +208,8 @@ class ComponentRegistry {
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
async updateLocalRegistry(componentName, category) {
|
|
210
|
-
// ✅
|
|
211
|
-
const componentsPath = path.join(__dirname, '
|
|
211
|
+
// ✅ CORREGIDO: Usar 4 niveles para compatibilidad con node_modules
|
|
212
|
+
const componentsPath = path.join(__dirname, '../../../../src/Components/components.js');
|
|
212
213
|
|
|
213
214
|
try {
|
|
214
215
|
let content = await fs.readFile(componentsPath, 'utf8');
|
|
@@ -261,11 +262,11 @@ class ComponentRegistry {
|
|
|
261
262
|
|
|
262
263
|
const categoryPath = validations.getCategoryPath(category);
|
|
263
264
|
|
|
264
|
-
// ✅
|
|
265
|
+
// ✅ CORREGIDO: Usar 4 niveles para compatibilidad con node_modules
|
|
265
266
|
const isProduction = this.config?.production?.enabled === true;
|
|
266
267
|
const folderSuffix = isProduction ? 'dist' : 'src';
|
|
267
268
|
|
|
268
|
-
const targetPath = path.join(__dirname,
|
|
269
|
+
const targetPath = path.join(__dirname, `../../../../${folderSuffix}`, categoryPath, componentName);
|
|
269
270
|
|
|
270
271
|
// Check if component already exists
|
|
271
272
|
if (await fs.pathExists(targetPath) && !force) {
|
|
@@ -273,7 +274,7 @@ class ComponentRegistry {
|
|
|
273
274
|
{
|
|
274
275
|
type: 'confirm',
|
|
275
276
|
name: 'overwrite',
|
|
276
|
-
message: `
|
|
277
|
+
message: `The component '${componentName}' already exists locally. Do you really want to overwrite your own version for the repository version?`,
|
|
277
278
|
default: false
|
|
278
279
|
}
|
|
279
280
|
]);
|