Conversation
|
This is especially useful when using the main repo as a submodule for a different repository such as a Theia extension: My approach was to clone Theia as a submodule in the extension repo, then add
This PR also makes developing a bit more comfortable: only the minimal amount of work required is done, if you need more you need to explicitly trigger it. E.g. building a given app, linting, etc... |
618b1c2 to
0762ab1
Compare
This sounds like it goes some way to addressing some of the pain points described in #9153, as well. |
Could you detail in what way it does not play well with |
|
|
||
| ## Watching | ||
|
|
||
| ### Watch the TypeScript packages |
There was a problem hiding this comment.
I'm not sure about the term "typescript packages". What would a non-typescript package be, for example?
There was a problem hiding this comment.
This mostly refers to TypeScript compilation which happens before bundling, so if we have a pure JS extension then there will be nothing to watch.
There was a problem hiding this comment.
I understand TypeScript package as a package written using TypeScript and requiring transpilation.
There was a problem hiding this comment.
So it's really "typescript files", because some packages may container both *.js and *.ts files, right? Also, not sure how that works, exactly, but don't we have to reload the code when *.js files change, as well?
There was a problem hiding this comment.
In Theia the watch scripts are related to code transformations. There's basically two steps: TypeScript compilation and Webpack bundling. This documentation refers to the former. JavaScript sources don't require any change during the first step, but bundling still depends on them indeed.
All the times I remember doing Since we migrated to Webpack 5 maybe this won't be an issue anymore... So independently from that, this PR still simplifies the |
5abd78f to
4f80f9f
Compare
| ### Watch the core and extension packages | ||
|
|
||
| To rebuild each time a change is detected run: | ||
| To rebuild _everything_ each time a change is detected run: |
There was a problem hiding this comment.
"Everything" being both the regular packages and the example applications?
There was a problem hiding this comment.
Yes, both steps: TypeScript compilation and the bundling of both examples.
|
@paul-marechal I'll review this, if you're still interested in getting this merged. Would you mind rebasing and fixing merge conflicts? |
146f79e to
f899f7f
Compare
|
@msujew thanks for proposing! I just rebased. edit: I forgot to download the plugins, fixed. |
30ff600 to
637ea3b
Compare
msujew
left a comment
There was a problem hiding this comment.
I really like the proposed changes, especially the newer watch options and the removal of yarn lint from every build.
I also have an addition to propose: In my usual workflow when working on Theia I needed to start the server/electron app and watch both typescript and webpack. The latter two are now merged using yarn browser watch and yarn electron watch. I would like to see the former in there as well. Something like this:
"scripts": {
"start:watch": "concurrently --kill-others -n tsc,bundle,run -c red,yellow,green \"tsc -b -w --preserveWatchOutput\" \"yarn watch:bundle\" \"yarn start\""
}What's your opinion on that?
fa34aff to
4d25a63
Compare
Co-authored-by: Mark Sujew <mark.sujew@typefox.io>
cbbb102 to
02aa2e4
Compare
c55af33 to
a3cb5e0
Compare
msujew
left a comment
There was a problem hiding this comment.
@paul-marechal Still fine with merging, everything looks good 👍
|
I'll just wait on CI to turn green... |
Follow up from #9710 When doing refactorings, one might end up renaming/deleting TypeScript source files. But if a build was run previously, the outputted JavaScript files will still be in the build output folder. Then extensions that depend on the refactored package will not fail to build because the old path still resolves to the lingering JavaScript files. Add `ts-clean` script that deletes all generated files without a corresponding source file. Add the missing compile script to most packages.
|
Really miss the easy |
|
@thegecko I think you should be able to run |
Confirmed, thanks! |
What it does
Fixes: #7275.
Simplify
scripts/compile-references.js. TypeScript Server now properlyunderstand TypeScript references for navigation, so we can simplify our
tsconfigsetup.Rewrite some
npm/yarnscripts to do less on install (yarnoryarn install). It will only run the requiredpreparescripts across ourpackages, wire
tsconfig.jsonfiles and build the TypeScript sources.To build the example applications you need to run one of
yarn browser build,yarn electron buildoryarn build:examples.Linting is done as part of CI, but it won't automatically run locally
anymore. You can run
yarn lintto lint your code. For the bestexperience you should also enable the ESLint extension in your IDE.
How to test
Installation:
yarnalone should not build the example applications anymore, nor should it lint.Building:
yarn buildshould build TypeScript and both apps.yarn compileshould build TypeScript.yarn browser buildshould build both TypeScript and the browser app.yarn electron buildshould build both TypeScript and the electron app.yarn build:examplesshould build both apps.Watching:
yarn watchshould watch TypeScript and both example apps.yarn watch:compileshould watch only TypeScript.yarn browser watchshould watch both TypeScript and the browser app.yarn electron watchshould watch both TypeScript and the electron app.Linting:
yarn lintshould lint TypeScript sources.Review checklist
Reminder for reviewers