Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4ae1e30
Set bundle mappings in the window
ncamera Sep 14, 2025
6a435b7
Add an utility to calculate the gzip size of files that are downloade…
ncamera Sep 14, 2025
7cb9bcd
Improve how the bundle sizes are printed to the output
ncamera Sep 14, 2025
92589fa
Add the `viteMercury` plugin for Vite environments
ncamera Sep 14, 2025
8f4630f
Add tests for validating the bundle size
ncamera Sep 14, 2025
7a692c1
Add tests for validating the gzipped size
ncamera Sep 14, 2025
665b6a7
Add support to inline css bundles in the html head
ncamera Sep 15, 2025
fcf8945
Improve path normalization
ncamera Sep 15, 2025
c68cf6a
Add support to preload CSS bundles
ncamera Sep 15, 2025
183007b
Add support to specify the fetch priority
ncamera Sep 15, 2025
d4be7f6
Add comment for an upcoming feature (lightningcss)
ncamera Sep 15, 2025
91cbaff
Inline the "resets/box-sizing" css bundle by default
ncamera Sep 16, 2025
5a2e6dc
Split the Mercury DS implementation into the mercury-build, mercury-c…
ncamera Oct 6, 2025
e811a8a
Add support to build the Mercury CSS bundles
ncamera Oct 12, 2025
8caf560
Fix Mercury build
ncamera Oct 12, 2025
1c91be7
More fixes for the Mercury build
ncamera Oct 12, 2025
c0a7776
Update eslint.config.js
ncamera Oct 13, 2025
3cd3f7f
Remove comments
ncamera Oct 13, 2025
075fab4
Copy assets when building the css
ncamera Oct 18, 2025
8f64647
Improve build output style
ncamera Oct 18, 2025
9d12bbf
Improve script names
ncamera Oct 18, 2025
22f178f
Fixes for building the dist for Mercury
ncamera Oct 19, 2025
ba46e27
Update validate-args.ts
ncamera Oct 19, 2025
3cbcae1
Remove bulding scripts for the showcase in the Mercury package
ncamera Oct 19, 2025
528113c
Move assets file to the src folder
ncamera Oct 19, 2025
83e6644
Update tsconfig.json
ncamera Oct 19, 2025
564bec1
New dev server for the showcase
ncamera Oct 19, 2025
1ac34e8
Add missing commits
ncamera Oct 19, 2025
98c3efd
Fix wrong placeholder values
ncamera Oct 19, 2025
ccd3c6e
Add missing commit
ncamera Oct 19, 2025
c4a6477
Refresh the showcase when rebuilding Mercury
ncamera Oct 19, 2025
ddcc13b
Improve main readme for local development
ncamera Oct 19, 2025
ebc10a8
Avoid memory leaks when the build crashes
ncamera Oct 19, 2025
aff4ed4
Fix dev server not working properly
ncamera Oct 20, 2025
00f218b
Build Mercury for usage
ncamera Oct 20, 2025
ebb2ba8
Remove no longer required code for the mercury-cli package
ncamera Oct 20, 2025
9a23e65
Merge branch 'main' into feat/vite-plugin
ncamera Oct 20, 2025
4ef9b16
Properly build mercury for the distribution of the showcase
ncamera Oct 20, 2025
fe518aa
Merge branch 'main' into feat/vite-plugin
ncamera Nov 2, 2025
38ea7a0
Remove --outDir argument
ncamera Nov 3, 2025
6b68f42
Merge branch 'main' into feat/vite-plugin
ncamera Nov 4, 2025
55fe7b6
Copy the fonts and icons when building Mercury for usage
ncamera Nov 5, 2025
1595f11
Move Mercury plugins to the mercury-plugins folder
ncamera Nov 5, 2025
7d99fda
Use TS GO for faster dev builds
ncamera Nov 5, 2025
b89d072
Force "hoisted" installs by adding bunfig.toml file
ncamera Nov 5, 2025
5cb2bfe
Complete the implementation for vite-mercury-plugin
ncamera Nov 5, 2025
638a725
Fix conflicts between NodeJS' threads and Vite's build process
ncamera Nov 5, 2025
58ed674
Don't clear fonts and icons folders to let multiple plugins add asset…
ncamera Nov 5, 2025
0a0863f
Improvements for the React installation docs
ncamera Nov 5, 2025
8159fc0
Add readme for the @genexus/mercury-build package
ncamera Nov 5, 2025
b36e9a1
Improve package.json description
ncamera Nov 5, 2025
924a3a3
Fix ESM only export not working for require
ncamera Nov 5, 2025
4792457
Delete unused script
ncamera Nov 5, 2025
d227f1d
Use bun for running build-scss-and-copy-assets script and delete unus…
ncamera Nov 5, 2025
292973e
Fix showcase dev server
ncamera Nov 5, 2025
348906d
Fix tests not working in common package
ncamera Nov 5, 2025
13a317f
More fixes for running tests in the common package
ncamera Nov 5, 2025
0008179
Rename "vite-mercury-plugin" to "vite-plugin-mercury"
ncamera Nov 5, 2025
86fa0d1
Try to fix workflows
ncamera Nov 5, 2025
3085582
Fix missing "bun" runner in workflows
ncamera Nov 5, 2025
91fd48d
Try to fix workflow
ncamera Nov 5, 2025
9ac788a
Try to fix workflows again
ncamera Nov 5, 2025
0e19e6d
Comment out workflow to test ci
ncamera Nov 5, 2025
96abffa
Comment out workflow step
ncamera Nov 5, 2025
ebbd975
Update install-and-deploy.yml
ncamera Nov 5, 2025
be619c7
Fix tests
ncamera Nov 5, 2025
d7d585c
Fix code scanning result issue
ncamera Nov 5, 2025
d82898d
Remove unused "start.watch" script
ncamera Nov 5, 2025
9639e58
Fix typo in react docs
ncamera Nov 5, 2025
53a917a
Use TS and bun for all scripts
ncamera Nov 6, 2025
9e91bfc
Update NextJS installation guide
ncamera Nov 6, 2025
75b0c4a
Update installation-for-react.md
ncamera Nov 6, 2025
621af5b
Move the bundle-to-hash-mapping.ts file to the "node_modules/.genexus…
ncamera Nov 6, 2025
cf2c0c8
Improve all installation readmes
ncamera Nov 6, 2025
e5a794d
Improve/add readmes for the new packages
ncamera Nov 6, 2025
2f92c40
Fix image path
ncamera Nov 6, 2025
4f62375
More improvements for readmes
ncamera Nov 6, 2025
92f83c5
Fix typo
ncamera Nov 6, 2025
173b274
Add workflows for the new packages
ncamera Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/install-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('''**/bun.lockb''') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-

