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
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
"@types/semver": "^7",
"@typescript-eslint/eslint-plugin": "^8.48.0",
"@typescript-eslint/parser": "^8.48.0",
"@yarnpkg/cli": "^4.17.1",
"@yarnpkg/core": "^4.9.0",
"@yarnpkg/fslib": "^3.1.5",
"@yarnpkg/parsers": "^3.0.3",
"@yarnpkg/types": "^4.0.0",
"bats": "^1.13.0",
"comment-json": "^4.5.1",
Expand Down
3 changes: 3 additions & 0 deletions packages/foundryup/src/extract.ts

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Adding @yarnpkg/parsers bumped our version of tar which has a breaking change (despite being released as minor version) 😕.

isaacs/node-tar@dd1c36a#diff-2123f97b7bf9480a61717c843425e483e8d97819592e8c04e4e149eb65b451e8R235-R240

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep.

Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ async function extractFromTar(
extractTar(
{
cwd: dir,
// @ts-expect-error: Types here broke in `tar@7.5.12`, but it appears to
// work fine as-is.
// See: https://github.com/isaacs/node-tar/issues/459
transform: (entry) => {
const absolutePath = entry.absolute;
if (!absolutePath) {
Expand Down
17 changes: 7 additions & 10 deletions scripts/generate-partial-build-tsconfig.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
getAllWorkspaces,
getTypeScriptWorkspaces,
computeChangedWorkspaces,
getChangedFiles,
} from './lib/workspaces.mjs';

/**
Expand Down Expand Up @@ -30,17 +28,16 @@ async function main(): Promise<void> {

const headRef = process.argv[3] ?? 'HEAD';

const allWorkspaces = await getAllWorkspaces();
const typeScriptWorkspaces = await getTypeScriptWorkspaces();
const changedFiles = await getChangedFiles(mergeBase, headRef);
const packagesToBuild = await computeChangedWorkspaces(
allWorkspaces,
changedFiles,
true,
);
const { workspaces: packagesToBuild } = await computeChangedWorkspaces({
includeDependencies: true,
mergeBase,
headRef,
});

const packagesToBuildNames = new Set(packagesToBuild.map(({ name }) => name));
const references = typeScriptWorkspaces
.filter(({ name }) => packagesToBuild.has(name))
.filter(({ name }) => packagesToBuildNames.has(name))
.map(({ location }) => ({ path: `./${location}/tsconfig.build.json` }));

if (references.length === 0) {
Expand Down
25 changes: 7 additions & 18 deletions scripts/get-changed-workspaces.mts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

import {
getAllWorkspaces,
checkRootChange,
computeChangedWorkspaces,
getChangedFiles,
} from './lib/workspaces.mjs';
import { computeChangedWorkspaces } from './lib/workspaces.mjs';

/**
* List workspaces that need to be checked given a merge base.
Expand Down Expand Up @@ -39,23 +34,17 @@ const argv = await yargs(hideBin(process.argv))
.parseAsync();

const { mergeBase, headRef = 'HEAD', includeDependencies } = argv;
const workspaces = await getAllWorkspaces();

const changedFiles = await getChangedFiles(mergeBase, headRef);
const hasRootChange = checkRootChange(workspaces, changedFiles);

const changed = await computeChangedWorkspaces(
workspaces,
changedFiles,
const { workspaces, hasRootChange } = await computeChangedWorkspaces({
includeDependencies,
);

const changedWorkspaces = workspaces.filter(({ name }) => changed.has(name));
mergeBase,
headRef,
});

console.log(
JSON.stringify({
names: changedWorkspaces.map(({ name }) => name),
locations: changedWorkspaces.map(({ location }) => location),
names: workspaces.map(({ name }) => name),
locations: workspaces.map(({ location }) => location),
hasRootChange,
}),
);
Loading