Skip to content

Commit

Permalink
ci: fix race condition writing globals.d.ts shim (#4717)
Browse files Browse the repository at this point in the history
Co-authored-by: Chance Strickland <[email protected]>
  • Loading branch information
ascorbic and chaance authored Dec 2, 2022
1 parent ab29ec3 commit 46d6c2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { spawn } from "cross-spawn";
import glob from "glob";

const args = process.argv.slice(2);
const tsc = process.env.CI || args.includes("--tsc");
const publish = process.env.CI || args.includes("--publish");
const tsc = process.env.CI || args.includes("--tsc") || publish;
const denoCheck = process.env.CI || args.includes("--deno");

exec("yarn", ["rollup", "-c"])
Expand Down
28 changes: 12 additions & 16 deletions scripts/copy-build-to-dist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ async function copyBuildToDist() {
};
});

// Write an export shim for @remix-run/node/globals types
let dest = path.join(
".",
"build",
"node_modules",
"@remix-run",
"node",
"globals.d.ts"
);
console.log(chalk.yellow(` 🛠 Writing globals.d.ts shim to ${dest}`));
await fse.writeFile(dest, "export * from './dist/globals';");

/** @type {Promise<void>[]} */
let copyQueue = [];
for (let pkg of packages) {
Expand Down Expand Up @@ -65,22 +77,6 @@ async function copyBuildToDist() {
} catch (e) {}
}

// Write an export shim for @remix-run/node/globals types
copyQueue.push(
(async () => {
let dest = path.join(
".",
"build",
"node_modules",
"@remix-run",
"node",
"globals.d.ts"
);
console.log(chalk.yellow(` 🛠 Writing globals.d.ts shim to ${dest}`));
await fse.writeFile(dest, "export * from './dist/globals';");
})()
);

// One-off deep import copies so folks don't need to import from inside of
// dist/. TODO: Remove in v2 and either get rid of the deep import or manage
// with the package.json "exports" field
Expand Down

0 comments on commit 46d6c2f

Please sign in to comment.