0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Drop .bowerrc, move bower install into ember:init task

no issue
- perform `bower install` alongside `npm install` in the `ember:init` task - every usage of `shell:bower` was immediately preceded by `shell:ember:init` so it makes sense to move all ember initialisation steps into the one grunt command
- remove `.bowerrc` file so that the standard ember conventions of `npm install && bower install` inside the client directory work without ending up with folders such as `core/client/core/client/bower_components/*`

This does have the effect of causing `bower install` from the root dir to fail with `bower ENOENT No bower.json present`. As far as I can tell we have not documented running `bower install` manually anywhere and I believe the new behaviour matches the expected behaviour more closely as well adding more consistency to the way client-side dependencies are installed.
This commit is contained in:
Kevin Ansfield 2016-05-23 16:59:42 +01:00
parent 38e3654bbe
commit 30b3ccc387
2 changed files with 6 additions and 20 deletions

View file

@ -1,4 +0,0 @@
{
"cwd": "core/client/",
"directory": "bower_components"
}

View file

@ -269,7 +269,7 @@ var _ = require('lodash'),
command: function (mode) { command: function (mode) {
switch (mode) { switch (mode) {
case 'init': case 'init':
return 'echo Installing client dependencies... && npm install'; return 'echo Installing client dependencies... && npm install && bower install';
case 'prod': case 'prod':
return emberPath + ' build --environment=production --silent'; return emberPath + ' build --environment=production --silent';
@ -288,16 +288,6 @@ var _ = require('lodash'),
} }
} }
}, },
// #### Run bower install
// Used as part of `grunt init`. See the section on [Building Assets](#building%20assets) for more
// information.
bower: {
command: path.resolve(cwd + '/node_modules/.bin/bower --allow-root install'),
options: {
stdout: true,
stdin: false
}
},
test: { test: {
command: function (test) { command: function (test) {
@ -529,7 +519,7 @@ var _ = require('lodash'),
} else if (process.env.TEST_SUITE === 'client') { } else if (process.env.TEST_SUITE === 'client') {
grunt.task.run(['init', 'test-client']); grunt.task.run(['init', 'test-client']);
} else if (process.env.TEST_SUITE === 'lint') { } else if (process.env.TEST_SUITE === 'lint') {
grunt.task.run(['shell:ember:init', 'shell:bower', 'lint']); grunt.task.run(['shell:ember:init', 'lint']);
} else { } else {
grunt.task.run(['validate-all']); grunt.task.run(['validate-all']);
} }
@ -786,16 +776,16 @@ var _ = require('lodash'),
// ### Init assets // ### Init assets
// `grunt init` - will run an initial asset build for you // `grunt init` - will run an initial asset build for you
// //
// Grunt init runs `bower install` as well as the standard asset build tasks which occur when you run just // Grunt init runs `npm install && bower install` inside `core/client` as well as the standard asset build
// `grunt`. This fetches the latest client side dependencies, and moves them into their proper homes. // tasks which occur when you run just `grunt`. This fetches the latest client-side dependencies.
// //
// This task is very important, and should always be run and when fetching down an updated code base just after // This task is very important, and should always be run when fetching down an updated code base just after
// running `npm install`. // running `npm install`.
// //
// `bower` does have some quirks, such as not running as root. If you have problems please try running // `bower` does have some quirks, such as not running as root. If you have problems please try running
// `grunt init --verbose` to see if there are any errors. // `grunt init --verbose` to see if there are any errors.
grunt.registerTask('init', 'Prepare the project for development', grunt.registerTask('init', 'Prepare the project for development',
['update_submodules', 'shell:ember:init', 'shell:bower', 'assets', 'default']); ['update_submodules', 'shell:ember:init', 'assets', 'default']);
// ### Basic Asset Building // ### Basic Asset Building
// Builds and moves necessary client assets. Prod additionally builds the ember app. // Builds and moves necessary client assets. Prod additionally builds the ember app.