rwsdk 1.0.0-beta.32 → 1.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
1
|
import fs from "fs-extra";
|
|
3
|
-
import
|
|
2
|
+
import path from "node:path";
|
|
4
3
|
export const moveStaticAssetsPlugin = ({ rootDir, }) => ({
|
|
5
4
|
name: "rwsdk:move-static-assets",
|
|
6
5
|
apply: "build",
|
|
@@ -9,10 +8,14 @@ export const moveStaticAssetsPlugin = ({ rootDir, }) => ({
|
|
|
9
8
|
process.env.RWSDK_BUILD_PASS === "linker") {
|
|
10
9
|
const sourceDir = path.join(rootDir, "dist", "worker", "assets");
|
|
11
10
|
const destDir = path.join(rootDir, "dist", "client", "assets");
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (!(await fs.pathExists(sourceDir))) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const allFiles = await fs.readdir(sourceDir);
|
|
15
|
+
const filesToMove = allFiles.filter((file) => !file.endsWith(".js") && !file.endsWith(".map"));
|
|
16
|
+
if (filesToMove.length > 0) {
|
|
14
17
|
await fs.ensureDir(destDir);
|
|
15
|
-
for (const file of
|
|
18
|
+
for (const file of filesToMove) {
|
|
16
19
|
const sourceFile = path.join(sourceDir, file);
|
|
17
20
|
const destFile = path.join(destDir, file);
|
|
18
21
|
await fs.move(sourceFile, destFile, { overwrite: true });
|