g360-cli 1.1.1 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "g360-cli",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "CLI tool for bootstrapping G360 ecosystem projects",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
@@ -17,6 +17,7 @@
17
17
  <!-- Firma G360 -->
18
18
  <g360-signature mode="powered" style="position: fixed; bottom: 16px; right: 16px; z-index: 100;"></g360-signature>
19
19
 
20
+ <script type="module" src="https://unpkg.com/g360-signature@1.0.0/index.js"></script>
20
21
  <script type="module" src="/app.js"></script>
21
22
  </body>
22
23
  </html>
package/src/cli.js CHANGED
@@ -12,6 +12,7 @@ import { clean } from './commands/clean.js';
12
12
  import { health } from './commands/health.js';
13
13
  import { update } from './commands/update.js';
14
14
  import { convert } from './commands/convert.js';
15
+ import { signature } from './commands/signature.js';
15
16
 
16
17
  const program = new Command();
17
18
 
@@ -96,4 +97,11 @@ program
96
97
  .option('--backup', 'Create backup before converting')
97
98
  .action(convert);
98
99
 
100
+ program
101
+ .command('signature')
102
+ .argument('<command>', 'Command to execute (install)')
103
+ .option('-p, --path <path>', 'Target project path', '.')
104
+ .option('--force', 'Force reinstall if already exists')
105
+ .action(signature);
106
+
99
107
  program.parse();
@@ -0,0 +1,51 @@
1
+ import chalk from 'chalk';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+
8
+ export async function signature(command, options) {
9
+ const { path: targetPath = '.', force = false } = options;
10
+
11
+ if (command === 'install') {
12
+ console.log(chalk.bold.cyan('\nšŸ”– Instalando g360-signature\n'));
13
+
14
+ const targetDir = path.resolve(process.cwd(), targetPath);
15
+ const indexHtmlPath = path.join(targetDir, 'index.html');
16
+
17
+ if (!fs.existsSync(indexHtmlPath)) {
18
+ console.error(chalk.red('āŒ No se encontro archivo index.html en el directorio actual'));
19
+ return;
20
+ }
21
+
22
+ let htmlContent = fs.readFileSync(indexHtmlPath, 'utf8');
23
+
24
+ // Verificar si ya esta instalado
25
+ if (htmlContent.includes('g360-signature') && !force) {
26
+ console.log(chalk.yellow('āš ļø g360-signature ya se encuentra instalado'));
27
+ console.log(chalk.gray('Usa --force para reinstalar'));
28
+ return;
29
+ }
30
+
31
+ // Agregar script CDN antes del cierre del body
32
+ const scriptTag = ' <script type="module" src="https://unpkg.com/g360-signature@latest/index.js"></script>';
33
+ const signatureComponent = `
34
+ <!-- Firma Oficial G360 -->
35
+ <g360-signature mode="powered" style="position: fixed; bottom: 16px; right: 16px; z-index: 99999;"></g360-signature>
36
+ `;
37
+
38
+ if (!htmlContent.includes(scriptTag)) {
39
+ htmlContent = htmlContent.replace('</body>', `${scriptTag}\n </body>`);
40
+ }
41
+
42
+ if (!htmlContent.includes('<g360-signature')) {
43
+ htmlContent = htmlContent.replace('</body>', `${signatureComponent}\n </body>`);
44
+ }
45
+
46
+ fs.writeFileSync(indexHtmlPath, htmlContent, 'utf8');
47
+
48
+ console.log(chalk.green('āœ… g360-signature instalado exitosamente!'));
49
+ console.log(chalk.gray('\nEl componente ha sido agregado en el pie de pagina de tu proyecto\n'));
50
+ }
51
+ }
@@ -1,6 +0,0 @@
1
- ' G360 VBA Excel Template
2
- ' Powered by G360 Ecosystem
3
-
4
- Sub G360_Main()
5
- MsgBox "G360 VBA initialized", vbInformation, "G360"
6
- End Sub
@@ -1,46 +0,0 @@
1
- ' ============================================================================
2
- ' G360 DataMap VBA
3
- ' ============================================================================
4
- ' Funciones de mapeo de campos para VBA Excel
5
- ' ============================================================================
6
-
7
- Option Explicit
8
-
9
- ' ============================================================================
10
- ' TIPOS
11
- ' ============================================================================
12
-
13
- Public Type G360FieldMap
14
- LocalName As String
15
- StandardName As String
16
- DataType As String
17
- End Type
18
-
19
- ' ============================================================================
20
- ' FUNCIONES DE MAPEO
21
- ' ============================================================================
22
-
23
- Public Function G360_NormalizeFieldName(fieldName As String, dominio As String) As String
24
- Dim normalized As String
25
- normalized = LCase(Replace(Replace(fieldName, "_", ""), " ", ""))
26
-
27
- Select Case normalized
28
- Case "codigo", "sku", "cod", "producto", "item"
29
- G360_NormalizeFieldName = "codigo"
30
- Case "nombre", "descripcion", "producto", "nombreproducto"
31
- G360_NormalizeFieldName = "nombre"
32
- Case "cantidad", "cant", "qty", "stock"
33
- G360_NormalizeFieldName = "cantidad"
34
- Case "precio", "tarifa", "monto", "valor", "importe"
35
- G360_NormalizeFieldName = "precio"
36
- Case "fecha", "fec", "date"
37
- G360_NormalizeFieldName = "fecha"
38
- Case Else
39
- G360_NormalizeFieldName = fieldName
40
- End Select
41
- End Function
42
-
43
- Public Function G360_MapRow(rowData As Object, dominio As String) As Object
44
- ' Placeholder para mapeo de fila completa
45
- Set G360_MapRow = rowData
46
- End Function
@@ -1,9 +0,0 @@
1
- {
2
- "proyecto": "vba-excel-template",
3
- "tipo": "vba-excel",
4
- "skill": "libre",
5
- "dominio": "operaciones",
6
- "version": "1.0.0",
7
- "autor": "Carlos Cusi",
8
- "descripcion": "Template base para macros VBA Excel con G360"
9
- }