Compare commits

..

9 Commits

Author SHA1 Message Date
5f70072f4e 1.0.12 2020-03-17 00:21:05 +00:00
e2550aaf78 fix(core): update 2020-03-17 00:21:05 +00:00
3d30f41f84 1.0.11 2020-03-16 17:04:18 +00:00
9abe66c830 fix(core): update 2020-03-16 17:04:17 +00:00
61dbf9680b 1.0.10 2020-03-16 15:52:09 +00:00
a45fcf016e 1.0.9 2020-03-16 15:48:38 +00:00
4e04843e0e fix(core): update 2020-03-16 15:48:38 +00:00
e4586658aa 1.0.8 2020-03-16 15:44:54 +00:00
7ae1657bfc fix(core): update 2020-03-16 15:44:54 +00:00
6 changed files with 18 additions and 12 deletions

View File

@ -1,6 +1,7 @@
{
"npmci": {
"npmGlobalTools": []
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "smartarchive",
"version": "1.0.7",
"version": "1.0.12",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "smartarchive",
"version": "1.0.7",
"name": "@pushrocks/smartarchive",
"version": "1.0.12",
"description": "work with archives",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@ -11,13 +11,14 @@ const testPlugins = {
};
const testPaths = {
nogitDir: testPlugins.path.join(process.cwd(), '.nogit/')
nogitDir: testPlugins.path.join(__dirname, '../.nogit/'),
remoteDir: testPlugins.path.join(__dirname, '../.nogit/remote')
};
import * as smartarchive from '../ts/index';
tap.preTask('should prepare .nogit dir', async () => {
await testPlugins.smartfile.fs.ensureDir(testPaths.nogitDir);
await testPlugins.smartfile.fs.ensureDir(testPaths.remoteDir);
});
tap.preTask('should prepare downloads', async tools => {
@ -32,7 +33,7 @@ tap.preTask('should prepare downloads', async tools => {
);
});
tap.test('should extract files on disk', async () => {
tap.test('should extract existing files on disk', async () => {
const testSmartarchive = new smartarchive.SmartArchive();
await testSmartarchive.extractArchiveFromFilePath(
testPlugins.path.join(testPaths.nogitDir, 'test.tgz'),
@ -40,4 +41,10 @@ tap.test('should extract files on disk', async () => {
);
});
tap.test('should download a package from the registry', async () => {
const testSmartarchive = new smartarchive.SmartArchive();
await testSmartarchive.extractArchiveFromUrl('https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.11.tgz', testPaths.remoteDir);
});
tap.start();

View File

@ -12,13 +12,10 @@ export class SmartArchive {
const parsedPath = plugins.path.parse(urlArg);
const uniqueFileName = plugins.smartunique.uni() + parsedPath.ext;
const downloadPath = plugins.path.join(paths.nogitDir, uniqueFileName);
const downloadedArchive = (
await plugins.smartrequest.getBinary(
'https://verdaccio.lossless.one/@pushrocks%2fwebsetup/-/websetup-2.0.14.tgz'
)
).body;
const downloadedArchive = (await plugins.smartrequest.getBinary(urlArg)).body;
await plugins.smartfile.memory.toFs(downloadedArchive, downloadPath);
await this.extractArchiveFromFilePath(downloadPath, targetDir);
await plugins.smartfile.fs.remove(downloadPath);
}
/**

View File

@ -2,3 +2,4 @@ import * as plugins from './smartarchive.plugins';
export const packageDir = plugins.path.join(__dirname, '../');
export const nogitDir = plugins.path.join(__dirname, './.nogit');
plugins.smartfile.fs.ensureDir(nogitDir);