From f5617d9d45a33f41f43dab0e0288ae0ab15e31ea Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 31 Jul 2022 15:18:04 +0200 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 23 +++++++---------------- .vscode/launch.json | 24 +++--------------------- npmextra.json | 2 +- package.json | 5 +++-- readme.md | 1 - test/test.ts | 9 ++++++--- ts/00_commitinfo_data.ts | 2 +- ts/smartgit.classes.gitrepo.ts | 19 +++++++++---------- ts/smartgit.classes.smartgit.ts | 22 ++++++++++++---------- 9 files changed, 42 insertions(+), 65 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a4467e..69b3e08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,20 +12,12 @@ stages: - release - metadata +before_script: + - npm install -g @shipzone/npmci + # ==================== # security stage # ==================== -mirror: - stage: security - script: - - npmci git mirror - only: - - tags - tags: - - lossless - - docker - - notpriv - auditProductionDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci stage: security @@ -36,6 +28,7 @@ auditProductionDependencies: - npmci command npm audit --audit-level=high --only=prod --production tags: - docker + allow_failure: true auditDevDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci @@ -96,10 +89,9 @@ codequality: only: - tags script: - - npmci command npm install -g tslint typescript + - npmci command npm install -g typescript - npmci npm prepare - npmci npm install - - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - lossless - docker @@ -119,11 +111,10 @@ trigger: pages: stage: metadata script: - - npmci node install lts - - npmci command npm install -g @gitzone/tsdoc + - npmci node install stable - npmci npm prepare - npmci npm install - - npmci command tsdoc + - npmci command npm run buildDocs tags: - lossless - docker diff --git a/.vscode/launch.json b/.vscode/launch.json index 112db52..26e9f92 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,28 +2,10 @@ "version": "0.2.0", "configurations": [ { - "name": "current file", - "type": "node", + "command": "npm test", + "name": "Run npm test", "request": "launch", - "args": [ - "${relativeFile}" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" - }, - { - "name": "test.ts", - "type": "node", - "request": "launch", - "args": [ - "test/test.ts" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" + "type": "node-terminal" } ] } diff --git a/npmextra.json b/npmextra.json index 5aab550..aad6c9c 100644 --- a/npmextra.json +++ b/npmextra.json @@ -9,7 +9,7 @@ "githost": "gitlab.com", "gitscope": "pushrocks", "gitrepo": "smartgit", - "shortDescription": "smart wrapper for nodegit", + "description": "smart wrapper for nodegit", "npmPackagename": "@pushrocks/smartgit", "license": "MIT" } diff --git a/package.json b/package.json index abb0039..9c6a4ff 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "type": "module", "scripts": { "test": "(tstest test/)", - "build": "(tsbuild --web)" + "build": "(tsbuild --web)", + "buildDocs": "tsdoc" }, "repository": { "type": "git", @@ -55,4 +56,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index f9dbfba..81016d7 100644 --- a/readme.md +++ b/readme.md @@ -75,7 +75,6 @@ Tip: use [smartssh](https://npmjs.com/smartssh) to setup your SSH environment [![npm](https://push.rocks/assets/repo-header.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). :) diff --git a/test/test.ts b/test/test.ts index f328be7..1730e89 100644 --- a/test/test.ts +++ b/test/test.ts @@ -7,20 +7,23 @@ import * as path from 'path'; let testSmartgitInstance: smartgit.Smartgit; const testRepoDir = path.join(__dirname, '../.nogit/testrepo'); -const testRepoDirSmartfile = path.join(__dirname, '../.nogit/pushrocks_smartfile') +const testRepoDirSmartfile = path.join(__dirname, '../.nogit/pushrocks_smartfile'); tap.test('should create a valid smartgit instance', async () => { testSmartgitInstance = new smartgit.Smartgit(); await testSmartgitInstance.init(); expect(testSmartgitInstance).toBeInstanceOf(smartgit.Smartgit); -}) +}); tap.test('should create a new repo at .nogit', async () => { const gitRepo = await testSmartgitInstance.createRepoByOpen(testRepoDir); }); tap.test('should clone a repo', async () => { - const gitRepo = await testSmartgitInstance.createRepoByClone('https://gitlab.com/pushrocks/smartfile.git', testRepoDirSmartfile); + const gitRepo = await testSmartgitInstance.createRepoByClone( + 'https://gitlab.com/pushrocks/smartfile.git', + testRepoDirSmartfile + ); }); tap.start(); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 9b791b4..b8a3cba 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartgit', - version: '2.0.3', + version: '2.0.4', description: 'smart wrapper for nodegit' } diff --git a/ts/smartgit.classes.gitrepo.ts b/ts/smartgit.classes.gitrepo.ts index ac5af61..8501d84 100644 --- a/ts/smartgit.classes.gitrepo.ts +++ b/ts/smartgit.classes.gitrepo.ts @@ -74,24 +74,23 @@ export class GitRepo { */ public async ensureRemote(remoteNameArg: string, remoteUrlArg: string): Promise { const remotes = await this.listRemotes(); - const existingRemote = - remotes.find((itemArg) => itemArg.remote === remoteNameArg); + const existingRemote = remotes.find((itemArg) => itemArg.remote === remoteNameArg); if (existingRemote) { if (existingRemote.url !== remoteUrlArg) { await plugins.isomorphicGit.deleteRemote({ remote: remoteNameArg, fs: this.smartgitRef.envDeps.fs, - dir: this.repoDir - }) + dir: this.repoDir, + }); } else { return; - }; + } } await plugins.isomorphicGit.addRemote({ remote: remoteNameArg, fs: this.smartgitRef.envDeps.fs, - url: remoteUrlArg - }) + url: remoteUrlArg, + }); } /** @@ -99,7 +98,7 @@ export class GitRepo { */ public async getUrlForRemote(remoteName: string): Promise { const remotes = await this.listRemotes(); - const existingRemote = remotes.find(remoteArg => remoteArg.remote === remoteName); + const existingRemote = remotes.find((remoteArg) => remoteArg.remote === remoteName); return existingRemote?.url; } @@ -108,7 +107,7 @@ export class GitRepo { fs: this.smartgitRef.envDeps.fs, http: this.smartgitRef.envDeps.http, ref: branchName, - remote: remoteName - }) + remote: remoteName, + }); } } diff --git a/ts/smartgit.classes.smartgit.ts b/ts/smartgit.classes.smartgit.ts index 0217a9a..7886d93 100644 --- a/ts/smartgit.classes.smartgit.ts +++ b/ts/smartgit.classes.smartgit.ts @@ -8,31 +8,33 @@ export class Smartgit { http: any; } = { fs: null, - http: null - } + http: null, + }; - constructor() {}; + constructor() {} public async init() { if (this.smartenvInstance.isNode) { this.envDeps.fs = await this.smartenvInstance.getSafeNodeModule('fs'); - this.envDeps.http = await this.smartenvInstance.getSafeNodeModule('isomorphic-git/http/node/index.js'); + this.envDeps.http = await this.smartenvInstance.getSafeNodeModule( + 'isomorphic-git/http/node/index.js' + ); } else { - throw new Error('currently only node.js is supported.') + throw new Error('currently only node.js is supported.'); } - }; + } public async createRepoByClone(fromUrlArg: string, toDirArg: string) { - const repo = await GitRepo.fromCloningIntoDir(this, fromUrlArg, toDirArg) - }; + const repo = await GitRepo.fromCloningIntoDir(this, fromUrlArg, toDirArg); + } public async createRepoByInit(dirArg: string) { const repo = await GitRepo.fromCreatingRepoInDir(this, dirArg); return repo; - }; + } public async createRepoByOpen(dirArg: string) { const repo = await GitRepo.fromOpeningRepoDir(this, dirArg); return repo; } -} \ No newline at end of file +}