forked from ReactiveX/rxjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.make-packages.js
49 lines (43 loc) · 2.15 KB
/
.make-packages.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var pkg = require('./package.json');
var fs = require('fs');
var mkdirp = require('mkdirp');
var path = require('path');
var Builder = require('systemjs-builder');
var addLicenseToFile = require('./tools/add-license-to-file');
delete pkg.scripts;
var cjsPkg = Object.assign({}, pkg, {
name: 'rxjs',
main: 'Rx.js',
typings: 'Rx.d.ts'
});
var es6Pkg = Object.assign({}, cjsPkg, {
name: 'rxjs-es',
main: 'Rx.js',
typings: 'Rx.d.ts'
});
fs.writeFileSync('dist/cjs/package.json', JSON.stringify(cjsPkg, null, 2));
fs.writeFileSync('dist/cjs/LICENSE.txt', fs.readFileSync('./LICENSE.txt').toString());
fs.writeFileSync('dist/cjs/README.md', fs.readFileSync('./README.md').toString());
// Bundles for CJS only
mkdirp.sync('dist/cjs/bundles');
// UMD bundles
fs.writeFileSync('dist/cjs/bundles/Rx.umd.js', fs.readFileSync('dist/global/Rx.umd.js').toString());
fs.writeFileSync('dist/cjs/bundles/Rx.umd.min.js', fs.readFileSync('dist/global/Rx.umd.min.js').toString());
fs.writeFileSync('dist/cjs/bundles/Rx.umd.min.js.map', fs.readFileSync('dist/global/Rx.umd.min.js.map').toString());
// System bundles
fs.writeFileSync('dist/cjs/bundles/Rx.js', fs.readFileSync('dist/global/Rx.js').toString());
fs.writeFileSync('dist/cjs/bundles/Rx.min.js', fs.readFileSync('dist/global/Rx.min.js').toString());
fs.writeFileSync('dist/cjs/bundles/Rx.min.js.map', fs.readFileSync('dist/global/Rx.min.js.map').toString());
// ES6 Package
fs.writeFileSync('dist/es6/package.json', JSON.stringify(es6Pkg, null, 2));
fs.writeFileSync('dist/es6/LICENSE.txt', fs.readFileSync('./LICENSE.txt').toString());
fs.writeFileSync('dist/es6/README.md', fs.readFileSync('./README.md').toString());
// Add licenses to tops of bundles
addLicenseToFile('LICENSE.txt', 'dist/cjs/bundles/Rx.umd.js');
addLicenseToFile('LICENSE.txt', 'dist/cjs/bundles/Rx.umd.min.js');
addLicenseToFile('LICENSE.txt', 'dist/cjs/bundles/Rx.js');
addLicenseToFile('LICENSE.txt', 'dist/cjs/bundles/Rx.min.js');
addLicenseToFile('LICENSE.txt', 'dist/global/Rx.umd.js');
addLicenseToFile('LICENSE.txt', 'dist/global/Rx.umd.min.js');
addLicenseToFile('LICENSE.txt', 'dist/global/Rx.js');
addLicenseToFile('LICENSE.txt', 'dist/global/Rx.min.js');