Make WordPress Core

Changeset 44245

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  
    1313        nodesass = require( 'node-sass' ),
    1414        phpUnitWatchGroup = grunt.option( 'group' ),
     15
     16
     17
     18
    1519        buildFiles = [
    1620            '*.php',
     
    2024            'wp-admin/**', // Include everything in wp-admin.
    2125            'wp-content/index.php',
    22             'wp-content/themes/index.php',
    23             'wp-content/themes/twenty*/**',
    2426            'wp-content/plugins/index.php',
    2527            'wp-content/plugins/hello.php',
    2628            'wp-content/plugins/akismet/**'
    27         ],
     29        ],
    2830        cleanFiles = [],
    2931        changedFiles = {
     
    128130            }
    129131        },
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
    130168        copy: {
    131169            files: {
     
    139177                            '!.{svn,git}', // Exclude version control folders.
    140178                            '!wp-includes/version.php', // Exclude version.php
     179
     180
    141181                            '!index.php', '!wp-admin/index.php',
    142182                            '!_index.php', '!wp-admin/_index.php'
     
    153193                    }
    154194                ]
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
    155212            },
    156213            'npm-packages': {
     
    342399                dest: BUILD_DIR + 'wp-includes/version.php'
    343400            },
     401
     402
     403
     404
     405
     406
     407
    344408            dynamic: {
    345409                dot: true,
     
    707771        webpack: {
    708772            prod: webpackConfig( { environment: 'production' } ),
     773
    709774            dev: webpackConfig( { environment: 'development' } ),
    710775            watch: webpackConfig( { environment: 'development', watch: true } )
     
    11591224    grunt.registerTask( 'watch', function() {
    11601225        if ( ! this.args.length || this.args.indexOf( 'webpack' ) > -1 ) {
    1161             grunt.task.run( 'build' );
     1226            grunt.task.run( 'build' );
    11621227        }
    11631228
     
    13081373    } );
    13091374
     1375
     1376
     1377
     1378
     1379
     1380
     1381
    13101382    grunt.registerTask( 'copy:js', [
    13111383        'copy:npm-packages',
     
    13151387    ] );
    13161388
    1317     grunt.registerTask( 'uglify:all', [
    1318         'uglify:core',
    1319         'uglify:embed',
    1320         'uglify:jqueryui',
    1321         'uglify:imgareaselect'
     1389    grunt.registerTask( 'copyOrSymlink', function() {
     1390        var task = grunt.option( 'symlink' ) === true ? 'symlink:expanded' : 'copy:files';
     1391        grunt.task.run( task );
     1392    } );
     1393
     1394    grunt.registerTask( 'copy:all', [
     1395        'copyOrSymlink',
     1396        'copy:php-buildFiles',
     1397        'copy:css',
     1398        'copy:themes',
     1399        'copy:wp-admin-css-compat-rtl',
     1400        'copy:wp-admin-css-compat-min',
     1401        'copy:version',
     1402        'copy:js'
    13221403    ] );
    13231404
     
    13391420    ] );
    13401421
    1341     grunt.registerTask( 'copy:all', [
    1342         'copy:files',
    1343         'copy:wp-admin-css-compat-rtl',
    1344         'copy:wp-admin-css-compat-min',
    1345         'copy:version',
    1346         'copy:js'
    1347     ] );
    1348 
    1349     grunt.registerTask( 'build', [
    1350         'clean:all',
     1422    grunt.registerTask( 'clean-all', function() {
     1423        if ( grunt.option( 'symlink' ) === true ) {
     1424            // clean all symlinks
     1425            try {
     1426                var delSymlinks = require('del-symlinks');
     1427
     1428                var result = delSymlinks.sync(['./build/**']);
     1429                grunt.log.writeln( '>> ' + result.length + ' symlinks cleaned.' );
     1430            } catch ( e ) {
     1431                grunt.verbose.error( 'Error:', e.message );
     1432                grunt.fail.warn( "Failed to delete symlinks. If you're on Windows, " +
     1433                                                 "running as administrator could resolve this issue.");
     1434            }
     1435        }
     1436
     1437        grunt.task.run( 'clean:all' );
     1438    } );
     1439
     1440    grunt.registerTask( 'build:all', [
     1441        'clean-all',
    13511442        'copy:all',
    13521443        'file_append',
     
    13631454        'usebanner',
    13641455        'webpack:prod',
    1365         'webpack:dev',
     1456        'webpack:dev',
    13661457        'jsvalidate:build'
    13671458    ] );
     1459
     1460
     1461
     1462
     1463
     1464
     1465
     1466
     1467
     1468
     1469
     1470
     1471
     1472
     1473
     1474
     1475
     1476
     1477
     1478
     1479
    13681480
    13691481    grunt.registerTask( 'prerelease', [
  • trunk/tools/webpack/packages.js

    r44177 r44245  
    5050}
    5151
    52 module.exports = function( env = { environment: 'production', watch: false } ) {
     52module.exports = function( env = { environment: 'production', watch: false } ) {
    5353    const mode = env.environment;
    5454    const suffix = mode === 'production' ? '.min' : '';
    55     const buildTarget = ( mode === 'production' ? 'build' : 'src' ) + '/wp-includes';
     55    const buildTarget = ( mode === 'production' ? 'build' : 'src' ) + '/wp-includes';
    5656
    5757    const packages = [
  • trunk/webpack.config.js

    r44112 r44245  
    22const packagesConfig = require( './tools/webpack/packages' );
    33
    4 module.exports = function( env = { environment: "production", watch: false } ) {
     4module.exports = function( env = { environment: "production", watch: false } ) {
    55    if ( ! env.watch ) {
    66        env.watch = false;
     7
     8
     9
     10
    711    }
    812
Note: See TracChangeset for help on using the changeset viewer.