vanilla-jet 1.3.1 → 1.4.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.
@@ -5,38 +5,45 @@ on:
5
5
  branches:
6
6
  - main
7
7
 
8
+ permissions:
9
+ id-token: write
10
+ contents: write
11
+
8
12
  jobs:
9
13
  release:
10
14
  name: Publish
11
15
  runs-on: ubuntu-latest
12
- environment: rep
13
16
 
14
17
  steps:
15
18
  - name: Check out the repository
16
- uses: actions/checkout@v3
19
+ uses: actions/checkout@v4
17
20
 
18
21
  - name: Setup Node.js
19
- uses: actions/setup-node@v3
22
+ uses: actions/setup-node@v4
20
23
  with:
21
- node-version: '16'
22
- registry-url: 'https://registry.npmjs.org/'
24
+ node-version: '24'
25
+ registry-url: 'https://registry.npmjs.org'
23
26
 
24
27
  - name: Install dependencies
25
- run: npm install
28
+ run: npm ci
29
+
30
+ - name: Build
31
+ run: npm run build --if-present
32
+
33
+ - name: Test
34
+ run: npm test
26
35
 
27
36
  - name: Publish to npm
28
- env:
29
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30
37
  run: npm publish
31
38
 
32
39
  - name: Configure git identity
33
40
  run: |
34
- git config --global user.email "actions@github.com"
35
- git config --global user.name "GitHub Actions"
41
+ git config user.email "actions@github.com"
42
+ git config user.name "GitHub Actions"
36
43
 
37
44
  - name: Get version from package.json
38
45
  id: get_version
39
- run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
46
+ run: echo "version=$(node -p 'require(\"./package.json\").version')" >> "$GITHUB_OUTPUT"
40
47
 
41
48
  - name: Check if tag exists
42
49
  run: |
@@ -10,18 +10,9 @@ let Functions = require('../framework/functions.js');
10
10
  let Dipper = require('../framework/dipper.js');
11
11
  let Config = require(processCwd() + '/config.js');
12
12
 
13
- // -- Get environment
14
- let env = process.argv[2] || 'development';
15
- if (env === 'dev') { env = 'development'; }
16
- if (env === 'build:qa') { env = 'qa'; }
17
- if (env === 'build:staging') { env = 'staging'; }
18
- if (env === 'build:prod') { env = 'production'; }
19
-
20
13
  // -- Init Dipper
21
14
  let settings = Config.settings;
22
- settings['shared']['environment'] = env;
23
-
24
- let opts = settings[env] || {},
15
+ let opts = settings['profile'] || {},
25
16
  shared = settings['shared'] || {};
26
17
  const dipper = new Dipper(opts, shared);
27
18
 
