Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de4632d186 | |||
| e69ca55a40 | |||
| 5803ef597f | |||
| 0bb6bfbb37 | |||
| 703bfe7fe8 | |||
| 545f5d35f5 |
@@ -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"
|
||||||
|
|||||||
21006
package-lock.json
generated
21006
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smarts3",
|
"name": "@pushrocks/smarts3",
|
||||||
"version": "1.0.9",
|
"version": "2.0.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "create an s3 endpoint that maps to a local directory",
|
"description": "create an s3 endpoint that maps to a local directory",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -12,11 +13,11 @@
|
|||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.61",
|
||||||
"@gitzone/tsbundle": "^1.0.78",
|
"@gitzone/tsbundle": "^1.0.102",
|
||||||
"@gitzone/tstest": "^1.0.44",
|
"@gitzone/tstest": "^1.0.70",
|
||||||
"@pushrocks/tapbundle": "^3.2.9",
|
"@pushrocks/tapbundle": "^5.0.3",
|
||||||
"@types/node": "^17.0.0",
|
"@types/node": "^17.0.24",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
@@ -36,8 +37,9 @@
|
|||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartbucket": "^1.0.44",
|
"@pushrocks/smartbucket": "^2.0.1",
|
||||||
"@pushrocks/smartfile": "^9.0.3",
|
"@pushrocks/smartfile": "^9.0.6",
|
||||||
|
"@pushrocks/smartpath": "^5.0.5",
|
||||||
"@types/s3rver": "^3.7.0",
|
"@types/s3rver": "^3.7.0",
|
||||||
"s3rver": "^3.7.1"
|
"s3rver": "^3.7.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import * as smartbucket from '@pushrocks/smartbucket';
|
import * as smartbucket from '@pushrocks/smartbucket';
|
||||||
|
|
||||||
export {
|
export { smartbucket };
|
||||||
smartbucket
|
|
||||||
};
|
|
||||||
|
|||||||
12
test/test.ts
12
test/test.ts
@@ -1,11 +1,11 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as plugins from './plugins';
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
import * as smarts3 from '../ts/index';
|
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();
|
||||||
|
|||||||
18
ts/index.ts
18
ts/index.ts
@@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './smarts3.plugins';
|
import * as plugins from './smarts3.plugins.js';
|
||||||
import * as paths from './paths';
|
import * as paths from './paths.js';
|
||||||
|
|
||||||
export interface ISmarts3ContructorOptions {
|
export interface ISmarts3ContructorOptions {
|
||||||
port?: number;
|
port?: number;
|
||||||
@@ -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,13 @@ export class Smarts3 {
|
|||||||
endpoint: 'localhost',
|
endpoint: 'localhost',
|
||||||
port: this.options.port,
|
port: this.options.port,
|
||||||
useSsl: false,
|
useSsl: false,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async createBucket(bucketNameArg: string) {
|
||||||
|
const smartbucketInstance = new plugins.smartbucket.SmartBucket(await this.getS3Descriptor());
|
||||||
|
const bucket = await smartbucketInstance.createBucket(bucketNameArg);
|
||||||
|
return bucket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stop() {
|
public async stop() {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import * as plugins from './smarts3.plugins';
|
import * as plugins from './smarts3.plugins.js';
|
||||||
|
|
||||||
export const packageDir = plugins.path.join(__dirname, '../');
|
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,22 +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';
|
||||||
|
|
||||||
export {
|
export { smartbucket, smartfile, smartpath };
|
||||||
smartbucket,
|
|
||||||
smartfile,
|
|
||||||
}
|
|
||||||
|
|
||||||
// thirdparty scope
|
// thirdparty scope
|
||||||
import s3rver from 's3rver';
|
import s3rver from 's3rver';
|
||||||
|
|
||||||
export {
|
export { s3rver };
|
||||||
s3rver
|
|
||||||
}
|
|
||||||
|
|||||||
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user