fix(structure): format
This commit is contained in:
parent
5803ef597f
commit
e69ca55a40
@ -100,10 +100,9 @@ codequality:
|
|||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "pushrocks",
|
||||||
"gitrepo": "smarts3",
|
"gitrepo": "smarts3",
|
||||||
"shortDescription": "create an s3 endpoint that maps to a local directory",
|
"description": "create an s3 endpoint that maps to a local directory",
|
||||||
"npmPackagename": "@pushrocks/smarts3",
|
"npmPackagename": "@pushrocks/smarts3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "push.rocks"
|
"projectDomain": "push.rocks"
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import * as smartbucket from '@pushrocks/smartbucket';
|
import * as smartbucket from '@pushrocks/smartbucket';
|
||||||
|
|
||||||
export {
|
export { smartbucket };
|
||||||
smartbucket
|
|
||||||
};
|
|
||||||
|
@ -5,7 +5,7 @@ import * as smarts3 from '../ts/index.js';
|
|||||||
|
|
||||||
let testSmarts3Instance: smarts3.Smarts3;
|
let testSmarts3Instance: smarts3.Smarts3;
|
||||||
|
|
||||||
tap.test('should create a smarts3 instance and run it', async toolsArg => {
|
tap.test('should create a smarts3 instance and run it', async (toolsArg) => {
|
||||||
testSmarts3Instance = await smarts3.Smarts3.createAndStart({
|
testSmarts3Instance = await smarts3.Smarts3.createAndStart({
|
||||||
port: 3000,
|
port: 3000,
|
||||||
cleanSlate: true,
|
cleanSlate: true,
|
||||||
@ -15,7 +15,9 @@ tap.test('should create a smarts3 instance and run it', async toolsArg => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should be able to access buckets', async () => {
|
tap.test('should be able to access buckets', async () => {
|
||||||
const smartbucketInstance = new plugins.smartbucket.SmartBucket(await testSmarts3Instance.getS3Descriptor());
|
const smartbucketInstance = new plugins.smartbucket.SmartBucket(
|
||||||
|
await testSmarts3Instance.getS3Descriptor()
|
||||||
|
);
|
||||||
const bucket = await smartbucketInstance.createBucket('testbucket');
|
const bucket = await smartbucketInstance.createBucket('testbucket');
|
||||||
const baseDirectory = await bucket.getBaseDirectory();
|
const baseDirectory = await bucket.getBaseDirectory();
|
||||||
await baseDirectory.fastStore('subdir/hello.txt', 'hi there!');
|
await baseDirectory.fastStore('subdir/hello.txt', 'hi there!');
|
||||||
@ -23,6 +25,6 @@ tap.test('should be able to access buckets', async () => {
|
|||||||
|
|
||||||
tap.test('should stop the instance', async () => {
|
tap.test('should stop the instance', async () => {
|
||||||
await testSmarts3Instance.stop();
|
await testSmarts3Instance.stop();
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
10
ts/index.ts
10
ts/index.ts
@ -22,8 +22,8 @@ export class Smarts3 {
|
|||||||
this.options = optionsArg;
|
this.options = optionsArg;
|
||||||
this.options = {
|
this.options = {
|
||||||
...this.options,
|
...this.options,
|
||||||
...optionsArg
|
...optionsArg,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async start() {
|
public async start() {
|
||||||
@ -36,8 +36,8 @@ export class Smarts3 {
|
|||||||
port: this.options.port || 3000,
|
port: this.options.port || 3000,
|
||||||
address: '0.0.0.0',
|
address: '0.0.0.0',
|
||||||
silent: false,
|
silent: false,
|
||||||
directory: paths.bucketsDir
|
directory: paths.bucketsDir,
|
||||||
})
|
});
|
||||||
await this.s3Instance.run();
|
await this.s3Instance.run();
|
||||||
console.log('s3 server is running');
|
console.log('s3 server is running');
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ export class Smarts3 {
|
|||||||
endpoint: 'localhost',
|
endpoint: 'localhost',
|
||||||
port: this.options.port,
|
port: this.options.port,
|
||||||
useSsl: false,
|
useSsl: false,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createBucket(bucketNameArg: string) {
|
public async createBucket(bucketNameArg: string) {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import * as plugins from './smarts3.plugins.js';
|
import * as plugins from './smarts3.plugins.js';
|
||||||
|
|
||||||
export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
|
export const packageDir = plugins.path.join(
|
||||||
|
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
||||||
|
'../'
|
||||||
|
);
|
||||||
export const nogitDir = plugins.path.join(packageDir, './.nogit');
|
export const nogitDir = plugins.path.join(packageDir, './.nogit');
|
||||||
|
|
||||||
export const bucketsDir = plugins.path.join(nogitDir, './bucketsDir');
|
export const bucketsDir = plugins.path.join(nogitDir, './bucketsDir');
|
||||||
|
@ -1,24 +1,16 @@
|
|||||||
// node native
|
// node native
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export {
|
export { path };
|
||||||
path
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as smartbucket from '@pushrocks/smartbucket';
|
import * as smartbucket from '@pushrocks/smartbucket';
|
||||||
import * as smartfile from '@pushrocks/smartfile';
|
import * as smartfile from '@pushrocks/smartfile';
|
||||||
import * as smartpath from '@pushrocks/smartpath';
|
import * as smartpath from '@pushrocks/smartpath';
|
||||||
|
|
||||||
export {
|
export { smartbucket, smartfile, smartpath };
|
||||||
smartbucket,
|
|
||||||
smartfile,
|
|
||||||
smartpath
|
|
||||||
}
|
|
||||||
|
|
||||||
// thirdparty scope
|
// thirdparty scope
|
||||||
import s3rver from 's3rver';
|
import s3rver from 's3rver';
|
||||||
|
|
||||||
export {
|
export { s3rver };
|
||||||
s3rver
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user