Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
6ebb7cec81 | |||
c64de19815 | |||
26d4753ddf | |||
6d5b9f3553 | |||
8dd8bd0be1 | |||
0bd91c2bda | |||
6ef3e6e6f5 | |||
93709f920e | |||
75fa530f73 | |||
f5617d9d45 | |||
b46d1e19a7 | |||
c8d173807d | |||
5944c7e96f | |||
39ea160fdf | |||
91ca5e53f1 | |||
778267bb36 |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm publish
|
||||
|
||||
metadata:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
run: |
|
||||
npmci command npm install -g typescript
|
||||
npmci npm install
|
||||
|
||||
- name: Trigger
|
||||
run: npmci trigger
|
||||
|
||||
- name: Build docs and upload artifacts
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @gitzone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
137
.gitlab-ci.yml
137
.gitlab-ci.yml
@ -1,137 +0,0 @@
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# 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
|
||||
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:
|
||||
- docker
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- 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:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- 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:
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- 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
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -7,10 +7,10 @@
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartgit",
|
||||
"shortDescription": "smart wrapper for nodegit",
|
||||
"npmPackagename": "@pushrocks/smartgit",
|
||||
"description": "smart wrapper for nodegit",
|
||||
"npmPackagename": "@push.rocks/smartgit",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
26916
package-lock.json
generated
26916
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
33
package.json
33
package.json
@ -1,12 +1,14 @@
|
||||
{
|
||||
"name": "@pushrocks/smartgit",
|
||||
"version": "2.0.0",
|
||||
"name": "@push.rocks/smartgit",
|
||||
"version": "3.0.1",
|
||||
"description": "smart wrapper for nodegit",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild --web)"
|
||||
"build": "(tsbuild --web --allowimplicitany)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -24,21 +26,20 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/smartgit",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartenv": "^4.0.16",
|
||||
"@pushrocks/smartfile": "^8.0.10",
|
||||
"@pushrocks/smartpath": "^4.0.3",
|
||||
"@pushrocks/smartpromise": "^3.1.6",
|
||||
"@pushrocks/smartshell": "^2.0.28",
|
||||
"@pushrocks/smartstring": "^3.0.24",
|
||||
"@types/minimatch": "^3.0.5",
|
||||
"isomorphic-git": "^1.10.1"
|
||||
"@push.rocks/smartenv": "^5.0.5",
|
||||
"@push.rocks/smartfile": "^10.0.26",
|
||||
"@push.rocks/smartpath": "^5.0.5",
|
||||
"@push.rocks/smartpromise": "^4.0.2",
|
||||
"@push.rocks/smartshell": "^3.0.3",
|
||||
"@push.rocks/smartstring": "^4.0.7",
|
||||
"@types/minimatch": "^5.1.2",
|
||||
"isomorphic-git": "^1.24.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.28",
|
||||
"@gitzone/tstest": "^1.0.59",
|
||||
"@pushrocks/tapbundle": "^3.2.14",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
"@gitzone/tsbuild": "^2.1.66",
|
||||
"@gitzone/tsrun": "^1.2.44",
|
||||
"@gitzone/tstest": "^1.0.77",
|
||||
"@push.rocks/tapbundle": "^5.0.8"
|
||||
},
|
||||
"private": false,
|
||||
"files": [
|
||||
|
4860
pnpm-lock.yaml
generated
Normal file
4860
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
31
readme.md
31
readme.md
@ -1,27 +1,26 @@
|
||||
# @pushrocks/smartgit
|
||||
# @push.rocks/smartgit
|
||||
smart wrapper for nodegit
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartgit)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartgit)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/smartgit)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartgit/)
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartgit)
|
||||
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartgit)
|
||||
* [github.com (source mirror)](https://github.com/push.rocks/smartgit)
|
||||
* [docs (typedoc)](https://push.rocks.gitlab.io/smartgit/)
|
||||
|
||||
## Status for master
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
GitLab Pipelines | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
TypeScript Support | [](https://lossless.cloud)
|
||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
@ -75,14 +74,12 @@ Tip: use [smartssh](https://npmjs.com/smartssh) to setup your SSH environment
|
||||
|
||||
[](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)
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
17
test/test.ts
17
test/test.ts
@ -1,24 +1,29 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import * as smartgit from '../ts/index';
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import * as smartgit from '../ts/index.js';
|
||||
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
const __dirname = smartpath.get.dirnameFromImportMetaUrl(import.meta.url);
|
||||
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).to.be.instanceOf(smartgit.Smartgit);
|
||||
})
|
||||
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/push.rocks/smartfile.git',
|
||||
testRepoDirSmartfile
|
||||
);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartgit',
|
||||
version: '3.0.1',
|
||||
description: 'smart wrapper for nodegit'
|
||||
}
|
@ -1,4 +1,2 @@
|
||||
import plugins = require('./smartgit.plugins');
|
||||
|
||||
export * from './smartgit.classes.gitrepo';
|
||||
export * from './smartgit.classes.smartgit';
|
||||
export * from './smartgit.classes.gitrepo.js';
|
||||
export * from './smartgit.classes.smartgit.js';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './smartgit.plugins';
|
||||
import * as plugins from './smartgit.plugins.js';
|
||||
|
||||
import { Smartgit } from './smartgit.classes.smartgit';
|
||||
import { Smartgit } from './smartgit.classes.smartgit.js';
|
||||
|
||||
/**
|
||||
* class GitRepo allows access to git directories from node
|
||||
@ -74,24 +74,23 @@ export class GitRepo {
|
||||
*/
|
||||
public async ensureRemote(remoteNameArg: string, remoteUrlArg: string): Promise<void> {
|
||||
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<string> {
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as plugins from './smartgit.plugins';
|
||||
import { GitRepo } from './smartgit.classes.gitrepo';
|
||||
import * as plugins from './smartgit.plugins.js';
|
||||
import { GitRepo } from './smartgit.classes.gitrepo.js';
|
||||
|
||||
export class Smartgit {
|
||||
public smartenvInstance = new plugins.smartenv.Smartenv();
|
||||
@ -8,29 +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 = this.smartenvInstance.getSafeNodeModule('fs');
|
||||
this.envDeps.http = this.smartenvInstance.getSafeNodeModule('isomorphic-git/http/node');
|
||||
this.envDeps.fs = await this.smartenvInstance.getSafeNodeModule('fs');
|
||||
this.envDeps.http = await this.smartenvInstance.getSafeNodeModule(
|
||||
'isomorphic-git/http/node/index.js'
|
||||
);
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ import * as path from 'path';
|
||||
|
||||
export { path };
|
||||
|
||||
import * as smartenv from '@pushrocks/smartenv';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartpath from '@pushrocks/smartpath';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
import * as smartenv from '@push.rocks/smartenv';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartstring from '@push.rocks/smartstring';
|
||||
|
||||
export { smartenv, smartfile, smartpath, smartpromise, smartstring };
|
||||
|
||||
|
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
}
|
||||
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
Reference in New Issue
Block a user