g360-cli 1.6.0 → 1.6.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/package.json +1 -1
- package/src/commands/signature.js +25 -8
package/package.json
CHANGED
|
@@ -231,12 +231,29 @@ async function installFlet(targetDir, { force, mode, version, position }) {
|
|
|
231
231
|
footerCode = `\n # Firma G360\n page.add(g360_footer(${versionAttr.trim() ? versionAttr : ''}))\n`;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
if (!mainContent.includes('g360_signature')) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
if (!mainContent.includes('from core.components.g360_signature')) {
|
|
235
|
+
// Intentar agregar import despues de otros imports de core
|
|
236
|
+
const importRegex = /(from\s+core\.\w+.*\n)/;
|
|
237
|
+
if (importRegex.test(mainContent)) {
|
|
238
|
+
mainContent = mainContent.replace(importRegex, `$1${importLine}\n`);
|
|
239
|
+
} else {
|
|
240
|
+
// Si no hay imports de core, agregar despues del ultimo import
|
|
241
|
+
const lastImport = mainContent.lastIndexOf('import ');
|
|
242
|
+
if (lastImport !== -1) {
|
|
243
|
+
const endOfLine = mainContent.indexOf('\n', lastImport);
|
|
244
|
+
if (endOfLine !== -1) {
|
|
245
|
+
mainContent = mainContent.slice(0, endOfLine + 1) + importLine + '\n' + mainContent.slice(endOfLine + 1);
|
|
246
|
+
} else {
|
|
247
|
+
mainContent = mainContent + '\n' + importLine + '\n';
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
// Si no hay imports, agregar al inicio
|
|
251
|
+
mainContent = importLine + '\n\n' + mainContent;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
239
255
|
|
|
256
|
+
if (!mainContent.includes('g360_footer()') && !mainContent.includes('G360Signature')) {
|
|
240
257
|
if (mainContent.includes('page.add')) {
|
|
241
258
|
const lastAdd = mainContent.lastIndexOf('page.add');
|
|
242
259
|
const endOfLine = mainContent.indexOf('\n', lastAdd);
|
|
@@ -244,9 +261,9 @@ async function installFlet(targetDir, { force, mode, version, position }) {
|
|
|
244
261
|
} else {
|
|
245
262
|
mainContent += footerCode;
|
|
246
263
|
}
|
|
247
|
-
|
|
248
|
-
fs.writeFileSync(mainPyPath, mainContent, 'utf8');
|
|
249
|
-
console.log(chalk.gray(' main.py actualizado'));
|
|
250
264
|
}
|
|
265
|
+
|
|
266
|
+
fs.writeFileSync(mainPyPath, mainContent, 'utf8');
|
|
267
|
+
console.log(chalk.gray(' main.py actualizado'));
|
|
251
268
|
}
|
|
252
269
|
}
|