rwsdk 1.0.0-beta.46 → 1.0.0-beta.47
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.
package/bin/rw-scripts.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { execa } from "execa";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { $ as $base } from "execa";
|
|
6
6
|
|
|
7
7
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
8
|
|
|
@@ -12,19 +12,19 @@ const BIN_DIR = path.resolve(ROOT_DIR, "node_modules", ".bin");
|
|
|
12
12
|
const ARGS = process.argv.slice(2);
|
|
13
13
|
const SCRIPT_NAME = ARGS[0];
|
|
14
14
|
|
|
15
|
-
const $ = $base({
|
|
16
|
-
shell: true,
|
|
17
|
-
stdio: "inherit",
|
|
18
|
-
reject: false,
|
|
19
|
-
env: {
|
|
20
|
-
PATH: `${process.env.PATH}:${BIN_DIR}`,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
15
|
const main = async () => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
const scriptPath =
|
|
17
|
+
path.resolve(ROOT_DIR, "dist", "scripts", SCRIPT_NAME) + ".mjs";
|
|
18
|
+
const args = ARGS.slice(1);
|
|
19
|
+
|
|
20
|
+
const result = await execa("node", [scriptPath, ...args], {
|
|
21
|
+
stdio: "inherit",
|
|
22
|
+
reject: false,
|
|
23
|
+
env: {
|
|
24
|
+
...process.env,
|
|
25
|
+
PATH: `${process.env.PATH}:${BIN_DIR}`,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
28
|
process.exitCode = result.exitCode;
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
2
|
-
import { resolve } from "node:path";
|
|
2
|
+
import { resolve } from "node:path/posix";
|
|
3
3
|
import { unstable_readConfig } from "wrangler";
|
|
4
4
|
import { devServerConstantPlugin } from "./devServerConstant.mjs";
|
|
5
5
|
import { hasOwnCloudflareVitePlugin } from "./hasOwnCloudflareVitePlugin.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { join } from "node:path/posix";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { determineWorkerEntryPathname } from "./redwoodPlugin.mjs";
|
|
4
4
|
describe("determineWorkerEntryPathname", () => {
|
|
@@ -9,7 +9,7 @@ describe("determineWorkerEntryPathname", () => {
|
|
|
9
9
|
workerConfigPath: "/test/project/wrangler.toml",
|
|
10
10
|
options: { entry: { worker: "src/custom-worker.ts" } },
|
|
11
11
|
});
|
|
12
|
-
expect(result).toBe(
|
|
12
|
+
expect(result).toBe(join(projectRootDir, "src/custom-worker.ts"));
|
|
13
13
|
});
|
|
14
14
|
it("should use the main path from wrangler config if no entry option is provided", async () => {
|
|
15
15
|
const readConfig = () => ({ main: "src/wrangler-worker.tsx" });
|
|
@@ -19,7 +19,7 @@ describe("determineWorkerEntryPathname", () => {
|
|
|
19
19
|
options: {},
|
|
20
20
|
readConfig: readConfig,
|
|
21
21
|
});
|
|
22
|
-
expect(result).toBe(
|
|
22
|
+
expect(result).toBe(join(projectRootDir, "src/wrangler-worker.tsx"));
|
|
23
23
|
});
|
|
24
24
|
it("should use the default path if wrangler config has no main property", async () => {
|
|
25
25
|
const readConfig = () => ({});
|
|
@@ -29,6 +29,6 @@ describe("determineWorkerEntryPathname", () => {
|
|
|
29
29
|
options: {},
|
|
30
30
|
readConfig: readConfig,
|
|
31
31
|
});
|
|
32
|
-
expect(result).toBe(
|
|
32
|
+
expect(result).toBe(join(projectRootDir, "src/worker.tsx"));
|
|
33
33
|
});
|
|
34
34
|
});
|