Skip to content

Commit 9c97f8f

Browse files
committed
updates to task for copying assets
1 parent 0c863da commit 9c97f8f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

copy-media.mjs copy-assets.mjs

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import { globby } from "globby";
22
import { dirname, join } from "path";
33
import { copyFile, mkdir } from "fs/promises";
44

5-
const source = "./src/media";
6-
const target = "./assets/media";
7-
const patterns = [ '**/*' ];
8-
95
const toShortTime = timespan => {
106
if ( timespan > 1000 ) {
117
return ( timespan / 1000 ).toFixed( 3 )
@@ -14,7 +10,7 @@ const toShortTime = timespan => {
1410
return timespan + "ms";
1511
};
1612

17-
const performCopy = async() => {
13+
const performCopy = async(source, target, patterns) => {
1814
const started = Date.now();
1915
try {
2016
console.log( `copying "${ source }" to "${ target }"...` );
@@ -30,4 +26,5 @@ const performCopy = async() => {
3026
}
3127
};
3228

33-
await performCopy();
29+
await performCopy( "./src/media", "./assets/media", [ '**/*' ] );
30+
await performCopy( "./src/admin", "./assets/admin", [ '**/*' ] );

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"build": "wp-scripts build --output-path=assets && npm run copy",
2020
"start": "wp-scripts start --output-path=assets",
2121
"develop": "wp-scripts start --no-watch --output-path=assets && npm run copy",
22-
"copy": "node copy-media.mjs",
22+
"copy": "node copy-assets.mjs",
2323
"i18n": "node make-pot.mjs",
2424
"composer:install": "composer install --prefer-dist --optimize-autoloader --no-dev",
2525
"composer:update": "composer update --optimize-autoloader",

0 commit comments

Comments
 (0)