Make WordPress Core

Ticket #31823: 31823.6.diff

File 31823.6.diff, 5.0 KB (added by netweb, 8 years ago)
  • Gruntfile.js

     
    11/* jshint node:true */
     2/* global module, require, __dirname */
    23/* globals Set */
    3 var webpackConfig = require( './webpack.config.prod' );
    4 var webpackDevConfig = require( './webpack.config.dev' );
     4var webpackConfig = require( './webpack.config.prod' ),
     5        webpackDevConfig = require( './webpack.config.dev' );
    56
    67module.exports = function(grunt) {
    78        var path = require('path'),
     
    1011                SOURCE_DIR = 'src/',
    1112                BUILD_DIR = 'build/',
    1213                BANNER_TEXT = '/*! This file is auto-generated */',
    13                 autoprefixer = require( 'autoprefixer' );
     14                autoprefixer = require( 'autoprefixer' ),
     15                copyFilesOptions = grunt.config.get( 'copy.files.files' );
    1416
    1517        // Load tasks.
    1618        require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );
     
    145147                                                        version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd.HHMMss' ) );
    146148
    147149                                                        /* jshint quotmark: true */
    148                                                         return "$wp_version = '" + version + "';";
     150                                                        return '$wp_version = \'' + version + '\';';
    149151                                                });
    150152                                        }
    151153                                },
     
    306308                                src: []
    307309                        }
    308310                },
     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                },
    309368                jshint: {
    310                         options: grunt.file.readJSON('.jshintrc'),
     369                        options: grunt.file.readJSON( '.jshintrc' ),
    311370                        grunt: {
    312                                 src: ['Gruntfile.js']
     371                                src: [ 'Gruntfile.js' ]
    313372                        },
    314373                        tests: {
    315374                                src: [
     
    748807
    749808        // Allow builds to be minimal
    750809        if( grunt.option( 'minimal-copy' ) ) {
    751                 var copyFilesOptions = grunt.config.get( 'copy.files.files' );
    752810                copyFilesOptions[0].src.push( '!wp-content/plugins/**' );
    753811                copyFilesOptions[0].src.push( '!wp-content/themes/!(twenty*)/**' );
    754812                grunt.config.set( 'copy.files.files', copyFilesOptions );
    755813        }
    756814
    757 
    758815        // Register tasks.
    759816
    760817        // Webpack task.
     
    815872        ] );
    816873
    817874        grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() {
    818                 var done = this.async();
    819                 var map = {
     875                var done = this.async(),
     876                        map = {
    820877                        svn: 'svn status --ignore-externals',
    821878                        git: 'git status --short'
    822879                };
     
    832889
    833890                        if ( set.length ) {
    834891                                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                                });
    837898                        } else {
    838899                                runAllTasks();
    839900                        }
  • package.json

     
    1313  "license": "GPL-2.0+",
    1414  "devDependencies": {
    1515    "autoprefixer": "^6.5.1",
     16    "eslint": "^4.13.1",
     17    "eslint-config-wordpress": "^1.0.0",
    1618    "grunt": "~0.4.5",
    1719    "grunt-banner": "^0.6.0",
    1820    "grunt-contrib-clean": "~1.0.0",
     
    2527    "grunt-contrib-qunit": "^1.2.0",
    2628    "grunt-contrib-uglify": "~2.0.0",
    2729    "grunt-contrib-watch": "~1.0.0",
     30    "grunt-eslint": "^20.1.0",
    2831    "grunt-includes": "~0.5.1",
    2932    "grunt-jsdoc": "^2.1.0",
    3033    "grunt-jsvalidate": "~0.2.2",
     
    3437    "grunt-replace": "~1.0.1",
    3538    "grunt-rtlcss": "~2.0.1",
    3639    "grunt-sass": "~1.2.1",
    37     "ink-docstrap": "^1.3.0",
    3840    "grunt-webpack": "^3.0.2",
     41    "ink-docstrap": "^1.3.0",
    3942    "matchdep": "~1.0.0",
    4043    "webpack": "^3.6.0",
    4144    "webpack-dev-server": "^2.9.1"