3 ms·
One thing I'm curious about is if it's just possible to sort of roll your own package version manager as part of your deno app. For instance, the current thing
by mrozbarry 4y ago
One thing I'm curious about is if it's just possible to sort of roll your own package version manager as part of your deno app.
For instance, the current thing, from what I understand, is <code>import foo from 'https://some-cdn/your-library@^1.1.1'</code> https://some-cdn/your-library@^1.1.1'</code> and deno loads that in. The problem that adding a package.json solves (also, from my limited understanding) is for cases when you import this library in several places and have different version requirements.
So, why not have something like:
export const libraries = {
"some-library": "https://your-cdn/some-library@^1.1.1",
};
export const load = (library) => import(libraries[library]);
Wouldn't that mostly solve the problem without just doing what NodeJS does?
- illiarian 4y agoBecause now you have to write this manually for every package. And how do you deal with dependencies of that package that also need to be fetched from `your-cdn`? Oh, perhaps write them in a JSON form in some sort of package.json and read them from there perhaps?
- joshmanders 4y ago> Oh, perhaps write them in a JSON form in some sort of package.json and read them from there perhaps? Maybe even have an executable that will read this file and understand your dependency graph and needs and install everything for you, and also allow you to keep it up to date. Maybe put this in `utils/npm.js` // short for node package manager. Brilliant. Lets all implement our own.
- mrozbarry 4y agoWell, you wouldn't need to for every package, it really depends on what you're bringing in and what dependencies they have. I do see your point, though.