8 Commits

Author SHA1 Message Date
1f1bf7c21f 1.2.7 2022-10-11 13:18:04 +02:00
c652d0bf07 fix(core): update 2022-10-11 13:18:04 +02:00
eccc6294a8 1.2.6 2022-10-11 13:13:14 +02:00
f8a75a8d42 fix(core): update 2022-10-11 13:13:14 +02:00
d5c2bc1b53 1.2.5 2022-10-11 13:05:30 +02:00
d577a82a7b fix(core): update 2022-10-11 13:05:29 +02:00
f0b52c8da7 1.2.4 2019-07-17 11:48:31 +02:00
4cb6aa03e6 fix(core): update 2019-07-17 11:48:31 +02:00
31 changed files with 17345 additions and 900 deletions

21
.gitignore vendored
View File

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

View File

@ -1,126 +1,122 @@
# gitzone standard # gitzone ci_default
image: hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .npmci_cache/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: '$CI_BUILD_STAGE'
stages: stages:
- security - security
- test - test
- release - release
- metadata - metadata
before_script:
- npm install -g @shipzone/npmci
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
mirror: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci git mirror - 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
- notpriv allow_failure: true
snyk: auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci command npm install -g snyk - npmci npm prepare
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags: tags:
- docker - docker
- notpriv allow_failure: true
# ==================== # ====================
# test stage # test stage
# ==================== # ====================
testLEGACY:
stage: test
script:
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
allow_failure: true
testLTS: testStable:
stage: test stage: test
script: script:
- npmci node install lts - npmci npm prepare
- npmci npm install - npmci node install stable
- npmci npm test - npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
testSTABLE: testBuild:
stage: test stage: test
script: script:
- npmci node install stable - npmci npm prepare
- npmci npm install - npmci node install stable
- npmci npm test - npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci node install stable - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
# ==================== # ====================
# metadata stage # metadata stage
# ==================== # ====================
codequality: codequality:
stage: metadata stage: metadata
image: docker:stable
allow_failure: true allow_failure: true
services: only:
- docker:stable-dind - tags
script: script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - npmci command npm install -g typescript
- docker run - npmci npm prepare
--env SOURCE_CODE="$PWD" - npmci npm install
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags: tags:
- docker - lossless
- priv - docker
- priv
trigger: trigger:
stage: metadata stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - lossless
- notpriv - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata stage: metadata
script: script:
- npmci command npm install -g typedoc typescript - npmci node install stable
- npmci npm prepare
- npmci npm install - npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ - npmci command npm run buildDocs
tags: tags:
- lossless
- docker - docker
- notpriv - notpriv
only: only:
@ -128,15 +124,5 @@ pages:
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- public - public
allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true 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,5 +0,0 @@
FROM hosttoday/ht-docker-node:npmts
COPY ./ /node-app
WORKDIR /node-app
RUN npm install
RUN npm test

View File

@ -1,58 +0,0 @@
# smartssh
setups SSH quickly and in a painless manner
> Attention: This is still alpha, so some things won't work, not all things are implemented.
## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartssh)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/smartssh)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartssh)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartssh/)
## Status for master
[![build status](https://gitlab.com/pushrocks/smartssh/badges/master/build.svg)](https://gitlab.com/pushrocks/smartssh/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartssh/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartssh/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartssh.svg)](https://www.npmjs.com/package/smartssh)
[![Dependency Status](https://david-dm.org/pushrocks/smartssh.svg)](https://david-dm.org/pushrocks/smartssh)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartssh/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartssh/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartssh/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartssh)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
```javascript
var smartssh = require('smartssh');
var sshInstance = new smartssh.sshInstance({
sshDir: '/some/path/.ssh', // the standard ssh directory, optional, defaults to "~./.ssh"
sshSync: true // sync ssh this instance will represent the status of an ssh dir if set to true;
});
sshInstance.addKey(
new smartssh.sshKey({
private: 'somestring',
public: 'somestring', // optional
host: 'github.com',
encoding: 'base64' // optional, defaults to "utf8", can be "utf8" or "base64", useful for reading ssh keys from environment variables
})
);
sshInstance.removeKey(sshInstance.getKey('github.com')); // removes key for host "github.com" is present
sshInstance.createKey({
host: 'gitlab.com' // returns new key in the form sshKey, read more about the sshKey class below
});
sshInstance.getKey({
// returns ssh key in the form sshKey, read more about the sshKey class below
host: 'github.com'
});
sshInstance.getKeys(); // returns array of all available getKeys. Each key is in form of class sshKey
```
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)

View File

@ -2,5 +2,16 @@
"npmci": { "npmci": {
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartssh",
"description": "setups SSH quickly and in a painless manner",
"npmPackagename": "@pushrocks/smartssh",
"license": "MIT"
}
} }
} }

