Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate changing link to documentation using git tag from RGBDS #69

Merged
merged 3 commits into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
<ul>
<li id="infomenu">Info...</li>
<li>
<a href="https://rgbds.gbdev.io/docs/v0.9.1" target="_blank">rgbds manual</a>
<!-- This link is templated using the VITE_RGBDS_VERSION env variable, set at build time. See vite.config.js -->
<a href="https://rgbds.gbdev.io/docs/%VITE_RGBDS_VERSION%" target="_blank">rgbds manual</a>
</li>
<li>
<a href="https://github.com/gbdev/rgbds-live/issues" target="_blank">Report a problem</a>
Expand Down
50 changes: 29 additions & 21 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import { execSync } from 'node:child_process';

export default defineConfig({
base: '/rgbds-live/',
build: {
target: ['chrome109', 'safari15.6', 'firefox102'],
outDir: 'www',
chunkSizeWarningLimit: 1000,
},
resolve: {
alias: {
ace: 'ace-builds/src-noconflict/',
export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
// Extract the RGBDS version we're using and set it as an env variable
process.env.VITE_RGBDS_VERSION = execSync(
"git --git-dir=rgbds/.git -c safe.directory='*' describe --tags --always",
).toString('utf8');
console.log("VITE_RGBDS_VERSION set to", process.env.VITE_RGBDS_VERSION)
return {
base: '/rgbds-live/',
build: {
target: ['chrome109', 'safari15.6', 'firefox102'],
outDir: 'www',
chunkSizeWarningLimit: 1000,
},
},
plugins: [
viteStaticCopy({
targets: [
{
src: './node_modules/ace-builds/src-noconflict/**',
dest: 'assets/ace',
},
],
}),
],
resolve: {
alias: {
ace: 'ace-builds/src-noconflict/',
},
},
plugins: [
viteStaticCopy({
targets: [
{
src: './node_modules/ace-builds/src-noconflict/**',
dest: 'assets/ace',
},
],
}),
],
};
});