-
Notifications
You must be signed in to change notification settings - Fork 1
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
New ReleaseVersion
component into HelpButton
#310
Conversation
746a283
to
96598ab
Compare
…rocess - Introduced `scripts/set-env.mjs` to dynamically set `VITE_CLI_VERSION_*` environment variables during build and dev processes. - `VITE_CLI_VERSION_VERSION`: Package version from `package.json`. - `VITE_CLI_VERSION_GIT_HASH`: Current Git commit hash. - `VITE_CLI_VERSION_IS_RELEASED_GIT_HASH`: Flag indicating if the commit matches the latest tagged release. - `VITE_CLI_VERSION_DATE`: Commit date or fallback to the current date.
96598ab
to
4027944
Compare
ReleaseVersion
component into HelpButton
ReleaseVersion
component into HelpButton ReleaseVersion
component into HelpButton
- Added `ReleaseVersion` component: - Displays the current CLI version, including: - Released version (e.g., `v0.0.11 (2024-12-19)`). - Unreleased version with short Git hash (e.g., `v0.0.11 + 0d6169a (2024-12-19)`). - Fetches version information from the `CliVersionProvider`. - Updated `App.tsx`: - Initialized `cliVersion` using `import.meta.env.VITE_CLI_VERSION_*` environment variables. - Wrapped `ERDRenderer` with `CliVersionProvider` to provide version context globally.
4027944
to
343e01d
Compare
frontend/packages/cli/package.json
Outdated
"command:build": "node ./dist-cli/bin/cli.js erd build --input fixtures/input.schema.rb --format schemarb", | ||
"cp:prism": "cp ../db-structure/node_modules/@ruby/prism/src/prism.wasm ./dist-cli/bin/prism.wasm", | ||
"dev": "pnpm command:build && cp dist/schema.json public/ && pnpm run '/^dev:.*/'", | ||
"dev:app": "vite", | ||
"dev:app": "node scripts/set-env.mjs vite", |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
export * from './cliVersion' | ||
export * from './queryParam' | ||
export * from './showMode' |
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 only wanted the cliVersion here, but I'm also exporting the others for consistency
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 created a new directory, but is it appropriate? 💭
This commit removes the 'set-env.mjs' script and integrates environment variable setup directly within the Vite build process using a custom Vite plugin. This change simplifies the build and development commands by removing the dependency on the external environment setup script.
847ce71
to
924806a
Compare
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.
Great!!
I've wrote some comments!
@@ -25,7 +26,7 @@ export default defineConfig({ | |||
], | |||
}, | |||
}, | |||
plugins: [react(), tsconfigPaths()], | |||
plugins: [react(), tsconfigPaths(), setEnvPlugin()], |
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 🚀
.cliVersion { | ||
padding: var(--spacing-2); | ||
} | ||
|
||
.cliVersionInner { | ||
border-radius: var(--border-radius-full); | ||
background: var(--pane-muted-background); | ||
padding: var(--spacing-1) var(--spacing-2); | ||
color: var(--global-mute-text); | ||
font-family: var(--code-font); | ||
font-size: var(--font-size-1); | ||
} |
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.
nits: If we use margin, it would be simple to implement without nesting divs.
.cliVersion { | |
padding: var(--spacing-2); | |
} | |
.cliVersionInner { | |
border-radius: var(--border-radius-full); | |
background: var(--pane-muted-background); | |
padding: var(--spacing-1) var(--spacing-2); | |
color: var(--global-mute-text); | |
font-family: var(--code-font); | |
font-size: var(--font-size-1); | |
} | |
.cliVersion { | |
margin: var(--spacing-2); | |
border-radius: var(--border-radius-full); | |
background: var(--pane-muted-background); | |
padding: var(--spacing-1) var(--spacing-2); | |
color: var(--global-mute-text); | |
font-family: var(--code-font); | |
font-size: var(--font-size-1); | |
} |
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 see!
<div className={styles.cliVersionInner}> | ||
<span>{`v${cliVersion.version}`}</span> | ||
<span> | ||
{' '} | ||
{cliVersion.isReleasedGitHash || | ||
`+ ${cliVersion.gitHash.slice(0, 7)} `} | ||
</span> | ||
<span>{cliVersion.date.length > 0 && ` (${cliVersion.date})`}</span> | ||
</div> |
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.
<div className={styles.cliVersionInner}> | |
<span>{`v${cliVersion.version}`}</span> | |
<span> | |
{' '} | |
{cliVersion.isReleasedGitHash || | |
`+ ${cliVersion.gitHash.slice(0, 7)} `} | |
</span> | |
<span>{cliVersion.date.length > 0 && ` (${cliVersion.date})`}</span> | |
</div> | |
<span>{`v${cliVersion.version}`}</span> | |
<span> | |
{' '} | |
{cliVersion.isReleasedGitHash || | |
`+ ${cliVersion.gitHash.slice(0, 7)} `} | |
</span> | |
<span>{cliVersion.date.length > 0 && ` (${cliVersion.date})`}</span> |
Summary
Example output for cliVersion:
v0.0.11 (2024-12-19)
v0.0.11 + 0d6169a (2024-12-19)
Explanation:
Related Issue
Changes
VITE_CLI_VERSION_*
env vars into Vite build processCliVersionProvider
and schema definition for CLI version contextReleaseVersion
component intoHelpButton
Testing
Manually tested.
Other Information
In pull requests, the commit hash displayed in the HelpButton may differ from the hash of the latest commit. This happens because when using
on: pull_request
in GitHub Actions, a special merge is performed before the code is checked out.