@hiscovega/vundle 0.0.8 → 0.0.10
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/README.md +11 -225
- package/package.json +1 -1
- package/plugins/index.mjs +11 -11
- package/vite.config.mjs +7 -12
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @griddo/
|
|
1
|
+
# @griddo/vundler
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Griddo vite bundler configuration for Griddo Instance projects.
|
|
4
4
|
|
|
5
5
|
## 📦 Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @hiscovega/vundle # at @hiscovega org for the beta testing
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## 🚀 Publishing
|
|
@@ -14,237 +14,23 @@ npm install @griddo/bundler
|
|
|
14
14
|
|
|
15
15
|
This package uses [release-it](https://github.com/release-it/release-it) for automated versioning and publishing.
|
|
16
16
|
|
|
17
|
-
#### Prerequisites
|
|
18
|
-
|
|
19
|
-
1. **NPM Token**: Ensure you have an NPM token with publish permissions
|
|
20
|
-
2. **GitHub Token**: For automatic GitHub releases (optional)
|
|
21
|
-
3. **Clean working directory**: All changes should be committed
|
|
22
|
-
|
|
23
|
-
#### Release Commands
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# Dry run (recommended first)
|
|
27
|
-
npm run release:dry
|
|
28
|
-
|
|
29
|
-
# Release patch version (1.0.0 -> 1.0.1)
|
|
30
|
-
npm run release:patch
|
|
31
|
-
|
|
32
|
-
# Release minor version (1.0.0 -> 1.1.0)
|
|
33
|
-
npm run release:minor
|
|
34
|
-
|
|
35
|
-
# Release major version (1.0.0 -> 2.0.0)
|
|
36
|
-
npm run release:major
|
|
37
|
-
|
|
38
|
-
# Interactive release (recommended)
|
|
39
|
-
npm run release
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
#### What happens during release:
|
|
43
|
-
|
|
44
|
-
1. ✅ **Pre-release checks**: Lint and format verification
|
|
45
|
-
2. 📝 **Version bump**: Automatic version increment
|
|
46
|
-
3. 📝 **Changelog generation**: Conventional commits to CHANGELOG.md
|
|
47
|
-
4. 🔖 **Git operations**: Commit, tag, and push
|
|
48
|
-
5. 📦 **NPM publish**: Publish to npm registry
|
|
49
|
-
6. 🐙 **GitHub release**: Create GitHub release (if configured)
|
|
50
|
-
|
|
51
|
-
#### Conventional Commits
|
|
52
|
-
|
|
53
|
-
Use conventional commit format for automatic changelog generation:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
feat: add new feature
|
|
57
|
-
fix: bug fix
|
|
58
|
-
docs: documentation update
|
|
59
|
-
style: code style changes
|
|
60
|
-
refactor: code refactoring
|
|
61
|
-
test: add tests
|
|
62
|
-
chore: maintenance tasks
|
|
63
|
-
```
|
|
64
|
-
|
|
65
17
|
## 🚀 Usage
|
|
66
18
|
|
|
67
|
-
### Configuración Automática (Recomendada)
|
|
68
|
-
|
|
69
|
-
```javascript
|
|
70
|
-
// vite.config.js
|
|
71
|
-
import { defineConfig } from "vite";
|
|
72
|
-
import react from "@vitejs/plugin-react";
|
|
73
|
-
import { plugins } from "@griddo/bundler/plugins";
|
|
74
|
-
|
|
75
|
-
export default defineConfig({
|
|
76
|
-
plugins: [react(), ...plugins],
|
|
77
|
-
build: {
|
|
78
|
-
// Tu configuración se mergeará automáticamente desde vite.config.mjs
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
19
|
### Client Configuration (vite.config.mjs)
|
|
84
20
|
|
|
85
|
-
The bundler automatically looks for a `vite.config.mjs` file in
|
|
86
|
-
|
|
87
|
-
#### Quick Start Template
|
|
88
|
-
|
|
89
|
-
Copy the `vite.config.mjs.example` file from this repository as a starting point:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
cp node_modules/@griddo/bundler/vite.config.mjs.example ./vite.config.mjs
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Or create it manually:
|
|
21
|
+
The bundler automatically looks for a `vite.config.mjs` file in a Griddo project root. Create this file to customize the build configuration.
|
|
96
22
|
|
|
97
23
|
```javascript
|
|
98
24
|
// vite.config.mjs (in your project root)
|
|
99
25
|
export default {
|
|
100
|
-
build: {
|
|
101
|
-
rollupOptions: {
|
|
102
|
-
external: (id) => {
|
|
103
|
-
// Custom external dependencies
|
|
104
|
-
if (id === "your-heavy-dependency") return true;
|
|
105
|
-
return false;
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
26
|
plugins: [
|
|
110
27
|
// Additional Vite plugins for your project
|
|
111
28
|
],
|
|
29
|
+
griddoOptions: {
|
|
30
|
+
customExternals: [
|
|
31
|
+
"some-heavy-package-foo", // Mark as external by exact name
|
|
32
|
+
// /^@company\//, // Mark all packages from a scope as external
|
|
33
|
+
],
|
|
34
|
+
}
|
|
112
35
|
};
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Advanced Configuration
|
|
116
|
-
|
|
117
|
-
```javascript
|
|
118
|
-
// If you need more complex configuration, you can also do:
|
|
119
|
-
import { defineConfig } from 'vite';
|
|
120
|
-
import { plugins } from "@griddo/bundler/plugins";
|
|
121
|
-
|
|
122
|
-
// Your project's main vite.config.js
|
|
123
|
-
export default defineConfig({
|
|
124
|
-
plugins: [
|
|
125
|
-
...plugins,
|
|
126
|
-
// Your additional plugins
|
|
127
|
-
],
|
|
128
|
-
build: {
|
|
129
|
-
// Your custom build config
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### TypeScript Support
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
// vite.config.ts
|
|
138
|
-
import { defineConfig } from "vite";
|
|
139
|
-
import type { ClientConfig } from "@griddo/bundler/types";
|
|
140
|
-
import { plugins } from "@griddo/bundler/plugins";
|
|
141
|
-
|
|
142
|
-
const clientConfig: ClientConfig = {
|
|
143
|
-
build: {
|
|
144
|
-
rollupOptions: {
|
|
145
|
-
external: (id) => id.startsWith("client-dependency"),
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export default defineConfig({
|
|
151
|
-
...clientConfig,
|
|
152
|
-
plugins: [...plugins],
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## 📁 Package Structure
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
@griddo/bundler/
|
|
160
|
-
├── vite.config.ts # 📦 Main configuration file
|
|
161
|
-
├── plugins/
|
|
162
|
-
│ ├── index.mjs # ESModule plugins
|
|
163
|
-
│ └── index.d.ts # TypeScript definitions
|
|
164
|
-
├── types/
|
|
165
|
-
│ └── client-config.d.ts # TypeScript types
|
|
166
|
-
├── package.json # 📦 Package definition
|
|
167
|
-
└── README.md # 📖 Documentation
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Exports
|
|
171
|
-
|
|
172
|
-
The package provides the following exports:
|
|
173
|
-
|
|
174
|
-
- **Default config**: `import config from '@griddo/bundler'` - Configuración automática
|
|
175
|
-
- **Vite config**: `import config from '@griddo/bundler/vite.config'`
|
|
176
|
-
- **Plugins**: `import { plugins } from '@griddo/bundler/plugins'`
|
|
177
|
-
- **Types**: `import type { ClientConfig } from '@griddo/bundler/types'`
|
|
178
|
-
|
|
179
|
-
## 🚀 Uso
|
|
180
|
-
|
|
181
|
-
### 1. "Instalar" el master bundler
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
npm run install:master
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Esto crea un symlink desde `node_modules/@griddo/bundler/` hacia `external/config/`
|
|
188
|
-
|
|
189
|
-
### 2. Ejecutar el build
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
npm run build
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
El build ahora usa la configuración desde `node_modules/@griddo/bundler/vite.config.ts`
|
|
196
|
-
|
|
197
|
-
### 3. Limpiar la instalación simulada
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
npm run uninstall:master
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## 🔄 Flujo de trabajo
|
|
204
|
-
|
|
205
|
-
1. **Desarrollo**: Usa `npm run build:local` para trabajar con la config local
|
|
206
|
-
2. **Validación**: Usa `npm run install:master` + `npm run build` para validar el flujo simulado
|
|
207
|
-
3. **Producción**: Los clientes reales usarán `npm install @griddo/master-bundler`
|
|
208
|
-
|
|
209
|
-
## 📋 Comandos disponibles
|
|
210
|
-
|
|
211
|
-
- `npm run install:master` - Instala el bundler simulado
|
|
212
|
-
- `npm run uninstall:master` - Remueve la instalación simulada
|
|
213
|
-
- `npm run build` - Build usando configuración simulada
|
|
214
|
-
- `npm run build:local` - Build usando configuración local
|
|
215
|
-
|
|
216
|
-
## 🎯 Beneficios
|
|
217
|
-
|
|
218
|
-
- ✅ **Simulación realista** del paquete NPM
|
|
219
|
-
- ✅ **Sin cambios en el workflow** de desarrollo
|
|
220
|
-
- ✅ **Validación completa** antes de publicar
|
|
221
|
-
- ✅ **Transición suave** al paquete real
|
|
222
|
-
- ✅ **Mantenimiento fácil** del código
|
|
223
|
-
|
|
224
|
-
## 🔧 Configuración del cliente
|
|
225
|
-
|
|
226
|
-
Los clientes pueden mantener su `vite.config.ts` local con configuración específica:
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
// vite.config.ts del cliente
|
|
230
|
-
import type { ClientConfig } from "@griddo/bundler/types";
|
|
231
|
-
|
|
232
|
-
const config: ClientConfig = {
|
|
233
|
-
plugins: [
|
|
234
|
-
// Plugins específicos del cliente
|
|
235
|
-
],
|
|
236
|
-
build: {
|
|
237
|
-
rollupOptions: {
|
|
238
|
-
external: (id) => {
|
|
239
|
-
// Dependencias externas específicas
|
|
240
|
-
if (id === "cliente-paquete-pesado") return true;
|
|
241
|
-
return false;
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
export default config;
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
El master bundler combinará esta configuración con la suya propia.
|
|
36
|
+
```
|
package/package.json
CHANGED
package/plugins/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import react from "@vitejs/plugin-react";
|
|
2
|
-
import dts from "vite-plugin-dts";
|
|
2
|
+
// import dts from "vite-plugin-dts";
|
|
3
3
|
|
|
4
4
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
|
5
5
|
|
|
6
6
|
export const plugins = [
|
|
7
7
|
react(),
|
|
8
8
|
|
|
9
|
-
dts({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
9
|
+
// dts({
|
|
10
|
+
// insertTypesEntry: true,
|
|
11
|
+
// include: ["src"],
|
|
12
|
+
// exclude: ["src/**/*.test.*", "src/**/*.spec.*", "src/builder/**/*.jsx"],
|
|
13
|
+
// entryRoot: "src",
|
|
14
|
+
// compilerOptions: {
|
|
15
|
+
// declaration: true,
|
|
16
|
+
// emitDeclarationOnly: false,
|
|
17
|
+
// },
|
|
18
|
+
// }),
|
|
19
19
|
|
|
20
20
|
viteStaticCopy({
|
|
21
21
|
targets: [
|
package/vite.config.mjs
CHANGED
|
@@ -1,42 +1,38 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { defineConfig, loadConfigFromFile, mergeConfig } from "vite";
|
|
3
|
-
|
|
4
3
|
import { plugins as masterPlugins } from "./plugins/index.mjs";
|
|
5
4
|
|
|
6
5
|
export default defineConfig(async ({ command, mode }) => {
|
|
7
6
|
let clientConfig = {};
|
|
8
7
|
|
|
9
|
-
// --- Lógica de Carga de Configuración del Cliente Mejorada ---
|
|
10
8
|
// Usamos la función nativa de Vite para encontrar, cargar y transpilar
|
|
11
9
|
// la configuración del cliente, soportando .ts, .js, .mjs, etc.
|
|
12
10
|
try {
|
|
11
|
+
console.log(`Looking for client configuration in: ${process.cwd()}`);
|
|
12
|
+
|
|
13
13
|
const clientConfigResult = await loadConfigFromFile(
|
|
14
14
|
{ command, mode },
|
|
15
15
|
// Dejamos el segundo argumento como undefined para que Vite busque el nombre por defecto
|
|
16
16
|
// (vite.config.ts, vite.config.js, etc.)
|
|
17
17
|
undefined,
|
|
18
18
|
// Especificamos la ruta raíz donde se encuentra el proyecto del cliente
|
|
19
|
-
|
|
19
|
+
process.cwd(),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
if (clientConfigResult) {
|
|
23
23
|
clientConfig = clientConfigResult.config;
|
|
24
|
-
console.log(`
|
|
24
|
+
console.log(`Client configuration loaded from: ${clientConfigResult.path}`);
|
|
25
25
|
} else {
|
|
26
|
-
console.log("No
|
|
26
|
+
console.log("No client configuration found, using master base configuration.");
|
|
27
27
|
}
|
|
28
|
-
// biome-ignore lint/correctness/noUnusedVariables: No error, only byass with a console.log
|
|
29
28
|
} catch (e) {
|
|
30
29
|
// Si 'loadConfigFromFile' no encuentra el archivo, devuelve null en lugar de lanzar un error.
|
|
31
30
|
// Este catch es para errores de sintaxis dentro del archivo de config del cliente u otros problemas.
|
|
32
|
-
console.log(
|
|
33
|
-
|
|
34
|
-
);
|
|
31
|
+
console.log(`Error loading client configuration: ${e.message}`);
|
|
32
|
+
console.log("Using master base configuration.");
|
|
35
33
|
}
|
|
36
|
-
// --- Fin de la Lógica de Carga ---
|
|
37
34
|
|
|
38
35
|
// --- Configuración Base del Master ---
|
|
39
|
-
// (El resto del archivo no cambia)
|
|
40
36
|
const masterConfig = {
|
|
41
37
|
logLevel: "warn",
|
|
42
38
|
publicDir: "static",
|
|
@@ -109,6 +105,5 @@ export default defineConfig(async ({ command, mode }) => {
|
|
|
109
105
|
delete clientConfig.build.rollupOptions.external;
|
|
110
106
|
}
|
|
111
107
|
|
|
112
|
-
// Una única llamada a mergeConfig fusiona de forma inteligente ambas configuraciones.
|
|
113
108
|
return mergeConfig(masterConfig, clientConfig);
|
|
114
109
|
});
|