-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc58311
commit abfbe9e
Showing
5 changed files
with
190 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!env node | ||
"use strict"; | ||
|
||
let version = require('../package.json').version; | ||
|
||
require('shelljs/global'); | ||
let readlineSync = require('readline-sync'); | ||
let fs = require('fs'); | ||
let path = require('path'); | ||
let util = require('./util'); | ||
let _exec = util._exec; | ||
|
||
cd(path.join(__dirname, '..')); | ||
|
||
if (!readlineSync.keyInYN('Ready to publish to ' + version + '-artifacts tag?')) { | ||
process.exit(1); | ||
} | ||
|
||
util.ensureCleanMaster('master'); | ||
|
||
_exec('npm run all'); | ||
|
||
// then tag and push tag | ||
_exec(`git checkout -b ${version}-artifacts-prep`); | ||
_exec(`git add --force lib _bundles`); | ||
_exec(`git commit -m 'chore(*): commiting build files'`); | ||
_exec(`git tag ${version}-artifacts`); | ||
_exec(`git push -u origin ${version}-artifacts`); | ||
_exec(`git checkout master`); | ||
_exec(`git branch -D ${version}-artifacts-prep`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
import progress from 'rollup-plugin-progress'; | ||
import sourcemaps from 'rollup-plugin-sourcemaps'; | ||
import visualizer from 'rollup-plugin-visualizer'; | ||
|
||
var MINIFY = process.env.MINIFY; | ||
var ROUTER = process.env.ROUTER; | ||
var EVENTS = process.env.EVENTS; | ||
var RESOLVE = process.env.RESOLVE; | ||
|
||
var pkg = require('./package.json'); | ||
var banner = | ||
`/** | ||
* ${pkg.description} | ||
* @version v${pkg.version} | ||
* @link ${pkg.homepage} | ||
* @license MIT License, http://www.opensource.org/licenses/MIT | ||
*/`; | ||
|
||
var uglifyOpts = { output: {} }; | ||
// retain multiline comment with @license | ||
uglifyOpts.output.comments = (node, comment) => | ||
comment.type === 'comment2' && /@license/i.test(comment.value); | ||
|
||
var plugins = [ | ||
nodeResolve({jsnext: true}), | ||
progress(), | ||
sourcemaps(), | ||
]; | ||
|
||
if (MINIFY) plugins.push(uglify(uglifyOpts)); | ||
if (ROUTER && MINIFY) plugins.push(visualizer({ sourcemap: true })); | ||
|
||
var extension = MINIFY ? ".min.js" : ".js"; | ||
|
||
const BASE_CONFIG = { | ||
sourceMap: true, | ||
format: 'umd', | ||
exports: 'named', | ||
plugins: plugins, | ||
banner: banner, | ||
}; | ||
|
||
const ROUTER_CONFIG = Object.assign({ | ||
moduleName: 'angular-ui-router', | ||
entry: 'lib-esm/index.js', | ||
dest: 'release/angular-ui-router' + extension, | ||
globals: { angular: 'angular' }, | ||
external: 'angular', | ||
}, BASE_CONFIG); | ||
|
||
const EVENTS_CONFIG = Object.assign({}, BASE_CONFIG, { | ||
moduleName: 'angular-ui-router-state-events', | ||
entry: 'lib-esm/legacy/stateEvents.js', | ||
dest: 'release/stateEvents' + extension, | ||
globals: { angular: 'angular', 'ui-router-core': 'ui-router-core' }, | ||
external: ['angular', 'ui-router-core'], | ||
}); | ||
|
||
const RESOLVE_CONFIG = Object.assign({}, BASE_CONFIG, { | ||
moduleName: 'angular-ui-router-resolve-service', | ||
entry: 'lib-esm/legacy/resolveService.js', | ||
dest: 'release/resolveService' + extension, | ||
globals: { angular: 'angular', 'ui-router-core': 'ui-router-core' }, | ||
external: ['angular', 'ui-router-core'], | ||
}); | ||
|
||
const CONFIG = | ||
RESOLVE ? RESOLVE_CONFIG : | ||
EVENTS ? EVENTS_CONFIG : | ||
ROUTER ? ROUTER_CONFIG : ROUTER_CONFIG; | ||
|
||
export default CONFIG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"use strict"; | ||
|
||
require('shelljs/global'); | ||
let fs = require('fs'); | ||
|
||
function ensureCleanMaster(branch) { | ||
branch = branch || 'master'; | ||
if (exec('git symbolic-ref HEAD').stdout.trim() !== `refs/heads/${branch}`) | ||
throw new Error(`Not on ${branch} branch, aborting`); | ||
if (exec('git status --porcelain').stdout.trim() !== '') | ||
throw new Error('Working copy is dirty, aborting'); | ||
} | ||
|
||
function _exec(command) { | ||
echo(command); | ||
echo(); | ||
var result = exec(command); | ||
if (result.code === 0) return result; | ||
echo(`Aborting; non-zero return value (${result.code}) from: ${command}`); | ||
exit(result.code) | ||
} | ||
|
||
function asJson (obj) { return JSON.stringify(obj, null, 2); } | ||
|
||
let ensure = (type) => (path) => { | ||
let is = false; | ||
try { is = fs.lstatSync(path)['is' + type](); } catch (e) { console.log(e); } | ||
if (!is) echo(`Not a ${type}: ${path}`) && exit(-3); | ||
}; | ||
let assertDir = ensure('Directory'); | ||
let assertFile = ensure('File'); | ||
|
||
module.exports = { | ||
ensureCleanMaster: ensureCleanMaster, | ||
_exec: _exec, | ||
asJson: asJson, | ||
assertDir: assertDir, | ||
assertFile: assertFile | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters