rwsdk 1.0.0-beta.2-test.20250930092748 → 1.0.0-beta.3

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.
@@ -3,7 +3,7 @@ import { PackageManager } from "./types.mjs";
3
3
  /**
4
4
  * Copy project to a temporary directory with a unique name
5
5
  */
6
- export declare function copyProjectToTempDir(projectDir: string, resourceUniqueKey: string, packageManager?: PackageManager, monorepoRoot?: string): Promise<{
6
+ export declare function copyProjectToTempDir(projectDir: string, resourceUniqueKey: string, packageManager?: PackageManager, monorepoRoot?: string, installDependenciesRetries?: number): Promise<{
7
7
  tempDir: tmp.DirectoryResult;
8
8
  targetDir: string;
9
9
  workerName: string;
@@ -9,7 +9,11 @@ import tmp from "tmp-promise";
9
9
  import { $ } from "../../lib/$.mjs";
10
10
  import { ROOT_DIR } from "../constants.mjs";
11
11
  import { retry } from "./retry.mjs";
12
+ import { INSTALL_DEPENDENCIES_RETRIES } from "./testHarness.mjs";
12
13
  const log = debug("rwsdk:e2e:environment");
14
+ const getTempDir = async () => {
15
+ return tmp.dir({ unsafeCleanup: true });
16
+ };
13
17
  const createSdkTarball = async () => {
14
18
  const existingTarballPath = process.env.RWSKD_SMOKE_TEST_TARBALL_PATH;
15
19
  if (existingTarballPath) {
@@ -46,12 +50,11 @@ const setTarballDependency = async (targetDir, tarballName) => {
46
50
  /**
47
51
  * Copy project to a temporary directory with a unique name
48
52
  */
49
- export async function copyProjectToTempDir(projectDir, resourceUniqueKey, packageManager, monorepoRoot) {
53
+ export async function copyProjectToTempDir(projectDir, resourceUniqueKey, packageManager, monorepoRoot, installDependenciesRetries) {
50
54
  const { tarballPath, cleanupTarball } = await createSdkTarball();
51
55
  try {
52
56
  log("Creating temporary directory for project");
53
- // Create a temporary directory
54
- const tempDir = await tmp.dir({ unsafeCleanup: true });
57
+ const tempDir = await getTempDir();
55
58
  // Determine the source directory to copy from
56
59
  const sourceDir = monorepoRoot || projectDir;
57
60
  // Create unique project directory name
@@ -130,7 +133,6 @@ export async function copyProjectToTempDir(projectDir, resourceUniqueKey, packag
130
133
  log("⚙️ Configuring temp project to not use frozen lockfile...");
131
134
  const npmrcPath = join(targetDir, ".npmrc");
132
135
  await fs.promises.writeFile(npmrcPath, "frozen-lockfile=false\n");
133
- // For yarn, create .yarnrc.yml to disable PnP and allow lockfile changes
134
136
  if (packageManager === "yarn") {
135
137
  const yarnrcPath = join(targetDir, ".yarnrc.yml");
136
138
  const yarnCacheDir = path.join(os.tmpdir(), "yarn-cache");
@@ -144,11 +146,19 @@ export async function copyProjectToTempDir(projectDir, resourceUniqueKey, packag
144
146
  await fs.promises.writeFile(yarnrcPath, yarnConfig);
145
147
  log("Created .yarnrc.yml to allow lockfile changes for yarn");
146
148
  }
149
+ if (packageManager === "yarn-classic") {
150
+ const yarnrcPath = join(targetDir, ".yarnrc");
151
+ const yarnCacheDir = path.join(os.tmpdir(), "yarn-classic-cache");
152
+ await fs.promises.mkdir(yarnCacheDir, { recursive: true });
153
+ const yarnConfig = `cache-folder "${yarnCacheDir}"`;
154
+ await fs.promises.writeFile(yarnrcPath, yarnConfig);
155
+ log("Created .yarnrc with cache-folder for yarn-classic");
156
+ }
147
157
  await setTarballDependency(targetDir, tarballFilename);
148
158
  // Install dependencies in the target directory
149
159
  const installDir = monorepoRoot ? tempCopyRoot : targetDir;
150
160
  await retry(() => installDependencies(installDir, packageManager), {
151
- retries: 3,
161
+ retries: INSTALL_DEPENDENCIES_RETRIES,
152
162
  delay: 1000,
153
163
  });
154
164
  // Return the environment details
@@ -185,7 +195,7 @@ async function installDependencies(targetDir, packageManager = "pnpm") {
185
195
  }
186
196
  else if (packageManager === "yarn-classic") {
187
197
  log(`Preparing yarn@1.22.19 with corepack...`);
188
- await $("corepack", ["prepare", "yarn@1.22.19", "--activate"], {
198
+ await $("corepack", ["prepare", "yarn@1.x", "--activate"], {
189
199
  cwd: targetDir,
190
200
  stdio: "pipe",
191
201
  });
@@ -1,6 +1,7 @@
1
1
  import { type Browser, type Page } from "puppeteer-core";
2
2
  import { test } from "vitest";
3
3
  export type { Browser, Page } from "puppeteer-core";
4
+ export declare const INSTALL_DEPENDENCIES_RETRIES: number;
4
5
  interface DevServerInstance {
5
6
  url: string;
6
7
  stopDev: () => Promise<void>;
@@ -42,6 +42,10 @@ const TEST_MAX_RETRIES = process.env.RWSDK_TEST_MAX_RETRIES
42
42
  const TEST_MAX_RETRIES_PER_CODE = process.env.RWSDK_TEST_MAX_RETRIES_PER_CODE
43
43
  ? parseInt(process.env.RWSDK_TEST_MAX_RETRIES_PER_CODE, 10)
44
44
  : 6;
45
+ export const INSTALL_DEPENDENCIES_RETRIES = process.env
46
+ .RWSDK_INSTALL_DEPENDENCIES_RETRIES
47
+ ? parseInt(process.env.RWSDK_INSTALL_DEPENDENCIES_RETRIES, 10)
48
+ : 10;
45
49
  // Environment variable flags for skipping tests
46
50
  const SKIP_DEV_SERVER_TESTS = process.env.RWSDK_SKIP_DEV === "1";
47
51
  const SKIP_DEPLOYMENT_TESTS = process.env.RWSDK_SKIP_DEPLOY === "1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rwsdk",
3
- "version": "1.0.0-beta.2-test.20250930092748",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
5
5
  "type": "module",
6
6
  "bin": {