fix(core): update
This commit is contained in:
@@ -2,8 +2,11 @@ import * as plugins from './smartnpm.plugins';
|
||||
import { NpmRegistry } from './smartnpm.classes.npmregistry';
|
||||
|
||||
export class NpmPackage {
|
||||
public static async createFromFullMetadata(npmRegistry: NpmRegistry, fullMetadata: plugins.packageJson.FullMetadata) {
|
||||
const npmPackage = new NpmPackage();
|
||||
public static async createFromFullMetadata(
|
||||
npmRegistryArg: NpmRegistry,
|
||||
fullMetadata: plugins.packageJson.FullMetadata
|
||||
) {
|
||||
const npmPackage = new NpmPackage(npmRegistryArg);
|
||||
Object.assign(npmPackage, fullMetadata);
|
||||
return npmPackage;
|
||||
}
|
||||
@@ -30,6 +33,11 @@ export class NpmPackage {
|
||||
email: 'npm@git.zone';
|
||||
};
|
||||
public maintainers: any = null;
|
||||
public dist: {
|
||||
integrity: string;
|
||||
shasum: string;
|
||||
tarball: string;
|
||||
};
|
||||
public score: {
|
||||
final: number;
|
||||
detail: {
|
||||
@@ -39,4 +47,17 @@ export class NpmPackage {
|
||||
};
|
||||
} = null;
|
||||
public searchScore: number = null;
|
||||
|
||||
public npmRegistry: NpmRegistry;
|
||||
constructor(npmRegistryArg: NpmRegistry) {
|
||||
this.npmRegistry = npmRegistryArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* saves the package to disk
|
||||
*/
|
||||
public async saveToDisk(targetDir: string) {
|
||||
const smartarchiveInstance = new plugins.smartarchive.SmartArchive();
|
||||
await smartarchiveInstance.extractArchiveFromUrl(this.dist.tarball, targetDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user