diff --git a/gulpfile.js b/gulpfile.js index e9423a6dcb..62f4f22e63 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -29,9 +29,9 @@ function loadTask(fileName, taskName) { gulp.task('format:enforce', loadTask('format', 'enforce')); gulp.task('format', loadTask('format', 'format')); -gulp.task('format:changes', loadTask('format', 'format-changes')); +gulp.task('format:untracked', loadTask('format', 'format-untracked')); gulp.task('format:diff', loadTask('format', 'format-diff')); -gulp.task('format:changed', ['format:changes', 'format:diff']); +gulp.task('format:changed', ['format:untracked', 'format:diff']); gulp.task('build.sh', loadTask('build', 'all')); gulp.task('build.sh:no-bundle', loadTask('build', 'no-bundle')); gulp.task('lint', ['format:enforce', 'validate-commit-messages', 'tslint']); diff --git a/package.json b/package.json index 15344bb4db..2830cefd58 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "gulp": "3.9.1", "gulp-clang-format": "1.0.23", "gulp-connect": "5.0.0", - "gulp-conventional-changelog": "1.1.0", + "gulp-conventional-changelog": "^2.0.3", "gulp-filter": "^5.1.0", "gulp-git": "^2.7.0", "gulp-tslint": "8.1.2", diff --git a/tools/gulp-tasks/format.js b/tools/gulp-tasks/format.js index 0b4642e50e..c8bbe342f8 100644 --- a/tools/gulp-tasks/format.js +++ b/tools/gulp-tasks/format.js @@ -30,8 +30,9 @@ const srcsToFmt = [ ]; /** - * Gulp stream that wraps the gulp-git status task - * and converts the stdout into a stream of files + * Gulp stream that wraps the gulp-git status, + * only returns untracked files, and converts + * the stdout into a stream of files. */ function gulpStatus() { const Vinyl = require('vinyl'); @@ -43,7 +44,7 @@ function gulpStatus() { const opt = {cwd: process.cwd()}; // https://git-scm.com/docs/git-status#_short_format - const RE_STATUS = /^((\s\w)|(\w+)|\?{0,2})\s([\w\+\-\/\\\.]+)(\s->\s)?([\w\+\-\/\\\.]+)*\n/gm; + const RE_STATUS = /((\s\w)|(\w+)|\?{0,2})\s([\w\+\-\/\\\.]+)(\s->\s)?([\w\+\-\/\\\.]+)*\n{0,1}/gm; gulpGit.status({args: '--porcelain', quiet: true}, function(err, stdout) { if (err) return srcStream.emit('error', err); @@ -52,16 +53,11 @@ function gulpStatus() { let currentMatch; while ((currentMatch = RE_STATUS.exec(data)) !== null) { - // This is necessary to avoid infinite loops with zero-width matches - if (currentMatch.index === RE_STATUS.lastIndex) { - RE_STATUS.lastIndex++; - } - // status const status = currentMatch[1].trim().toLowerCase(); - // File has been deleted - if (status.includes('d')) { + // We only care about untracked files and renamed files + if (!new RegExp(/r|\?/i).test(status)) { continue; } @@ -76,6 +72,8 @@ function gulpStatus() { path: path.resolve(opt.cwd, filePath), cwd: opt.cwd, })); + + RE_STATUS.lastIndex++; } srcStream.end(); @@ -102,8 +100,8 @@ module.exports = { .pipe(gulp.dest('.')); }, - // Format only the changed source code files with clang-format (see .clang-format) - 'format-changes': (gulp) => () => { + // Format only the untracked source code files with clang-format (see .clang-format) + 'format-untracked': (gulp) => () => { const format = require('gulp-clang-format'); const clangFormat = require('clang-format'); const gulpFilter = require('gulp-filter'); diff --git a/yarn.lock b/yarn.lock index c18f2d0688..be35edaa17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -302,6 +302,12 @@ amqplib@^0.5.2: version "1.7.2" resolved "https://registry.yarnpkg.com/angular/-/angular-1.7.2.tgz#687b955dbe5c533f8d73460461707af00360251f" +ansi-colors@^1.0.1: + version "1.1.0" + resolved "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz#6374b4dd5d4718ff3ce27a671a3b1cad077132a9" + dependencies: + ansi-wrap "^0.1.0" + ansi-cyan@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" @@ -332,7 +338,7 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-wrap@0.1.0: +ansi-wrap@0.1.0, ansi-wrap@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" @@ -1368,7 +1374,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.7, concat-stream@^1.5.0: +concat-stream@^1.4.7, concat-stream@^1.6.0: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" dependencies: @@ -1467,48 +1473,18 @@ conventional-changelog-angular@^1.6.6: compare-func "^1.3.1" q "^1.5.1" -conventional-changelog-atom@^0.2.8: - version "0.2.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-atom/-/conventional-changelog-atom-0.2.8.tgz#8037693455990e3256f297320a45fa47ee553a14" - dependencies: - q "^1.5.1" - conventional-changelog-atom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-atom/-/conventional-changelog-atom-2.0.0.tgz#cd6453469cfb8fc345af3391b92990251c95558b" dependencies: q "^1.5.1" -conventional-changelog-codemirror@^0.3.8: - version "0.3.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-codemirror/-/conventional-changelog-codemirror-0.3.8.tgz#a1982c8291f4ee4d6f2f62817c6b2ecd2c4b7b47" - dependencies: - q "^1.5.1" - conventional-changelog-codemirror@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-codemirror/-/conventional-changelog-codemirror-2.0.0.tgz#bfb61ccabacdd3bf8425a5cbe92276c86c5a0c1e" dependencies: q "^1.5.1" -conventional-changelog-core@^2.0.11: - version "2.0.11" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-2.0.11.tgz#19b5fbd55a9697773ed6661f4e32030ed7e30287" - dependencies: - conventional-changelog-writer "^3.0.9" - conventional-commits-parser "^2.1.7" - dateformat "^3.0.0" - get-pkg-repo "^1.0.0" - git-raw-commits "^1.3.6" - git-remote-origin-url "^2.0.0" - git-semver-tags "^1.3.6" - lodash "^4.2.1" - normalize-package-data "^2.3.5" - q "^1.5.1" - read-pkg "^1.1.0" - read-pkg-up "^1.0.1" - through2 "^2.0.0" - conventional-changelog-core@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.1.0.tgz#96a81bb3301b4b2a3dc2851cc54c5fb674ac1942" @@ -1527,36 +1503,18 @@ conventional-changelog-core@^3.1.0: read-pkg-up "^1.0.1" through2 "^2.0.0" -conventional-changelog-ember@^0.3.12: - version "0.3.12" - resolved "https://registry.yarnpkg.com/conventional-changelog-ember/-/conventional-changelog-ember-0.3.12.tgz#b7d31851756d0fcb49b031dffeb6afa93b202400" - dependencies: - q "^1.5.1" - conventional-changelog-ember@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/conventional-changelog-ember/-/conventional-changelog-ember-2.0.1.tgz#5a5595b9ed50a6daca4bd3508a47ffe4a1a7152f" dependencies: q "^1.5.1" -conventional-changelog-eslint@^1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-eslint/-/conventional-changelog-eslint-1.0.9.tgz#b13cc7e4b472c819450ede031ff1a75c0e3d07d3" - dependencies: - q "^1.5.1" - conventional-changelog-eslint@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-eslint/-/conventional-changelog-eslint-3.0.0.tgz#cc5376cb29a622c1ade197e155bf054640c05cd3" dependencies: q "^1.5.1" -conventional-changelog-express@^0.3.6: - version "0.3.6" - resolved "https://registry.yarnpkg.com/conventional-changelog-express/-/conventional-changelog-express-0.3.6.tgz#4a6295cb11785059fb09202180d0e59c358b9c2c" - dependencies: - q "^1.5.1" - conventional-changelog-express@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-express/-/conventional-changelog-express-2.0.0.tgz#d3d020118fbfce21a75e025ec097101e355a2361" @@ -1575,13 +1533,6 @@ conventional-changelog-jscs@^0.1.0: dependencies: q "^1.4.1" -conventional-changelog-jshint@^0.3.8: - version "0.3.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-jshint/-/conventional-changelog-jshint-0.3.8.tgz#9051c1ac0767abaf62a31f74d2fe8790e8acc6c8" - dependencies: - compare-func "^1.3.1" - q "^1.5.1" - conventional-changelog-jshint@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.0.tgz#7a038330f485082e489f47f5d07539036949f87d" @@ -1589,29 +1540,10 @@ conventional-changelog-jshint@^2.0.0: compare-func "^1.3.1" q "^1.5.1" -conventional-changelog-preset-loader@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-1.1.8.tgz#40bb0f142cd27d16839ec6c74ee8db418099b373" - conventional-changelog-preset-loader@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.0.1.tgz#d134734e0cc1b91b88b30586c5991f31442029f1" -conventional-changelog-writer@^3.0.9: - version "3.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-3.0.9.tgz#4aecdfef33ff2a53bb0cf3b8071ce21f0e994634" - dependencies: - compare-func "^1.3.1" - conventional-commits-filter "^1.1.6" - dateformat "^3.0.0" - handlebars "^4.0.2" - json-stringify-safe "^5.0.1" - lodash "^4.2.1" - meow "^4.0.0" - semver "^5.5.0" - split "^1.0.0" - through2 "^2.0.0" - conventional-changelog-writer@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.0.tgz#3ed983c8ef6a3aa51fe44e82c9c75e86f1b5aa42" @@ -1627,22 +1559,6 @@ conventional-changelog-writer@^4.0.0: split "^1.0.0" through2 "^2.0.0" -conventional-changelog@^1.1.0: - version "1.1.24" - resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-1.1.24.tgz#3d94c29c960f5261c002678315b756cdd3d7d1f0" - dependencies: - conventional-changelog-angular "^1.6.6" - conventional-changelog-atom "^0.2.8" - conventional-changelog-codemirror "^0.3.8" - conventional-changelog-core "^2.0.11" - conventional-changelog-ember "^0.3.12" - conventional-changelog-eslint "^1.0.9" - conventional-changelog-express "^0.3.6" - conventional-changelog-jquery "^0.1.0" - conventional-changelog-jscs "^0.1.0" - conventional-changelog-jshint "^0.3.8" - conventional-changelog-preset-loader "^1.1.8" - conventional-changelog@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-2.0.3.tgz#779cff582c0091d2b24574003eaa82ef5ddf653d" @@ -1659,13 +1575,6 @@ conventional-changelog@^2.0.3: conventional-changelog-jshint "^2.0.0" conventional-changelog-preset-loader "^2.0.1" -conventional-commits-filter@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-1.1.6.tgz#4389cd8e58fe89750c0b5fb58f1d7f0cc8ad3831" - dependencies: - is-subset "^0.1.1" - modify-values "^1.0.0" - conventional-commits-filter@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.0.tgz#a0ce1d1ff7a1dd7fab36bee8e8256d348d135651" @@ -1673,18 +1582,6 @@ conventional-commits-filter@^2.0.0: is-subset "^0.1.1" modify-values "^1.0.0" -conventional-commits-parser@^2.1.7: - version "2.1.7" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-2.1.7.tgz#eca45ed6140d72ba9722ee4132674d639e644e8e" - dependencies: - JSONStream "^1.0.4" - is-text-path "^1.0.0" - lodash "^4.2.1" - meow "^4.0.0" - split2 "^2.0.0" - through2 "^2.0.0" - trim-off-newlines "^1.0.0" - conventional-commits-parser@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.0.tgz#7f604549a50bd8f60443fbe515484b1c2f06a5c4" @@ -2884,16 +2781,6 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -git-raw-commits@^1.3.6: - version "1.3.6" - resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-1.3.6.tgz#27c35a32a67777c1ecd412a239a6c19d71b95aff" - dependencies: - dargs "^4.0.1" - lodash.template "^4.0.2" - meow "^4.0.0" - split2 "^2.0.0" - through2 "^2.0.0" - git-raw-commits@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.0.tgz#d92addf74440c14bcc5c83ecce3fb7f8a79118b5" @@ -2911,13 +2798,6 @@ git-remote-origin-url@^2.0.0: gitconfiglocal "^1.0.0" pify "^2.3.0" -git-semver-tags@^1.3.6: - version "1.3.6" - resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-1.3.6.tgz#357ea01f7280794fe0927f2806bee6414d2caba5" - dependencies: - meow "^4.0.0" - semver "^5.5.0" - git-semver-tags@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.0.tgz#c218fd895bdf8e8e02f6bde555b2c3893ac73cd7" @@ -3101,15 +2981,16 @@ gulp-connect@5.0.0: gulp-util "^3.0.6" tiny-lr "^0.2.1" -gulp-conventional-changelog@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/gulp-conventional-changelog/-/gulp-conventional-changelog-1.1.0.tgz#0aae0c02da3ec45a7b4fe258295e491b47ffa202" +gulp-conventional-changelog@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/gulp-conventional-changelog/-/gulp-conventional-changelog-2.0.3.tgz#80d3b558365bb0d662f61b20257d4084bbed6b07" dependencies: add-stream "^1.0.0" - concat-stream "^1.5.0" - conventional-changelog "^1.1.0" - gulp-util "^3.0.6" + concat-stream "^1.6.0" + conventional-changelog "^2.0.3" + fancy-log "^1.3.2" object-assign "^4.0.1" + plugin-error "^1.0.1" through2 "^2.0.0" gulp-diff@^1.0.0: @@ -5530,6 +5411,15 @@ plugin-error@^0.1.2: arr-union "^2.0.1" extend-shallow "^1.1.2" +plugin-error@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c" + dependencies: + ansi-colors "^1.0.1" + arr-diff "^4.0.0" + arr-union "^3.1.0" + extend-shallow "^3.0.2" + posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"