Use pnpm
workspaces for our Typescript monorepo
#1289
Closed
pokey
started this conversation in
Architectural decision record
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just a rough draft
Context
Desiderata
Note that the import and auto-import tests can be checked by applying this patch and then uncommenting the last line of each block one by one and checking whether error is flagged / not flagged (for import tests), or whether suggestion appears / doesn't appear in auto-complete (for auto-import tests). Make sure to comment the line again before trying the next one, as sometimes a bad import can affect other imports (packages can "collapse" into one from the perspective of TS server)
Correctly flagging errors
D1
: It is a compile error to import external packages that are not listed inpackage.json
D1.1
:vscode
(for some reason this one behaves strangely)D1.2
: Other packagesD2
: It is not a compile error to import from local packages that you depend on, using our preferred syntax (eg@cursorless/foo
)D3
: It is a compile error to import from local packages that you depend on, not using our preferred syntax (eg../foo
)D4
: It is a compile error to import from local packages that you do not depend on, eitherD4.1
: using our non-preferred syntax (eg../packages/foo
), orD4.2
: using preferred syntax (eg@cursorless/foo
)D5
: It is a compile error to import from anything other thanindex.ts
in another moduleD5.1
: no@cursorless/foo/bar
D5.2
: no../foo/bar
a
: Even if you depend on the moduleb
: Even ifbar
was re-exported infoo/index.ts
. In that case it should be required to import@cursorless/foo
D6
: It is not a compile error to import external packages listed inpackage.json
D6.1
:vscode
(for some reason this one behaves strangely)D6.2
: Other packagesAuto-import
D7
: Auto-import doesn't import from external packages not listed inpackage.json
D7.1
:vscode
(for some reason this one behaves strangely)D7.2
: Other packagesD8
: Auto-import imports from external packages listed inpackage.json
D8.1
:vscode
(for some reason this one behaves strangely)D8.2
: Other packagesD9
: Auto-import imports from local packages that you depend on, using our preferred syntax (eg@cursorless/foo
)D10
: Auto-import doesn't import from local packages that you don't depend onD11
: Auto-import doesn't import from anything other thanindex.ts
in another package (eg no@cursorless/foo/bar
)D11.1
: When you depend on the packageD11.2
: When you don't depend on the packageOther DX
D12
: Find references across projects when no file from the referencing project is openD13
: Rename across projects when no file from the referencing project is openD14
: Jump to definition across projectsD15
: It is easy to move a file from one package to anotherD16
: It is easy to create a new packageD17
: Breakpoints work in Cursorless extensionD18
: Breakpoints work on Cursorless root websiteD19
: Breakpoints work on Cursorless docs websiteOptions considered
nx
npm
workspacespnpm
workspacesDecision
Consequences
Beta Was this translation helpful? Give feedback.
All reactions