Expand All @@ -76,6 +76,26 @@ jobs:
# if: ${{ inputs.common-tests == true }}
# run: bun test.common.ci

# We need to pre-build Mercury, because the mercury-build package needs it.
# TODO: We should eliminate this "cycle dependency" in the future.
- name: Prebuild Mercury
run: bun build.js
working-directory: "packages/mercury"

# Test if the @genexus/mercury-build, @genexus/mercury-cli, and @genexus/vite-plugin-mercury packages are built correctly.
- name: Build genexus/mercury-build
run: bun dev
working-directory: "packages/mercury-build"

- name: Build genexus/mercury-cli
run: bun dev
working-directory: "packages/mercury-cli"

- name: Build genexus/vite-plugin-mercury
run: bun dev
working-directory: "packages/mercury-plugins/vite-plugin-mercury"

# The validate.ci for Mercury needs to be run after building the three packages above.
- name: Run tests
run: bun validate.ci
working-directory: ${{ inputs.package }}
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ jobs:
publish: false
package: "packages/mercury"

mercury-build:
uses: ./.github/workflows/install-and-deploy.yml
with:
node-version: "22.x"
cache: true
common-tests: false
publish: false
package: "packages/mercury-build"

mercury-cli:
uses: ./.github/workflows/install-and-deploy.yml
with:
node-version: "22.x"
cache: true
common-tests: false
publish: false
package: "packages/mercury-cli"

svg-sass-generator:
uses: ./.github/workflows/install-and-deploy.yml
with:
Expand All @@ -35,3 +53,13 @@ jobs:
common-tests: false
publish: false
package: "packages/svg-sass-generator"

vite-plugin-mercury:
uses: ./.github/workflows/install-and-deploy.yml
with:
node-version: "22.x"
cache: true
common-tests: false
publish: false
package: "packages/mercury-plugins/vite-plugin-mercury"

