mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: support install a npm package as plugin
This commit is contained in:
1 file changed
+4
-1
@@ -164,7 +164,10 @@ if (!argv.args[0] || argv.args[0] === 'cli') {
|
||||
throw new Error('Cannot fetch package info.');
|
||||
}
|
||||
}
|
||||
// TODO: install from npm and check for update
|
||||
if (src.startsWith('@hydrooj/')) {
|
||||
src = child.execSync(`npm info ${src} dist.tarball`, { cwd: os.tmpdir() }).toString().trim();
|
||||
if (!src.startsWith('http')) throw new Error('Cannot fetch package info.');
|
||||
}
|
||||
if (src.startsWith('http')) {
|
||||
const url = new URL(src);
|
||||
const filename = url.pathname.split('/').pop()!;
|
||||
|
||||
Reference in new issue
Block a user