@onpe/ui 1.0.53 → 1.1.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/dist/cli.esm.js +333 -65
- package/dist/cli.js +333 -65
- package/dist/commands/createBarrelFiles.d.ts +10 -0
- package/dist/index.css +1 -1
- package/dist/index.esm.css +1 -1
- package/package.json +1 -1
package/dist/cli.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import require$$0 from 'events';
|
|
3
|
-
import require$$1
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
3
|
+
import require$$1 from 'child_process';
|
|
4
|
+
import * as path$d from 'path';
|
|
5
|
+
import path__default from 'path';
|
|
6
6
|
import require$$3 from 'fs';
|
|
7
7
|
import require$$4 from 'process';
|
|
8
8
|
import require$$0$1 from 'constants';
|
|
@@ -1176,8 +1176,8 @@ function suggestSimilar$1(word, candidates) {
|
|
|
1176
1176
|
suggestSimilar$2.suggestSimilar = suggestSimilar$1;
|
|
1177
1177
|
|
|
1178
1178
|
const EventEmitter = require$$0.EventEmitter;
|
|
1179
|
-
const childProcess = require$$1
|
|
1180
|
-
const path$c =
|
|
1179
|
+
const childProcess = require$$1;
|
|
1180
|
+
const path$c = path__default;
|
|
1181
1181
|
const fs$i = require$$3;
|
|
1182
1182
|
const process$1 = require$$4;
|
|
1183
1183
|
|
|
@@ -4525,7 +4525,7 @@ var makeDir$1 = {};
|
|
|
4525
4525
|
|
|
4526
4526
|
var utils$1 = {};
|
|
4527
4527
|
|
|
4528
|
-
const path$b =
|
|
4528
|
+
const path$b = path__default;
|
|
4529
4529
|
|
|
4530
4530
|
// https://github.com/nodejs/node/issues/8987
|
|
4531
4531
|
// https://github.com/libuv/libuv/pull/1088
|
|
@@ -4630,7 +4630,7 @@ var utimes = {
|
|
|
4630
4630
|
};
|
|
4631
4631
|
|
|
4632
4632
|
const fs$c = fs$h;
|
|
4633
|
-
const path$a =
|
|
4633
|
+
const path$a = path__default;
|
|
4634
4634
|
const u$b = universalify$1.fromPromise;
|
|
4635
4635
|
|
|
4636
4636
|
function getStats$1 (src, dest, opts) {
|
|
@@ -4788,7 +4788,7 @@ var stat$4 = {
|
|
|
4788
4788
|
};
|
|
4789
4789
|
|
|
4790
4790
|
const fs$b = fs$h;
|
|
4791
|
-
const path$9 =
|
|
4791
|
+
const path$9 = path__default;
|
|
4792
4792
|
const { mkdirs: mkdirs$1 } = mkdirs$2;
|
|
4793
4793
|
const { pathExists: pathExists$5 } = pathExists_1;
|
|
4794
4794
|
const { utimesMillis } = utimes;
|
|
@@ -4969,7 +4969,7 @@ async function onLink$1 (destStat, src, dest, opts) {
|
|
|
4969
4969
|
var copy_1 = copy$2;
|
|
4970
4970
|
|
|
4971
4971
|
const fs$a = gracefulFs;
|
|
4972
|
-
const path$8 =
|
|
4972
|
+
const path$8 = path__default;
|
|
4973
4973
|
const mkdirsSync$1 = mkdirs$2.mkdirsSync;
|
|
4974
4974
|
const utimesMillisSync = utimes.utimesMillisSync;
|
|
4975
4975
|
const stat$2 = stat$4;
|
|
@@ -5162,7 +5162,7 @@ var remove_1 = {
|
|
|
5162
5162
|
|
|
5163
5163
|
const u$8 = universalify$1.fromPromise;
|
|
5164
5164
|
const fs$8 = fs$h;
|
|
5165
|
-
const path$7 =
|
|
5165
|
+
const path$7 = path__default;
|
|
5166
5166
|
const mkdir$3 = mkdirs$2;
|
|
5167
5167
|
const remove$1 = remove_1;
|
|
5168
5168
|
|
|
@@ -5199,7 +5199,7 @@ var empty = {
|
|
|
5199
5199
|
};
|
|
5200
5200
|
|
|
5201
5201
|
const u$7 = universalify$1.fromPromise;
|
|
5202
|
-
const path$6 =
|
|
5202
|
+
const path$6 = path__default;
|
|
5203
5203
|
const fs$7 = fs$h;
|
|
5204
5204
|
const mkdir$2 = mkdirs$2;
|
|
5205
5205
|
|
|
@@ -5264,7 +5264,7 @@ var file = {
|
|
|
5264
5264
|
};
|
|
5265
5265
|
|
|
5266
5266
|
const u$6 = universalify$1.fromPromise;
|
|
5267
|
-
const path$5 =
|
|
5267
|
+
const path$5 = path__default;
|
|
5268
5268
|
const fs$6 = fs$h;
|
|
5269
5269
|
const mkdir$1 = mkdirs$2;
|
|
5270
5270
|
const { pathExists: pathExists$4 } = pathExists_1;
|
|
@@ -5326,7 +5326,7 @@ var link = {
|
|
|
5326
5326
|
createLinkSync: createLinkSync$1
|
|
5327
5327
|
};
|
|
5328
5328
|
|
|
5329
|
-
const path$4 =
|
|
5329
|
+
const path$4 = path__default;
|
|
5330
5330
|
const fs$5 = fs$h;
|
|
5331
5331
|
const { pathExists: pathExists$3 } = pathExists_1;
|
|
5332
5332
|
|
|
@@ -5460,7 +5460,7 @@ var symlinkType_1 = {
|
|
|
5460
5460
|
};
|
|
5461
5461
|
|
|
5462
5462
|
const u$3 = universalify$1.fromPromise;
|
|
5463
|
-
const path$3 =
|
|
5463
|
+
const path$3 = path__default;
|
|
5464
5464
|
const fs$3 = fs$h;
|
|
5465
5465
|
|
|
5466
5466
|
const { mkdirs, mkdirsSync } = mkdirs$2;
|
|
@@ -5663,7 +5663,7 @@ var jsonfile = {
|
|
|
5663
5663
|
|
|
5664
5664
|
const u$2 = universalify$1.fromPromise;
|
|
5665
5665
|
const fs$2 = fs$h;
|
|
5666
|
-
const path$2 =
|
|
5666
|
+
const path$2 = path__default;
|
|
5667
5667
|
const mkdir = mkdirs$2;
|
|
5668
5668
|
const pathExists$1 = pathExists_1.pathExists;
|
|
5669
5669
|
|
|
@@ -5729,7 +5729,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
|
|
|
5729
5729
|
var json = jsonFile;
|
|
5730
5730
|
|
|
5731
5731
|
const fs$1 = fs$h;
|
|
5732
|
-
const path$1 =
|
|
5732
|
+
const path$1 = path__default;
|
|
5733
5733
|
const { copy } = copy$1;
|
|
5734
5734
|
const { remove } = remove_1;
|
|
5735
5735
|
const { mkdirp } = mkdirs$2;
|
|
@@ -5787,7 +5787,7 @@ async function moveAcrossDevice$1 (src, dest, overwrite) {
|
|
|
5787
5787
|
var move_1 = move$1;
|
|
5788
5788
|
|
|
5789
5789
|
const fs = gracefulFs;
|
|
5790
|
-
const path =
|
|
5790
|
+
const path = path__default;
|
|
5791
5791
|
const copySync = copy$1.copySync;
|
|
5792
5792
|
const removeSync = remove_1.removeSync;
|
|
5793
5793
|
const mkdirpSync = mkdirs$2.mkdirpSync;
|
|
@@ -5861,11 +5861,221 @@ var lib = {
|
|
|
5861
5861
|
...remove_1
|
|
5862
5862
|
};
|
|
5863
5863
|
|
|
5864
|
+
/**
|
|
5865
|
+
* Crea archivos de barril (barrel exports) para simplificar las importaciones
|
|
5866
|
+
* Solo crea las carpetas y archivos que realmente existen
|
|
5867
|
+
*/
|
|
5868
|
+
function createBarrelFiles() {
|
|
5869
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5870
|
+
var componentsDir, folderExists, getFilesInFolder, mainExports, mainIndexContent, uiPath, uiFiles, uiExports, uiIndexContent, modalsPath, modalFiles, modalExports, modalsIndexContent, iconsPath, iconExports, iconsIndexContent, iconCategories, _i, iconCategories_1, category, categoryPath, categoryFiles, categoryExports, categoryIndexContent;
|
|
5871
|
+
var _this = this;
|
|
5872
|
+
return __generator(this, function (_a) {
|
|
5873
|
+
switch (_a.label) {
|
|
5874
|
+
case 0:
|
|
5875
|
+
componentsDir = path$d.join(process.cwd(), "src", "components", "onpe");
|
|
5876
|
+
// Solo crear la carpeta principal si no existe
|
|
5877
|
+
return [4 /*yield*/, lib.ensureDir(componentsDir)];
|
|
5878
|
+
case 1:
|
|
5879
|
+
// Solo crear la carpeta principal si no existe
|
|
5880
|
+
_a.sent();
|
|
5881
|
+
folderExists = function (folderPath) { return __awaiter(_this, void 0, void 0, function () {
|
|
5882
|
+
var exists, files;
|
|
5883
|
+
return __generator(this, function (_b) {
|
|
5884
|
+
switch (_b.label) {
|
|
5885
|
+
case 0:
|
|
5886
|
+
_b.trys.push([0, 3, , 4]);
|
|
5887
|
+
return [4 /*yield*/, lib.pathExists(folderPath)];
|
|
5888
|
+
case 1:
|
|
5889
|
+
exists = _b.sent();
|
|
5890
|
+
if (!exists)
|
|
5891
|
+
return [2 /*return*/, false];
|
|
5892
|
+
return [4 /*yield*/, lib.readdir(folderPath)];
|
|
5893
|
+
case 2:
|
|
5894
|
+
files = _b.sent();
|
|
5895
|
+
return [2 /*return*/, files.some(function (file) { return file.endsWith(".tsx") && !file.includes(".stories"); })];
|
|
5896
|
+
case 3:
|
|
5897
|
+
_b.sent();
|
|
5898
|
+
return [2 /*return*/, false];
|
|
5899
|
+
case 4: return [2 /*return*/];
|
|
5900
|
+
}
|
|
5901
|
+
});
|
|
5902
|
+
}); };
|
|
5903
|
+
getFilesInFolder = function (folderPath) { return __awaiter(_this, void 0, void 0, function () {
|
|
5904
|
+
var files;
|
|
5905
|
+
return __generator(this, function (_b) {
|
|
5906
|
+
switch (_b.label) {
|
|
5907
|
+
case 0:
|
|
5908
|
+
_b.trys.push([0, 2, , 3]);
|
|
5909
|
+
return [4 /*yield*/, lib.readdir(folderPath)];
|
|
5910
|
+
case 1:
|
|
5911
|
+
files = _b.sent();
|
|
5912
|
+
return [2 /*return*/, files.filter(function (file) { return file.endsWith(".tsx") && !file.includes(".stories"); }).map(function (file) { return file.replace(".tsx", ""); })];
|
|
5913
|
+
case 2:
|
|
5914
|
+
_b.sent();
|
|
5915
|
+
return [2 /*return*/, []];
|
|
5916
|
+
case 3: return [2 /*return*/];
|
|
5917
|
+
}
|
|
5918
|
+
});
|
|
5919
|
+
}); };
|
|
5920
|
+
mainExports = [];
|
|
5921
|
+
return [4 /*yield*/, folderExists(path$d.join(componentsDir, "ui"))];
|
|
5922
|
+
case 2:
|
|
5923
|
+
if (_a.sent()) {
|
|
5924
|
+
mainExports.push("export * from './ui';");
|
|
5925
|
+
}
|
|
5926
|
+
return [4 /*yield*/, folderExists(path$d.join(componentsDir, "modals"))];
|
|
5927
|
+
case 3:
|
|
5928
|
+
if (_a.sent()) {
|
|
5929
|
+
mainExports.push("export * from './modals';");
|
|
5930
|
+
}
|
|
5931
|
+
return [4 /*yield*/, folderExists(path$d.join(componentsDir, "icons"))];
|
|
5932
|
+
case 4:
|
|
5933
|
+
if (_a.sent()) {
|
|
5934
|
+
mainExports.push("export * from './icons';");
|
|
5935
|
+
}
|
|
5936
|
+
if (!(mainExports.length > 0)) return [3 /*break*/, 6];
|
|
5937
|
+
mainIndexContent = "// ONPE UI - Punto de entrada principal\n".concat(mainExports.join("\n"));
|
|
5938
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(componentsDir, "index.ts"), mainIndexContent)];
|
|
5939
|
+
case 5:
|
|
5940
|
+
_a.sent();
|
|
5941
|
+
_a.label = 6;
|
|
5942
|
+
case 6:
|
|
5943
|
+
uiPath = path$d.join(componentsDir, "ui");
|
|
5944
|
+
return [4 /*yield*/, folderExists(uiPath)];
|
|
5945
|
+
case 7:
|
|
5946
|
+
if (!_a.sent()) return [3 /*break*/, 10];
|
|
5947
|
+
return [4 /*yield*/, getFilesInFolder(uiPath)];
|
|
5948
|
+
case 8:
|
|
5949
|
+
uiFiles = _a.sent();
|
|
5950
|
+
if (!(uiFiles.length > 0)) return [3 /*break*/, 10];
|
|
5951
|
+
uiExports = uiFiles.map(function (file) { return "export * from './".concat(file, "';"); }).join("\n");
|
|
5952
|
+
uiIndexContent = "// Componentes b\u00E1sicos ONPE UI\n".concat(uiExports);
|
|
5953
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(uiPath, "index.ts"), uiIndexContent)];
|
|
5954
|
+
case 9:
|
|
5955
|
+
_a.sent();
|
|
5956
|
+
_a.label = 10;
|
|
5957
|
+
case 10:
|
|
5958
|
+
modalsPath = path$d.join(componentsDir, "modals");
|
|
5959
|
+
return [4 /*yield*/, folderExists(modalsPath)];
|
|
5960
|
+
case 11:
|
|
5961
|
+
if (!_a.sent()) return [3 /*break*/, 14];
|
|
5962
|
+
return [4 /*yield*/, getFilesInFolder(modalsPath)];
|
|
5963
|
+
case 12:
|
|
5964
|
+
modalFiles = _a.sent();
|
|
5965
|
+
if (!(modalFiles.length > 0)) return [3 /*break*/, 14];
|
|
5966
|
+
modalExports = modalFiles.map(function (file) { return "export * from './".concat(file, "';"); }).join("\n");
|
|
5967
|
+
modalsIndexContent = "// Modales especializados ONPE\n".concat(modalExports);
|
|
5968
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(modalsPath, "index.ts"), modalsIndexContent)];
|
|
5969
|
+
case 13:
|
|
5970
|
+
_a.sent();
|
|
5971
|
+
_a.label = 14;
|
|
5972
|
+
case 14:
|
|
5973
|
+
iconsPath = path$d.join(componentsDir, "icons");
|
|
5974
|
+
return [4 /*yield*/, folderExists(iconsPath)];
|
|
5975
|
+
case 15:
|
|
5976
|
+
if (!_a.sent()) return [3 /*break*/, 27];
|
|
5977
|
+
iconExports = [];
|
|
5978
|
+
return [4 /*yield*/, folderExists(path$d.join(iconsPath, "actions"))];
|
|
5979
|
+
case 16:
|
|
5980
|
+
if (_a.sent()) {
|
|
5981
|
+
iconExports.push("export * from './actions';");
|
|
5982
|
+
}
|
|
5983
|
+
return [4 /*yield*/, folderExists(path$d.join(iconsPath, "browsers"))];
|
|
5984
|
+
case 17:
|
|
5985
|
+
if (_a.sent()) {
|
|
5986
|
+
iconExports.push("export * from './browsers';");
|
|
5987
|
+
}
|
|
5988
|
+
return [4 /*yield*/, folderExists(path$d.join(iconsPath, "systems"))];
|
|
5989
|
+
case 18:
|
|
5990
|
+
if (_a.sent()) {
|
|
5991
|
+
iconExports.push("export * from './systems';");
|
|
5992
|
+
}
|
|
5993
|
+
return [4 /*yield*/, folderExists(path$d.join(iconsPath, "onpe"))];
|
|
5994
|
+
case 19:
|
|
5995
|
+
if (_a.sent()) {
|
|
5996
|
+
iconExports.push("export * from './onpe';");
|
|
5997
|
+
}
|
|
5998
|
+
if (!(iconExports.length > 0)) return [3 /*break*/, 21];
|
|
5999
|
+
iconsIndexContent = "// Iconos ONPE organizados por categor\u00EDas\n".concat(iconExports.join("\n"));
|
|
6000
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(iconsPath, "index.ts"), iconsIndexContent)];
|
|
6001
|
+
case 20:
|
|
6002
|
+
_a.sent();
|
|
6003
|
+
_a.label = 21;
|
|
6004
|
+
case 21:
|
|
6005
|
+
iconCategories = ["actions", "browsers", "systems", "onpe"];
|
|
6006
|
+
_i = 0, iconCategories_1 = iconCategories;
|
|
6007
|
+
_a.label = 22;
|
|
6008
|
+
case 22:
|
|
6009
|
+
if (!(_i < iconCategories_1.length)) return [3 /*break*/, 27];
|
|
6010
|
+
category = iconCategories_1[_i];
|
|
6011
|
+
categoryPath = path$d.join(iconsPath, category);
|
|
6012
|
+
return [4 /*yield*/, folderExists(categoryPath)];
|
|
6013
|
+
case 23:
|
|
6014
|
+
if (!_a.sent()) return [3 /*break*/, 26];
|
|
6015
|
+
return [4 /*yield*/, getFilesInFolder(categoryPath)];
|
|
6016
|
+
case 24:
|
|
6017
|
+
categoryFiles = _a.sent();
|
|
6018
|
+
if (!(categoryFiles.length > 0)) return [3 /*break*/, 26];
|
|
6019
|
+
categoryExports = categoryFiles.map(function (file) { return "export * from './".concat(file, "';"); }).join("\n");
|
|
6020
|
+
categoryIndexContent = "// Iconos de ".concat(category, "\n").concat(categoryExports);
|
|
6021
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(categoryPath, "index.ts"), categoryIndexContent)];
|
|
6022
|
+
case 25:
|
|
6023
|
+
_a.sent();
|
|
6024
|
+
_a.label = 26;
|
|
6025
|
+
case 26:
|
|
6026
|
+
_i++;
|
|
6027
|
+
return [3 /*break*/, 22];
|
|
6028
|
+
case 27:
|
|
6029
|
+
console.log("✅ Archivos de barril actualizados exitosamente!");
|
|
6030
|
+
console.log("📁 Solo se crearon archivos para carpetas que existen");
|
|
6031
|
+
return [2 /*return*/];
|
|
6032
|
+
}
|
|
6033
|
+
});
|
|
6034
|
+
});
|
|
6035
|
+
}
|
|
6036
|
+
/**
|
|
6037
|
+
* Crea archivos de barril solo para una carpeta específica
|
|
6038
|
+
*/
|
|
6039
|
+
function createBarrelForFolder(folderPath) {
|
|
6040
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6041
|
+
var exists, files, componentFiles, exports_1, indexContent, error_1;
|
|
6042
|
+
return __generator(this, function (_a) {
|
|
6043
|
+
switch (_a.label) {
|
|
6044
|
+
case 0:
|
|
6045
|
+
_a.trys.push([0, 4, , 5]);
|
|
6046
|
+
return [4 /*yield*/, lib.pathExists(folderPath)];
|
|
6047
|
+
case 1:
|
|
6048
|
+
exists = _a.sent();
|
|
6049
|
+
if (!exists)
|
|
6050
|
+
return [2 /*return*/];
|
|
6051
|
+
return [4 /*yield*/, lib.readdir(folderPath)];
|
|
6052
|
+
case 2:
|
|
6053
|
+
files = _a.sent();
|
|
6054
|
+
componentFiles = files.filter(function (file) { return file.endsWith(".tsx") && !file.includes(".stories"); }).map(function (file) { return file.replace(".tsx", ""); });
|
|
6055
|
+
if (componentFiles.length === 0)
|
|
6056
|
+
return [2 /*return*/];
|
|
6057
|
+
exports_1 = componentFiles.map(function (file) { return "export * from './".concat(file, "';"); }).join("\n");
|
|
6058
|
+
indexContent = "// Componentes en esta carpeta\n".concat(exports_1);
|
|
6059
|
+
return [4 /*yield*/, lib.writeFile(path$d.join(folderPath, "index.ts"), indexContent)];
|
|
6060
|
+
case 3:
|
|
6061
|
+
_a.sent();
|
|
6062
|
+
console.log("\u2705 Archivo de barril creado para: ".concat(path$d.basename(folderPath)));
|
|
6063
|
+
return [3 /*break*/, 5];
|
|
6064
|
+
case 4:
|
|
6065
|
+
error_1 = _a.sent();
|
|
6066
|
+
console.warn("\u26A0\uFE0F No se pudo crear el archivo de barril: ".concat(error_1.message));
|
|
6067
|
+
return [3 /*break*/, 5];
|
|
6068
|
+
case 5: return [2 /*return*/];
|
|
6069
|
+
}
|
|
6070
|
+
});
|
|
6071
|
+
});
|
|
6072
|
+
}
|
|
6073
|
+
|
|
5864
6074
|
var COMPONENTS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/components";
|
|
5865
6075
|
var ICONS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/icons";
|
|
5866
6076
|
function addComponent(componentName) {
|
|
5867
6077
|
return __awaiter(this, void 0, void 0, function () {
|
|
5868
|
-
var isIcon, isModalComponent, componentPath, iconCategory, componentDependencies, availableComponents, availableIcons, componentFile, availableItems, dependencies, _i, dependencies_1, dependency, depError_1, downloadUrl, response, componentCode, personalizedCode, fileName, filePath,
|
|
6078
|
+
var isIcon, isModalComponent, componentPath, iconCategory, componentDependencies, availableComponents, availableIcons, componentFile, availableItems, dependencies, _i, dependencies_1, dependency, depError_1, downloadUrl, response, componentCode, personalizedCode, fileName, filePath, barrelError_1, componentNamePascal, iconCategory, dependencies, error_1;
|
|
5869
6079
|
return __generator(this, function (_a) {
|
|
5870
6080
|
switch (_a.label) {
|
|
5871
6081
|
case 0:
|
|
@@ -5873,15 +6083,15 @@ function addComponent(componentName) {
|
|
|
5873
6083
|
isModalComponent = componentName.toLowerCase().startsWith("modal") && componentName !== "modal";
|
|
5874
6084
|
if (isIcon) {
|
|
5875
6085
|
iconCategory = getIconCategory(componentName);
|
|
5876
|
-
componentPath =
|
|
6086
|
+
componentPath = path$d.join(process.cwd(), "src", "components", "onpe", "icons", iconCategory);
|
|
5877
6087
|
}
|
|
5878
6088
|
else if (isModalComponent) {
|
|
5879
|
-
// Los modales específicos van en src/components/onpe
|
|
5880
|
-
componentPath =
|
|
6089
|
+
// Los modales específicos van en src/components/onpe/modals/
|
|
6090
|
+
componentPath = path$d.join(process.cwd(), "src", "components", "onpe", "modals");
|
|
5881
6091
|
}
|
|
5882
6092
|
else {
|
|
5883
|
-
// Los componentes básicos (incluyendo Modal base) van en src/components/onpe
|
|
5884
|
-
componentPath =
|
|
6093
|
+
// Los componentes básicos (incluyendo Modal base) van en src/components/onpe/ui/
|
|
6094
|
+
componentPath = path$d.join(process.cwd(), "src", "components", "onpe", "ui");
|
|
5885
6095
|
}
|
|
5886
6096
|
// Crear directorio si no existe
|
|
5887
6097
|
return [4 /*yield*/, lib.ensureDir(componentPath)];
|
|
@@ -5936,7 +6146,7 @@ function addComponent(componentName) {
|
|
|
5936
6146
|
}
|
|
5937
6147
|
_a.label = 2;
|
|
5938
6148
|
case 2:
|
|
5939
|
-
_a.trys.push([2,
|
|
6149
|
+
_a.trys.push([2, 17, , 18]);
|
|
5940
6150
|
if (!(!isIcon && componentDependencies[componentName.toLowerCase()])) return [3 /*break*/, 8];
|
|
5941
6151
|
dependencies = componentDependencies[componentName.toLowerCase()];
|
|
5942
6152
|
console.log("\uD83D\uDD17 Instalando dependencias: ".concat(dependencies.join(", ")));
|
|
@@ -5972,30 +6182,60 @@ function addComponent(componentName) {
|
|
|
5972
6182
|
componentCode = _a.sent();
|
|
5973
6183
|
personalizedCode = personalizeComponent(componentCode, componentName);
|
|
5974
6184
|
fileName = "".concat(convertToPascalCase(componentName), ".tsx");
|
|
5975
|
-
filePath =
|
|
6185
|
+
filePath = path$d.join(componentPath, fileName);
|
|
5976
6186
|
return [4 /*yield*/, lib.writeFile(filePath, personalizedCode)];
|
|
5977
6187
|
case 11:
|
|
5978
6188
|
_a.sent();
|
|
5979
6189
|
console.log("\uD83D\uDCC1 ".concat(isIcon ? "Icono" : "Componente", " guardado en: ").concat(filePath));
|
|
6190
|
+
_a.label = 12;
|
|
6191
|
+
case 12:
|
|
6192
|
+
_a.trys.push([12, 15, , 16]);
|
|
6193
|
+
return [4 /*yield*/, createBarrelForFolder(componentPath)];
|
|
6194
|
+
case 13:
|
|
6195
|
+
_a.sent();
|
|
6196
|
+
// También actualizar el archivo de barril principal si existe
|
|
6197
|
+
return [4 /*yield*/, createBarrelFiles()];
|
|
6198
|
+
case 14:
|
|
6199
|
+
// También actualizar el archivo de barril principal si existe
|
|
6200
|
+
_a.sent();
|
|
6201
|
+
return [3 /*break*/, 16];
|
|
6202
|
+
case 15:
|
|
6203
|
+
barrelError_1 = _a.sent();
|
|
6204
|
+
console.warn("\u26A0\uFE0F No se pudieron actualizar los archivos de barril: ".concat(barrelError_1.message));
|
|
6205
|
+
return [3 /*break*/, 16];
|
|
6206
|
+
case 16:
|
|
5980
6207
|
// Mostrar instrucciones
|
|
5981
6208
|
console.log("\n📋 Próximos pasos:");
|
|
5982
6209
|
console.log("1. Importa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
5983
6210
|
componentNamePascal = convertToPascalCase(componentName);
|
|
5984
|
-
|
|
6211
|
+
// Mostrar opciones de importación
|
|
5985
6212
|
if (isIcon) {
|
|
5986
6213
|
iconCategory = getIconCategory(componentName);
|
|
5987
|
-
|
|
6214
|
+
console.log(" // Opci\u00F3n 1: Importaci\u00F3n directa");
|
|
6215
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/icons/").concat(iconCategory, "/").concat(componentNamePascal, "';"));
|
|
6216
|
+
console.log(" // Opci\u00F3n 2: Importaci\u00F3n con barril (recomendado)");
|
|
6217
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/icons/").concat(iconCategory, "';"));
|
|
6218
|
+
console.log(" // Opci\u00F3n 3: Importaci\u00F3n desde ra\u00EDz");
|
|
6219
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe';"));
|
|
5988
6220
|
}
|
|
5989
6221
|
else {
|
|
5990
|
-
// Los componentes van en onpe-modals o onpe-ui
|
|
5991
6222
|
if (componentName.toLowerCase().startsWith("modal") && componentName !== "modal") {
|
|
5992
|
-
|
|
6223
|
+
console.log(" // Opci\u00F3n 1: Importaci\u00F3n directa");
|
|
6224
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/modals/").concat(componentNamePascal, "';"));
|
|
6225
|
+
console.log(" // Opci\u00F3n 2: Importaci\u00F3n con barril (recomendado)");
|
|
6226
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/modals';"));
|
|
6227
|
+
console.log(" // Opci\u00F3n 3: Importaci\u00F3n desde ra\u00EDz");
|
|
6228
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe';"));
|
|
5993
6229
|
}
|
|
5994
6230
|
else {
|
|
5995
|
-
|
|
6231
|
+
console.log(" // Opci\u00F3n 1: Importaci\u00F3n directa");
|
|
6232
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/ui/").concat(componentNamePascal, "';"));
|
|
6233
|
+
console.log(" // Opci\u00F3n 2: Importaci\u00F3n con barril (recomendado)");
|
|
6234
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe/ui';"));
|
|
6235
|
+
console.log(" // Opci\u00F3n 3: Importaci\u00F3n desde ra\u00EDz");
|
|
6236
|
+
console.log(" import { ".concat(componentNamePascal, " } from '../onpe';"));
|
|
5996
6237
|
}
|
|
5997
6238
|
}
|
|
5998
|
-
console.log(" import { ".concat(componentNamePascal, " } from '").concat(importPath, "'"));
|
|
5999
6239
|
// Mostrar dependencias si las hay
|
|
6000
6240
|
if (!isIcon && componentDependencies[componentName.toLowerCase()]) {
|
|
6001
6241
|
dependencies = componentDependencies[componentName.toLowerCase()];
|
|
@@ -6021,11 +6261,11 @@ function addComponent(componentName) {
|
|
|
6021
6261
|
console.log("2. Usa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
6022
6262
|
}
|
|
6023
6263
|
console.log(" <".concat(componentNamePascal, " />"));
|
|
6024
|
-
return [3 /*break*/,
|
|
6025
|
-
case
|
|
6264
|
+
return [3 /*break*/, 18];
|
|
6265
|
+
case 17:
|
|
6026
6266
|
error_1 = _a.sent();
|
|
6027
6267
|
throw new Error("Error al instalar el ".concat(isIcon ? "icono" : "componente", ": ").concat(error_1.message));
|
|
6028
|
-
case
|
|
6268
|
+
case 18: return [2 /*return*/];
|
|
6029
6269
|
}
|
|
6030
6270
|
});
|
|
6031
6271
|
});
|
|
@@ -6070,41 +6310,44 @@ function convertToPascalCase(name) {
|
|
|
6070
6310
|
}
|
|
6071
6311
|
function personalizeComponent(code, componentName) {
|
|
6072
6312
|
var componentNamePascal = convertToPascalCase(componentName);
|
|
6073
|
-
// Mapeo de componentes y sus ubicaciones reales
|
|
6313
|
+
// Mapeo de componentes y sus ubicaciones reales - NUEVA ESTRUCTURA
|
|
6074
6314
|
var componentPaths = {
|
|
6075
|
-
// Componentes básicos
|
|
6076
|
-
Button: "../onpe
|
|
6077
|
-
Overlay: "../onpe
|
|
6078
|
-
Portal: "../onpe
|
|
6079
|
-
Show: "../onpe
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
ModalConfirm: "../onpe
|
|
6083
|
-
ModalLoading: "../onpe
|
|
6084
|
-
ModalBrowserIncompatible: "../onpe
|
|
6085
|
-
ModalSystemIncompatible: "../onpe
|
|
6086
|
-
// Iconos
|
|
6087
|
-
// Iconos organizados por categorías
|
|
6315
|
+
// Componentes básicos - van en onpe/ui/
|
|
6316
|
+
Button: "../onpe/ui/Button",
|
|
6317
|
+
Overlay: "../onpe/ui/Overlay",
|
|
6318
|
+
Portal: "../onpe/ui/Portal",
|
|
6319
|
+
Show: "../onpe/ui/Show",
|
|
6320
|
+
Modal: "../onpe/ui/Modal",
|
|
6321
|
+
// Modales especializados - van en onpe/modals/
|
|
6322
|
+
ModalConfirm: "../onpe/modals/ModalConfirm",
|
|
6323
|
+
ModalLoading: "../onpe/modals/ModalLoading",
|
|
6324
|
+
ModalBrowserIncompatible: "../onpe/modals/ModalBrowserIncompatible",
|
|
6325
|
+
ModalSystemIncompatible: "../onpe/modals/ModalSystemIncompatible",
|
|
6326
|
+
// Iconos - organizados por categorías en onpe/icons/
|
|
6088
6327
|
// Actions
|
|
6089
|
-
IconCheck: "../onpe
|
|
6090
|
-
IconClose: "../onpe
|
|
6091
|
-
IconWarning: "../onpe
|
|
6092
|
-
IconSpinnerDesktop: "../onpe
|
|
6093
|
-
IconSpinnerMobile: "../onpe
|
|
6094
|
-
IconHome: "../onpe
|
|
6328
|
+
IconCheck: "../onpe/icons/actions/IconCheck",
|
|
6329
|
+
IconClose: "../onpe/icons/actions/IconClose",
|
|
6330
|
+
IconWarning: "../onpe/icons/actions/IconWarning",
|
|
6331
|
+
IconSpinnerDesktop: "../onpe/icons/actions/IconSpinnerDesktop",
|
|
6332
|
+
IconSpinnerMobile: "../onpe/icons/actions/IconSpinnerMobile",
|
|
6333
|
+
IconHome: "../onpe/icons/actions/IconHome",
|
|
6095
6334
|
// Browsers
|
|
6096
|
-
IconChrome: "../onpe
|
|
6097
|
-
IconChromeColor: "../onpe
|
|
6098
|
-
IconEdge: "../onpe
|
|
6099
|
-
IconEdgeColor: "../onpe
|
|
6100
|
-
IconMozilla: "../onpe
|
|
6101
|
-
IconMozillaColor: "../onpe
|
|
6102
|
-
IconSafari: "../onpe
|
|
6103
|
-
IconSafariColor: "../onpe
|
|
6335
|
+
IconChrome: "../onpe/icons/browsers/IconChrome",
|
|
6336
|
+
IconChromeColor: "../onpe/icons/browsers/IconChromeColor",
|
|
6337
|
+
IconEdge: "../onpe/icons/browsers/IconEdge",
|
|
6338
|
+
IconEdgeColor: "../onpe/icons/browsers/IconEdgeColor",
|
|
6339
|
+
IconMozilla: "../onpe/icons/browsers/IconMozilla",
|
|
6340
|
+
IconMozillaColor: "../onpe/icons/browsers/IconMozillaColor",
|
|
6341
|
+
IconSafari: "../onpe/icons/browsers/IconSafari",
|
|
6342
|
+
IconSafariColor: "../onpe/icons/browsers/IconSafariColor",
|
|
6104
6343
|
// Systems
|
|
6105
|
-
IconAndroid: "../onpe
|
|
6106
|
-
IconApple: "../onpe
|
|
6107
|
-
IconWindow: "../onpe
|
|
6344
|
+
IconAndroid: "../onpe/icons/systems/IconAndroid",
|
|
6345
|
+
IconApple: "../onpe/icons/systems/IconApple",
|
|
6346
|
+
IconWindow: "../onpe/icons/systems/IconWindow",
|
|
6347
|
+
// ONPE
|
|
6348
|
+
IconVotoDigital: "../onpe/icons/onpe/IconVotoDigital",
|
|
6349
|
+
IconElectionsGeneral: "../onpe/icons/onpe/IconElectionsGeneral",
|
|
6350
|
+
IconElections: "../onpe/icons/onpe/IconElections",
|
|
6108
6351
|
};
|
|
6109
6352
|
// Reemplazar las rutas de importación
|
|
6110
6353
|
var personalizedCode = code;
|
|
@@ -6172,5 +6415,30 @@ program
|
|
|
6172
6415
|
}
|
|
6173
6416
|
});
|
|
6174
6417
|
}); });
|
|
6418
|
+
program
|
|
6419
|
+
.command("init")
|
|
6420
|
+
.description("Crear la estructura inicial de carpetas y archivos de barril")
|
|
6421
|
+
.action(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6422
|
+
var error_2;
|
|
6423
|
+
return __generator(this, function (_a) {
|
|
6424
|
+
switch (_a.label) {
|
|
6425
|
+
case 0:
|
|
6426
|
+
_a.trys.push([0, 2, , 3]);
|
|
6427
|
+
console.log("\uD83D\uDE80 Creando estructura inicial de ONPE UI...");
|
|
6428
|
+
return [4 /*yield*/, createBarrelFiles()];
|
|
6429
|
+
case 1:
|
|
6430
|
+
_a.sent();
|
|
6431
|
+
console.log("\u2705 Estructura inicial creada exitosamente!");
|
|
6432
|
+
console.log("\uD83D\uDCC1 Estructura creada en: src/components/onpe/");
|
|
6433
|
+
return [3 /*break*/, 3];
|
|
6434
|
+
case 2:
|
|
6435
|
+
error_2 = _a.sent();
|
|
6436
|
+
console.error("\u274C Error: ".concat(error_2));
|
|
6437
|
+
process.exit(1);
|
|
6438
|
+
return [3 /*break*/, 3];
|
|
6439
|
+
case 3: return [2 /*return*/];
|
|
6440
|
+
}
|
|
6441
|
+
});
|
|
6442
|
+
}); });
|
|
6175
6443
|
program.parse();
|
|
6176
6444
|
//# sourceMappingURL=cli.esm.js.map
|