Update Gruntfile to make use of node-sass when calling grunt-sass.

Introduce new minimum node and npm versions
Make es6 default language for eslintrc
Fix a couple of es6 linting errors due to too long lines.
This commit is contained in:
Gerhard 2019-01-30 10:12:08 +02:00
parent 00a93ae8f0
commit efd72f3222
3 changed files with 21 additions and 7 deletions

View File

@ -7,12 +7,16 @@
"globals": { "globals": {
"wp": true, "wp": true,
"wpApiSettings": true, "wpApiSettings": true,
"wcSettings": true "wcSettings": true,
"es6": true
}, },
"rules": { "rules": {
"camelcase": 0, "camelcase": 0,
"indent": 0, "indent": 0,
"max-len": [ 2, { "code": 140 } ], "max-len": [ 2, { "code": 140 } ],
"no-console": 1 "no-console": 1
},
"parserOptions": {
"ecmaVersion": 6
} }
} }

View File

@ -1,6 +1,7 @@
/* jshint node:true */ /* jshint node:true */
module.exports = function( grunt ) { module.exports = function( grunt ) {
'use strict'; 'use strict';
const sass = require( 'node-sass' );
grunt.initConfig({ grunt.initConfig({
@ -75,9 +76,13 @@ module.exports = function( grunt ) {
'<%= dirs.js %>/jquery-flot/jquery.flot.time.min.js': ['<%= dirs.js %>/jquery-flot/jquery.flot.time.js'], '<%= dirs.js %>/jquery-flot/jquery.flot.time.min.js': ['<%= dirs.js %>/jquery-flot/jquery.flot.time.js'],
'<%= dirs.js %>/jquery-payment/jquery.payment.min.js': ['<%= dirs.js %>/jquery-payment/jquery.payment.js'], '<%= dirs.js %>/jquery-payment/jquery.payment.min.js': ['<%= dirs.js %>/jquery-payment/jquery.payment.js'],
'<%= dirs.js %>/jquery-qrcode/jquery.qrcode.min.js': ['<%= dirs.js %>/jquery-qrcode/jquery.qrcode.js'], '<%= dirs.js %>/jquery-qrcode/jquery.qrcode.min.js': ['<%= dirs.js %>/jquery-qrcode/jquery.qrcode.js'],
'<%= dirs.js %>/jquery-serializejson/jquery.serializejson.min.js': ['<%= dirs.js %>/jquery-serializejson/jquery.serializejson.js'], '<%= dirs.js %>/jquery-serializejson/jquery.serializejson.min.js': [
'<%= dirs.js %>/jquery-serializejson/jquery.serializejson.js'
],
'<%= dirs.js %>/jquery-tiptip/jquery.tipTip.min.js': ['<%= dirs.js %>/jquery-tiptip/jquery.tipTip.js'], '<%= dirs.js %>/jquery-tiptip/jquery.tipTip.min.js': ['<%= dirs.js %>/jquery-tiptip/jquery.tipTip.js'],
'<%= dirs.js %>/jquery-ui-touch-punch/jquery-ui-touch-punch.min.js': ['<%= dirs.js %>/jquery-ui-touch-punch/jquery-ui-touch-punch.js'], '<%= dirs.js %>/jquery-ui-touch-punch/jquery-ui-touch-punch.min.js': [
'<%= dirs.js %>/jquery-ui-touch-punch/jquery-ui-touch-punch.js'
],
'<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.init.min.js': ['<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.init.js'], '<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.init.min.js': ['<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.init.js'],
'<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.min.js': ['<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.js'], '<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.min.js': ['<%= dirs.js %>/prettyPhoto/jquery.prettyPhoto.js'],
'<%= dirs.js %>/flexslider/jquery.flexslider.min.js': ['<%= dirs.js %>/flexslider/jquery.flexslider.js'], '<%= dirs.js %>/flexslider/jquery.flexslider.min.js': ['<%= dirs.js %>/flexslider/jquery.flexslider.js'],
@ -112,6 +117,7 @@ module.exports = function( grunt ) {
sass: { sass: {
compile: { compile: {
options: { options: {
implementation: sass,
sourceMap: 'none' sourceMap: 'none'
}, },
files: [{ files: [{
@ -260,7 +266,9 @@ module.exports = function( grunt ) {
contributors: { contributors: {
command: [ command: [
'echo "Generating contributor list since <%= fromDate %>"', 'echo "Generating contributor list since <%= fromDate %>"',
'./node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce --fromDate <%= fromDate %> --authToken <%= authToken %> --cols 6 --sortBy contributions --format md --sortOrder desc --showlogin true > contributors.md' './node_modules/.bin/githubcontrib --owner woocommerce --repo woocommerce --fromDate <%= fromDate %>' +
' --authToken <%= authToken %> --cols 6 --sortBy contributions --format md --sortOrder desc' +
' --showlogin true > contributors.md'
].join( '&&' ) ].join( '&&' )
} }
}, },
@ -277,7 +285,8 @@ module.exports = function( grunt ) {
{ {
config: 'authToken', config: 'authToken',
type: 'input', type: 'input',
message: '(optional) Provide a personal access token. This will allow 5000 requests per hour rather than 60 - use if nothing is generated.' message: '(optional) Provide a personal access token.' +
' This will allow 5000 requests per hour rather than 60 - use if nothing is generated.'
} }
] ]
} }

View File

@ -54,14 +54,15 @@
"istanbul": "1.0.0-alpha.2", "istanbul": "1.0.0-alpha.2",
"lint-staged": "8.1.0", "lint-staged": "8.1.0",
"mocha": "5.2.0", "mocha": "5.2.0",
"node-sass": "4.11.0",
"prettier": "github:automattic/calypso-prettier#c56b4251", "prettier": "github:automattic/calypso-prettier#c56b4251",
"stylelint": "9.10.1", "stylelint": "9.10.1",
"stylelint-config-wordpress": "13.1.0", "stylelint-config-wordpress": "13.1.0",
"wc-e2e-page-objects": "0.10.0" "wc-e2e-page-objects": "0.10.0"
}, },
"engines": { "engines": {
"node": ">=8.9.3", "node": ">=10.15.0",
"npm": ">=5.5.1" "npm": ">=6.4.1"
}, },
"dependencies": { "dependencies": {
"github-contributors-list": "https://github.com/woocommerce/github-contributors-list/tarball/master" "github-contributors-list": "https://github.com/woocommerce/github-contributors-list/tarball/master"