WordPress.org

Make WordPress Core

Ticket #45119: 45119.diff

File 45119.diff, 2.9 KB (added by atimmer, 11 months ago)
  • .gitignore

     
    1818/wp-cli.local.yml
    1919/jsdoc
    2020/vendor
     21/src/js/dist
     22/src/css/dist
    2123
    2224# Files and folders that get created in wp-content
    2325/src/wp-content/blogs.dir
  • tools/webpack/packages.js

     
    3737/**
    3838 * Maps vendors to copy commands for the CopyWebpackPlugin.
    3939 *
    40  * @param {Object} vendors Vendors to include in the vendor folder.
     40 * @param {Object} vendors     Vendors to include in the vendor folder.
     41 * @param {string} buildTarget The folder in which to build the packages.
    4142 *
    4243 * @return {Object[]} Copy object suitable for the CopyWebpackPlugin.
    4344 */
    44 function mapVendorCopies( vendors ) {
     45function mapVendorCopies( vendors, buildTarget ) {
    4546        return Object.keys( vendors ).map( ( filename ) => ( {
    4647                from: join( baseDir, `node_modules/${ vendors[ filename ] }` ),
    47                 to: join( baseDir, `build/js/dist/vendor/${ filename }` ),
     48                to: join( baseDir, `${ buildTarget }/js/dist/vendor/${ filename }` ),
    4849        } ) );
    4950}
    5051
     
    5152module.exports = function( env = { environment: 'production', watch: false } ) {
    5253        const mode = env.environment;
    5354        const suffix = mode === 'production' ? '.min': '';
     55        const buildTarget = mode === 'production' ? 'build': 'src';
    5456
    5557        const packages = [
    5658                'api-fetch',
     
    143145                };
    144146        } );
    145147
    146         const developmentCopies = mapVendorCopies( vendors );
    147         const minifiedCopies = mapVendorCopies( minifiedVendors );
    148         const minifyCopies = mapVendorCopies( minifyVendors ).map( ( copyCommand ) => {
     148        const developmentCopies = mapVendorCopies( vendors, buildTarget );
     149        const minifiedCopies = mapVendorCopies( minifiedVendors, buildTarget );
     150        const minifyCopies = mapVendorCopies( minifyVendors, buildTarget ).map( ( copyCommand ) => {
    149151                return {
    150152                        ...copyCommand,
    151153                        transform: ( content ) => {
     
    158160
    159161        let cssCopies = packages.map( ( packageName ) => ( {
    160162                from: join( baseDir, `node_modules/@wordpress/${ packageName }/build-style/*.css` ),
    161                 to: join( baseDir, `build/styles/dist/${ packageName }/` ),
     163                to: join( baseDir, `${ buildTarget }/styles/dist/${ packageName }/` ),
    162164                flatten: true,
    163165                transform: ( content ) => {
    164166                        if ( config.mode === 'production' ) {
     
    190192                }, {} ),
    191193                output: {
    192194                        filename: `[basename]${ suffix }.js`,
    193                         path: join( baseDir, 'build/js/dist' ),
     195                        path: join( baseDir, `${ buildTarget }/js/dist` ),
    194196                        library: {
    195197                                root: [ 'wp', '[name]' ]
    196198                        },
  • .