WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 8 months ago

Last modified 8 months ago

#45119 closed enhancement (fixed)

Add a way to build packages scripts to `/src` folder.

Reported by: atimmer Owned by: pento
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch, commit, fixed-5.0
Focuses: javascript Cc:

Description

I've got a request from @mcsf to be able to build the packages scripts into the /src folder. I will attach a patch that will build into /src/ by default when running grunt webpack:dev, I've also included a change to the ignore files for the relevant folders.

cc @omarreiss.

Attachments (2)

45119.diff (2.9 KB) - added by atimmer 10 months ago.
45119.2.diff (442 bytes) - added by netweb 10 months ago.

Download all attachments as: .zip

Change History (13)

@atimmer
10 months ago

#1 @omarreiss
10 months ago

  • Milestone changed from Awaiting Review to 5.0

For trunk I've got a patch ready to allow building into /src using --dev option. I think building into /build has turned out to be a suboptimal solution for PHP workflows for different reasons. If we agree building into src makes more sense for development (at least for as long as we don't have a dev server / GUI), then this patch makes total sense to me.

@pento would you have any objections to us committing this?

#2 @pento
10 months ago

  • Keywords commit added

Yah, let's go with this for now.

A couple of minor things:

  • .gitignore should be /src/js and /src/css.
  • Don't forget to set the equivalent svn:ignore when you commit.

#3 @netweb
10 months ago

The 45119.diff doesn't include the same .gitignore changes for svn:ignore.

To add these run svn propedit svn:ignore .:

Note there is no leading / on the paths for SVN

Index: .
===================================================================
--- .   (revision 43735)
+++ .   (working copy)

Property changes on: .
___________________________________________________________________
Modified: svn:ignore
## -5,9 +5,14 ##
 
 # Files and folders related to build/test tools
 phpunit.xml
phpcs.xml
.phpcs.xml
 node_modules
 npm-debug.log
 build
 wp-cli.local.yml
 .git
 jsdoc
vendor
+src/js
+src/css
)))
Last edited 10 months ago by netweb (previous) (diff)

#4 @pento
10 months ago

  • Component changed from General to Build/Test Tools
  • Owner set to pento
  • Status changed from new to assigned

#5 @pento
10 months ago

  • Keywords commit removed

#6 @pento
10 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 43760:

Build Tools: Copy package JavaScript and CSS into wp-includes.

  • grunt webpack:dev now copies packages JS into /src/wp-includes/js/dist, and CSS into /src/wp-includes/css/dist.
  • grunt webpack:prod does the same, but into /build instead of /src.
  • grunt build now runs the webpack:prod task.

Props atimmer, pento.
Fixes #45119.

@netweb
10 months ago

#7 @netweb
10 months ago

  • Keywords commit added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Running grunt precommit currently from the 5.0 branch fails grunt jsvalidate:build:

Running "jsvalidate:build" (jsvalidate) task
Validating build/wp-includes/js/dist/vendor/wp-polyfill-formdata.js  
>> Line 20: Unexpected token >
Encountered 2 errors.
Warning: Task "jsvalidate:build" failed. Use --force to continue.

Patch 45119.2.diff resolves the issue by ignoring the vendor folder at wp-includes/js/dist/vendor

#8 @pento
10 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 43783:

Build: Ignore the vendor directory during the jsvalidate:build task.

Props netweb.
Fixes #45119.

#9 @SergeyBiryukov
10 months ago

  • Keywords fixed-5.0 added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for trunk.

#10 @jeremyfelt
8 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 44135:

Build: Ignore the vendor directory during the jsvalidate:build task.

Merges [43783] from the 5.0 branch to trunk.

Props netweb.
Fixes #45119.

#11 @pento
8 months ago

In 44159:

Build Tools: Copy package JavaScript and CSS into wp-includes.

  • grunt webpack:dev now copies packages JS into /src/wp-includes/js/dist, and CSS into /src/wp-includes/css/dist.
  • grunt webpack:prod does the same, but into /build instead of /src.
  • grunt build now runs the webpack:prod task.

Merges [43760] from the 5.0 branch to trunk.

Props atimmer, pento.
Fixes #45119.

Note: See TracTickets for help on using tickets.