@onpe/ui 1.0.32 → 1.0.34
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 +32 -11
- package/dist/cli.js +32 -11
- package/package.json +1 -1
package/dist/cli.esm.js
CHANGED
|
@@ -5862,13 +5862,15 @@ var lib = {
|
|
|
5862
5862
|
};
|
|
5863
5863
|
|
|
5864
5864
|
var COMPONENTS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/components";
|
|
5865
|
+
var ICONS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/icons";
|
|
5865
5866
|
function addComponent(componentName) {
|
|
5866
5867
|
return __awaiter(this, void 0, void 0, function () {
|
|
5867
|
-
var componentPath, availableComponents, componentFile, response, componentCode, personalizedCode, fileName, filePath, error_1;
|
|
5868
|
+
var isIcon, componentPath, availableComponents, availableIcons, componentFile, availableItems, downloadUrl, response, componentCode, personalizedCode, fileName, filePath, importPath, error_1;
|
|
5868
5869
|
return __generator(this, function (_a) {
|
|
5869
5870
|
switch (_a.label) {
|
|
5870
5871
|
case 0:
|
|
5871
|
-
|
|
5872
|
+
isIcon = componentName.toLowerCase().startsWith("icon-");
|
|
5873
|
+
componentPath = require$$1.join(process.cwd(), "src", "components", isIcon ? "onpe-icons" : "onpe-ui");
|
|
5872
5874
|
// Crear directorio si no existe
|
|
5873
5875
|
return [4 /*yield*/, lib.ensureDir(componentPath)];
|
|
5874
5876
|
case 1:
|
|
@@ -5881,14 +5883,32 @@ function addComponent(componentName) {
|
|
|
5881
5883
|
portal: "Portal/Portal.tsx",
|
|
5882
5884
|
show: "Show/Show.tsx",
|
|
5883
5885
|
};
|
|
5884
|
-
|
|
5886
|
+
availableIcons = {
|
|
5887
|
+
"icon-check": "Actions/IconCheck/IconCheck.tsx",
|
|
5888
|
+
"icon-close": "Actions/IconClose/IconClose.tsx",
|
|
5889
|
+
"icon-warning": "Actions/IconWarning/IconWarning.tsx",
|
|
5890
|
+
"icon-spinner-desktop": "Actions/IconSpinnerDesktop/IconSpinnerDesktop.tsx",
|
|
5891
|
+
"icon-spinner-mobile": "Actions/IconSpinnerMobile/IconSpinnerMobile.tsx",
|
|
5892
|
+
"icon-chrome": "Browsers/IconChrome/IconChrome.tsx",
|
|
5893
|
+
"icon-edge": "Browsers/IconEdge/IconEdge.tsx",
|
|
5894
|
+
"icon-mozilla": "Browsers/IconMozilla/IconMozilla.tsx",
|
|
5895
|
+
"icon-safari": "Browsers/IconSafari/IconSafari.tsx",
|
|
5896
|
+
"icon-elections": "ONPE/ElectionsIcon/ElectionsIcon.tsx",
|
|
5897
|
+
"icon-voto-digital": "ONPE/IconVotoDigital/IconVotoDigital.tsx",
|
|
5898
|
+
"icon-android": "OperatingSystems/IconAndroid/IconAndroid.tsx",
|
|
5899
|
+
"icon-apple": "OperatingSystems/IconApple/IconApple.tsx",
|
|
5900
|
+
"icon-window": "OperatingSystems/IconWindow/IconWindow.tsx",
|
|
5901
|
+
};
|
|
5902
|
+
componentFile = isIcon ? availableIcons[componentName.toLowerCase()] : availableComponents[componentName.toLowerCase()];
|
|
5885
5903
|
if (!componentFile) {
|
|
5886
|
-
|
|
5904
|
+
availableItems = isIcon ? Object.keys(availableIcons) : Object.keys(availableComponents);
|
|
5905
|
+
throw new Error("".concat(isIcon ? "Icono" : "Componente", " '").concat(componentName, "' no encontrado. ").concat(isIcon ? "Iconos" : "Componentes", " disponibles: ").concat(availableItems.join(", ")));
|
|
5887
5906
|
}
|
|
5888
5907
|
_a.label = 2;
|
|
5889
5908
|
case 2:
|
|
5890
5909
|
_a.trys.push([2, 6, , 7]);
|
|
5891
|
-
|
|
5910
|
+
downloadUrl = isIcon ? "".concat(ICONS_URL, "/").concat(componentFile) : "".concat(COMPONENTS_URL, "/").concat(componentFile);
|
|
5911
|
+
return [4 /*yield*/, fetch(downloadUrl)];
|
|
5892
5912
|
case 3:
|
|
5893
5913
|
response = _a.sent();
|
|
5894
5914
|
if (!response.ok) {
|
|
@@ -5903,17 +5923,18 @@ function addComponent(componentName) {
|
|
|
5903
5923
|
return [4 /*yield*/, lib.writeFile(filePath, personalizedCode)];
|
|
5904
5924
|
case 5:
|
|
5905
5925
|
_a.sent();
|
|
5906
|
-
console.log("\uD83D\uDCC1 Componente guardado en: ".concat(filePath));
|
|
5926
|
+
console.log("\uD83D\uDCC1 ".concat(isIcon ? "Icono" : "Componente", " guardado en: ").concat(filePath));
|
|
5907
5927
|
// Mostrar instrucciones
|
|
5908
5928
|
console.log("\n📋 Próximos pasos:");
|
|
5909
|
-
console.log("1. Importa el componente:");
|
|
5910
|
-
|
|
5911
|
-
console.log("
|
|
5929
|
+
console.log("1. Importa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
5930
|
+
importPath = isIcon ? "./components/onpe-icons/".concat(fileName.replace(".tsx", "")) : "./components/onpe-ui/".concat(fileName.replace(".tsx", ""));
|
|
5931
|
+
console.log(" import { ".concat(componentName.charAt(0).toUpperCase() + componentName.slice(1), " } from '").concat(importPath, "'"));
|
|
5932
|
+
console.log("2. Usa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
5912
5933
|
console.log(" <".concat(componentName.charAt(0).toUpperCase() + componentName.slice(1), " />"));
|
|
5913
5934
|
return [3 /*break*/, 7];
|
|
5914
5935
|
case 6:
|
|
5915
5936
|
error_1 = _a.sent();
|
|
5916
|
-
throw new Error("Error al instalar el componente: ".concat(error_1.message));
|
|
5937
|
+
throw new Error("Error al instalar el ".concat(isIcon ? "icono" : "componente", ": ").concat(error_1.message));
|
|
5917
5938
|
case 7: return [2 /*return*/];
|
|
5918
5939
|
}
|
|
5919
5940
|
});
|
|
@@ -5926,7 +5947,7 @@ function personalizeComponent(code, componentName) {
|
|
|
5926
5947
|
}
|
|
5927
5948
|
|
|
5928
5949
|
var program = new Command();
|
|
5929
|
-
program.name("onpe-ui").description("CLI para instalar componentes ONPE UI").version("1.0.
|
|
5950
|
+
program.name("onpe-ui").description("CLI para instalar componentes ONPE UI").version("1.0.33");
|
|
5930
5951
|
program
|
|
5931
5952
|
.command("add <component>")
|
|
5932
5953
|
.description("Agregar un componente ONPE UI al proyecto")
|
package/dist/cli.js
CHANGED
|
@@ -5862,13 +5862,15 @@ var lib = {
|
|
|
5862
5862
|
};
|
|
5863
5863
|
|
|
5864
5864
|
var COMPONENTS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/components";
|
|
5865
|
+
var ICONS_URL = "https://raw.githubusercontent.com/ricardosv46/onpe-ui/main/src/icons";
|
|
5865
5866
|
function addComponent(componentName) {
|
|
5866
5867
|
return __awaiter(this, void 0, void 0, function () {
|
|
5867
|
-
var componentPath, availableComponents, componentFile, response, componentCode, personalizedCode, fileName, filePath, error_1;
|
|
5868
|
+
var isIcon, componentPath, availableComponents, availableIcons, componentFile, availableItems, downloadUrl, response, componentCode, personalizedCode, fileName, filePath, importPath, error_1;
|
|
5868
5869
|
return __generator(this, function (_a) {
|
|
5869
5870
|
switch (_a.label) {
|
|
5870
5871
|
case 0:
|
|
5871
|
-
|
|
5872
|
+
isIcon = componentName.toLowerCase().startsWith("icon-");
|
|
5873
|
+
componentPath = require$$1.join(process.cwd(), "src", "components", isIcon ? "onpe-icons" : "onpe-ui");
|
|
5872
5874
|
// Crear directorio si no existe
|
|
5873
5875
|
return [4 /*yield*/, lib.ensureDir(componentPath)];
|
|
5874
5876
|
case 1:
|
|
@@ -5881,14 +5883,32 @@ function addComponent(componentName) {
|
|
|
5881
5883
|
portal: "Portal/Portal.tsx",
|
|
5882
5884
|
show: "Show/Show.tsx",
|
|
5883
5885
|
};
|
|
5884
|
-
|
|
5886
|
+
availableIcons = {
|
|
5887
|
+
"icon-check": "Actions/IconCheck/IconCheck.tsx",
|
|
5888
|
+
"icon-close": "Actions/IconClose/IconClose.tsx",
|
|
5889
|
+
"icon-warning": "Actions/IconWarning/IconWarning.tsx",
|
|
5890
|
+
"icon-spinner-desktop": "Actions/IconSpinnerDesktop/IconSpinnerDesktop.tsx",
|
|
5891
|
+
"icon-spinner-mobile": "Actions/IconSpinnerMobile/IconSpinnerMobile.tsx",
|
|
5892
|
+
"icon-chrome": "Browsers/IconChrome/IconChrome.tsx",
|
|
5893
|
+
"icon-edge": "Browsers/IconEdge/IconEdge.tsx",
|
|
5894
|
+
"icon-mozilla": "Browsers/IconMozilla/IconMozilla.tsx",
|
|
5895
|
+
"icon-safari": "Browsers/IconSafari/IconSafari.tsx",
|
|
5896
|
+
"icon-elections": "ONPE/ElectionsIcon/ElectionsIcon.tsx",
|
|
5897
|
+
"icon-voto-digital": "ONPE/IconVotoDigital/IconVotoDigital.tsx",
|
|
5898
|
+
"icon-android": "OperatingSystems/IconAndroid/IconAndroid.tsx",
|
|
5899
|
+
"icon-apple": "OperatingSystems/IconApple/IconApple.tsx",
|
|
5900
|
+
"icon-window": "OperatingSystems/IconWindow/IconWindow.tsx",
|
|
5901
|
+
};
|
|
5902
|
+
componentFile = isIcon ? availableIcons[componentName.toLowerCase()] : availableComponents[componentName.toLowerCase()];
|
|
5885
5903
|
if (!componentFile) {
|
|
5886
|
-
|
|
5904
|
+
availableItems = isIcon ? Object.keys(availableIcons) : Object.keys(availableComponents);
|
|
5905
|
+
throw new Error("".concat(isIcon ? "Icono" : "Componente", " '").concat(componentName, "' no encontrado. ").concat(isIcon ? "Iconos" : "Componentes", " disponibles: ").concat(availableItems.join(", ")));
|
|
5887
5906
|
}
|
|
5888
5907
|
_a.label = 2;
|
|
5889
5908
|
case 2:
|
|
5890
5909
|
_a.trys.push([2, 6, , 7]);
|
|
5891
|
-
|
|
5910
|
+
downloadUrl = isIcon ? "".concat(ICONS_URL, "/").concat(componentFile) : "".concat(COMPONENTS_URL, "/").concat(componentFile);
|
|
5911
|
+
return [4 /*yield*/, fetch(downloadUrl)];
|
|
5892
5912
|
case 3:
|
|
5893
5913
|
response = _a.sent();
|
|
5894
5914
|
if (!response.ok) {
|
|
@@ -5903,17 +5923,18 @@ function addComponent(componentName) {
|
|
|
5903
5923
|
return [4 /*yield*/, lib.writeFile(filePath, personalizedCode)];
|
|
5904
5924
|
case 5:
|
|
5905
5925
|
_a.sent();
|
|
5906
|
-
console.log("\uD83D\uDCC1 Componente guardado en: ".concat(filePath));
|
|
5926
|
+
console.log("\uD83D\uDCC1 ".concat(isIcon ? "Icono" : "Componente", " guardado en: ").concat(filePath));
|
|
5907
5927
|
// Mostrar instrucciones
|
|
5908
5928
|
console.log("\n📋 Próximos pasos:");
|
|
5909
|
-
console.log("1. Importa el componente:");
|
|
5910
|
-
|
|
5911
|
-
console.log("
|
|
5929
|
+
console.log("1. Importa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
5930
|
+
importPath = isIcon ? "./components/onpe-icons/".concat(fileName.replace(".tsx", "")) : "./components/onpe-ui/".concat(fileName.replace(".tsx", ""));
|
|
5931
|
+
console.log(" import { ".concat(componentName.charAt(0).toUpperCase() + componentName.slice(1), " } from '").concat(importPath, "'"));
|
|
5932
|
+
console.log("2. Usa el ".concat(isIcon ? "icono" : "componente", ":"));
|
|
5912
5933
|
console.log(" <".concat(componentName.charAt(0).toUpperCase() + componentName.slice(1), " />"));
|
|
5913
5934
|
return [3 /*break*/, 7];
|
|
5914
5935
|
case 6:
|
|
5915
5936
|
error_1 = _a.sent();
|
|
5916
|
-
throw new Error("Error al instalar el componente: ".concat(error_1.message));
|
|
5937
|
+
throw new Error("Error al instalar el ".concat(isIcon ? "icono" : "componente", ": ").concat(error_1.message));
|
|
5917
5938
|
case 7: return [2 /*return*/];
|
|
5918
5939
|
}
|
|
5919
5940
|
});
|
|
@@ -5926,7 +5947,7 @@ function personalizeComponent(code, componentName) {
|
|
|
5926
5947
|
}
|
|
5927
5948
|
|
|
5928
5949
|
var program = new Command();
|
|
5929
|
-
program.name("onpe-ui").description("CLI para instalar componentes ONPE UI").version("1.0.
|
|
5950
|
+
program.name("onpe-ui").description("CLI para instalar componentes ONPE UI").version("1.0.33");
|
|
5930
5951
|
program
|
|
5931
5952
|
.command("add <component>")
|
|
5932
5953
|
.description("Agregar un componente ONPE UI al proyecto")
|