-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks @SelvinPL !
build.sh
Outdated
@@ -4,6 +4,10 @@ set -eu | |||
|
|||
test -d binjgb/out || ./build-binjgb.sh | |||
test -f rgbds/rgbasm.wasm || ./build-rgbds.sh | |||
|
|||
#store rgbds version tag for use in vite build | |||
export VITE_RGBDS_VERSION=$(git --git-dir=rgbds/.git -c safe.directory='*' describe --tags --always) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we setting this here in "build.sh"? This basically makes it mandatory to rebuild everything just to export this value, which could be done afterwards (or just anytime before npm run build/ serve... Isn't there a way to make this part of the npm run command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find a way to do this via command line ... I'm not good with node and npm run set environment variables
search results aren't helpful
also doesn't
export VITE_RGBDS_VERSION=$(git --git-dir=rgbds/.git -c safe.directory='*' describe --tags --always)
would export to the current console env variable VITE_RGBDS_VERSION
if so then every consecutive npm run build
will use this value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, maybe build.sh may create .env
file with this variable ... This should work, but I need to check this (and because RL stuff it need to wait 'till weekend)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I've quickly checked, and it should be enough to add
VITE_RGBDS_VERSION=$(git --git-dir=rgbds/.git -c safe.directory='*' describe --tags --always)
in the npm script. So, in package.json, something like:
"scripts": {
"dev": "VITE_RGBDS_VERSION=$(git --git-dir=rgbds/.git -c safe.directory='*' describe --tags --always) && vite",
should work
or maybe changing vite.config.js (as you need to change import { defineConfig, loadEnv } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import { execSync } from 'node:child_process';
export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
//tested on both win and linux execute git command and store result in process.env.VITE_RGBDS_VERSION
process.env.VITE_RGBDS_VERSION = execSync("git --git-dir=rgbds/.git -c safe.directory='*' describe --tags --always").toString("utf8");
return {
base: '/rgbds-live/',
build: {
target: ['chrome109', 'safari15.6', 'firefox102'],
outDir: 'www',
chunkSizeWarningLimit: 1000,
},
resolve: {
alias: {
ace: 'ace-builds/src-noconflict/',
},
},
plugins: [
viteStaticCopy({
targets: [
{
src: './node_modules/ace-builds/src-noconflict/**',
dest: 'assets/ace',
},
],
}),
],
}}); |
|
Cool, I like this last option @SelvinPL |
Closes #66
For testing remeber to clear the changes(undo the patches) to binjgb and rgbds.
You may use this commands from
rgbds-live
root directory:Then you are ready to execute
./build.sh
In other case build may fail as build is trying to apply patches every time