9 Commits

Author SHA1 Message Date
cd3599557e 1.0.6 2021-12-03 16:54:29 +01:00
a552650d2a 1.0.5 2021-12-03 16:39:51 +01:00
b5bd1a7c9d fix(core): update 2021-12-03 16:39:50 +01:00
770c5a2b67 v1.0.4 2017-07-21 00:06:34 +02:00
b7bbe88cd5 1.0.3 2017-07-21 00:04:19 +02:00
cf401f1e7b 1.0.2 2017-07-21 00:04:10 +02:00
2b8ef598ec update dependencies 2017-07-21 00:04:08 +02:00
fbf107c3c7 initial 2017-06-09 01:24:19 +02:00
b269a05b3f add dependencies 2016-06-18 00:39:07 +02:00
18 changed files with 28647 additions and 39 deletions

21
.gitignore vendored
View File

@ -1,3 +1,20 @@
node_modules/ .nogit/
# artifacts
coverage/ coverage/
docs/ public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,36 +1,141 @@
image: hosttoday/ht-docker-node:npmts # gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages: stages:
- test - security
- release - test
- release
- metadata
testLEGACY: before_script:
stage: test - npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
mirror:
stage: security
script: script:
- npmci test legacy - npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
allow_failure: true allow_failure: true
testLTS: auditDevDependencies:
stage: test image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script: script:
- npmci test lts - npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags: tags:
- docker - docker
allow_failure: true
testSTABLE:
# ====================
# test stage
# ====================
testStable:
stage: test stage: test
script: script:
- npmci test stable - npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
release: release:
stage: release stage: release
script: script:
- npmci publish - npmci node install stable
- npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

11
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,2 +0,0 @@
# smartdrive
do more with cloud and local storage

View File

16
npmextra.json Normal file
View File

@ -0,0 +1,16 @@
{
"npmci": {
"npmGlobalpmTools": []
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartdrive",
"shortDescription": "a module for drive data and mount management",
"npmPackagename": "@pushrocks/smartdrive",
"license": "MIT"
}
}
}

28248
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,40 @@
{ {
"name": "smartdrive", "name": "@pushrocks/smartdrive",
"version": "1.0.3", "version": "1.0.6",
"description": "do more with local and cloud drives", "description": "do more with local and cloud drives",
"main": "dist/index.js", "main": "dist_ts/index.js",
"scripts": { "typings": "dist_ts/index.d.ts",
"test": "(npmts)"
},
"repository": {
"type": "git",
"url": "git+ssh://git@gitlab.com/pushrocks/smartdrive.git"
},
"keywords": [
"GDrive",
"OneDrive",
"LocalDrive"
],
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"bugs": { "scripts": {
"url": "https://gitlab.com/pushrocks/smartdrive/issues" "test": "tstest test/",
"build": "tsbuild --web"
}, },
"homepage": "https://gitlab.com/pushrocks/smartdrive#README",
"devDependencies": { "devDependencies": {
"npmts-g": "^5.2.6" "@gitzone/tsbuild": "^2.1.28",
"@gitzone/tstest": "^1.0.60",
"@pushrocks/tapbundle": "^3.2.14"
}, },
"dependencies": { "dependencies": {
"beautylog": "^5.0.12" "@pushrocks/smartfile": "^9.0.3",
} "@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartshell": "^2.0.30",
"drivelist": "^9.2.4"
},
"private": true,
"browserslist": [
"last 1 chrome versions"
],
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
]
} }

47
readme.md Normal file
View File

@ -0,0 +1,47 @@
# @pushrocks/smartdrive
a module for drive data and mount management
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdrive)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartdrive)
* [github.com (source mirror)](https://github.com/pushrocks/smartdrive)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartdrive/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartdrive/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartdrive/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartdrive)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartdrive)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartdrive)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartdrive)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartdrive)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
Use TypeScript for best in class instellisense.
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

23
test/test.ts Normal file
View File

@ -0,0 +1,23 @@
import * as smartdrive from '../ts/index';
import { expect, tap } from '@pushrocks/tapbundle';
let myLocalDriveList: smartdrive.SmartDrive;
let driveList: smartdrive.IDrive[];
tap.test('should create a new LocalDriveList', async () => {
myLocalDriveList = new smartdrive.SmartDrive();
expect(myLocalDriveList).to.be.instanceof(smartdrive.SmartDrive);
});
tap.test('should deliver a local drivelist', async () => {
driveList = await myLocalDriveList.getLocalDriveList();
});
tap.test('drivelist should contain drives', async () => {
console.log(driveList);
});
tap.test('drivelist should contain drives', async () => {});
tap.start();

4
ts/index.ts Normal file
View File

@ -0,0 +1,4 @@
import * as plugins from './smartdrive.plugins';
export * from './smartdrive.classes.localdrivelist';
export * from './smartdrive.interfaces';

View File

@ -0,0 +1,11 @@
import * as plugins from './smartdrive.plugins';
import * as interfaces from './smartdrive.interfaces';
export class DriveListResult {
result: interfaces.IDrive;
/**
* tries to determine the best mounting candidate from a physical drive
*/
public getBestMountCandidate() {}
}

View File

@ -0,0 +1,36 @@
import * as plugins from './smartdrive.plugins';
import * as paths from './smartdrive.paths';
import * as interfaces from './smartdrive.interfaces';
export class SmartDrive {
private smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash'
});
public async getLocalDriveList(): Promise<interfaces.IDrive[]> {
const list = await plugins.drivelist.list();
const lsblkExecResult = await this.smartshellInstance.execSilent(`lsblk --json --bytes`);
const lsblkJson: interfaces.ILsBlkJson = JSON.parse(lsblkExecResult.stdout);
console.log(lsblkJson);
const extendedList: interfaces.IDrive[] = list.map(driveItemArg => {
const deviceName = driveItemArg.device.replace('/dev/', '');
const blockDeviceLsBlk = lsblkJson.blockdevices.find((deviceArg) => {
return deviceArg.name === deviceName;
})
const result: interfaces.IDrive = {
...driveItemArg,
children: blockDeviceLsBlk.children,
}
return result;
});
return extendedList;
};
/**
* tries to mount a device to the corresponding name in /mnt/smartdrive/${devicename}
* @param devNameArg
*/
public async mountDeviceByName(devNameArg: string) {
}
}

View File

@ -0,0 +1,30 @@
import * as plugins from './smartdrive.plugins';
export interface ILsBlkJson {
blockdevices: {
name: string;
'maj:min': string;
rm: boolean;
size: number;
ro: boolean;
type: 'disk' | 'part';
mountpoint: null;
children: {
name: string;
'maj:min': string;
rm: boolean;
size: string;
ro: boolean;
type: 'disk' | 'part';
mountpoint: string;
}[];
}[];
}
export interface IDrive extends plugins.drivelist.Drive {
children: ILsBlkJson['blockdevices'][0]['children'];
}
export interface IMountpoint {
path: string;
}

3
ts/smartdrive.paths.ts Normal file
View File

@ -0,0 +1,3 @@
import * as plugins from './smartdrive.plugins';
export const baseMountPoint = `/dev/smartdrive`

6
ts/smartdrive.plugins.ts Normal file
View File

@ -0,0 +1,6 @@
import * as drivelist from 'drivelist';
import * as smartfile from '@pushrocks/smartfile';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartshell from '@pushrocks/smartshell';
export { drivelist, smartfile, smartpromise, smartshell };

17
tslint.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}