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

Set up top level Typescript config and extend to nested packages #5

Closed
nick-stebbings opened this issue Sep 2, 2023 · 5 comments
Closed
Assignees

Comments

@nick-stebbings
Copy link
Contributor

See https://www.typescriptlang.org/docs/handbook/project-references.html

@pospi
Copy link
Collaborator

pospi commented Sep 3, 2023

I don't think I see the point in this repo tbh. extends yes, references not so much. It's Storybook and Vite that are handling all the building and linking during development so everything happens within that single compilation pipeline. The different packages aren't considered "different" except when they're being packaged for publication.

@pospi
Copy link
Collaborator

pospi commented Sep 4, 2023

Current blocker is to do with this guarantee:

Prepending a project will include the project’s output above the output of the current project. All output files (.js, .d.ts, .js.map, .d.ts.map) will be emitted correctly.

😒 lies

@pospi
Copy link
Collaborator

pospi commented Sep 4, 2023

Hmm.

npx tsc -b seems to fail without being able to infer the imports in design-system-imports.stories.ts. The package references seem to be referenced totally fine by PNPM so far as I can see. The result is the same no matter which directory the command is run from, which implies to me that the composite and references are functioning as intended or we wouldn't be seeing consistent behaviour when executed from various working directories.

I have also tried with this workaround for manually specifying compilation output paths and having a separate build & watch script for each module that generates a locally-adjacent design-system/dist & dev-util/dist. Such an arrangement only partially works- when I cd design-system && npx tsc -p ./tsconfig.json I get a different strange set of failures resulting in some components missing. The indicator of this in the linked issue as a non-deterministic ordering bug in TypeScript's dependency resolution algorithm seems to confirm what I'm seeing. There are indicators that it's been resolved before, but idk, I'm hitting something weird.

I also tried referencing build artifacts outside of each module's package.json root but that was a silly idea.

Regardless, if I am reading the docs right these experiments feel like measures of desperation to inefficiently kludge around what project references are supposed to achieve?

It is also entirely possible that Storybook just doesn't play well with the TypeScript compiler in composite mode and that there are upstream bugs to be addressed there. It's quite probably running the Vite build process with the equivalent of tsc -p ./tsconfig.json rather than tsc -b.

@pospi
Copy link
Collaborator

pospi commented Sep 5, 2023

Sure wish I'd actually pushed that yesterday 😂 sorry @nick-stebbings

@pospi
Copy link
Collaborator

pospi commented Sep 11, 2023

Completed in #11

@pospi pospi closed this as completed Sep 11, 2023
@pospi pospi moved this to ✅ Done in NH alpha 2 Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants