Skip to content

Commit

Permalink
build: fix version text
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Aug 27, 2024
1 parent d371938 commit bb85e27
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default [
include: 'src/core/index.ts',
// (!) [plugin replace] @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
preventAssignment: true,
values: { _version_: version() },
values: { _version_: version().text },
}),
...[dev ? [] : [terser(terserOptions)]],
],
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-html.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const setVersion = () => {
?.setAttribute('href', github)
.removeAttribute('id');
html.getElementById('version')
?.set_content(v.text)
?.set_content(v.textShort)
.setAttribute('href', github + (v.dirty ? '' : `/tree/${v.commit}`))
.removeAttribute('id');
};
Expand Down
4 changes: 3 additions & 1 deletion scripts/utils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ const version = () => {
commit: commitHash(),
dirty: isDirty(),
text: '',
textShort: '',
};
r.text = `${r.branch}@${r.commit.slice(0, 8)}${r.dirty ? '(dirty)' : ''}`;
r.text = `${r.branch}@${r.commit}${r.dirty ? '(dirty)' : ''}`;
r.textShort = `${r.branch}@${r.commit.slice(0, 8)}${r.dirty ? '*' : ''}`;
return r;
};

Expand Down

0 comments on commit bb85e27

Please sign in to comment.