langium
langium copied to clipboard
generator-langium: Transform generated project to npm workspace
TODO:
- [x] Align template structure with target structure
- [x] Integrate a global tsconfig.build.json in target project
- [x] Unify how build and compile is done in target project
- [x] Update to the latest version of the wrapper lib stack
- [x] Fix Build issues: Create index files and export code to other packages
- [x] Fix regular
generator-langiumunit tests - [x] Add new test that check the complete structure
- [x] Option test not yet included even if selected
- [x]
tsconfig.build.jsonneeds to be dynamically created. Sources not contained should not be included as it leads to build failures otherwise. - [x] Align dependencies and update vitest
- [x] Remove the need to use
http-server
Fixes #1495
TODO: from review:
- [x] Update langium-quickstart.md
- [x] Add clean script and
build:cleanto all packages
@msujew @Yokozuna59 the generated workspace project builds again. Now, I need to fix the open points above ⬆️
@msujew @Yokozuna59 this is now ready for review. The only thing left is from the list is removing the need for http-server in the web package, because vite preview should do the job. But this is not blocking the review.
For me workspaces were hard to work with in the beginning, because I was switching to the packages folders to run npm run X. Would be good to have some documentation on our website, I think. Like workspace 101, especially with the -w flag to address packages.
Does it change anything for the existing documentation?
Does it change anything for the existing documentation?
Very likely 🙂 We need to update it once this is merged.
Like workspace 101
The generated project is the blueprint. 👍 It features all facets: TS with specific test configs, VSCode eslint compatibility (root tsconfig.json per package), workspace eslint check, global build and top-level scripts that directly execute package scripts.
All points are resolved. I also fix an issue with the web example. I broke the configuration during this update. It is working again.
@Yokozuna59 thank you for the review. I still need to implement the two bigger points (added to the description) and then I am done. Any further enhancements should go to a next PR, because this one is already quite large, but there was no way around.
@Yokozuna59 and @msujew all TODOs are done. We need to update tutorials and docs on the website as well. This change has some impact.
I rebased the branch after Langium 3.1.0 release to resolve the conflicts.
@msujew I just updated to the latest wrapper version. Do you have time to review it this week?
@msujew rework is complete. Im have not closed some of the discussions, because you should check if you agree with my solutions.
@kaisalmen I created a project from this branch and it seems there is an issue with the generated CLI. I think the following paths inside packages/generator-langium/templates/packages/cli should be updated:
- In
bin/cli.js, it should import from just'../out/main.js'(without/cli) - In
src/main.ts:13, thepackagePathshould have one less'..'
At least that's what I edited manually in my project for it to work
@aabounegm Thank you very much! Many things changed, it is easy to overlook things. I will push an update.
any updates on this? Will this be part of a 3.2 release?
And one more thing: it seems that vsce does not currently support npm workspaces (https://github.com/microsoft/vscode-vsce/issues/777#issuecomment-1285089955), so running vsce package tries to bundle the entire project (with all workspaces) and fails with weird errors.
Until this is fixed, there are 3 possible workarounds:
- Add
../and../../to.vscodeignore - Add
"vsce": { "dependencies": false }topackage.json - Add a note that users need to pass
--no-dependenciesto thevscecommand
I personally opted for the first option in my project with a comment linking to the issue.
And on a somewhat related note (also publishing), I would suggest adding a .gitignore file to packages/extension with at least *.vsix.
We used solution 2 in our own extension, too: https://github.com/eclipse-langium/langium/blob/3b007c2be9a6ec0c93f4dac62eea33854909db60/packages/langium-vscode/package.json#L84-L86
@aabounegm thank you for those additional findings/comments. Regarding vsce I selected option 2, modified the gitignore and fixed the prebublish/lint
Superseded by #1810.