chore(publish): add Rx bundles to code.angularjs.org publish step
Closes #5904 Closes #5909
This commit is contained in:
parent
3dca9d522a
commit
00822c3415
|
@ -0,0 +1,38 @@
|
|||
#! /usr/bin/env node
|
||||
|
||||
/**
|
||||
* TODO: remove this file when license is included in RxJS bundles.
|
||||
* https://github.com/ReactiveX/RxJS/issues/1067
|
||||
*
|
||||
* This script runs after bundles have already been copied to the build-path,
|
||||
* to prepend the license to each bundle.
|
||||
**/
|
||||
var fs = require('fs');
|
||||
var args = require('minimist')(process.argv);
|
||||
|
||||
var license = fs.readFileSync(args['license-path']);
|
||||
// Make the license block into a JS comment
|
||||
license = `/**
|
||||
${license}
|
||||
**/
|
||||
`;
|
||||
|
||||
var bundles = fs.readdirSync(args['build-path'])
|
||||
// Match files that begin with Rx and end with js
|
||||
.filter(bundle => /^Rx\.?.*\.js$/.test(bundle))
|
||||
// Load file contents
|
||||
.map(bundle => {
|
||||
return {
|
||||
path: bundle,
|
||||
contents: fs.readFileSync(`${args['build-path']}/${bundle}`).toString()
|
||||
};
|
||||
})
|
||||
// Concatenate license to bundle
|
||||
.map(bundle => {
|
||||
return {
|
||||
path: bundle.path,
|
||||
contents: `${license}${bundle.contents}`
|
||||
};
|
||||
})
|
||||
// Write file to disk
|
||||
.forEach(bundle => fs.writeFileSync(`${args['build-path']}/${bundle.path}`, bundle.contents));
|
|
@ -22,6 +22,8 @@ function init {
|
|||
else
|
||||
IS_SNAPSHOT_BUILD=
|
||||
fi
|
||||
RX_BUNDLE_DIR=$(resolveDir ../../node_modules/rxjs/bundles)
|
||||
RX_LICENSE=$(resolveDir ../../node_modules/rxjs)/LICENSE.txt
|
||||
}
|
||||
|
||||
function prepare {
|
||||
|
@ -54,6 +56,8 @@ function prepare {
|
|||
#
|
||||
mkdir $REPO_DIR/$NEW_VERSION
|
||||
cp -r $BUILD_DIR/* $REPO_DIR/$NEW_VERSION/
|
||||
cp -r $RX_BUNDLE_DIR/* $REPO_DIR/$NEW_VERSION/
|
||||
node ./add-license-to-rx.js --license-path=$RX_LICENSE --build-path=$REPO_DIR/$NEW_VERSION
|
||||
fi
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue