fix(core): update
This commit is contained in:
parent
af0d95f327
commit
e0ccb6c076
14
test/test.ts
14
test/test.ts
@ -37,11 +37,21 @@ tap.test('should get package from verdaccio', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should get a specific file from a package', async () => {
|
tap.test('should get a specific file from a package', async () => {
|
||||||
const bundleFile = await verdaccioRegistry.getFileFromPackage(
|
const wantedFile = await verdaccioRegistry.getFileFromPackage(
|
||||||
'@pushrocks/websetup',
|
'@pushrocks/websetup',
|
||||||
'ts/index.ts'
|
'ts/index.ts'
|
||||||
);
|
);
|
||||||
console.log(bundleFile.contentBuffer.toString());
|
console.log(wantedFile.contentBuffer.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should get a specific file from a package', async () => {
|
||||||
|
const wantedFiles = await verdaccioRegistry.getFilesFromPackage(
|
||||||
|
'@pushrocks/websetup',
|
||||||
|
'ts/'
|
||||||
|
);
|
||||||
|
for(const file of wantedFiles) {
|
||||||
|
console.log(file.path);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -140,7 +140,7 @@ export class NpmPackage {
|
|||||||
// lets resolve with the wanted file
|
// lets resolve with the wanted file
|
||||||
done.resolve([fileArg]);
|
done.resolve([fileArg]);
|
||||||
subscription.unsubscribe();
|
subscription.unsubscribe();
|
||||||
} else if(fileArg.path.startsWith(wantedFilePath)) {
|
} else if(!returnOnFirstArg && fileArg.path.startsWith(wantedFilePath)) {
|
||||||
allMatchingFiles.push(fileArg);
|
allMatchingFiles.push(fileArg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -78,11 +78,12 @@ export class NpmRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getFilesFromPackage(packageNameArg: string, filePath: string, optionsArg: {
|
public async getFilesFromPackage(packageNameArg: string, filePath: string, optionsArg?: {
|
||||||
distTag?: string;
|
distTag?: string;
|
||||||
version?: string;
|
version?: string;
|
||||||
}): Promise<plugins.smartfile.Smartfile[]> {
|
}): Promise<plugins.smartfile.Smartfile[]> {
|
||||||
return [];
|
const npmPackage = await this.getPackageInfo(packageNameArg);
|
||||||
|
return npmPackage.getFilesFromPackage(filePath, optionsArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getPackageAsSmartfileVirtualDir(packageNameArg: string): Promise<plugins.smartfile.VirtualDirectory> {
|
public async getPackageAsSmartfileVirtualDir(packageNameArg: string): Promise<plugins.smartfile.VirtualDirectory> {
|
||||||
|
Loading…
Reference in New Issue
Block a user