chore(release): v3.0.0

This commit is contained in:
Christopher S. Case
2017-12-11 11:59:00 -06:00
parent b3e1350fda
commit 9d6fc4cdc3
8 changed files with 577 additions and 484 deletions
+33 -6
View File
@@ -1,18 +1,45 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# This project uses EditorConfig for setting code formatting options: http://EditorConfig.org
root = true
# Default settings for all files
[*]
end_of_line = lf
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = tab
tab_width = 4
max_line_length = 120
# Tabs in JS unless otherwise specified
[**.js]
spaces_around_operators = true
spaces_around_brackets = none
curly_bracket_next_line = true
indent_brace_style = Allman
continuation_indent_size = 4
[*.{css,less}]
curly_bracket_next_line = false
continuation_indent_size = 0
# Formats likely to be pasted into an REPL on a terminal should not use tabs to avoid triggering tab-completion.
[*.{sh,bash,sql,psql,pgsql}]
indent_style = space
indent_size = 4
[*.yml]
indent_style = space
indent_size = 2
[*.md]
[*.{js,json}]
indent_style = space
indent_size = 4
# Special overrides for automatically-generated files
[package.json]
indent_size = 2
# For some formats, trailing whitespace is significant; don't strip it.
[*.{md,diff,patch}]
trim_trailing_whitespace = false
+5
View File
@@ -1,3 +1,8 @@
<a name="3.0.0"></a>
# [3.0.0](https://github.com/morgul/ui-bootstrap4/compare/3.0.0-beta.4...3.0.0) (2017-12-11)
<a name="3.0.0-beta.4"></a>
# [3.0.0-beta.4](https://github.com/morgul/ui-bootstrap4/compare/2.5.0...3.0.0-beta.4) (2017-12-10)
+158 -93
View File
@@ -1,6 +1,6 @@
var marked = require('marked');
var fs = require('fs');
var _ = require('lodash');
const marked = require('marked');
const fs = require('fs');
const _ = require('lodash');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
@@ -86,34 +86,38 @@ module.exports = function(grunt) {
]
},
demoassets: {
files: [{
files: [
{
expand: true,
//Don't re-copy html files, we process those
src: ['**/**/*', '!**/*.html'],
cwd: 'misc/demo',
dest: 'dist/'
}]
}
]
},
docs: {
files:[{
files: [
{
expand: true,
src: ['**/*', '*/*'],
cwd: 'dist/',
dest: 'docs/'
}]
}
]
}
},
uglify: {
options: {
banner: '<%= meta.banner %>'
},
dist:{
src:['<%= concat.dist.dest %>'],
dest:'<%= dist %>/<%= filename %>-<%= pkg.version %>.min.js'
dist: {
src: ['<%= concat.dist.dest %>'],
dest: '<%= dist %>/<%= filename %>-<%= pkg.version %>.min.js'
},
dist_tpls:{
src:['<%= concat.dist_tpls.dest %>'],
dest:'<%= dist %>/<%= filename %>-tpls-<%= pkg.version %>.min.js'
dist_tpls: {
src: ['<%= concat.dist_tpls.dest %>'],
dest: '<%= dist %>/<%= filename %>-tpls-<%= pkg.version %>.min.js'
}
},
html2js: {
@@ -125,15 +129,17 @@ module.exports = function(grunt) {
return `uib/${moduleName}`;
}
},
files: [{
files: [
{
expand: true,
src: ['template/**/*.html'],
ext: '.html.js'
}]
}
]
}
},
eslint: {
files: ['Gruntfile.js','src/**/*.js']
files: ['Gruntfile.js', 'src/**/*.js']
},
karma: {
options: {
@@ -180,17 +186,20 @@ module.exports = function(grunt) {
//We use %version% and evaluate it at run-time, because <%= pkg.version %>
//is only evaluated once
'release-prepare': [
'grunt before-test after-test',
'grunt version', //remove "-SNAPSHOT"
'grunt conventionalChangelog'
'cp ./dist/ui-bootstrap* docs',
'git add docs',
],
'release-complete': [
'git commit CHANGELOG.md package.json -m "chore(release): v%version%"',
'git tag %version%'
'git commit -a -m "chore(release): v%version%"',
'git tag %version%',
'git push --follow-tags'
],
'release-start': [
'grunt version:minor:"SNAPSHOT"',
'git commit package.json -m "chore(release): Starting v%version%"'
'publish': [
'rm -rf dist/*',
'cp ./docs/ui-bootstrap-%version%.js ./dist/ui-bootstrap.js',
'cp ./docs/ui-bootstrap-%version%-csp.css ./dist/ui-bootstrap-csp.css',
'cp ./docs/ui-bootstrap-tpls-%version%.js ./dist/ui-bootstrap-tpls.js',
'npm publish'
]
},
'ddescribe-iit': {
@@ -218,29 +227,39 @@ module.exports = function(grunt) {
//Common ui.bootstrap module containing all modules for src and templates
//findModule: Adds a given module to config
var foundModules = {};
function findModule(name) {
if (foundModules[name]) { return; }
const foundModules = {};
function findModule(name)
{
if(foundModules[name])
{ return; }
foundModules[name] = true;
function breakup(text, separator) {
return text.replace(/[A-Z]/g, function (match) {
function breakup(text, separator)
{
return text.replace(/[A-Z]/g, function(match) {
return separator + match;
});
}
function ucwords(text) {
return text.replace(/^([a-z])|\s+([a-z])/g, function ($1) {
function ucwords(text)
{
return text.replace(/^([a-z])|\s+([a-z])/g, function($1) {
return $1.toUpperCase();
});
}
function enquote(str) {
function enquote(str)
{
return `"${str}"`;
}
function enquoteUibDir(str) {
function enquoteUibDir(str)
{
return enquote(`uib/${str}`);
}
var module = {
const module = {
name: name,
moduleName: enquote(`ui.bootstrap.${name}`),
displayName: ucwords(breakup(name, ' ')),
@@ -260,12 +279,13 @@ module.exports = function(grunt) {
}
};
var styles = {
const styles = {
css: [],
js: []
};
module.cssFiles.forEach(processCSS.bind(null, module.name, styles, true));
if (styles.css.length) {
if(styles.css.length)
{
module.css = styles.css.join('\n');
module.cssJs = styles.js.join('\n');
}
@@ -274,21 +294,24 @@ module.exports = function(grunt) {
grunt.config('modules', grunt.config('modules').concat(module));
}
function dependenciesForModule(name) {
var deps = [];
function dependenciesForModule(name)
{
let deps = [];
grunt.file.expand([`src/${name}/*.js`, `!src/${name}/index.js`, `!src/${name}/index-nocss.js`])
.map(grunt.file.read)
.forEach(function(contents) {
//Strategy: find where module is declared,
//and from there get everything inside the [] and split them by comma
var moduleDeclIndex = contents.indexOf('angular.module(');
var depArrayStart = contents.indexOf('[', moduleDeclIndex);
var depArrayEnd = contents.indexOf(']', depArrayStart);
var dependencies = contents.substring(depArrayStart + 1, depArrayEnd);
const moduleDeclIndex = contents.indexOf('angular.module(');
const depArrayStart = contents.indexOf('[', moduleDeclIndex);
const depArrayEnd = contents.indexOf(']', depArrayStart);
const dependencies = contents.substring(depArrayStart + 1, depArrayEnd);
dependencies.split(',').forEach(function(dep) {
if (dep.indexOf('ui.bootstrap.') > -1) {
var depName = dep.trim().replace('ui.bootstrap.','').replace(/['"]/g,'');
if (deps.indexOf(depName) < 0) {
if(dep.indexOf('ui.bootstrap.') > -1)
{
const depName = dep.trim().replace('ui.bootstrap.', '').replace(/['"]/g, '');
if(deps.indexOf(depName) < 0)
{
deps.push(depName);
//Get dependencies for this new dependency
deps = deps.concat(dependenciesForModule(depName));
@@ -300,18 +323,22 @@ module.exports = function(grunt) {
}
grunt.registerTask('dist', 'Override dist directory', function() {
var dir = this.args[0];
if (dir) { grunt.config('dist', dir); }
const dir = this.args[0];
if(dir)
{ grunt.config('dist', dir); }
});
grunt.registerTask('build', 'Create bootstrap build files', function() {
var _ = grunt.util._;
const _ = grunt.util._;
//If arguments define what modules to build, build those. Else, everything
if (this.args.length) {
if(this.args.length)
{
this.args.forEach(findModule);
grunt.config('filename', grunt.config('filenamecustom'));
} else {
}
else
{
grunt.file.expand({
filter: 'isDirectory', cwd: '.'
}, 'src/*').forEach((dir) => {
@@ -319,21 +346,24 @@ module.exports = function(grunt) {
});
}
var modules = grunt.config('modules');
const modules = grunt.config('modules');
grunt.config('srcModules', _.pluck(modules, 'moduleName'));
grunt.config('tplModules', _.pluck(modules, 'tplModules').filter((tpls) => tpls.length > 0));
grunt.config('demoModules', modules
.filter((module) => module.docs.md && module.docs.js && module.docs.html)
.sort((a, b) => {
if (a.name < b.name) { return -1; }
if (a.name > b.name) { return 1; }
if(a.name < b.name)
{ return -1; }
if(a.name > b.name)
{ return 1; }
return 0;
})
);
var cssStrings = _.flatten(_.compact(_.pluck(modules, 'css')));
var cssJsStrings = _.flatten(_.compact(_.pluck(modules, 'cssJs')));
if (cssStrings.length) {
const cssStrings = _.flatten(_.compact(_.pluck(modules, 'css')));
const cssJsStrings = _.flatten(_.compact(_.pluck(modules, 'cssJs')));
if(cssStrings.length)
{
grunt.config('meta.cssInclude', cssJsStrings.join('\n'));
grunt.file.write(grunt.config('meta.cssFileDest'), grunt.config('meta.cssFileBanner') +
@@ -342,13 +372,13 @@ module.exports = function(grunt) {
grunt.log.writeln('File ' + grunt.config('meta.cssFileDest') + ' created');
}
var moduleFileMapping = _.clone(modules, true);
const moduleFileMapping = _.clone(modules, true);
moduleFileMapping.forEach((module) => delete module.docs);
grunt.config('moduleFileMapping', moduleFileMapping);
var srcFiles = _.pluck(modules, 'srcFiles');
var tpljsFiles = _.pluck(modules, 'tpljsFiles');
const srcFiles = _.pluck(modules, 'srcFiles');
const tpljsFiles = _.pluck(modules, 'tpljsFiles');
//Set the concat task to concatenate the given src modules
grunt.config('concat.dist.src', grunt.config('concat.dist.src')
.concat(srcFiles));
@@ -362,12 +392,16 @@ module.exports = function(grunt) {
grunt.registerTask('test', 'Run tests on singleRun karma server', function() {
//this task can be executed in 3 different environments: local, Travis-CI and Jenkins-CI
//we need to take settings for each one into account
if (process.env.TRAVIS) {
if(process.env.TRAVIS)
{
grunt.task.run('karma:travis');
} else {
var isToRunJenkinsTask = !!this.args.length;
if (grunt.option('coverage')) {
var karmaOptions = grunt.config.get('karma.options'),
}
else
{
const isToRunJenkinsTask = !!this.args.length;
if(grunt.option('coverage'))
{
const karmaOptions = grunt.config.get('karma.options'),
coverageOpts = grunt.config.get('karma.coverage');
grunt.util._.extend(karmaOptions, coverageOpts);
grunt.config.set('karma.options', karmaOptions);
@@ -377,35 +411,36 @@ module.exports = function(grunt) {
});
grunt.registerTask('makeModuleMappingFile', function() {
var _ = grunt.util._;
var moduleMappingJs = 'dist/assets/module-mapping.json';
var moduleMappings = grunt.config('moduleFileMapping');
var moduleMappingsMap = _.object(_.pluck(moduleMappings, 'name'), moduleMappings);
var jsContent = JSON.stringify(moduleMappingsMap);
const _ = grunt.util._;
const moduleMappingJs = 'dist/assets/module-mapping.json';
const moduleMappings = grunt.config('moduleFileMapping');
const moduleMappingsMap = _.object(_.pluck(moduleMappings, 'name'), moduleMappings);
const jsContent = JSON.stringify(moduleMappingsMap);
grunt.file.write(moduleMappingJs, jsContent);
grunt.log.writeln('File ' + moduleMappingJs.cyan + ' created.');
});
grunt.registerTask('makeRawFilesJs', function() {
var _ = grunt.util._;
var jsFilename = 'dist/assets/raw-files.json';
var genRawFilesJs = require('./misc/raw-files-generator');
const _ = grunt.util._;
const jsFilename = 'dist/assets/raw-files.json';
const genRawFilesJs = require('./misc/raw-files-generator');
genRawFilesJs(grunt, jsFilename, _.flatten(grunt.config('concat.dist_tpls.src')),
grunt.config('meta.banner'), grunt.config('meta.cssFileBanner'));
grunt.config('meta.banner'), grunt.config('meta.cssFileBanner')
);
});
grunt.registerTask('makeVersionsMappingFile', function() {
var done = this.async();
const done = this.async();
var exec = require('child_process').exec;
const exec = require('child_process').exec;
var versionsMappingFile = 'dist/versions-mapping.json';
const versionsMappingFile = 'dist/versions-mapping.json';
exec('git tag --sort -version:refname', function(error, stdout, stderr) {
// Let's remove the oldest 14 versions.
var versions = stdout.split('\n').slice(0, -14);
var jsContent = versions.map(function(version) {
const versions = stdout.split('\n').slice(0, -14);
let jsContent = versions.map(function(version) {
version = version.replace(/^v/, '');
return {
version: version,
@@ -428,12 +463,14 @@ module.exports = function(grunt) {
* Logic from AngularJS
* https://github.com/angular/angular.js/blob/36831eccd1da37c089f2141a2c073a6db69f3e1d/lib/grunt/utils.js#L121-L145
*/
function processCSS(moduleName, state, minify, file) {
var css = fs.readFileSync(file).toString(),
function processCSS(moduleName, state, minify, file)
{
let css = fs.readFileSync(file).toString(),
js;
state.css.push(css);
if (minify) {
if(minify)
{
css = css
.replace(/\r?\n/g, '')
.replace(/\/\*.*?\*\//g, '')
@@ -448,24 +485,29 @@ module.exports = function(grunt) {
.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")
.replace(/\r?\n/g, '\\n');
js = `angular.module('ui.bootstrap.${moduleName}').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uib${_.capitalize(moduleName)}Css && angular.element(document).find('head').prepend('<style type="text/css">${css}</style>'); angular.$$uib${_.capitalize(moduleName)}Css = true; });`;
js = `angular.module('ui.bootstrap.${moduleName}').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uib${_.capitalize(
moduleName)}Css && angular.element(document).find('head').prepend('<style type="text/css">${css}</style>'); angular.$$uib${_.capitalize(
moduleName)}Css = true; });`;
state.js.push(js);
return state;
}
function setVersion(type, suffix) {
var file = 'package.json';
var VERSION_REGEX = /([\'|\"]version[\'|\"][ ]*:[ ]*[\'|\"])([\d|.]*)(-\w+)*([\'|\"])/;
var contents = grunt.file.read(file);
var version;
function setVersion(type, suffix)
{
const file = 'package.json';
const VERSION_REGEX = /([\'|\"]version[\'|\"][ ]*:[ ]*[\'|\"])([\d|.]*)(-\w+)*([\'|\"])/;
let contents = grunt.file.read(file);
let version;
contents = contents.replace(VERSION_REGEX, function(match, left, center) {
version = center;
if (type) {
if(type)
{
version = require('semver').inc(version, type);
}
//semver.inc strips our suffix if it existed
if (suffix) {
if(suffix)
{
version += '-' + suffix;
}
return left + version + '"';
@@ -480,17 +522,40 @@ module.exports = function(grunt) {
});
grunt.registerMultiTask('shell', 'run shell commands', function() {
var self = this;
var sh = require('shelljs');
const self = this;
const sh = require('shelljs');
self.data.forEach(function(cmd) {
cmd = cmd.replace('%version%', grunt.file.readJSON('package.json').version);
grunt.log.ok(cmd);
var result = sh.exec(cmd,{silent:true});
if (result.code !== 0) {
const result = sh.exec(cmd, { silent: true });
if(result.code !== 0)
{
grunt.fatal(result.output);
}
});
});
//------------------------------------------------------------------------------------------------------------------
// New Release System
//------------------------------------------------------------------------------------------------------------------
grunt.registerTask('release', function(version) {
// Step 1, we change package.json
const pkg = grunt.config('pkg');
pkg.version = version;
grunt.file.write('./package.json', JSON.stringify(pkg, null, 2));
// Step 2, we queue up additional tasks
grunt.task.run([
'conventionalChangelog',
'build',
'shell:release-prepare',
'shell:release-complete',
'shell:publish'
])
});
//------------------------------------------------------------------------------------------------------------------
return grunt;
};
+1 -3
View File
@@ -2,7 +2,7 @@
* ui-bootstrap4
* http://morgul.github.io/ui-bootstrap4/
* Version: 3.0.0-beta.4 - 2017-12-09
* Version: 3.0.0-beta.4 - 2017-12-11
* License: MIT
*/angular.module("ui.bootstrap", ["ui.bootstrap.collapse","ui.bootstrap.tabindex","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.datepicker","ui.bootstrap.position","ui.bootstrap.datepickerPopup","ui.bootstrap.debounce","ui.bootstrap.multiMap","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]);
angular.module('ui.bootstrap.collapse', [])
@@ -2736,8 +2736,6 @@ angular.module('ui.bootstrap.position', [])
arrowCss[placement[1]] = borderRadius;
console.log('calc CSS:', arrowCss);
angular.element(arrowElem).css(arrowCss);
}
};
File diff suppressed because one or more lines are too long
+1 -3
View File
@@ -2,7 +2,7 @@
* ui-bootstrap4
* http://morgul.github.io/ui-bootstrap4/
* Version: 3.0.0-beta.4 - 2017-12-09
* Version: 3.0.0-beta.4 - 2017-12-11
* License: MIT
*/angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.collapse","ui.bootstrap.tabindex","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.datepicker","ui.bootstrap.position","ui.bootstrap.datepickerPopup","ui.bootstrap.debounce","ui.bootstrap.multiMap","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]);
angular.module("ui.bootstrap.tpls", ["uib/template/accordion/accordion-group.html","uib/template/accordion/accordion.html","uib/template/alert/alert.html","uib/template/carousel/carousel.html","uib/template/carousel/slide.html","uib/template/datepicker/datepicker.html","uib/template/datepicker/day.html","uib/template/datepicker/month.html","uib/template/datepicker/year.html","uib/template/datepickerPopup/popup.html","uib/template/modal/window.html","uib/template/pager/pager.html","uib/template/pagination/pagination.html","uib/template/tooltip/tooltip-html-popup.html","uib/template/tooltip/tooltip-popup.html","uib/template/tooltip/tooltip-template-popup.html","uib/template/popover/popover-html.html","uib/template/popover/popover-template.html","uib/template/popover/popover.html","uib/template/progressbar/bar.html","uib/template/progressbar/progress.html","uib/template/progressbar/progressbar.html","uib/template/rating/rating.html","uib/template/tabs/tab.html","uib/template/tabs/tabset.html","uib/template/timepicker/timepicker.html","uib/template/typeahead/typeahead-match.html","uib/template/typeahead/typeahead-popup.html"]);
@@ -2737,8 +2737,6 @@ angular.module('ui.bootstrap.position', [])
arrowCss[placement[1]] = borderRadius;
console.log('calc CSS:', arrowCss);
angular.element(arrowElem).css(arrowCss);
}
};
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,7 +1,7 @@
{
"author": "https://github.com/morgul/ui-bootstrap4/graphs/contributors",
"name": "ui-bootstrap4",
"version": "3.0.0-beta.4",
"version": "3.0.0",
"description": "Native AngularJS (Angular) directives for Bootstrap",
"homepage": "http://morgul.github.io/ui-bootstrap4/",
"keywords": [