100 changes: 100 additions & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
outputs:
unanimo-changed: ${{ steps.check-unanimo.outputs.version-changed }}
mercury-changed: ${{ steps.check-mercury.outputs.version-changed }}
mercury-build-changed: ${{ steps.check-mercury-build.outputs.version-changed }}
mercury-cli-changed: ${{ steps.check-mercury-cli.outputs.version-changed }}
svg-sass-generator-changed: ${{ steps.check-svg-sass-generator.outputs.version-changed }}
vite-plugin-mercury-changed: ${{ steps.check-vite-plugin-mercury.outputs.version-changed }}
steps:
# Pinning to a specific commit hash for security reasons.
# This hash corresponds to version 4.3.0 of the actions/checkout action.
Expand All @@ -34,18 +37,42 @@
LATEST_MERCURY_VERSION=$(curl -s https://registry.npmjs.org/$PACKAGE_NAME | jq -r '.["dist-tags"].latest')
echo "latest_mercury_version=$LATEST_MERCURY_VERSION" >> $GITHUB_ENV

- name: Get the latest mercury-build version
id: get-latest-mercury-build-version
run: |
PACKAGE_NAME=@genexus/mercury-build
LATEST_MERCURY_BUILD_VERSION=$(curl -s https://registry.npmjs.org/$PACKAGE_NAME | jq -r '.["dist-tags"].latest')
echo "latest_mercury_build_version=$LATEST_MERCURY_BUILD_VERSION" >> $GITHUB_ENV

- name: Get the latest mercury-cli version
id: get-latest-mercury-cli-version
run: |
PACKAGE_NAME=@genexus/mercury-cli
LATEST_MERCURY_CLI_VERSION=$(curl -s https://registry.npmjs.org/$PACKAGE_NAME | jq -r '.["dist-tags"].latest')
echo "latest_mercury_cli_version=$LATEST_MERCURY_CLI_VERSION" >> $GITHUB_ENV

- name: Get the latest SVG_Generator version
id: get-latest-svg_generator-version
run: |
PACKAGE_NAME=@genexus/svg-sass-generator
LATEST_SVG_GENERATOR_VERSION=$(curl -s https://registry.npmjs.org/$PACKAGE_NAME | jq -r '.["dist-tags"].latest')
echo "latest_svg_generator_version=$LATEST_SVG_GENERATOR_VERSION" >> $GITHUB_ENV

- name: Get the latest vite-plugin-mercury version
id: get-latest-vite-plugin-mercury-version
run: |
PACKAGE_NAME=@genexus/vite-plugin-mercury
LATEST_VITE_PLUGIN_MERCURY_VERSION=$(curl -s https://registry.npmjs.org/$PACKAGE_NAME | jq -r '.["dist-tags"].latest')
echo "latest_vite_plugin_mercury_version=$LATEST_VITE_PLUGIN_MERCURY_VERSION" >> $GITHUB_ENV

- name: Print last published versions
run: |
echo "The latest Unanimo version is ${{ env.latest_unanimo_version }}"
echo "The latest Mercury version is ${{ env.latest_mercury_version }}"
echo "The latest mercury-build version is ${{ env.latest_mercury_build_version }}"
echo "The latest mercury-cli version is ${{ env.latest_mercury_cli_version }}"
echo "The latest SVG Generator version is ${{ env.latest_svg_generator_version }}"
echo "The latest vite-plugin-mercury version is ${{ env.latest_vite_plugin_mercury_version }}"

- name: Check if `unanimo` version changed
id: check-unanimo
Expand All @@ -71,6 +98,30 @@
echo "version-changed=false" >> $GITHUB_OUTPUT
fi

- name: Check if `mercury-build` version changed
id: check-mercury-build
run: |
CURRENT_VERSION=$(jq -r .version packages/mercury-build/package.json)
PREVIOUS_VERSION=${{ env.latest_mercury_build_version }}
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "Version changed!"
echo "version-changed=true" >> $GITHUB_OUTPUT
else
echo "version-changed=false" >> $GITHUB_OUTPUT
fi

- name: Check if `mercury-cli` version changed
id: check-mercury-cli
run: |
CURRENT_VERSION=$(jq -r .version packages/mercury-cli/package.json)
PREVIOUS_VERSION=${{ env.latest_mercury_cli_version }}
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "Version changed!"
echo "version-changed=true" >> $GITHUB_OUTPUT
else
echo "version-changed=false" >> $GITHUB_OUTPUT
fi

- name: Check if `svg-sass-generator` version changed
id: check-svg-sass-generator
run: |
Expand All @@ -83,6 +134,18 @@
echo "version-changed=false" >> $GITHUB_OUTPUT
fi

- name: Check if `vite-plugin-mercury` version changed
id: check-vite-plugin-mercury
run: |
CURRENT_VERSION=$(jq -r .version packages/mercury-plugins/vite-plugin-mercury/package.json)
PREVIOUS_VERSION=${{ env.latest_vite_plugin_mercury_version }}
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "Version changed!"
echo "version-changed=true" >> $GITHUB_OUTPUT
else
echo "version-changed=false" >> $GITHUB_OUTPUT
fi

publish-unanimo:
needs: check-version
if: needs.check-version.outputs.unanimo-changed == 'true'
Expand All @@ -107,7 +170,31 @@
package: "packages/mercury"
secrets: inherit

publish-mercury-build:
needs: check-version
if: needs.check-version.outputs.mercury-build-changed == 'true'
uses: ./.github/workflows/install-and-deploy.yml
with:
node-version: "22.x"
cache: false
common-tests: false
publish: true
package: "packages/mercury-build"
secrets: inherit

publish-mercury-cli:
Comment on lines +174 to +185

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 22 minutes ago

To address the issue, you should add a permissions block specifying the minimal required privileges for the workflow. The best practice is to add this block at the root of the workflow file, so that all jobs inherit it unless they explicitly override it. If your jobs only need to read source files and pull packages, contents: read is usually safe and minimal. If jobs need to publish to npm/GitHub Packages, consider adding packages: write. For workflows that only need to check versions and publish, the most conservative permissions would be contents: read, but if you know that publishing jobs require write access to packages or contents, you can increase the permission for just those jobs as needed.

In this case, adding the following at the top level (just below name: but above on:), is the best fix:

permissions:
  contents: read

If you know that jobs which do publishing need to write to the packages, you may additionally grant packages: write – but since you can only change what you see, and the minimal fix is to add a contents: read block at the workflow level.

File/Region to change:

  • Edit .github/workflows/npmpublish.yml
  • Add the following after line 1 (name: Node.js Package), before on:

Suggested changeset 1
.github/workflows/npmpublish.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml
--- a/.github/workflows/npmpublish.yml
+++ b/.github/workflows/npmpublish.yml
@@ -1,7 +1,8 @@
 name: Node.js Package
+permissions:
+  contents: read
 
 on:
-  push:
     tags:
       - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
 
EOF
@@ -1,7 +1,8 @@
name: Node.js Package
permissions:
contents: read

on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

Copilot is powered by AI and may make mistakes. Always verify output.
needs: check-version
if: needs.check-version.outputs.mercury-cli-changed == 'true'
uses: ./.github/workflows/install-and-deploy.yml
with:
node-version: "22.x"
cache: false
common-tests: false
publish: true
package: "packages/mercury-cli"
secrets: inherit

publish-svg-sass-generator:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
needs: check-version
if: needs.check-version.outputs.svg-sass-generator-changed == 'true'
uses: ./.github/workflows/install-and-deploy.yml
Expand All @@ -118,3 +205,16 @@
publish: true
package: "packages/svg-sass-generator"
secrets: inherit

publish-vite-plugin-mercury:
needs: check-version
if: needs.check-version.outputs.vite-plugin-mercury-changed == 'true'
uses: ./.github/workflows/install-and-deploy.yml
with:
node-version: "22.x"
cache: false
common-tests: false
publish: true
package: "packages/mercury-plugins/vite-plugin-mercury"
secrets: inherit
Comment on lines +210 to +219

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 22 minutes ago

To fix this, add an explicit permissions: block at the top-level of the workflow file, setting sensible defaults such as contents: read. This restricts the default permissions for all jobs to read-only, unless a job or workflow requires more. If specific jobs need different permissions, a permissions: block can be added at the job level, overriding the global setting. Since the install-and-deploy workflow is called using uses:, we should ensure those jobs get enough permission (most npm publish workflows only require contents: read to read code, but if you are creating GitHub releases you might need packages: write, contents: write, etc.), but from the content provided, adding a top-level block for least privilege is sufficient.

Add the following block just below name: Node.js Package, e.g. before or after on:, but the official GH docs recommend after name and before on::

permissions:
  contents: read

If, later, you determine that more permissions are needed per job, you can override at the job level, but for now this is minimal and sufficient.

Suggested changeset 1
.github/workflows/npmpublish.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml
--- a/.github/workflows/npmpublish.yml
+++ b/.github/workflows/npmpublish.yml
@@ -1,4 +1,6 @@
 name: Node.js Package
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
name: Node.js Package
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.

10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@ To see the documentation and examples of how to use Mercury, visit the [showcase
npm i bun -g
```

- To start the showcase, run:
- To start the showcase which automatically rebuilds Mercury, run:

```bash
bun start.watch
```

- To automatically build Mercury, run:

```bash
bun build.mer.watch
bun start
```

- To automatically build Unanimo, run:
Expand Down
Loading