@@ -12,6 +12,9 @@ const fsPromises = require('fs/promises');
12
12
const { copyFile, lstat, mkdir, readdir } = require ( 'fs/promises' ) ;
13
13
const path = require ( 'path' ) ;
14
14
15
+ const purgeLocations = [
16
+ path . normalize ( path . join ( __dirname , '..' , '..' , 'web' , 'test' ) )
17
+ ] ;
15
18
const sourceDirectories = [
16
19
path . normalize ( path . join ( __dirname , '..' , '..' , 'web' ) )
17
20
// path.normalize(path.join(__dirname, '..', '..', 'staged-themes'))
@@ -21,6 +24,13 @@ const targetDirectory = path.normalize(path.join(__dirname, '..', '..', '..', 'e
21
24
module . exports = function ( configObj ) {
22
25
return new Promise ( async ( resolve , reject ) => {
23
26
console . log ( "Running after_build hook." ) ;
27
+ console . log ( 'Purging unnecessary files created by the build...' ) ;
28
+ for ( const purgeLocation of purgeLocations ) {
29
+ if ( fs . existsSync ( purgeLocation ) ) {
30
+ fs . rmSync ( purgeLocation , { force : true , recursive : true } ) ;
31
+ }
32
+ }
33
+
24
34
if ( configObj . buildType === 'release' ) {
25
35
console . log ( 'Consolidating files for building the release' ) ;
26
36
for ( const sourceDirectory of sourceDirectories ) {
0 commit comments