Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix race condition writing globals.d.ts shim #4717

Merged
merged 3 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { spawn } from "cross-spawn";

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;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If using the --publish flag the --tsc flag is required.


exec("yarn", ["rollup", "-c"])
.then(() => tsc && exec("yarn", ["tsc", "-b"]))
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