Skip to content

Keep ts-morph project reference between watches - #474

Merged
eddeee888 merged 5 commits into
masterfrom
keep-project-reference
Aug 25, 2026
Merged

Keep ts-morph project reference between watches#474
eddeee888 merged 5 commits into
masterfrom
keep-project-reference

Conversation

@eddeee888

@eddeee888 eddeee888 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Description

TODO

Result

The main impact is on watch triggers, the part that typechecks and generates resolvers is 50% faster

Before

4.11s (total 5.05s)

Screenshot 2026-08-24 at 12 32 22 am

After

2.29s (total 3.35s)

Screenshot 2026-08-24 at 12 30 01 am

@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1ffb026

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@eddeee888/gcg-typescript-resolver-files Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eddeee888

Copy link
Copy Markdown
Owner Author

/release-snapshot

@github-actions

Copy link
Copy Markdown
Contributor

Snapshot published

@eddeee888/gcg-operation-location-migration@0.0.0-pr467-run390-1-20260809065829
@eddeee888/gcg-server-config@0.0.0-pr467-run390-1-20260809065829
@eddeee888/gcg-typescript-resolver-files@0.0.0-pr472-run403-1-20260813130340

@eddeee888
eddeee888 force-pushed the keep-project-reference branch from 0c414eb to 4e161f1 Compare August 22, 2026 10:47
Comment on lines +149 to +162
// 4. Apply to result files the updated content done in step 2. and 3. above
sourceFilesToProcess.forEach(({ sourceFile, resolverFile }) => {
const normalizedRelativePath = path.posix.relative(
cwd(),
sourceFile.getFilePath()
);

// Overwrite existing files with fixes
result.files[normalizedRelativePath] = {
...resolverFile,
content: sourceFile.getText(),
};
});
// Overwrite existing files with fixes
result.files[normalizedRelativePath] = {
...resolverFile,
content: sourceFile.getText(),
};
});
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This was sitting outside of the intended scope so we were running sourceFilesToProcess.forEach twice! i.e. doubling the work


export const presetName = '@eddeee888/gcg-typescript-resolver-files';

let tsMorphProject: Project;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Keeping a reference so we don't need to re-initialise and type-check files every run.

@eddeee888
eddeee888 marked this pull request as ready for review August 25, 2026 13:30
@eddeee888
eddeee888 merged commit d5d480a into master Aug 25, 2026
13 checks passed
@eddeee888
eddeee888 deleted the keep-project-reference branch August 25, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant