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

feat: expose package version to Node.js #2327

Merged
merged 1 commit into from
May 10, 2023
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
10 changes: 9 additions & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ Paste the results here:

## Eufemia Version

Type `Eufemia.version` in your browser console and include it here.
**Browser:** Type `Eufemia.version` in your browser console.

**Node.js:** Use import or require to find out what Eufemia version is imported:

```js
// NB: Use "require" if needed
import { version } from '@dnb/eufemia/shared/Eufemia'
console.log('Eufemia version:', version)
```
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,9 @@ describe('makeReleaseVersion', () => {
expect.stringContaining('src/shared/Eufemia.js'),
expect.stringContaining(`return 'release'`)
)
expect(fs.writeFile).toHaveBeenLastCalledWith(
expect.stringContaining('src/shared/Eufemia.js'),
expect.stringContaining(`export const version = 'release'`)
)
})
})
2 changes: 2 additions & 0 deletions packages/dnb-eufemia/src/shared/Eufemia.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const version = '__VERSION__'

export function init() {
if (typeof window !== 'undefined') {
class Eufemia {
Expand Down