-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve build tool to make it easier to maintain and more pleasant to use #21777
Conversation
build/grunt/if.js
Outdated
options: { | ||
test() { | ||
return typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' && (!process.env.TWBS_TEST || process.env.TWBS_TEST === | ||
'sauce-js') && (process.env.TWBS_DO_SAUCE === undefined || process.env.TWBS_DO_SAUCE !== '0') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
build/grunt/if.js
Outdated
'sauce-js': { | ||
options: { | ||
test() { | ||
return typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' && (!process.env.TWBS_TEST || process.env.TWBS_TEST === |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
build/grunt/if.js
Outdated
options: { | ||
test() { | ||
return (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'validate-html') && (process.env.TWBS_DO_VALIDATOR === | ||
undefined || process.env.TWBS_DO_VALIDATOR !== '0') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
build/grunt/if.js
Outdated
'validate-html': { | ||
options: { | ||
test() { | ||
return (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'validate-html') && (process.env.TWBS_DO_VALIDATOR === |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'process' is not defined no-undef
Unexpected use of process.env no-process-env
build/grunt/if.js
Outdated
core: { | ||
options: { | ||
test() { | ||
return (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'core') && process.env.TRAVIS_REPO_SLUG !== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
build/grunt/if.js
Outdated
@@ -0,0 +1,29 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,8 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,28 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,14 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,20 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,27 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,18 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,24 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,45 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,24 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
@@ -0,0 +1,26 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
}, | ||
// Skip Sauce on Travis when [skip sauce] is in the commit message | ||
isDoSauceJs() { | ||
return this.isSauceJs() && isUndefOrNonZero(process.env.TWBS_DO_SAUCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
// Only run Sauce Labs tests if there's a Sauce access key | ||
// and skip Sauce if running a different subset of the test suite | ||
isSauceJs() { | ||
return typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' && runSubset('sauce-js-unit') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
build/utils/travisTestEnv.js
Outdated
// Skip HTML validation if running a different subset of the test suite | ||
// or [skip validator] is in the commit message | ||
isValidateHtml() { | ||
return runSubset('validate-html') && isUndefOrNonZero(process.env.TWBS_DO_VALIDATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
// Skip core tests if running a different subset | ||
// of the test suite or if this is a Savage build | ||
isCore() { | ||
return runSubset('core') && process.env.TRAVIS_REPO_SLUG !== 'twbs-savage/bootstrap' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
module.exports = function () { | ||
|
||
function runSubset(subset) { | ||
return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected use of process.env no-process-env
'process' is not defined no-undef
@@ -0,0 +1,32 @@ | |||
module.exports = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
branch: 'gh-pages' | ||
} | ||
require('time-grunt')(grunt) | ||
require('load-grunt-config')(grunt, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected require() global-require
'require' is not defined no-undef
remote: '[email protected]:twbs/derpstrap.git', | ||
branch: 'gh-pages' | ||
} | ||
require('time-grunt')(grunt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected require() global-require
'require' is not defined no-undef
# Conflicts: # package.json
This is interesting, but a heads-up that I can't guarantee we'll use this. |
@bardiharborow that's alright. I continue to improve it whenever I see something because I use it when I work on Bootstrap. The gain in comfort and productivity is really appreciable. Btw, let me know if you want me to improve/change something that would help this build tool to be adopted. |
# Conflicts: # Gruntfile.js # package.json
# Conflicts: # Gruntfile.js # docs/.htmllintrc # package.json
# Conflicts: # package.json
Hi @vanduynslagerp! Thanks for wanting to contribute to Bootstrap by sending this pull request! You'll need to fix these mistakes and revise your pull request before we can proceed further. (Please note that this is a fully automated comment.) |
Reopened here #21929
Following #20332 I've spent some time trying to improve the build process by switching to npm scripts only. See comment.
My analysis is that npm scripts, while looking incredibly simple in theory, present several constraints and that the problems of the build tool are not necessarly related to the tools but mostly the way tasks are organized and orchestrated.
So I decided to evaluate a solution that would make the build tool simpler to use, easier to maintain, robust and more importantly pleasant to use for developers, while building as much as possible on the existing that works.
It turns out it was not that hard and really fun to do :-), so after a couple hours the evaluation turned something that was almost there. So I decided to polish it, update the doc and propose a PR so anyone can can have a look.
Image speak more than words so this is what I have now:
Here is the improvement that this PR brings.
Easy setup
npm install
and that's it.Simple to use
Only 3 commands for the user/developer:
dist
: build JS, CSS and Docs.test
: build JS, CSS, Docs, test and lint.watch
: Start everything to dev efficiently.Only 4 commands for the maintainer:
prep-release
: prepare release.publish
: publish doc on GitHub.change-version
: update version in source files.update-shrinkwrap
: update shrinkwrap dependencies management.Pleasant to develop with
npm run watch
, Open your browser and voila! All changes made in scss, js and docs are automatically reflected in live on the local doc website. See gif above :)Fast
build
runs in 6s (it used to be 24s)test
runs in 20swatch
react to a modification of js, scss or docs files, handle everythingand reload the docs on the browser in about 1s (it used to be up to 10s just for sass + time for Jekyll to process the change)
Easier to maintain
Gruntfile
is now 10 line of code and shouldn't have to be modified anymore.build/grunt
.build/grunt/aliases.js
.Gruntfile.js
).build/grunt
andbuild/grunt/aliases.js
and is written in a more declarative way than it would in an npm script.Stable
How do I use it?
git clone -b build-rework https://github.com/vanduynslagerp/bootstrap
cd bootstrap
npm install
npm run watch
I understand the Bootstrap team, like many others, seems to desire to move to pure npm scripts. That said, I think I reached a pretty satisfying result, that worth to be evaluated, which is the point of this PR.