Skip to content

Commit d093223

Browse files
authored
Include version in build (immutable-js#1345)
Now you can `Immutable.version` to get an idea of what version you're using. Wish I had done this a long time ago, it's pretty useful! Fixes immutable-js#133
1 parent d267ac2 commit d093223

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"rollup": "0.41.5",
9696
"rollup-plugin-buble": "0.15.0",
9797
"rollup-plugin-commonjs": "7.1.0",
98+
"rollup-plugin-json": "^2.3.0",
9899
"rollup-plugin-strip-banner": "0.1.0",
99100
"run-sequence": "1.2.2",
100101
"through2": "2.0.3",
@@ -123,5 +124,6 @@
123124
"stateless",
124125
"sequence",
125126
"iteration"
126-
]
127+
],
128+
"dependencies": {}
127129
}

resources/rollup-config-es.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import fs from 'fs';
99
import path from 'path';
1010
import buble from 'rollup-plugin-buble';
1111
import commonjs from 'rollup-plugin-commonjs';
12+
import json from 'rollup-plugin-json';
1213
import stripBanner from 'rollup-plugin-strip-banner';
1314

1415
const copyright = fs.readFileSync(path.join('resources', 'COPYRIGHT'), 'utf-8');
@@ -24,5 +25,5 @@ export default {
2425
moduleName: 'Immutable',
2526
entry: path.join(SRC_DIR, 'Immutable.js'),
2627
dest: path.join(DIST_DIR, 'immutable.es.js'),
27-
plugins: [commonjs(), stripBanner(), buble()]
28+
plugins: [commonjs(), json(), stripBanner(), buble()]
2829
};

resources/rollup-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import path from 'path';
1010
import { minify } from 'uglify-js';
1111
import buble from 'rollup-plugin-buble';
1212
import commonjs from 'rollup-plugin-commonjs';
13+
import json from 'rollup-plugin-json';
1314
import saveLicense from 'uglify-save-license';
1415
import stripBanner from 'rollup-plugin-strip-banner';
1516

@@ -28,6 +29,7 @@ export default {
2829
dest: path.join(DIST_DIR, 'immutable.js'),
2930
plugins: [
3031
commonjs(),
32+
json(),
3133
stripBanner(),
3234
buble(),
3335
{

src/Immutable.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ import {
2929
import { Collection } from './CollectionImpl';
3030
import { hash } from './Hash';
3131

32+
import { version } from '../package.json';
33+
3234
export default {
35+
version: version,
36+
3337
Collection: Collection,
3438
// Note: Iterable is deprecated
3539
Iterable: Collection,
@@ -63,6 +67,7 @@ export default {
6367
const Iterable = Collection;
6468

6569
export {
70+
version,
6671
Collection,
6772
Iterable,
6873
Seq,

yarn.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5197,6 +5197,12 @@ rollup-plugin-commonjs@7.1.0:
51975197
resolve "^1.1.7"
51985198
rollup-pluginutils "^2.0.1"
51995199

5200+
rollup-plugin-json@^2.3.0:
5201+
version "2.3.0"
5202+
resolved "https://registry.yarnpkg.com/rollup-plugin-json/-/rollup-plugin-json-2.3.0.tgz#3c07a452c1b5391be28006fbfff3644056ce0add"
5203+
dependencies:
5204+
rollup-pluginutils "^2.0.1"
5205+
52005206
rollup-plugin-strip-banner@0.1.0:
52015207
version "0.1.0"
52025208
resolved "https://registry.yarnpkg.com/rollup-plugin-strip-banner/-/rollup-plugin-strip-banner-0.1.0.tgz#ef2782b9e217c8ca44544f57e2995694db732899"

0 commit comments

Comments
 (0)