Skip to content

Commit ab98dbc

Browse files
authored
feat: add version export (#840)
* feat: add version export
1 parent 0cf4ea3 commit ab98dbc

5 files changed

+20
-6
lines changed

.size-snapshot.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"dist/ui-kit.esm.js": {
3-
"bundled": 866786,
4-
"minified": 596078,
5-
"gzipped": 121176,
3+
"bundled": 866961,
4+
"minified": 596248,
5+
"gzipped": 121235,
66
"treeshaked": {
77
"rollup": {
8-
"code": 429612,
8+
"code": 429763,
99
"import_statements": 919
1010
},
1111
"webpack": {
12-
"code": 453939
12+
"code": 454131
1313
}
1414
}
1515
}

rollup.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const configureRollupPlugins = (options = {}) =>
1818
[
1919
replace({
2020
'process.env.NODE_ENV': JSON.stringify('production'),
21+
'process.env.npm_package_version': JSON.stringify(
22+
process.env.npm_package_version
23+
),
2124
}),
2225
// To use the nodejs `resolve` algorithm
2326
resolve(),

src/index.bundlespec.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { i18n, customProperties } from 'ui-kit';
1+
import { i18n, customProperties, version } from 'ui-kit';
22

33
describe('exports', () => {
44
it('should export i18n for five languages', () => {
@@ -9,6 +9,12 @@ describe('exports', () => {
99
expect(customProperties).toBeTruthy();
1010
});
1111

12+
describe('version', () => {
13+
it('should match package.json version', () => {
14+
expect(version).toMatch(process.env.npm_package_version);
15+
});
16+
});
17+
1218
it('should have the translations', () => {
1319
// This test ensures some translations exist, assuming the others would
1420
// work as well then

src/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ export { default as customProperties } from '../materials/custom-properties';
138138

139139
export { i18n };
140140

141+
export { default as version } from './version';
142+
141143
export {
142144
default as ContentNotification,
143145
} from './components/notifications/content-notification';

src/version.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const version = process.env.npm_package_version;
2+
3+
export default version;

0 commit comments

Comments
 (0)