Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 20 additions & 0 deletions scripts/build-desktop-artifact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
DesktopDmgBackgroundSourceMissingError,
createStageWorkspaceConfig,
createStagePatchedDependencies,
readWorkspaceConfig,
createBuildConfig,
DESKTOP_ELECTRON_LANGUAGES,
DESKTOP_FILE_EXCLUSIONS,
Expand Down Expand Up @@ -497,6 +498,25 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
});
});

// pnpm writes "set this to true or false" placeholders into allowBuilds when a
// tarball changes. pnpm ignores them, but the release build decode rejects them.
it.effect("decodes the repo allowBuilds and every file: tarball it names exists", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const { allowBuilds = {} } = yield* readWorkspaceConfig();
const repoRoot = path.join(import.meta.dirname, "..");
for (const key of Object.keys(allowBuilds)) {
const tarball = key.split("@file:")[1];
if (tarball === undefined) continue;
assert.isTrue(
yield* fs.exists(path.join(repoRoot, tarball)),
`allowBuilds names a missing tarball: ${key}`,
);
}
}),
);

it("stages pnpm 11 allowBuilds and patchedDependencies in the workspace yaml", () => {
assert.deepStrictEqual(
createStageWorkspaceConfig({
Expand Down
4 changes: 3 additions & 1 deletion scripts/build-desktop-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ const encodeJsonString = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknow
const decodeWorkspaceConfig = Schema.decodeEffect(fromYaml(WorkspaceConfig));
const encodeStageWorkspaceConfig = Schema.encodeEffect(fromYaml(StageWorkspaceConfig));

const readWorkspaceConfig = Effect.fn("readWorkspaceConfig")(function* () {
// Decodes the repo's pnpm-workspace.yaml. A PR CI test calls this too, so a bad
// entry fails the PR instead of the nightly desktop build.
export const readWorkspaceConfig = Effect.fn("readWorkspaceConfig")(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const repoRoot = yield* RepoRoot;
Expand Down
Loading