preprocess inlang.config.js
to be able to use the advantages of an npm
workflow
#669
-
To be honest, the current way to declare the Problem
Proposal
@benjaminpreiss, master of ASTs, can help us with this task. migrationWe could write a migration script that automatically "upgrades" the config to the new system. This could be a cli command or we could just do it when e.g. the editor reads the file. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 18 replies
-
@ivanhofer I think you make valid points here. I wrapped my head around it for the last 10 minutes and according to "future-poofing" the inlang config, this would be a great enhancement. I think it can be decided based on a draft implementation which performs better in the points above and doesn't miss anything what the config already has. Maybe hard part:
|
Beta Was this translation helpful? Give feedback.
-
So does it mean that we have a breaking change in the config file? |
Beta Was this translation helpful? Give feedback.
-
I acknowledge that the DX of writing the config is improbable. But, I push back hard on introducing any NPM or node dependency:
Instead of "hacking" workarounds, we should be at the forefront of innovating JS to make JS better, our solution less complex, and ultimately deliver a better UX and DX. Besides, the proposal of introducing transpilation will lead to noticeably longer loading times of the inlang editor. We are already battling loading times in the editor. Replying to the mentions problems1. there is no typesafetyWe can and should (at some point) introduce type safety in multiple ways that do not depend on node or npm.
2. Caching
This is a non-issue. You can prune the cache https://www.jsdelivr.com/tools/purge :) On the flipside, NPM doesn't auto-update at all. That's what package.lock is for which makes sense for source code but less so for plugins. 3. users don't really know if there exists an update
This is exactly what we need to introduce. Companies will use the inlang editor, CLI and ide extension without the SDK-JS. How would we be able to notify users in the editor that a plugin update exists if we rely on NPM? 4. version mismatch.
Given, this is an ugly edge case. But one that only exists because we also offer an SDK-JS (will only happen if the SDK-jS is used). Coming up with a working solution is desired. One way could be to let the inlang sdk plugin export a version that is read by the vite plugin and the vite plugin installs the correct node dependency.
5. developers don't know how "popular" a package is.
We need a plugin registry at some point. That plugin registry will become the go-to directory, not npm. Ofc this plugin registry can include downloads. PS JSDelivr has download stats. 6. not using "the platform"NPM and node are not the platform. ECMAScript and the browser is the platform.
We have to introduce a system that is cross-environment compatible. The inlang environment exists to ensure that imports and access to the filesystem work in any environment, not to have a fancier import. The reality is that the inlang editor is cutting edge innovation. There exists no standard to import plugins and access the filesystem in the browser [that also works on the server]. We are the ones building that standard because we have to.
Fun fact, url imports are long supported in ECMAScript/Browsers but not node. Node is introducing them though and this isn't even the main reason for SummaryThe main point seems TypeSafety and yes that is a pain. If we have more users, revenue, and manpower, we should introduce typesafety for URI imports ❗ But, any NPM or node dependency will break inlang on multiple fronts. Typesafety itself is an example. How would a Flutter project get TypeSafety without NPM? |
Beta Was this translation helpful? Give feedback.
-
I had a call with @samuelstroschein today and we have found ways to improve 3 of the above described issues:
Please take a look at the issues and add your thoughts there |
Beta Was this translation helpful? Give feedback.
I had a call with @samuelstroschein today and we have found ways to improve 3 of the above described issues:
Please take a look at the issues and add your thoughts there