WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#47749 new enhancement

Build tools: remove all old files when cleaning

Reported by: azaozz Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: needs-testing
Focuses: Cc:

Description

Currently running clean doesn't delete all old files. It either cleans only /build or only the inline files in /src. This can get confusing when switching the building location.

The presence of the build files in /src can also cause some problems when doing grunt precommit or building to /build, see #47078.

Attachments (2)

47749.diff (23.3 KB) - added by azaozz 4 weeks ago.
47749.1.diff (30.9 KB) - added by azaozz 4 weeks ago.

Download all attachments as: .zip

Change History (7)

@azaozz
4 weeks ago

#1 @azaozz
4 weeks ago

  • Keywords needs-testing added

In 47749.diff: fix the clean task to clean old files from both /build and /src.

The patch also contains some unrelated WPCS fixes in Gruntfile.js.

Last edited 4 weeks ago by azaozz (previous) (diff)

#2 @dkarfa
4 weeks ago

  • Keywords dev-feedback added
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Warning: Task "build" not found. Use --force to continue.

Aborted due to warnings.

#3 @dkarfa
4 weeks ago

My bad, I update the babel runtime

npm install @babel/runtime@latest

Then check, working fine with the patch, it worked :).

Last edited 4 weeks ago by dkarfa (previous) (diff)

#4 @azaozz
4 weeks ago

  • Keywords dev-feedback removed

@dkarfa Thanks for testing! Yeah, I forget to run npm install sometimes too. Glad it's working as expected.

@azaozz
4 weeks ago

#5 @azaozz
4 weeks ago

Was looking a bit more at what "grunt clean" does and why:

  • clean:files cleans everything from /build. Wondering if there's need to separately clean /js and /css there.
  • Running Webpack when building the js also creates /src/wp-includes/css/dist. It needs to be "cleaned" when cleaning the js or it may get deleted after it's created.
  • After building to /build there's a leftover /src/wp-includes/js directory with some of the js files.

In 47749.1.diff:

  • Switch grunt clean:js and grunt clean:css to only clean in /src. Can make that that dependent on passing --dev but not sure it's needed.
  • Delete /src/wp-includes/css/dist when running clean:js.
  • Run clean:js after building in /build to remove /src/wp-includes/js.
Last edited 4 weeks ago by azaozz (previous) (diff)
Note: See TracTickets for help on using tickets.