WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 4 weeks ago

#47749 new enhancement

Build tools: remove all old files when cleaning

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

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 3 months ago.
47749.1.diff (30.9 KB) - added by azaozz 3 months ago.

Download all attachments as: .zip

Change History (8)

@azaozz
3 months ago

#1 @azaozz
3 months 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 3 months ago by azaozz (previous) (diff)

#2 @dkarfa
3 months 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
3 months ago

My bad, I update the babel runtime

npm install @babel/runtime@latest

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

Last edited 3 months ago by dkarfa (previous) (diff)

#4 @azaozz
3 months 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
3 months ago

#5 @azaozz
3 months 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 3 months ago by azaozz (previous) (diff)

#6 @desrosj
4 weeks ago

  • Milestone changed from 5.3 to Future Release

With 5.3 beta 1 in a few hours, I'm punting this one. However, because it is test and tooling related, it can be moved back and committed during the beta period if someone has time to own.

Note: See TracTickets for help on using tickets.