13493
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,16 @@
{ {
"name": "@pushrocks/smartssh", "name": "@pushrocks/smartssh",
"version": "1.2.3", "version": "1.2.7",
"private": false, "private": false,
"description": "setups SSH quickly and in a painless manner", "description": "setups SSH quickly and in a painless manner",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"testDocker": "npmdocker", "testDocker": "tsdocker",
"build": "(tsbuild)" "build": "(tsbuild --allowimplicitany)",
"buildDocs": "tsdoc"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -26,21 +28,36 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartssh#readme", "homepage": "https://gitlab.com/pushrocks/smartssh#readme",
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^6.0.8", "@pushrocks/smartfile": "^10.0.5",
"@pushrocks/smartpath": "^4.0.1", "@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartpromise": "^2.0.5", "@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartshell": "^2.0.6", "@pushrocks/smartshell": "^2.0.23",
"@pushrocks/smartstring": "^3.0.4", "@pushrocks/smartstring": "^4.0.5",
"@types/fs-extra": "^5.0.4", "@types/fs-extra": "^9.0.13",
"@types/minimatch": "^3.0.3", "@types/minimatch": "^5.1.2",
"fs-extra": "^7.0.0", "fs-extra": "^10.1.0",
"minimatch": "^3.0.4" "minimatch": "^5.1.0"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.0.22", "@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsrun": "^1.1.12", "@gitzone/tsrun": "^1.2.6",
"@gitzone/tstest": "^1.0.15", "@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.7", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^10.10.1" "@types/node": "^18.8.4"
} },
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
} }

4213
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

68
readme.md Normal file
View File