@@ -0,0 +1,36 @@
1
+ const path = require('path');
2
+ const { spawnSync } = require('child_process');
3
+
4
+ function resolveConsumerRoot() {
5
+ return process.cwd()
6
+ .replace('/node_modules/vanilla-jet', '')
7
+ .replace('/.scripts', '')
8
+ .replace('/.grunt', '');
9
+ }
10
+
11
+ function main() {
12
+ const action = process.argv[2] || 'dev';
13
+ const viteCommand = action === 'build' ? 'build' : 'serve';
14
+ const packageRoot = path.resolve(__dirname, '..');
15
+ const consumerRoot = resolveConsumerRoot();
16
+ const vitePackageJson = require.resolve('vite/package.json', { paths: [packageRoot] });
17
+ const viteBin = path.join(path.dirname(vitePackageJson), 'bin/vite.js');
18
+ const configFile = path.join(packageRoot, 'vite.config.js');
19
+
20
+ const args = [viteBin, viteCommand, '--config', configFile];
21
+ if (viteCommand === 'serve') {
22
+ args.push('--host');
23
+ }
24
+
25
+ const result = spawnSync(process.execPath, args, {
26
+ stdio: 'inherit',
27
+ cwd: consumerRoot,
28
+ env: Object.assign({}, process.env, {
29
+ VANILLAJET_PACKAGE_ROOT: packageRoot
30
+ })
31
+ });
32
+
33
+ process.exit(typeof result.status === 'number' ? result.status : 1);
34
+ }
35
+
36
+ main();
package/CHANGELOG.md ADDED
@@ -0,0 +1,95 @@
1
+ # Changelog
2
+
3
+ All notable project changes are documented in this file.
4
+
5
+ The format follows a structure inspired by Keep a Changelog and semantic versioning.
6
+
7
+ ## [1.4.0] - 2026-02-19
8
+
9
+ ### Highlights
10
+
11
+ - Added `dev:vite` and `build:vite` scripts to introduce a Vite-first JS/LESS pipeline without removing legacy Gulp commands.
12
+ - Added `vite.config.js` and `.scripts/run_vite.js` to support consumer-root execution, compatibility output in `public/`, and a dev helper route (`/__vanillajet__/`).
13
+ - Added CLI support in `bin.js` for `npx vanilla-jet dev:vite` and `npx vanilla-jet build:vite`.
14
+ - Updated `README.md` to document legacy vs modern workflows for HU 2.1.
15
+
16
+ ## [1.3.6] - 2026-02-19
17
+
18
+ ### Highlights (v1.3.6)
19
+
20
+ - Fixed protected directory typo in `framework/router.js`: `node_mudules` -> `node_modules`.
21
+ - Fixed stability issues in `framework/dipper.js`:
22
+ - `includeAnimations()` now calls the existing `includeAnimation()`.
23
+ - `dequeueStyle()` and `dequeueScript()` now read `item.requires` correctly.
24
+ - Dependency dequeue now runs only when explicitly requested (`dependencies === true`).
25
+ - Fixed `package.json` recursive `test` script to avoid infinite loop and keep `npm test` stable.
26
+ - Completed HU 1.4 hardening milestone and updated roadmap tracking.
27
+
28
+ ### Compatibility notes (v1.3.6)
29
+
30
+ - No public API changes.
31
+ - No route contract changes.
32
+ - This patch only hardens runtime behavior and developer workflow reliability.
33
+
34
+ ## [1.3.5] - 2026-02-19
35
+
36
+ ### Highlights (v1.3.5)
37
+
38
+ - Added safe precompressed fallback in `response.render()` for HTML templates: `.br` (when enabled and accepted) -> `.gz` (when accepted) -> original HTML.
39
+ - Wired `Response` to server profile options, so HTML negotiation follows `settings.profile.enable_precompressed_negotiation`.
40
+ - Added `Vary: Accept-Encoding` for negotiated HTML responses and support for `Accept-Encoding` quality params.
41
+ - Updated documentation and roadmap status for HU 1.3.
42
+
43
+ ## [1.3.4] - 2026-02-19
44
+
45
+ ### Highlights (v1.3.4)
46
+
47
+ - Added optional static precompressed negotiation flag: `settings.profile.enable_precompressed_negotiation`.
48
+ - Static files now resolve safely with fallback chain: `.br` (when enabled and accepted) -> `.gz` (when accepted) -> original file.
49
+ - Static compression negotiation now handles `Accept-Encoding` values with quality params (for example `gzip;q=1.0`).
50
+ - `Vary: Accept-Encoding` is set for negotiated static responses.
51
+
52
+ ## [1.3.3] - 2026-02-18
53
+
54
+ ### Added
55
+
56
+ - Static metadata in-memory cache in `framework/router.js` (`size`, `lastModified`, `etag`) to reduce repeated filesystem work.
57
+ - Conditional request handling for static files using `If-None-Match` and `If-Modified-Since`.
58
+ - Static response headers: `ETag`, `Last-Modified`, and `Cache-Control: no-cache, must-revalidate`.
59
+
60
+ ### Changed
61
+
62
+ - Static files can now return `304 Not Modified` when validators match, reducing transfer for repeated requests.
63
+ - Conditional requests force metadata refresh before deciding `304`, so clients can still see new content without hard reload.
64
+
65
+ ### Compatibility notes
66
+
67
+ - No route or filename contract changes.
68
+ - No impact on dynamic endpoints behavior.
69
+
70
+ ## [1.3.2] - 2026-02-18
71
+
72
+ ### Current documented state
73
+
74
+ - Released version `1.3.2` of `vanilla-jet`.
75
+ - The framework exports `Server` from `index.js` for simple integration in Node.js projects.
76
+ - Includes a Gulp-based build pipeline for:
77
+ - JavaScript minification and concatenation.
78
+ - LESS/CSS compilation and minification.
79
+ - HTML template compilation with Nunjucks.
80
+ - Generation of compressed `.gz` artifacts.
81
+ - Includes HTTP server and optional HTTPS server (self-managed certificates) in `framework/server.js`.
82
+ - Includes internal router with Backbone-style route support (`:param`, `*splat`, optional segments).
83
+ - Includes resource utilities (scripts, styles, meta tags, sentry, environment) in `framework/dipper.js`.
84
+
85
+ ### Compatibility note
86
+
87
+ - This version keeps the historical behavior expected by existing projects.
88
+ - Future improvements are planned with backward compatibility in mind. See `ROADMAP_INTEGRAL.md`.
89
+
90
+ [1.3.3]: https://github.com/nalancer08/VanillaJet/releases/tag/v1.3.3
91
+ [1.3.2]: https://github.com/nalancer08/VanillaJet/releases/tag/v1.3.2
92
+ [1.3.4]: https://github.com/nalancer08/VanillaJet/releases/tag/v1.3.4
93
+ [1.3.5]: https://github.com/nalancer08/VanillaJet/releases/tag/v1.3.5
94
+ [1.3.6]: https://github.com/nalancer08/VanillaJet/releases/tag/v1.3.6
95
+ [1.4.0]: https://github.com/nalancer08/VanillaJet/releases/tag/v1.4.0
package/README.md CHANGED
@@ -1,6 +1,144 @@
1
- <p align="center">
2
- <img src="https://github.com/nalancer08/App-Builders/blob/master/Logos/logo_monocromatico_horizontal_.png">
3
- </p>
4
-
5
1
  # VanillaJet
