-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Proposed addition to libraryPath searching to support NPM #9549
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
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Confirmed: flibbles has already signed the Contributor License Agreement (see contributing.md) |
📊 Build Size Comparison:
|
| Branch | Size |
|---|---|
| Base (master) | 2451.4 KB |
| PR | 2451.5 KB |
Diff: ⬆️ Increase: +0.2 KB
✅ Change Note Status
All change notes are properly formatted and validated!
📝 $:/changenotes/5.4.0/#9549
Type: enhancement | Category: plugin
Release: 5.4.0
Support for installing TiddlyWiki plugins through NPM
🔗 #9549
👥 Contributors: Flibbles
📖 Change Note Guidelines
Change notes help track and communicate changes effectively. See the full documentation for details.
|
Hmm. The problem with windows that @CrossEye does appear to be the case. This solution for NPM does not work on Windows. Back to the drawing board for the moment. |
|
New Proposal! I tooled around with a bunch of other possibilities and landed on this! We have a dedicated Then we have function in boot/boot.js which will search npm module packages if it can't find a plugin the old fashion way. It builds a map by collecting together those tiddlywiki sections. This works. It's clean. The tiddlywiki section is very straight forward for our plugin developers. And it does result in seamless plugin installation with npm for end users. A few points to discuss. $tw.npmMapBecause searching through package.json files requires looking at a TON of directories, I make sure we only do this if any plugins can't otherwise be sourced, so no slowdown for most users. I also cache it in SpeedStartup is still pretty quick, but if we want to optimize this, we can prioritize searching through a project's packages-lock.json file for relevant packages first. That way, we don't trawl through all the node packages, of which there are a lot. This is robustAt least it seems that way to me. This should handle both locally and globally installed packages. Anyway, what are everyone's thoughts for this approach? I can't see it being a problem on Windows, but I'll test that also before clearing this PR. (Also: It's really ****ing annoying that ESLint rushes to tell me my PR is bad because one one small mistake, but when I run lint locally, I get 1500 mistakes.) |
|
I don't know why I'm getting dozens of emails about this PR failing. what the hell is this "validate-changenotes"? Why does it not exist in the repository? And how do I make it shut the hell up? |
|
Okay. I am done trying to appease this garbage build process that's been introduced. I have tried building the release notes. It's still flooding my inbox with emails calling me a failure. It is not telling me what I'm doing wrong. |
Reverting my work, because it's no good. But I may have a strategy that will work.
This was bothering me.
|
Nope. Rebased to the broken |
|
Now Lint is failing again. Sorry @pmario. You're going to get a lot of emails, because when I run lint on my end, I get 4253 errors. So I guess I've got to do a thousand little pushes. |
I see that far too often here. It's making contributions far too difficult. I haven't had time to dig into why this happens. But it really must be fixed. |
|
Finally. A few remarks I'd like to make.
|
For me that only triggers a warning, not an error. Both locally and here. I use the ESLint config |
|
I think focusing on NPM for the start is OK. But There are several runtime systems, which can run tiddlywiki. Node in combination with NPM is just one of them. There is Deno.com, Bun.com which basically are drop-in replacements. But we still need to test them. If we add "library" searching code, we need to make sure that Deno, Bun and probably others also work with our new code. Otherwise we will get in trouble. So imo function names like Deno is runtime and npm library manager, but I think it stores the libraries loaded form npm in a different directory structure. But I am not sue about this one, since I did never analyse it that deep, because it was not necessary for TW. IMO now it is necessary. ... Just some thoughts. Also we need to make sure that Windows support is first class and not an oversight. |
It is suggested to install eslint plugins if the code editor supports it. I also think it is annoying to receice "PR run failed" emails. Perhaps we can include eslint error in the comment rather than making pipeline fail. |
@pmario, it may be possible to move the NPM specific stuff into the tiddlywiki.js file off the root directory. I believe (but I'm not sure) that file is only ever called by NPM implementations. The package.json hunting could happen there, and it could leave the plugin map somewhere that boot.js could find it. Or something like that? |
|
Hey @pmario, Since we're on the topic of overly specific code in the boot.js file, is there a reason we've never moved all the Node.JS specific boot code into a file like
If there's any merit to this idea, (Maybe by thumbs-upping it) I can create a separate issue to discuss it. |
|
@flibbles -- There is a I am pretty sure, that Jeremy will be OK, if we can split stuff out of So I think you should open a new issue or add to an existing one, if there is one. |
|
@pmario, done. (#9557) But in the meantime. Would you say that you'd accept a change like this if it were sandboxed to a node specific boot file like |
|
I have put in the following key changes:
Bear in mind that this PR does not have to be perfect. All that matters is that it doesn't introduce bugs or backward incompatibility issues, nor does it introduce any code we'll need to commit to. It doesn't. Everything it introduces is private within a scope, or it's in a All that matters is that we agree on the design for how TW becomes NPM available. In this case, that packages will have a |
|
I have no idea why some of these build steps still haven't completed after 5 days, but I'm pretty sure it has nothing to do with my code. I still posit that this PR is good to go as is, and that the finer details of NPM node_module adoption can be ironed out in later v5.4.x releases. |
|
Pinging @Jermolene on this. NPM support doesn't need to be perfect for initial implementation. In fact, more basic is better, so we're committing ourself to very little. This only commits us to the idea of having |
|
@flibbles ... This seems to happen sometimes. Create a new commit and push it. So the process should start again. |
|
Thanks @flibbles. On reflection I feel that there is not enough time in the v5.4.0 cycle for adequate review by other plugin authors who might be impacted. So I've added it to the plan for v5.5.0 |
|
I understand, but I can't say I'm not disappointed. One common complaint I see about Relink is people can't figure out how to install it on Node.JS. It involves directory copying or symlinks. Or one has to drop big json files into the correct directories. While Uglify can be used to compress individual tiddlywiki files, it's real strength is that it can be added to Node.JS servers or plugin projects to compress output. But I don't think anyone does that because there's no easy way to integrate it alongside other build processes like gulp or sass. Not without checking all of Uglify into your own repository. TW5-Graph integrates with other independent plugins, like Mermaid, and soon ECharts, but the only way to make it part of the site presentation, or integrate it into testing, would be to wholesale copy those plugins into my projects, which isn't good git hygiene. And I already know of several other plugins, some which I'm not even the author of, which could benefit from being installable by NPM. So while I understand, I really do hope this support comes in soon. I do believe that while TiddlyWiki is making strides in making plugins more easily accessible through the browser, its means of using plugins for Node.JS is lacking. Something that NPM has long figure out. I will ping this thread occasionally. I won't let this fall into TiddlyWiki's dusty PR closet. |

Edit: Content removed. Look to my new proposal a few comments down will. Read that instead.