UNPKG

1.77 kBJavaScriptView Raw
1"use strict";
2
3let pkg = require('./compat/package.json');
4let fs = require('fs-extra');
5let mkdirp = require('mkdirp');
6let path = require('path');
7let klawSync = require('klaw-sync');
8let licenseTool = require('./tools/add-license-to-file');
9let makePackages = require('./.make-helpers');
10let copySources = makePackages.copySources;
11let createImportTargets = makePackages.createImportTargets;
12let cleanSourceMapRoot = makePackages.cleanSourceMapRoot;
13
14let addLicenseToFile = licenseTool.addLicenseToFile;
15let addLicenseTextToFile = licenseTool.addLicenseTextToFile;
16
17const ROOT = 'dist-compat/';
18const CJS_ROOT = ROOT + 'cjs/compat/';
19const ESM5_ROOT = ROOT + 'esm5/compat/';
20const ESM2015_ROOT = ROOT + 'esm2015/compat/';
21const GLOBAL_ROOT = ROOT + 'global/';
22const TYPE_ROOT = ROOT + 'typings/compat/';
23const PKG_ROOT = ROOT + 'package/';
24const CJS_PKG = PKG_ROOT + '';
25const ESM5_PKG = PKG_ROOT + '_esm5/';
26const ESM2015_PKG = PKG_ROOT + '_esm2015/';
27const UMD_PKG = PKG_ROOT + 'bundles/';
28const SRC_ROOT_PKG = PKG_ROOT + 'src/';
29const TYPE_PKG = PKG_ROOT;
30
31// License info for minified files
32let licenseUrl = 'https://github.com/ReactiveX/RxJS/blob/master/LICENSE.txt';
33let license = 'Apache License 2.0 ' + licenseUrl;
34
35// Recreate the distribution folder
36fs.removeSync(PKG_ROOT);
37mkdirp.sync(PKG_ROOT);
38
39// Copy over the sources
40fs.copySync(TYPE_ROOT, TYPE_PKG);
41copySources(CJS_ROOT, CJS_PKG);
42cleanSourceMapRoot(CJS_PKG, SRC_ROOT_PKG);
43copySources(ESM5_ROOT, ESM5_PKG, true);
44cleanSourceMapRoot(ESM5_PKG, SRC_ROOT_PKG);
45copySources(ESM2015_ROOT, ESM2015_PKG, true);
46cleanSourceMapRoot(ESM2015_PKG, SRC_ROOT_PKG);
47copySources(GLOBAL_ROOT, UMD_PKG, true);
48cleanSourceMapRoot(UMD_PKG, SRC_ROOT_PKG);
49
50fs.copySync('compat/package.json', PKG_ROOT + '/package.json');