6
- NodeJS framework to create apps with jQuery or VueJS over a SPA (Single Page Application), the framework helps to create the server and add dependencia, includes router and server side functions as routes (internal API).
2
+
3
+ Node.js framework for building SPA applications with a JS/CSS/HTML build pipeline, HTTP/HTTPS server, internal router, and template rendering utilities.
4
+
5
+ ![VanillaJet logo](https://github.com/nalancer08/App-Builders/blob/master/Logos/logo_monocromatico_horizontal_.png)
6
+
7
+ ## Current version
8
+
9
+ - Version: `1.4.0`
10
+ - Changelog: see [`CHANGELOG.md`](./CHANGELOG.md)
11
+ - Improvement plan (performance and backward compatibility): see `ROADMAP_INTEGRAL.md`
12
+
13
+ ## Requirements
14
+
15
+ - Node.js `>=16` recommended
16
+ - npm `>=8`
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install vanilla-jet
22
+ ```
23
+
24
+ If you are working in this local repository:
25
+
26
+ ```bash
27
+ npm install
28
+ ```
29
+
30
+ ## Quick start
31
+
32
+ ### 1) Export the server from your project
33
+
34
+ ```js
35
+ const { Server } = require('vanilla-jet');
36
+ ```
37
+
38
+ ### 2) Define endpoints (classes)
39
+
40
+ Each endpoint should expose a `name` and register routes with the router in the constructor.
41
+
42
+ ```js
43
+ class AppEndpoint {
44
+ constructor(router) {
45
+ this.name = 'AppEndpoint';
46
+ router.addRoute('get', '/', 'AppEndpoint.index');
47
+ }
48
+
49
+ index(request, response) {
50
+ response.setBody('Hello VanillaJet');
51
+ response.respond();
52
+ }
53
+ }
54
+ ```
55
+
56
+ ### 3) Start the server
57
+
58
+ ```js
59
+ const { Server } = require('vanilla-jet');
60
+ const Config = require('./config');
61
+
62
+ new Server(Config, [AppEndpoint]).start();
63
+ ```
64
+
65
+ ## Available commands
66
+
67
+ From this repository:
68
+
69
+ - `npm run setup`: generates a base `vanillaJet.package.json` if it does not exist.
70
+ - `npm run dev`: legacy Gulp build + watcher for development.
71
+ - `npm run dev:vite`: modern Vite dev server for JS/LESS DX (keeps Nunjucks flow unchanged).
72
+ - `npm run build:vite`: modern Vite build for JS/LESS output in `public/`.
73
+ - `npm run build:qa`: build for QA.
74
+ - `npm run build:staging`: build for staging.
75
+ - `npm run build:prod`: build for production.
76
+
77
+ As CLI (`bin.js`):
78
+
79
+ - `npx vanilla-jet setup`
80
+ - `npx vanilla-jet dev`
81
+ - `npx vanilla-jet build`
82
+ - `npx vanilla-jet dev:vite`
83
+ - `npx vanilla-jet build:vite`
84
+
85
+ ## Legacy vs Vite mode
86
+
87
+ - Legacy (`npm run dev` / `npx vanilla-jet dev`):
88
+ - Keeps full historical Gulp pipeline (JS minify+concat, LESS, templates, gzip artifacts).
89
+ - Recommended when you need 100% historical behavior.
90
+ - Vite (`npm run dev:vite` / `npx vanilla-jet dev:vite`):
91
+ - Focuses on JS/LESS developer experience with faster feedback.
92
+ - Does not replace Nunjucks compilation in this stage (HU 2.1), so template flow remains legacy.
93
+ - Dev helper page: open `http://localhost:5173/__vanillajet__/` to load the Vite entry.
94
+ - Vite build (`npm run build:vite` / `npx vanilla-jet build:vite`):
95
+ - Generates `public/scripts/vanilla.min.js` and `public/styles/app.min.css`.
96
+ - Keeps existing legacy build commands available and unchanged.
97
+
98
+ ## Expected consumer project structure
99
+
100
+ VanillaJet expects a structure similar to:
101
+
102
+ - `assets/pages/home.html`
103
+ - `assets/templates/**/*.html`
104
+ - `assets/scripts/**/*.js`
105
+ - `assets/styles/less/admin.less`
106
+ - `public/` (compiled output)
107
+ - `config.js`
108
+ - `vanillaJet.package.json`
109
+
110
+ ## Build pipeline (summary)
111
+
112
+ - Minifies JS and concatenates into `public/scripts/vanilla.min.js`
113
+ - Compiles LESS and generates `public/styles/app.min.css`
114
+ - Compiles templates and generates `public/pages/home.html`
115
+ - Generates `.gz` versions of JS/CSS/HTML for compressed delivery
116
+
117
+ ## Compression negotiation (optional)
118
+
119
+ You can enable precompressed static negotiation from `settings.profile`:
120
+
121
+ ```js
122
+ module.exports = {
123
+ settings: {
124
+ profile: {
125
+ // Enables priority: .br -> .gz -> original file
126
+ enable_precompressed_negotiation: true
127
+ }
128
+ }
129
+ };
130
+ ```
131
+
132
+ Behavior details:
133
+
134
+ - Default (`false`): keeps existing gzip behavior for supported static assets.
135
+ - Enabled (`true`): if client accepts Brotli, server tries `.br` first.
136
+ - Safe fallback: if `.br` or `.gz` does not exist, server serves the original file.
137
+ - HTML rendering (`response.render`) also uses safe runtime fallback for precompressed templates (`.br`/`.gz`/original).
138
+
139
+ ## Additional documentation
140
+
141
+ - Router: `docs/router.md`
142
+ - Version history: [`CHANGELOG.md`](./CHANGELOG.md)
143
+ - Roadmap and improvements: `ROADMAP_INTEGRAL.md`
144
+ - Deployment templates (nginx + docker): `docs/deployment/`
@@ -0,0 +1,248 @@
1
+ # ROADMAP INTEGRAL - VanillaJet
2
+
3
+ Documento canonico de planeacion por epicas e historias.
4
+ Cada historia incluye su ciclo completo: fases, tareas, entregables, metricas, criterios y documentacion.
5
+
6
+ ## Objetivo
7
+
8
+ - Modernizar el framework con `Vite` como base de DX.
9
+ - Reducir dependencia de Node para servir frontend.
10
+ - Adoptar `nginx` y Docker al final, con evidencia y sin romper legacy.
11
+
12
+ ## Reglas de ejecucion
13
+
14
+ - Retrocompatibilidad primero.
15
+ - Cambios sensibles con flags.
16
+ - Todo cambio con medicion antes/despues.
17
+ - Entregas pequenas y reversibles.
18
+
19
+ ---
20
+
21
+ ## EPIC 1 - Estabilidad base
22
+
23
+ ### HU 1.1 - Cache metadata + 304 (completada `v1.3.3`)
24
+
25
+ #### Fases
26
+ - F1: cache metadata.
27
+ - F2: validacion condicional.
28
+ - F3: no-regresion.
29
+
30
+ #### Tareas
31
+ - Cache `size/mtime/etag`.
32
+ - Soporte `If-None-Match` y `If-Modified-Since`.
33
+
34
+ #### Entregables
35
+ - `framework/router.js` actualizado.
36
+
37
+ #### Metricas
38
+ - Menor latencia y menor I/O en estaticos repetidos.
39
+
40
+ #### Criterios
41
+ - `304` correcto.
42
+ - Sin impacto en dinamico.
43
+
44
+ #### Documentacion
45
+ - `CHANGELOG.md`.
46
+
47
+ ### HU 1.2 - Negociacion `br/gz` estaticos (completada `v1.3.4`)
48
+
49
+ #### Fases
50
+ - F1: flag opt-in.
51
+ - F2: fallback seguro.
52
+ - F3: validacion.
53
+
54
+ #### Tareas
55
+ - `.br -> .gz -> original`.
56
+ - `Vary: Accept-Encoding`.
57
+
58
+ #### Entregables
59
+ - `framework/router.js`.
60
+
61
+ #### Metricas
62
+ - Menor transferencia en cliente.
63
+
64
+ #### Criterios
65
+ - Fallback sin 404.
66
+
67
+ #### Documentacion
68
+ - `README.md`, `CHANGELOG.md`.
69
+
70
+ ### HU 1.3 - Fallback precompressed HTML (completada `v1.3.5`)
71
+
72
+ #### Fases
73
+ - F1: fallback runtime HTML.
74
+ - F2: pruebas de ausencia de artefactos.
75
+ - F3: release.
76
+
77
+ #### Tareas
78
+ - Resolver `.br/.gz/original` en `render`.
79
+
80
+ #### Entregables
81
+ - `framework/response.js`.
82
+
83
+ #### Metricas
84
+ - Menor peso de HTML inicial.
85
+
86
+ #### Criterios
87
+ - Sin errores por artefactos faltantes.
88
+
89
+ #### Documentacion
90
+ - `README.md`, `CHANGELOG.md`.
91
+
92
+ ### HU 1.4 - Hardening de bugs conocidos (completada `v1.3.6`)
93
+
94
+ #### Fases
95
+ - F1: correccion.
96
+ - F2: smoke tests.
97
+ - F3: patch release.
98
+
99
+ #### Tareas
100
+ - [x] `node_mudules -> node_modules`.
101
+ - [x] fixes en `dipper`.
102
+ - [x] fix script `test`.
103
+
104
+ #### Entregables
105
+ - Patch de estabilidad.
106
+
107
+ #### Metricas
108
+ - Menos errores silenciosos en runtime/build.
109
+
110
+ #### Criterios
111
+ - [x] `npm test` estable.
112
+
113
+ #### Documentacion
114
+ - `CHANGELOG.md` con nota de compatibilidad.
115
+
116
+ ---
117
+
118
+ ## EPIC 2 - Vite first (foco actual)
119
+
120
+ ### HU 2.1 - `dev:vite` y `build:vite` sin romper legacy (completada `v1.4.0`)
121
+
122
+ #### Fases
123
+ - F1: baseline.
124
+ - F2: integrar scripts Vite.
125
+ - F3: coexistencia con legacy.
126
+ - F4: validacion en consumidor real.
127
+
128
+ #### Tareas
129
+ - [x] Config Vite (JS/LESS).
130
+ - [x] Mantener Nunjucks en esta etapa.
131
+ - [x] Documentar `dev` legacy vs `dev:vite`.
132
+
133
+ #### Entregables
134
+ - Config y scripts de Vite.
135
+
136
+ #### Metricas
137
+ - Arranque dev >= 40% mas rapido.
138
+ - Rebuild incremental >= 50% mas rapido.
139
+
140
+ #### Criterios
141
+ - HMR estable.
142
+ - Legacy intacto.
143
+
144
+ #### Documentacion
145
+ - `README.md` + `CHANGELOG.md`.
146
+
147
+ ### HU 2.2 - Node deja de servir frontend en modo moderno (pendiente)
148
+
149
+ #### Fases
150
+ - F1: contrato `legacy` vs `modern`.
151
+ - F2: flag de transicion.
152
+ - F3: validacion de compatibilidad.
153
+
154
+ #### Tareas
155
+ - Node solo API/dinamico en modo moderno.
156
+ - Frontend servido por Vite (dev) y luego Nginx (prod).
157
+
158
+ #### Entregables
159
+ - Contrato por entorno.
160
+
161
+ #### Metricas
162
+ - Menos carga de static serving en Node.
163
+
164
+ #### Criterios
165
+ - Modo moderno sin dependencia de `response.render()`.
166
+ - Modo legacy intacto.
167
+
168
+ #### Documentacion
169
+ - Guia de migracion de modo.
170
+
171
+ ---
172
+
173
+ ## EPIC 3 - Benchmark y decision gate
174
+
175
+ ### HU 3.1 - Go/No-Go de Nginx basado en datos (pendiente)
176
+
177
+ #### Fases
178
+ - F1: dise;o benchmark A/B.
179
+ - F2: ejecucion.
180
+ - F3: analisis.
181
+ - F4: decision.
182
+
183
+ #### Tareas
184
+ - Medir p50/p95/p99, throughput, CPU, memoria.
185
+ - Definir umbrales minimos de aprobacion.
186
+
187
+ #### Entregables
188
+ - Reporte benchmark.
189
+ - Decision log Go/No-Go.
190
+
191
+ #### Criterios
192
+ - Decision trazable con evidencia.
193
+
194
+ #### Documentacion
195
+ - Documento benchmark + resumen tecnico.
196
+
197
+ ---
198
+
199
+ ## EPIC 4 - Adopcion final de infraestructura
200
+
201
+ ### HU 4.1 - Nginx oficial para consumidores (pendiente)
202
+
203
+ #### Fases
204
+ - F1: template.
205
+ - F2: staging.
206
+ - F3: guia de operacion.
207
+
208
+ #### Tareas
209
+ - `try_files`, SPA fallback, proxy a Node, cache y precompressed.
210
+
211
+ #### Entregables
212
+ - Template y guia.
213
+
214
+ #### Documentacion
215
+ - `docs/deployment/` + `README.md`.
216
+
217
+ ### HU 4.2 - Docker de referencia (pendiente)
218
+
219
+ #### Fases
220
+ - F1: Dockerfile.
221
+ - F2: docker-compose.
222
+ - F3: validacion server.
223
+
224
+ #### Tareas
225
+ - Definir imagenes, puertos y variables.
226
+ - Documentar rollback.
227
+
228
+ #### Entregables
229
+ - Dockerfile y compose de referencia.
230
+
231
+ #### Documentacion
232
+ - `docs/deployment/` + `README.md`.
233
+
234
+ ---
235
+
236
+ ## Secuencia oficial de ejecucion
237
+
238
+ 1. HU 1.4
239
+ 2. HU 2.1
240
+ 3. HU 2.2
241
+ 4. HU 3.1
242
+ 5. HU 4.1
243
+ 6. HU 4.2
244
+
245
+ ## Estado global
246
+
247
+ - Completado: HU 1.1, HU 1.2, HU 1.3, HU 1.4, HU 2.1.
248
+ - Pendiente: HU 2.2, HU 3.1, HU 4.1, HU 4.2.
package/bin.js CHANGED
@@ -9,39 +9,39 @@ const generatePackagesJson = require(path.join(__dirname, './.scripts/generate_p
9
9
 
10
10
  switch (args[0]) {
11
11
 
12
- case 'setup':
13
- generatePackagesJson();
14
- break;
15
-
16
- case 'dev':
17
- try {
18
- execSync('npx gulp dev --env development', { stdio: 'inherit', cwd: __dirname });
19
- } catch (error) {
20
- console.error('Error ejecutando gulp:', error.message);
21
- }
22
- break;
23
-
24
- case 'build:qa':
25
- try {
26
- execSync('npx gulp build --env qa', { stdio: 'inherit', cwd: __dirname });
27
- } catch (error) {
28
- console.error('Error ejecutando gulp:', error.message);
29
- }
30
- break;
31
-
32
- case 'build:staging':
33
- try {
34
- execSync('npx gulp build --env staging', { stdio: 'inherit', cwd: __dirname });
35
- } catch (error) {
36
- console.error('Error ejecutando gulp:', error.message);
37
- }
38
- break;
39
-
40
- case 'build:prod':
41
- try {
42
- execSync('npx gulp build --env production', { stdio: 'inherit', cwd: __dirname });
43
- } catch (error) {
44
- console.error('Error ejecutando gulp:', error.message);
45
- }
46
- break;
12
+ case 'setup':
13
+ generatePackagesJson();
14
+ break;
15
+
16
+ case 'dev':
17
+ try {
18
+ execSync('npx gulp dev --env development', { stdio: 'inherit', cwd: __dirname });
19
+ } catch (error) {
20
+ console.error('Error executing gulp:', error.message);
21
+ }
22
+ break;
23
+
24
+ case 'build':
25
+ try {
26
+ execSync('npx gulp build', { stdio: 'inherit', cwd: __dirname });
27
+ } catch (error) {
28
+ console.error('Error executing gulp:', error.message);
29
+ }
30
+ break;
31
+
32
+ case 'dev:vite':
33
+ try {
34
+ execSync('node ./.scripts/run_vite.js dev', { stdio: 'inherit', cwd: __dirname });
35
+ } catch (error) {
36
+ console.error('Error executing Vite dev:', error.message);
37
+ }
38
+ break;
39
+
40
+ case 'build:vite':
41
+ try {
42
+ execSync('node ./.scripts/run_vite.js build', { stdio: 'inherit', cwd: __dirname });
43
+ } catch (error) {
44
+ console.error('Error executing Vite build:', error.message);
45
+ }
46
+ break;
47
47
  }
@@ -0,0 +1,19 @@
1
+ FROM node:20-alpine
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies first for better layer cache
6
+ COPY package*.json ./
7
+ RUN npm ci
8
+
9
+ # Copy app source
10
+ COPY . .
11
+
12
+ # Build command should generate static output under /app/public
13
+ # Replace with your app build script (for example: npm run build:vite)
14
+ RUN npm run build:vite || npm run build:prod
15
+
16
+ EXPOSE 8080
17
+
18
+ # Replace with your actual backend start command
19
+ CMD ["node", "index.js"]