@hiscovega/vundle 0.0.15 → 0.0.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.17](https://github.com/griddo/vundle/compare/v0.0.16...v0.0.17) (2026-01-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * add griddoDeployHashPlugin to include Git commit hash in build output ([d0dbe0e](https://github.com/griddo/vundle/commit/d0dbe0ee57bb19fd199e0fdd7e4036311d3c67fd))
9
+
10
+ ## [0.0.16](https://github.com/griddo/vundle/compare/v0.0.15...v0.0.16) (2026-01-21)
11
+
3
12
  ## [0.0.15](https://github.com/griddo/griddo-bundler/compare/v0.0.14...v0.0.15) (2026-01-21)
4
13
 
5
14
 
package/README.md CHANGED
@@ -8,17 +8,21 @@ Griddo vite bundler configuration for Griddo Instance projects.
8
8
  npm install @hiscovega/vundle # at @hiscovega org for the beta testing
9
9
  ```
10
10
 
11
- ## 🚀 Publishing
11
+ ## 🚀 Usage
12
12
 
13
- ### Automated Releases with release-it
13
+ ### Build (from a client project)
14
14
 
15
- This package uses [release-it](https://github.com/release-it/release-it) for automated versioning and publishing.
15
+ Run Vite using this package config:
16
16
 
17
- ## 🚀 Usage
17
+ ```bash
18
+ vite build --config node_modules/@hiscovega/vundle/vite.config.mjs
19
+ ```
20
+
21
+ The bundler will look for the client `vite.config.*` in the current working directory and merge it on top of the master config.
18
22
 
19
- ### Client Configuration (vite.config.mjs)
23
+ ### Client Configuration (`vite.config.mjs`)
20
24
 
21
- The bundler automatically looks for a `vite.config.mjs` file in a Griddo project root. Create this file to customize the build configuration.
25
+ Create a `vite.config.mjs` (or `.ts/.js`) in your project root to customize the build configuration.
22
26
 
23
27
  ```javascript
24
28
  // vite.config.mjs (in your project root)
@@ -26,6 +30,10 @@ export default {
26
30
  plugins: [
27
31
  // Additional Vite plugins for your project
28
32
  ],
33
+
34
+ // Standard Vite/Rollup external (advanced). It will be COMPOSED with the bundler externals.
35
+ // build: { rollupOptions: { external: (id) => id === "my-heavy-dep" } },
36
+
29
37
  griddoOptions: {
30
38
  customExternals: [
31
39
  "some-heavy-package-foo", // Mark as external by exact name
@@ -35,21 +43,50 @@ export default {
35
43
  };
36
44
  ```
37
45
 
38
- ## Salida del bundle
46
+ ### Notes
47
+
48
+ - **Mandatory externals**: React, React DOM and `@griddo/core` are always externalized by the bundler.
49
+ - **Optional assets**: `static/` and `thumbnails/` are copied into `dist/` if they exist. If they don't exist, the build will not fail.
50
+
51
+ ## Bundle output
39
52
 
40
- El bundle exporta cuatro elementos:
53
+ The bundle exports four artifacts:
41
54
 
42
55
  ```
43
- dist/index.js # Antiguo src/index.js de la instancia: templates, modules, components, contextos, etc..
44
- dist/builder.js # Archivos relacionados con Gatsby: antiguos builder.browser.jsx, builder.ssr.jsx y builder.config.js
45
- dist/griddo.config.js # Antiguo griddo.config.ts
46
- dist/builder.css # Todo el css de la instancia empaquetado
56
+ dist/index.js # Legacy instance entry: templates, modules, components, contexts, etc.
57
+ dist/builder.js # Builder-related files (legacy): builder.browser.jsx, builder.ssr.jsx and builder.config.js
58
+ dist/griddo.config.js # Legacy griddo.config.ts
59
+ dist/builder.css # All instance CSS bundled
47
60
  ```
48
61
 
49
62
  ```
50
- Para importarlos en AX / CX
63
+ Importing in AX / CX:
51
64
  import { SiteProvider, bundle, components, formsTemplates, templates } from "<bundle>"
52
65
  import { browser, config, ssr } from "<bundle>/builder"
53
66
  import griddoConfig from "<bundle>/griddo.config"
54
67
  import "<bundle>/builder.css"
55
68
  ```
69
+
70
+ ## ✅ Testing
71
+
72
+ ```bash
73
+ npm test
74
+ ```
75
+
76
+ ## 🧪 Local fixture (simple client)
77
+
78
+ This repo includes a minimal client fixture under `fixtures/client/`:
79
+
80
+ ```bash
81
+ npm run fixture:build
82
+ ```
83
+
84
+ ## 🚀 Publishing
85
+
86
+ This package uses [release-it](https://github.com/release-it/release-it) for automated versioning and publishing.
87
+
88
+ Tip: if you run releases in a non-interactive environment (no TTY), use:
89
+
90
+ ```bash
91
+ npm run release:patch -- --ci
92
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiscovega/vundle",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Master bundler configuration for Griddo Instance projects",
5
5
  "main": "vite.config.mjs",
6
6
  "module": "vite.config.mjs",
@@ -51,10 +51,10 @@
51
51
  "release:patch": "release-it patch"
52
52
  },
53
53
  "dependencies": {
54
- "@vitejs/plugin-react": "5.0.4",
55
- "vite": "7.1.10",
54
+ "@vitejs/plugin-react": "5.1.2",
55
+ "vite": "7.3.1",
56
56
  "vite-plugin-dts": "4.5.4",
57
- "vite-plugin-static-copy": "3.1.4"
57
+ "vite-plugin-static-copy": "3.1.5"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@griddo/core": "latest",
package/plugins/index.mjs CHANGED
@@ -1,8 +1,72 @@
1
1
  import react from "@vitejs/plugin-react";
2
2
  // import dts from "vite-plugin-dts";
3
3
 
4
+ import { execSync } from "node:child_process";
5
+ import { mkdir, writeFile } from "node:fs/promises";
6
+ import path from "node:path";
4
7
  import { viteStaticCopy } from "vite-plugin-static-copy";
5
8
 
9
+ const griddoDeployHashPlugin = () => {
10
+ /** @type {import("vite").ResolvedConfig | undefined} */
11
+ let resolvedConfig;
12
+
13
+ const getOutputDirs = () => {
14
+ /** @type {string[]} */
15
+ const dirs = [];
16
+
17
+ const output = resolvedConfig?.build?.rollupOptions?.output;
18
+ const outputs = Array.isArray(output) ? output : output ? [output] : [];
19
+
20
+ for (const o of outputs) {
21
+ if (typeof o?.dir === "string" && o.dir) dirs.push(o.dir);
22
+ if (typeof o?.file === "string" && o.file) dirs.push(path.dirname(o.file));
23
+ }
24
+
25
+ if (dirs.length === 0) {
26
+ const outDir = resolvedConfig?.build?.outDir || "dist";
27
+ dirs.push(outDir);
28
+ }
29
+
30
+ return [...new Set(dirs)];
31
+ };
32
+
33
+ const getGitHash = () => {
34
+ try {
35
+ return execSync("git rev-parse HEAD", {
36
+ cwd: resolvedConfig?.root || process.cwd(),
37
+ stdio: ["ignore", "pipe", "ignore"],
38
+ })
39
+ .toString()
40
+ .trim();
41
+ } catch {
42
+ // Fallbacks típicos en CI
43
+ return (
44
+ process.env.GITHUB_SHA || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CF_PAGES_COMMIT_SHA || "unknown"
45
+ );
46
+ }
47
+ };
48
+
49
+ return {
50
+ name: "griddo-deploy-hash",
51
+ apply: "build",
52
+ configResolved(config) {
53
+ resolvedConfig = config;
54
+ },
55
+ async closeBundle() {
56
+ const hash = getGitHash();
57
+ const outputDirs = getOutputDirs();
58
+
59
+ await Promise.all(
60
+ outputDirs.map(async (dir) => {
61
+ const absoluteDir = path.isAbsolute(dir) ? dir : path.join(resolvedConfig?.root || process.cwd(), dir);
62
+ await mkdir(absoluteDir, { recursive: true });
63
+ await writeFile(path.join(absoluteDir, "_griddo-ds-deploy-hash"), `${hash}\n`, "utf8");
64
+ }),
65
+ );
66
+ },
67
+ };
68
+ };
69
+
6
70
  export const plugins = [
7
71
  react(),
8
72
 
@@ -26,4 +90,6 @@ export const plugins = [
26
90
  { src: "thumbnails", dest: "" },
27
91
  ],
28
92
  }),
93
+
94
+ griddoDeployHashPlugin(),
29
95
  ];