mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Change grunt jshint and jscs tasks
This commit is contained in:
parent
2edc3d6a6b
commit
184da01702
2 changed files with 63 additions and 103 deletions
165
Gruntfile.js
165
Gruntfile.js
|
@ -34,51 +34,6 @@ var _ = require('lodash'),
|
||||||
});
|
});
|
||||||
}()),
|
}()),
|
||||||
|
|
||||||
// ## List of files we want to lint through jshint and jscs to make sure
|
|
||||||
// they conform to our desired code styles.
|
|
||||||
lintFiles = {
|
|
||||||
// Linting files for server side or shared javascript code.
|
|
||||||
server: {
|
|
||||||
files: {
|
|
||||||
src: [
|
|
||||||
'*.js',
|
|
||||||
'!config*.js', // note: i added this, do we want this linted?
|
|
||||||
'core/*.js',
|
|
||||||
'core/server/**/*.js',
|
|
||||||
'core/shared/**/*.js',
|
|
||||||
'!core/shared/vendor/**/*.js'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Linting files for client side javascript code.
|
|
||||||
client: {
|
|
||||||
files: {
|
|
||||||
src: [
|
|
||||||
'core/client/**/*.js',
|
|
||||||
'!core/client/docs/js/*.js',
|
|
||||||
'!core/client/bower_components/**/*.js',
|
|
||||||
'!core/client/node_modules/**/*.js'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clientTests: {
|
|
||||||
files: {
|
|
||||||
src: [
|
|
||||||
'core/test/client/**/*.js'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Linting files for test code.
|
|
||||||
test: {
|
|
||||||
files: {
|
|
||||||
src: [
|
|
||||||
'core/test/**/*.js',
|
|
||||||
'!core/test/client/**/*.js'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// ## Grunt configuration
|
// ## Grunt configuration
|
||||||
|
|
||||||
configureGrunt = function (grunt) {
|
configureGrunt = function (grunt) {
|
||||||
|
@ -150,64 +105,68 @@ var _ = require('lodash'),
|
||||||
// ### grunt-contrib-jshint
|
// ### grunt-contrib-jshint
|
||||||
// Linting rules, run as part of `grunt validate`. See [grunt validate](#validate) and its subtasks for
|
// Linting rules, run as part of `grunt validate`. See [grunt validate](#validate) and its subtasks for
|
||||||
// more information.
|
// more information.
|
||||||
jshint: (function () {
|
jshint: {
|
||||||
return _.merge({
|
options: {
|
||||||
server: {
|
jshintrc: true
|
||||||
options: {
|
},
|
||||||
jshintrc: '.jshintrc'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
client: {
|
|
||||||
options: {
|
|
||||||
jshintrc: 'core/client/.jshintrc'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clientTests: {
|
|
||||||
options: {
|
|
||||||
jshintrc: 'core/test/client/.jshintrc'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
test: {
|
|
||||||
options: {
|
|
||||||
jshintrc: 'core/test/.jshintrc'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, lintFiles);
|
|
||||||
})(),
|
|
||||||
|
|
||||||
// ### grunt-jscs
|
client: [
|
||||||
// Code style rules, run as part of `grunt validate`. See [grunt validate](#validate) and its subtasks for
|
'core/client/**/*.js',
|
||||||
// more information.
|
'!core/client/node_modules/**/*.js',
|
||||||
jscs: (function () {
|
'!core/client/bower_components/**/*.js',
|
||||||
var jscsConfig = _.merge({
|
'!core/client/tmp/**/*.js',
|
||||||
server: {
|
'!core/client/dist/**/*.js',
|
||||||
options: {
|
'!core/client/vendor/**/*.js'
|
||||||
config: '.jscsrc'
|
],
|
||||||
}
|
|
||||||
},
|
|
||||||
client: {
|
|
||||||
options: {
|
|
||||||
config: '.jscsrc',
|
|
||||||
esnext: true,
|
|
||||||
disallowObjectController: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clientTests: {
|
|
||||||
options: {
|
|
||||||
config: '.jscsrc',
|
|
||||||
esnext: true,
|
|
||||||
disallowObjectController: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
test: {
|
|
||||||
options: {
|
|
||||||
config: '.jscsrc'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, lintFiles);
|
|
||||||
|
|
||||||
return jscsConfig;
|
server: [
|
||||||
})(),
|
'*.js',
|
||||||
|
'!config*.js', // note: i added this, do we want this linted?
|
||||||
|
'core/*.js',
|
||||||
|
'core/server/**/*.js',
|
||||||
|
'core/shared/**/*.js',
|
||||||
|
'core/test/**/*.js',
|
||||||
|
'!core/shared/vendor/**/*.js'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
jscs: {
|
||||||
|
options: {
|
||||||
|
config: true
|
||||||
|
},
|
||||||
|
|
||||||
|
client: {
|
||||||
|
options: {
|
||||||
|
esnext: true,
|
||||||
|
disallowObjectController: true
|
||||||
|
},
|
||||||
|
|
||||||
|
files: {
|
||||||
|
src: [
|
||||||
|
'core/client/**/*.js',
|
||||||
|
'!core/client/node_modules/**/*.js',
|
||||||
|
'!core/client/bower_components/**/*.js',
|
||||||
|
'!core/client/tmp/**/*.js',
|
||||||
|
'!core/client/dist/**/*.js',
|
||||||
|
'!core/client/vendor/**/*.js'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
server: {
|
||||||
|
files: {
|
||||||
|
src: [
|
||||||
|
'*.js',
|
||||||
|
'!config*.js', // note: i added this, do we want this linted?
|
||||||
|
'core/*.js',
|
||||||
|
'core/server/**/*.js',
|
||||||
|
'core/shared/**/*.js',
|
||||||
|
'core/test/**/*.js',
|
||||||
|
'!core/shared/vendor/**/*.js'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// ### grunt-mocha-cli
|
// ### grunt-mocha-cli
|
||||||
// Configuration for the mocha test runner, used to run unit, integration and route tests as part of
|
// Configuration for the mocha test runner, used to run unit, integration and route tests as part of
|
||||||
|
@ -316,7 +275,7 @@ var _ = require('lodash'),
|
||||||
return 'echo Installing client dependencies... && npm install';
|
return 'echo Installing client dependencies... && npm install';
|
||||||
|
|
||||||
case 'prod':
|
case 'prod':
|
||||||
return './node_modules/.bin/ember build --environment=production --silent'
|
return './node_modules/.bin/ember build --environment=production --silent';
|
||||||
|
|
||||||
case 'dev':
|
case 'dev':
|
||||||
return './node_modules/.bin/ember build --silent';
|
return './node_modules/.bin/ember build --silent';
|
||||||
|
@ -906,7 +865,7 @@ var _ = require('lodash'),
|
||||||
// ### 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.
|
||||||
grunt.registerTask('assets', 'Basic asset building & moving',
|
grunt.registerTask('assets', 'Basic asset building & moving',
|
||||||
['clean:tmp', 'buildAboutPage', 'copy:jquery'])
|
['clean:tmp', 'buildAboutPage', 'copy:jquery']);
|
||||||
|
|
||||||
// ### Default asset build
|
// ### Default asset build
|
||||||
// `grunt` - default grunt task
|
// `grunt` - default grunt task
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"document",
|
"document",
|
||||||
"window",
|
"window",
|
||||||
"-Promise",
|
"-Promise",
|
||||||
|
"-Notification",
|
||||||
"$",
|
"$",
|
||||||
"validator",
|
"validator",
|
||||||
"ic",
|
"ic",
|
||||||
|
|
Loading…
Add table
Reference in a new issue