@ -0,0 +1,68 @@
# @pushrocks/smartssh
setups SSH quickly and in a painless manner
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartssh)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartssh)
* [github.com (source mirror)](https://github.com/pushrocks/smartssh)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartssh/)
## Status for master
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartssh/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartssh/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartssh)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartssh)](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/smartssh)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartssh)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartssh)](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
```javascript
var smartssh = require('smartssh');
var sshInstance = new smartssh.sshInstance({
sshDir: '/some/path/.ssh', // the standard ssh directory, optional, defaults to "~./.ssh"
sshSync: true, // sync ssh this instance will represent the status of an ssh dir if set to true;
});
sshInstance.addKey(
new smartssh.sshKey({
private: 'somestring',
public: 'somestring', // optional
host: 'github.com',
encoding: 'base64', // optional, defaults to "utf8", can be "utf8" or "base64", useful for reading ssh keys from environment variables
})
);
sshInstance.removeKey(sshInstance.getKey('github.com')); // removes key for host "github.com" is present
sshInstance.createKey({
host: 'gitlab.com', // returns new key in the form sshKey, read more about the sshKey class below
});
sshInstance.getKey({
// returns ssh key in the form sshKey, read more about the sshKey class below
host: 'github.com',
});
sshInstance.getKeys(); // returns array of all available getKeys. Each key is in form of class sshKey
```
## 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)

1
test/temp/bitbucket.org Normal file
View File

@ -0,0 +1 @@
somePrivateKey

View File

@ -0,0 +1 @@
somePublicKey

15
test/temp/config Normal file
View File

@ -0,0 +1,15 @@
Host gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/gitlab.com
StrictHostKeyChecking no
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/bitbucket.org
StrictHostKeyChecking no
Host github.com
HostName github.com
IdentityFile ~/.ssh/github.com
StrictHostKeyChecking no

1
test/temp/example.com Normal file
View File

@ -0,0 +1 @@
someExamplePrivateKey

View File

@ -0,0 +1 @@
someExamplePublicKey

1
test/temp/github.com Normal file
View File

@ -0,0 +1 @@
someGitHubPrivateKey

1
test/temp/github.com.pub Normal file
View File

@ -0,0 +1 @@
someGitHubPublicKey

1
test/temp/gitlab.com Normal file
View File

@ -0,0 +1 @@
somePrivateKey

1
test/temp/gitlab.com.pub Normal file
View File

@ -0,0 +1 @@
somePublicKey

View File

@ -1,6 +1,6 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import smartssh = require('../ts/index'); import * as smartssh from '../ts/index.js';
import path = require('path'); import * as path from 'path';
let testSshInstance: smartssh.SshInstance; let testSshInstance: smartssh.SshInstance;
let testSshKey: smartssh.SshKey; let testSshKey: smartssh.SshKey;
@ -8,18 +8,18 @@ tap.test('should create a valid SshKey object', async () => {
testSshKey = new smartssh.SshKey({ testSshKey = new smartssh.SshKey({
host: 'example.com', host: 'example.com',
private: 'someExamplePrivateKey', private: 'someExamplePrivateKey',
public: 'someExamplePublicKey' public: 'someExamplePublicKey',
}); });
expect(testSshKey).to.be.instanceof(smartssh.SshKey); expect(testSshKey).toBeInstanceOf(smartssh.SshKey);
}); });
tap.test('.type should be a valid type', async () => { tap.test('.type should be a valid type', async () => {
expect(testSshKey.type).equal('duplex'); expect(testSshKey.type).toEqual('duplex');
}); });
tap.test('.publicKey should be public key', async () => { tap.test('.publicKey should be public key', async () => {
expect(testSshKey.pubKey).equal('someExamplePublicKey'); expect(testSshKey.pubKey).toEqual('someExamplePublicKey');
}); });
tap.test('.privateKey should be private key', async () => { tap.test('.privateKey should be private key', async () => {
expect(testSshKey.privKey).equal('someExamplePrivateKey'); expect(testSshKey.privKey).toEqual('someExamplePrivateKey');
}); });
tap.test('.publicKeyBase64 should be public key base 64 encoded', async () => { tap.test('.publicKeyBase64 should be public key base 64 encoded', async () => {
// tslint:disable-next-line:no-unused-expression // tslint:disable-next-line:no-unused-expression
@ -32,49 +32,49 @@ tap.test('.store() should store the file to disk', async () => {
// SSH INstance // SSH INstance
tap.test("'new' keyword should create a new SshInstance object from class", async () => { tap.test("'new' keyword should create a new SshInstance object from class", async () => {
testSshInstance = new smartssh.SshInstance({ testSshInstance = new smartssh.SshInstance({
sshDirPath: path.join(process.cwd(), 'test/temp/') sshDirPath: path.join(process.cwd(), 'test/temp/'),
}); });
expect(testSshInstance).be.instanceof(smartssh.SshInstance); expect(testSshInstance).toBeInstanceOf(smartssh.SshInstance);
}); });
tap.test('.addKey() should accept a new SshKey object', async () => { tap.test('.addKey() should accept a new SshKey object', async () => {
testSshInstance.addKey( testSshInstance.addKey(
new smartssh.SshKey({ new smartssh.SshKey({
public: 'somePublicKey', public: 'somePublicKey',
private: 'somePrivateKey', private: 'somePrivateKey',
host: 'gitlab.com' host: 'gitlab.com',
}) })
); );
testSshInstance.addKey( testSshInstance.addKey(
new smartssh.SshKey({ new smartssh.SshKey({
public: 'somePublicKey', public: 'somePublicKey',
private: 'somePrivateKey', private: 'somePrivateKey',
host: 'bitbucket.org' host: 'bitbucket.org',
}) })
); );
testSshInstance.addKey( testSshInstance.addKey(
new smartssh.SshKey({ new smartssh.SshKey({
public: 'someGitHubPublicKey', public: 'someGitHubPublicKey',
private: 'someGitHubPrivateKey', private: 'someGitHubPrivateKey',
host: 'github.com' host: 'github.com',
}) })
); );
}); });
tap.test('.sshKeys should point to an array of sshKeys', async () => { tap.test('.sshKeys should point to an array of sshKeys', async () => {
let sshKeyArray = testSshInstance.sshKeys; let sshKeyArray = testSshInstance.sshKeys;
expect(sshKeyArray).be.instanceOf(Array); expect(sshKeyArray).toBeInstanceOf(Array);
expect(sshKeyArray[0].host).equal('gitlab.com'); expect(sshKeyArray[0].host).toEqual('gitlab.com');
expect(sshKeyArray[1].host).equal('bitbucket.org'); expect(sshKeyArray[1].host).toEqual('bitbucket.org');
expect(sshKeyArray[2].host).equal('github.com'); expect(sshKeyArray[2].host).toEqual('github.com');
}); });
tap.test('.getKey() should get a specific key selected by host', async () => { tap.test('.getKey() should get a specific key selected by host', async () => {
expect(testSshInstance.getKey('github.com').pubKey).equal('someGitHubPublicKey'); expect(testSshInstance.getKey('github.com').pubKey).toEqual('someGitHubPublicKey');
}); });
tap.test('.removeKey() should remove a key', async () => { tap.test('.removeKey() should remove a key', async () => {
testSshInstance.removeKey(testSshInstance.getKey('bitbucket.org')); testSshInstance.removeKey(testSshInstance.getKey('bitbucket.org'));
expect(testSshInstance.sshKeys[1].host).equal('github.com'); expect(testSshInstance.sshKeys[1].host).toEqual('github.com');
}); });
tap.test('it should store to disk', async () => { tap.test('it should store to disk', async () => {

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartssh',
version: '1.2.7',
description: 'setups SSH quickly and in a painless manner'
}

View File

@ -1,6 +1,6 @@
import * as plugins from './smartssh.plugins'; import * as plugins from './smartssh.plugins.js';
export { SshInstance } from './smartssh.classes.sshinstance'; export { SshInstance } from './smartssh.classes.sshinstance.js';
export { SshKey } from './smartssh.classes.sshkey'; export { SshKey } from './smartssh.classes.sshkey.js';
export { SshDir } from './smartssh.classes.sshdir'; export { SshDir } from './smartssh.classes.sshdir.js';
export { SshConfig } from './smartssh.classes.sshconfig'; export { SshConfig } from './smartssh.classes.sshconfig.js';

View File

@ -1,7 +1,7 @@
import * as plugins from './smartssh.plugins'; import * as plugins from './smartssh.plugins.js';
import { SshKey } from './smartssh.classes.sshkey'; import { SshKey } from './smartssh.classes.sshkey.js';
export let sshKeyArrayFromDir = function(dirArg: string): SshKey[] { export let sshKeyArrayFromDir = function (dirArg: string): SshKey[] {
let sshKeyArray = []; // TODO let sshKeyArray = []; // TODO
return sshKeyArray; return sshKeyArray;
}; };

View File

@ -1,6 +1,6 @@
import * as plugins from './smartssh.plugins'; import * as plugins from './smartssh.plugins.js';
import * as helpers from './smartssh.classes.helpers'; import * as helpers from './smartssh.classes.helpers.js';
import { SshKey } from './smartssh.classes.sshkey'; import { SshKey } from './smartssh.classes.sshkey.js';
export class SshConfig { export class SshConfig {
private _sshKeyArray: SshKey[]; private _sshKeyArray: SshKey[];
@ -12,7 +12,7 @@ export class SshConfig {
* stores a config file * stores a config file
*/ */
store(dirPathArg: string) { store(dirPathArg: string) {
let done = plugins.q.defer(); let done = plugins.smartpromise.defer();
let configArray: configObject[] = []; let configArray: configObject[] = [];
let configString; let configString;
for (let key in this._sshKeyArray) { for (let key in this._sshKeyArray) {
@ -34,7 +34,7 @@ export class SshConfig {
configArray.push({ configArray.push({
configString: configString, configString: configString,
authorized: sshKey.authorized, authorized: sshKey.authorized,
sshKey: sshKey sshKey: sshKey,
}); });
} }
let configFile: string = ''; let configFile: string = '';
@ -45,7 +45,7 @@ export class SshConfig {
return done.promise; return done.promise;
} }
read(dirPathArg) { read(dirPathArg) {
let done = plugins.q.defer(); let done = plugins.smartpromise.defer();
let configArray: configObject[]; let configArray: configObject[];
plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, 'config')); plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, 'config'));

View File

@ -1,8 +1,8 @@
import * as plugins from './smartssh.plugins'; import * as plugins from './smartssh.plugins.js';
import * as helpers from './smartssh.classes.helpers'; import * as helpers from './smartssh.classes.helpers.js';
import { SshInstance } from './smartssh.classes.sshinstance'; import { SshInstance } from './smartssh.classes.sshinstance.js';
import { SshKey } from './smartssh.classes.sshkey'; import { SshKey } from './smartssh.classes.sshkey.js';
import { SshConfig } from './smartssh.classes.sshconfig'; import { SshConfig } from './smartssh.classes.sshconfig.js';
export class SshDir { export class SshDir {
// sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE // sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE
@ -23,7 +23,7 @@ export class SshDir {
// syncs sshInstance to directory // syncs sshInstance to directory
let path = this._path; let path = this._path;
if (dirPathArg) path = dirPathArg; if (dirPathArg) path = dirPathArg;
this._sshKeyArray.forEach(sshKeyArg => { this._sshKeyArray.forEach((sshKeyArg) => {
sshKeyArg.store(path); sshKeyArg.store(path);
}); });
this._sshConfig.store(path); this._sshConfig.store(path);

View File

@ -1,9 +1,9 @@
import * as plugins from './smartssh.plugins'; import * as plugins from './smartssh.plugins.js';
import * as helpers from './smartssh.classes.helpers'; import * as helpers from './smartssh.classes.helpers.js';
import { SshDir } from './smartssh.classes.sshdir'; import { SshDir } from './smartssh.classes.sshdir.js';
import { SshConfig } from './smartssh.classes.sshconfig'; import { SshConfig } from './smartssh.classes.sshconfig.js';
import { SshKey } from './smartssh.classes.sshkey'; import { SshKey } from './smartssh.classes.sshkey.js';
/** /**
* SshInstance is the main class dealing with ssh management * SshInstance is the main class dealing with ssh management
@ -45,7 +45,7 @@ export class SshInstance {
// non altering methods // non altering methods
getKey(hostArg: string): SshKey { getKey(hostArg: string): SshKey {
this._syncAuto('from'); this._syncAuto('from');
let filteredArray = this._sshKeyArray.filter(function(keyArg) { let filteredArray = this._sshKeyArray.filter(function (keyArg) {
return keyArg.host === hostArg; return keyArg.host === hostArg;
}); });
if (filteredArray.length > 0) { if (filteredArray.length > 0) {

View File

@ -1,5 +1,5 @@
import * as plugins from './smartssh.plugins'; import * as plugins from './smartssh.plugins.js';
import * as helpers from './smartssh.classes.helpers'; import * as helpers from './smartssh.classes.helpers.js';
export class SshKey { export class SshKey {
private _privKey: string; private _privKey: string;
@ -8,7 +8,7 @@ export class SshKey {
private _authorized: boolean; private _authorized: boolean;
private _smarthshellInstance = new plugins.shelljs.Smartshell({ private _smarthshellInstance = new plugins.shelljs.Smartshell({
executor: 'bash' executor: 'bash',
}); });
/** /**

View File

@ -1,10 +1,10 @@
import * as fs from 'fs-extra'; import * as fs from 'fs-extra';
import * as minimatch from 'minimatch'; import * as minimatch from 'minimatch';
import * as path from 'path'; import * as path from 'path';
import * as q from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as shelljs from '@pushrocks/smartshell'; import * as shelljs from '@pushrocks/smartshell';
import * as smartfile from '@pushrocks/smartfile'; import * as smartfile from '@pushrocks/smartfile';
import * as smartpath from '@pushrocks/smartpath'; import * as smartpath from '@pushrocks/smartpath';
import * as smartstring from '@pushrocks/smartstring'; import * as smartstring from '@pushrocks/smartstring';
export { fs, minimatch, path, q, shelljs, smartfile, smartpath, smartstring }; export { fs, minimatch, path, smartpromise, shelljs, smartfile, smartpath, smartstring };

10
tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
}
}

View File

@ -1,3 +0,0 @@
{
"extends": "tslint-config-standard"
}