Make WordPress Core

Changeset 44245


Ignore:
Timestamp:
12/16/2018 11:27:36 PM ( 6 years ago)
Author:
SergeyBiryukov
Message:

Build Tools: Add non-minified @wordpress scripts to the build output.

Props atimmer.
Merges [43886] to trunk.
See #45156 .

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Gruntfile.js

    r44233 r44245  
    thirteen thirteen         nodesass = require( 'node-sass' ),
    fourteen fourteen         phpUnitWatchGroup = grunt.option( 'group' ),
      fifteen         themeFiles = [
      sixteen             'wp-content/themes/index.php',
      seventeen             'wp-content/themes/twenty*/**'
      eighteen         ],
    fifteen nineteen         buildFiles = [
    sixteen twenty             '*.php',
     
    twenty twenty-four             'wp-admin/**', // Include everything in wp-admin.
    twenty-one twenty-five             'wp-content/index.php',
    twenty-two               'wp-content/themes/index.php',
    twenty-three               'wp-content/themes/twenty*/**',
    twenty-four twenty-six             'wp-content/plugins/index.php',
    twenty-five twenty-seven             'wp-content/plugins/hello.php',
    twenty-six twenty-eight             'wp-content/plugins/akismet/**'
    twenty-seven           ] ,
      twenty-nine         ] .concat( themeFiles ) ,
    twenty-eight thirty         cleanFiles = [],
    twenty-nine thirty-one         changedFiles = {
     
    one hundred and twenty-eight one hundred and thirty             }
    one hundred and twenty-nine one hundred and thirty-one         },
      one hundred and thirty-two         symlink: {
      one hundred and thirty-three             expanded: {
      one hundred and thirty-four                 files: [
      one hundred and thirty-five                   {
      one hundred and thirty-six                     expand: true,
      one hundred and thirty-seven                     overwrite: true,
      one hundred and thirty-eight                     cwd: SOURCE_DIR,
      one hundred and thirty-nine                     src: [
      one hundred and forty                             'wp-admin/*',
      one hundred and forty-one                             'wp-content/uploads/',
      one hundred and forty-two                             'wp-content/index.php',
      one hundred and forty-three                             'wp-content/plugins/*',
      one hundred and forty-four                             'wp-includes/*',
      one hundred and forty-five                             '*.php',
      one hundred and forty-six                             '*.txt',
      one hundred and forty-seven                             '*.html',
      one hundred and forty-eight                             '! wp-load.php',
      one hundred and forty-nine                             '! wp-admin/css',
      one hundred and fifty                             '! wp-content/themes',
      one hundred and fifty-one                             '! wp-includes/css',
      one hundred and fifty-two                             '! wp-includes/version.php', // Exclude version.php
      one hundred and fifty-three                             '! wp-includes/formatting.php', // Exclude formatting.php
      one hundred and fifty-four                             '! wp-includes/embed.php', // Exclude formatting.php
      one hundred and fifty-five                             '! index.php', '!wp-admin/index.php',
      one hundred and fifty-six                             '!_ index.php', '!wp-admin/_index.php'
      one hundred and fifty-seven                         ],
      one hundred and fifty-eight                     dest: BUILD_DIR
      one hundred and fifty-nine                   },
      one hundred and sixty                     {
      one hundred and sixty-one                         'build/wp-config-sample.php': ['wp-config-sample.php'],
      one hundred and sixty-two                         'build/index.php': ['src/_index.php'],
      one hundred and sixty-three                         'build/wp-admin/index.php': ['src/wp-admin/_index.php']
      one hundred and sixty-four                     }
      one hundred and sixty-five                 ]
      one hundred and sixty-six             }
      one hundred and sixty-seven         },
    one hundred and thirty one hundred and sixty-eight         copy: {
    one hundred and thirty-one one hundred and sixty-nine             files: {
     
    one hundred and thirty-nine one hundred and seventy-seven                             '!. {svn, git}', // Exclude version control folders.
    one hundred and forty one hundred and seventy-eight                             '! wp-includes/version.php', // Exclude version.php
      one hundred and seventy-nine                             '! wp-admin/css/**/*', // Exclude the CSS
      one hundred and eighty                             '! wp-includes/css/**/*', // Exclude the CSS
    one hundred and forty-one one hundred and eighty-one                             '! index.php', '!wp-admin/index.php',
    one hundred and forty-two one hundred and eighty-two                             '!_ index.php', '!wp-admin/_index.php'
     
    one hundred and fifty-three one hundred and ninety-three                     }
    one hundred and fifty-four one hundred and ninety-four                 ]
      one hundred and ninety-five             },
      one hundred and ninety-six             css: {
      one hundred and ninety-seven                 dot: true,
      one hundred and ninety-eight                 expand: true,
      one hundred and ninety-nine                 cwd: SOURCE_DIR,
      two hundred                 src: [
      two hundred and one                     'wp-admin/**/*.css',
      two hundred and two                     'wp-includes/**/*.css'
      two hundred and three                 ],
      two hundred and four                 dest: BUILD_DIR
      two hundred and five             },
      two hundred and six             themes: {
      two hundred and seven                 dot: true,
      two hundred and eight                 expand: true,
      two hundred and nine                 cwd: SOURCE_DIR,
      two hundred and ten                 src: themeFiles,
      two hundred and eleven                 dest: BUILD_DIR
    one hundred and fifty-five two hundred and twelve             },
    one hundred and fifty-six two hundred and thirteen             'npm-packages': {
     
    three hundred and forty-two three hundred and ninety-nine                 dest: BUILD_DIR + 'wp-includes/version.php'
    three hundred and forty-three four hundred             },
      four hundred and one             'php-buildFiles': {
      four hundred and two                 files: {
      four hundred and three                     'build/wp-includes/formatting.php': ['src/wp-includes/formatting.php'],
      four hundred and four                     'build/wp-includes/embed.php': ['src/wp-includes/embed.php'],
      four hundred and five                     'build/wp-load.php': ['src/wp-load.php'],
      four hundred and six                 }
      four hundred and seven             },
    three hundred and forty-four four hundred and eight             dynamic: {
    three hundred and forty-five four hundred and nine                 dot: true,
     
    seven hundred and seven seven hundred and seventy-one         webpack: {
    seven hundred and eight seven hundred and seventy-two             prod: webpackConfig( { environment: 'production' } ),
      seven hundred and seventy-three             devProdTarget: webpackConfig( { environment: 'development', forceBuildTarget: 'build/wp-includes' } ),
    seven hundred and nine seven hundred and seventy-four             dev: webpackConfig( { environment: 'development' } ),
    seven hundred and ten seven hundred and seventy-five             watch: webpackConfig( { environment: 'development', watch: true } )
     
    one thousand one hundred and fifty-nine one thousand two hundred and twenty-four     grunt.registerTask( 'watch', function() {
    one thousand one hundred and sixty one thousand two hundred and twenty-five         if ( ! this.args.length || this.args.indexOf( 'webpack' ) > -1 ) {
    one thousand one hundred and sixty-one               grunt.task.run( 'build ' );
      one thousand two hundred and twenty-six             grunt.task.run( 'build :dev ' );
    one thousand one hundred and sixty-two one thousand two hundred and twenty-seven         }
    one thousand one hundred and sixty-three one thousand two hundred and twenty-eight
     
    one thousand three hundred and eight one thousand three hundred and seventy-three     } );
    one thousand three hundred and nine one thousand three hundred and seventy-four
      one thousand three hundred and seventy-five     grunt.registerTask( 'uglify:all', [
      one thousand three hundred and seventy-six         'uglify:core',
      one thousand three hundred and seventy-seven         'uglify:embed',
      one thousand three hundred and seventy-eight         'uglify:jqueryui',
      one thousand three hundred and seventy-nine         'uglify:imgareaselect'
      one thousand three hundred and eighty     ] );
      one thousand three hundred and eighty-one
    one thousand three hundred and ten one thousand three hundred and eighty-two     grunt.registerTask( 'copy:js', [
    one thousand three hundred and eleven one thousand three hundred and eighty-three         'copy:npm-packages',
     
    one thousand three hundred and fifteen one thousand three hundred and eighty-seven     ] );
    one thousand three hundred and sixteen one thousand three hundred and eighty-eight
    one thousand three hundred and seventeen       grunt.registerTask( 'uglify:all', [
    one thousand three hundred and eighteen           'uglify:core',
    one thousand three hundred and nineteen           'uglify:embed',
    one thousand three hundred and twenty           'uglify:jqueryui',
    one thousand three hundred and twenty-one           'uglify:imgareaselect'
      one thousand three hundred and eighty-nine     grunt.registerTask( 'copyOrSymlink', function() {
      one thousand three hundred and ninety         var task = grunt.option( 'symlink' ) === true ? ' symlink:expanded' : 'copy:files';
      one thousand three hundred and ninety-one         grunt.task.run( task );
      one thousand three hundred and ninety-two     } );
      one thousand three hundred and ninety-three
      one thousand three hundred and ninety-four     grunt.registerTask( 'copy:all', [
      one thousand three hundred and ninety-five         'copyOrSymlink',
      one thousand three hundred and ninety-six         'copy:php-buildFiles',
      one thousand three hundred and ninety-seven         'copy:css',
      one thousand three hundred and ninety-eight         'copy:themes',
      one thousand three hundred and ninety-nine         'copy:wp-admin-css-compat-rtl',
      one thousand and four hundred         'copy:wp-admin-css-compat-min',
      one thousand four hundred and one         'copy:version',
      one thousand four hundred and two         'copy:js'
    one thousand three hundred and twenty-two one thousand four hundred and three     ] );
    one thousand three hundred and twenty-three one thousand four hundred and four
     
    one thousand three hundred and thirty-nine one thousand four hundred and twenty     ] );
    one thousand three hundred and forty one thousand four hundred and twenty-one
    one thousand three hundred and forty-one       grunt.registerTask( 'copy:all', [
    one thousand three hundred and forty-two           'copy:files',
    one thousand three hundred and forty-three           'copy:wp-admin-css-compat-rtl',
    one thousand three hundred and forty-four           'copy:wp-admin-css-compat-min',
    one thousand three hundred and forty-five           'copy:version',
    one thousand three hundred and forty-six           'copy:js'
    one thousand three hundred and forty-seven       ] );
    one thousand three hundred and forty-eight  
    one thousand three hundred and forty-nine       grunt.registerTask( 'build', [
    one thousand three hundred and fifty           'clean:all',
      one thousand four hundred and twenty-two     grunt.registerTask( 'clean-all', function() {
      one thousand four hundred and twenty-three         if ( grunt.option( 'symlink' ) === true ) {
      one thousand four hundred and twenty-four             // clean all symlinks
      one thousand four hundred and twenty-five             try {
      one thousand four hundred and twenty-six                 var delSymlinks = require('del-symlinks');
      one thousand four hundred and twenty-seven
      one thousand four hundred and twenty-eight                 var result = delSymlinks.sync(['./build/**']);
      one thousand four hundred and twenty-nine                 grunt.log.writeln( '>> ' + result.length + ' symlinks cleaned.' );
      one thousand four hundred and thirty             } catch ( e ) {
      one thousand four hundred and thirty-one                 grunt.verbose.error( 'Error:', e.message );
      one thousand four hundred and thirty-two                 grunt.fail.warn( "Failed to delete symlinks. If you're on Windows, " +
      one thousand four hundred and thirty-three                                                  "running as administrator could resolve this issue.");
      one thousand four hundred and thirty-four             }
      one thousand four hundred and thirty-five         }
      one thousand four hundred and thirty-six
      one thousand four hundred and thirty-seven         grunt.task.run( 'clean:all' );
      one thousand four hundred and thirty-eight     } );
      one thousand four hundred and thirty-nine
      one thousand four hundred and forty     grunt.registerTask( 'build:all', [
      one thousand four hundred and forty-one         'clean-all',
    one thousand three hundred and fifty-one one thousand four hundred and forty-two         'copy:all',
    one thousand three hundred and fifty-two one thousand four hundred and forty-three         'file_append',
     
    one thousand three hundred and sixty-three one thousand four hundred and fifty-four         'usebanner',
    one thousand three hundred and sixty-four one thousand four hundred and fifty-five         'webpack:prod',
    one thousand three hundred and sixty-five           'webpack:dev ',
      one thousand four hundred and fifty-six         'webpack:dev ProdTarget ',
    one thousand three hundred and sixty-six one thousand four hundred and fifty-seven         'jsvalidate:build'
    one thousand three hundred and sixty-seven one thousand four hundred and fifty-eight     ] );
      one thousand four hundred and fifty-nine
      one thousand four hundred and sixty     grunt.registerTask( 'build', function() {
      one thousand four hundred and sixty-one         grunt.task.run( 'build:all' );
      one thousand four hundred and sixty-two     } );
      one thousand four hundred and sixty-three
      one thousand four hundred and sixty-four     grunt.registerTask( 'build:dev', function() {
      one thousand four hundred and sixty-five         try {
      one thousand four hundred and sixty-six             // Try creating a symlink.
      one thousand four hundred and sixty-seven             fs.symlinkSync( './symlink', './symlinktest');
      one thousand four hundred and sixty-eight             grunt.option( 'symlink', true );
      one thousand four hundred and sixty-nine             // If succeeded, remove it again.
      one thousand four hundred and seventy             fs.unlinkSync( './symlinktest' );
      one thousand four hundred and seventy-one         } catch( e ) {
      one thousand four hundred and seventy-two             grunt.verbose.error( 'Error:', e.message );
      one thousand four hundred and seventy-three             grunt.log.error( "Failed to delete symlinks. Falling back to copying " +
      one thousand four hundred and seventy-four                                              "files instead. If you're on Windows, " +
      one thousand four hundred and seventy-five                                              "running as administrator could resolve this issue.");
      one thousand four hundred and seventy-six         } finally {
      one thousand four hundred and seventy-seven             grunt.task.run( 'build:all' );
      one thousand four hundred and seventy-eight         }
      one thousand four hundred and seventy-nine     } );
    one thousand three hundred and sixty-eight one thousand four hundred and eighty
    one thousand three hundred and sixty-nine one thousand four hundred and eighty-one     grunt.registerTask( 'prerelease', [
  • trunk/tools/webpack/packages.js

    r44177 r44245  
    fifty fifty }
    fifty-one fifty-one
    fifty-two   module.exports = function( env = { environment: 'production', watch: false } ) {
      fifty-two module.exports = function( env = { environment: 'production', watch: false , forceBuildTarget: false } ) {
    fifty-three fifty-three     const mode = env.environment;
    fifty-four fifty-four     const suffix = mode === 'production' ? '. min' : '';
    fifty-five       const buildTarget = ( mode === 'production' ? 'build' : 'src' ) + '/wp-includes';
      fifty-five     const buildTarget = env.forceBuildTarget ? env.forceBuildTarget : ( mode === 'production' ? 'build' : 'src' ) + '/wp-includes';
    fifty-six fifty-six
    fifty-seven fifty-seven     const packages = [
  • trunk/webpack.config.js

    r44112 r44245  
    two two const packagesConfig = require( './ tools/webpack/packages' );
    three three
    four   module.exports = function( env = { environment: "production", watch: false } ) {
      four module.exports = function( env = { environment: "production", watch: false , forceBuildTarget: false } ) {
    five five     if ( ! env.watch ) {
    six six         env.watch = false;
      seven     }
      eight
      nine     if ( ! env.forceBuildTarget ) {
      ten         env.forceBuildTarget = false;
    seven eleven     }
    eight twelve
Note: See TracChangeset for help on using the changeset viewer.