Permalink
Browse files

Move simple tasks to package.json from Gruntfile

JW8-2272
  • Loading branch information...
pajong committed Nov 26, 2018
1 parent a073a3a commit 285d9a7f72e0c5ba23d9feab574508f6c597e67e
Showing with 14 additions and 15 deletions.
  1. +11 −15 Gruntfile.js
  2. +3 −0 package.json
@@ -10,6 +10,13 @@ const webpackCompilers = {};
const env = process.env;
const execSync = require('child_process').execSync;
function runCommand(command, dir) {
execSync(command, {
cwd: dir,
stdio: [0, 1, 2]
});
}
function getBuildVersion(packageInfo) {
// Build Version: {major.minor.revision}
let metadata = '';
@@ -220,11 +227,7 @@ module.exports = function(grunt) {
});
grunt.registerTask('hooks', 'Install Pre Push Hook', function() {
const command = '\\cp .github/hooks/pre-push .git/hooks/pre-push';
execSync(command, {
cwd: '.',
stdio: [0, 1, 2]
});
runCommand('yarn run hooks', '.');
});
grunt.registerTask('notice', 'Create notice.txt file', function() {
@@ -239,25 +242,18 @@ module.exports = function(grunt) {
});
grunt.registerTask('lint', 'ESLints JavaScript & Stylelints LESS', function(target) {
let command = 'npm run lint';
let command = 'yarn run lint';
if (target === 'js') {
command = command + ':js';
}
if (target === 'test') {
command = command + ':tests';
}
execSync(command, {
cwd: '.',
stdio: [0, 1, 2]
});
runCommand(command, '.');
});
grunt.registerTask('docs', 'Generate API documentation', function() {
const command = 'npm run docs';
execSync(command, {
cwd: '.',
stdio: [0, 1, 2]
});
runCommand('yarn run docs', '.');
});
grunt.registerTask('karma:local', [
@@ -75,12 +75,15 @@
"webpack-cli": "2.0.13"
},
"scripts": {
"build": "grunt",
"docs": "jsdoc -c docs/jsdoc.conf.json",
"hooks": "\\cp .github/hooks/pre-push .git/hooks/pre-push",
"lint": "yarn lint:js && yarn lint:tests && yarn lint:styles",
"lint:js": "eslint './src/js'",
"lint:styles": "stylelint './src/css/**/*.less'",
"lint:tests": "eslint './test/*.js'",
"preversion": "grunt && grunt clean:docs && npm run docs && git add docs",
"squash": "node parse-squashed-files.js",
"test": "karma start",
"karma:hook": "karma start --browsers=ChromeHeadless --reporters=mocha"
},

0 comments on commit 285d9a7

Please sign in to comment.