Ticket #31823: 31823.6.diff
File 31823.6.diff, 5.0 KB (added by , 8 years ago) |
---|
-
Gruntfile.js
1 1 /* jshint node:true */ 2 /* global module, require, __dirname */ 2 3 /* globals Set */ 3 var webpackConfig = require( './webpack.config.prod' ) ;4 varwebpackDevConfig = require( './webpack.config.dev' );4 var webpackConfig = require( './webpack.config.prod' ), 5 webpackDevConfig = require( './webpack.config.dev' ); 5 6 6 7 module.exports = function(grunt) { 7 8 var path = require('path'), … … 10 11 SOURCE_DIR = 'src/', 11 12 BUILD_DIR = 'build/', 12 13 BANNER_TEXT = '/*! This file is auto-generated */', 13 autoprefixer = require( 'autoprefixer' ); 14 autoprefixer = require( 'autoprefixer' ), 15 copyFilesOptions = grunt.config.get( 'copy.files.files' ); 14 16 15 17 // Load tasks. 16 18 require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); … … 145 147 version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd.HHMMss' ) ); 146 148 147 149 /* jshint quotmark: true */ 148 return "$wp_version = '" + version + "';";150 return '$wp_version = \'' + version + '\';'; 149 151 }); 150 152 } 151 153 }, … … 306 308 src: [] 307 309 } 308 310 }, 311 eslint: { 312 grunt: { 313 options: { 314 configFile: 'node_modules/eslint-config-wordpress/index.js' 315 }, 316 src: [ 'Gruntfile.js' ] 317 }, 318 core: { 319 options: { 320 configFile: 'node_modules/eslint-config-wordpress/index.js' 321 }, 322 cwd: SOURCE_DIR, 323 src: [ 324 'wp-admin/js/*.js', 325 'wp-includes/js/*.js', 326 327 // Built scripts. 328 '!wp-includes/js/media-*', 329 330 // WordPress scripts inside directories 331 'wp-includes/js/jquery/jquery.table-hotkeys.js', 332 'wp-includes/js/mediaelement/wp-mediaelement.js', 333 'wp-includes/js/mediaelement/wp-playlist.js', 334 'wp-includes/js/plupload/handlers.js', 335 'wp-includes/js/plupload/wp-plupload.js', 336 'wp-includes/js/tinymce/plugins/wordpress/plugin.js', 337 'wp-includes/js/tinymce/plugins/wp*/plugin.js', 338 339 // Third party scripts 340 '!wp-admin/js/farbtastic.js', 341 '!wp-includes/js/backbone*.js', 342 '!wp-includes/js/swfobject.js', 343 '!wp-includes/js/underscore*.js', 344 '!wp-includes/js/colorpicker.js', 345 '!wp-includes/js/hoverIntent.js', 346 '!wp-includes/js/json2.js', 347 '!wp-includes/js/tw-sack.js', 348 '!wp-includes/js/twemoji.js', 349 '!**/*.min.js' 350 ] 351 }, 352 themes: { 353 options: { 354 configFile: 'node_modules/eslint-config-wordpress/index.js' 355 }, 356 expand: true, 357 cwd: SOURCE_DIR + 'wp-content/themes', 358 src: [ 359 'twenty*/**/*.js', 360 '!twenty{eleven,twelve,thirteen}/**', 361 362 // Third party scripts 363 '!twenty{fourteen,fifteen,sixteen,seventeen}/**/html5.js', 364 '!twentyseventeen/assets/js/jquery.scrollTo.js' 365 ] 366 } 367 }, 309 368 jshint: { 310 options: grunt.file.readJSON( '.jshintrc'),369 options: grunt.file.readJSON( '.jshintrc' ), 311 370 grunt: { 312 src: [ 'Gruntfile.js']371 src: [ 'Gruntfile.js' ] 313 372 }, 314 373 tests: { 315 374 src: [ … … 748 807 749 808 // Allow builds to be minimal 750 809 if( grunt.option( 'minimal-copy' ) ) { 751 var copyFilesOptions = grunt.config.get( 'copy.files.files' );752 810 copyFilesOptions[0].src.push( '!wp-content/plugins/**' ); 753 811 copyFilesOptions[0].src.push( '!wp-content/themes/!(twenty*)/**' ); 754 812 grunt.config.set( 'copy.files.files', copyFilesOptions ); 755 813 } 756 814 757 758 815 // Register tasks. 759 816 760 817 // Webpack task. … … 815 872 ] ); 816 873 817 874 grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() { 818 var done = this.async() ;819 varmap = {875 var done = this.async(), 876 map = { 820 877 svn: 'svn status --ignore-externals', 821 878 git: 'git status --short' 822 879 }; … … 832 889 833 890 if ( set.length ) { 834 891 fs.stat( dir = set.shift(), function( error ) { 835 error ? find( set ) : run( path.basename( dir ).substr( 1 ) ); 836 } ); 892 if ( error ) { 893 find( set ); 894 } else { 895 run( path.basename( dir ).substr( 1 ) ); 896 } 897 }); 837 898 } else { 838 899 runAllTasks(); 839 900 } -
package.json
13 13 "license": "GPL-2.0+", 14 14 "devDependencies": { 15 15 "autoprefixer": "^6.5.1", 16 "eslint": "^4.13.1", 17 "eslint-config-wordpress": "^1.0.0", 16 18 "grunt": "~0.4.5", 17 19 "grunt-banner": "^0.6.0", 18 20 "grunt-contrib-clean": "~1.0.0", … … 25 27 "grunt-contrib-qunit": "^1.2.0", 26 28 "grunt-contrib-uglify": "~2.0.0", 27 29 "grunt-contrib-watch": "~1.0.0", 30 "grunt-eslint": "^20.1.0", 28 31 "grunt-includes": "~0.5.1", 29 32 "grunt-jsdoc": "^2.1.0", 30 33 "grunt-jsvalidate": "~0.2.2", … … 34 37 "grunt-replace": "~1.0.1", 35 38 "grunt-rtlcss": "~2.0.1", 36 39 "grunt-sass": "~1.2.1", 37 "ink-docstrap": "^1.3.0",38 40 "grunt-webpack": "^3.0.2", 41 "ink-docstrap": "^1.3.0", 39 42 "matchdep": "~1.0.0", 40 43 "webpack": "^3.6.0", 41 44 "webpack-dev-server": "^2.9.1"