From 03d4137b86f9f9977a0360d606a53ce20f5bfb04 Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Sun, 7 Aug 2016 04:53:28 -0500 Subject: [PATCH] Move remainder of ember tasks to client repo (#7172) * Updating Ghost-Admin: Gruntfile work * move remainder of ember tasks to client repo refs #6977 - move ember build tasks to client repo - remove unneeded dependencies --- Gruntfile.js | 98 +++++++++++++++++++++------------------------------- core/client | 2 +- package.json | 1 - 3 files changed, 41 insertions(+), 60 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index eeb40a4e7a..b2f06eb9a9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -16,7 +16,6 @@ var _ = require('lodash'), cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1'), buildDirectory = path.resolve(cwd, '.build'), distDirectory = path.resolve(cwd, '.dist'), - emberPath = path.resolve(cwd + '/core/client/node_modules/.bin/ember'), // ## Grunt configuration @@ -68,13 +67,6 @@ var _ = require('lodash'), options: { spawn: false } - }, - csscomb: { - files: ['core/client/app/styles/**/*.css'], - tasks: ['shell:csscombfix'], - options: { - livereload: true - } } }, @@ -215,47 +207,16 @@ var _ = require('lodash'), } }, - // ### grunt-bg-shell - // Used to run ember-cli watch in the background bgShell: { - ember: { - cmd: emberPath + ' build --watch', - execOpts: { - cwd: path.resolve(cwd + '/core/client/') - }, - bg: true, - stdout: function (out) { - grunt.log.writeln(chalk.cyan('Ember-cli::') + out); - }, - stderror: function (error) { - grunt.log.error(chalk.red('Ember-cli::' + error)); - } + client: { + cmd: 'grunt subgrunt:watch', + bg: true } }, + // ### grunt-shell // Command line tools where it's easier to run a command directly than configure a grunt plugin shell: { - ember: { - command: function (mode) { - switch (mode) { - case 'prod': - return emberPath + ' build --environment=production --silent'; - - case 'dev': - return emberPath + ' build'; - - case 'test': - return emberPath + ' test --silent'; - } - }, - options: { - execOptions: { - cwd: path.resolve(process.cwd() + '/core/client/'), - stdout: false - } - } - }, - shrinkwrap: { command: 'npm shrinkwrap' }, @@ -266,10 +227,6 @@ var _ = require('lodash'), dedupe: { command: 'npm dedupe' - }, - - csscombfix: { - command: path.resolve(cwd + '/node_modules/.bin/csscomb -c core/client/app/styles/csscomb.json -v core/client/app/styles') } }, @@ -350,12 +307,36 @@ var _ = require('lodash'), // ### grunt-subgrunt // Run grunt tasks in submodule Gruntfiles subgrunt: { + options: { + npmInstall: false + }, init: { - 'core/client': 'init' + options: { + npmInstall: true + }, + projects: { + 'core/client': 'init' + } + }, + + dev: { + 'core/client': 'shell:ember:dev' + }, + + prod: { + 'core/client': 'shell:ember:prod' + }, + + watch: { + 'core/client': ['bgShell:ember', 'watch'] }, lint: { 'core/client': 'lint' + }, + + test: { + 'core/client': 'shell:test' } } }; @@ -538,7 +519,7 @@ var _ = require('lodash'), ['test-routes', 'test-module', 'test-unit', 'test-integration']); grunt.registerTask('test-client', 'Run client tests', - ['test-ember']); + ['subgrunt:test']); // ### Lint // @@ -634,12 +615,6 @@ var _ = require('lodash'), ['test-setup', 'mochacli:module'] ); - // ### Ember unit tests *(sub task)* - // `grunt test-ember` will run just the ember unit tests - grunt.registerTask('test-ember', 'Run the ember unit tests', - ['test-setup', 'shell:ember:test'] - ); - // ### Coverage // `grunt coverage` will generate a report for the Unit Tests. // @@ -705,19 +680,26 @@ var _ = require('lodash'), grunt.registerTask('init', 'Prepare the project for development', ['update_submodules', 'subgrunt:init', 'clean:tmp', 'default']); + // ### Build assets + // `grunt build` - will build client assets (without updating the submodule) + // + // This task is identical to `grunt init`, except it does not build client dependencies + grunt.registerTask('build', 'Build client app', + ['subgrunt:init', 'clean:tmp', 'default']); + // ### Default asset build // `grunt` - default grunt task // // Build assets and dev version of the admin app. grunt.registerTask('default', 'Build JS & templates for development', - ['shell:ember:dev']); + ['subgrunt:dev']); // ### Production assets // `grunt prod` - will build the minified assets used in production. // // It is otherwise the same as running `grunt`, but is only used when running Ghost in the `production` env. grunt.registerTask('prod', 'Build JS & templates for production', - ['shell:ember:prod', 'uglify:prod', 'master-warn']); + ['subgrunt:prod', 'uglify:prod', 'master-warn']); // ### Live reload // `grunt dev` - build assets on the fly whilst developing @@ -731,7 +713,7 @@ var _ = require('lodash'), // // Note that the current implementation of watch only works with casper, not other themes. grunt.registerTask('dev', 'Dev Mode; watch files and restart server on changes', - ['bgShell:ember', 'express:dev', 'watch']); + ['bgShell:client', 'express:dev', 'watch']); // ### Contributors // `grunt contributors:` - generate a comma-separated list of contributors for a Ghost release. diff --git a/core/client b/core/client index 5d2e020fe9..1ce2e8b37c 160000 --- a/core/client +++ b/core/client @@ -1 +1 @@ -Subproject commit 5d2e020fe9375bd8c8201fdfedcdca0e42865df4 +Subproject commit 1ce2e8b37c931bcc4ac1381f17bc05018282a677 diff --git a/package.json b/package.json index fea12e0647..46121b2ddc 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "pg": "4.1.1" }, "devDependencies": { - "csscomb": "3.1.8", "gh-contrib-list": "0.1.2", "git-wrapper": "0.1.1", "grunt": "1.0.1",