handle scoped packages

This commit is contained in:
Evert Prants 2020-12-07 20:48:15 +02:00
parent 8c7d5b1d52
commit 753e021941
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 11 additions and 5 deletions

3
package-lock.json generated
View File

@ -63,7 +63,8 @@
"@types/semver": {
"version": "7.3.4",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.4.tgz",
"integrity": "sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ=="
"integrity": "sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ==",
"dev": true
},
"@types/tar": {
"version": "4.0.4",

View File

@ -1,6 +1,6 @@
{
"name": "@squeebot/core",
"version": "3.0.0",
"version": "3.0.1",
"description": "Squeebot v3 core for the execution environment",
"main": "lib/index.js",
"module": "lib/",

View File

@ -1,7 +1,7 @@
import * as fs from 'fs-extra';
import * as path from 'path';
import { IEnvironment } from '../types/environment';
import { IProcessData, spawnProcess } from '../util/run';
import { spawnProcess } from '../util/run';
export class NPMExecutor {
private installed: string[] = [];
@ -41,8 +41,13 @@ export class NPMExecutor {
await this.init();
}
const pkgNoVersion = pkg.split('@')[0];
if (this.installed.indexOf(pkgNoVersion) !== -1) {
let spi = 0;
if (pkg.indexOf('@') === 0) {
spi = 1;
}
const pkgNoVersion = pkg.split('@')[spi];
if (this.installed.indexOf((spi === 1 ? '@' : '') + pkgNoVersion) !== -1) {
return;
}