Compare commits

...

79 Commits

Author SHA1 Message Date
81b2b225a3 fix(changelog): Update to neweset format. 2024-06-23 23:42:47 +02:00
9a2d5afc04 3.1.1 2024-06-23 23:37:30 +02:00
6404c8342a fix(documentation): Remove outdated changelog entries 2024-06-23 23:37:29 +02:00
b14ae1d8a6 3.1.0 2024-06-23 21:05:51 +02:00
753bc49c4e feat(gitrepo): Enhance GitRepo to include commit date and version information 2024-06-23 21:05:50 +02:00
a5dae9b3a3 3.0.4 2024-06-22 10:01:16 +02:00
af909047ae fix(core): update 2024-06-22 10:01:15 +02:00
11cbe93b4b 3.0.3 2024-06-22 02:44:20 +02:00
e8c3d3c44f fix(GitRepo): add diff function 2024-06-22 02:44:19 +02:00
a2485560b3 update description 2024-05-29 14:13:21 +02:00
7aa83ac730 update tsconfig 2024-04-14 17:38:19 +02:00
141af9843f update npmextra.json: githost 2024-04-01 21:35:12 +02:00
71e84e79b1 update npmextra.json: githost 2024-04-01 19:58:19 +02:00
aefcf56f0e update npmextra.json: githost 2024-03-30 21:47:17 +01:00
ace668bfc1 3.0.2 2023-11-15 15:15:18 +01:00
f2949c5f21 fix(core): update 2023-11-15 15:15:18 +01:00
6ebb7cec81 3.0.1 2023-07-27 13:45:49 +02:00
c64de19815 fix(core): update 2023-07-27 13:45:48 +02:00
26d4753ddf switch to new org scheme 2023-07-11 00:44:24 +02:00
6d5b9f3553 switch to new org scheme 2023-07-10 02:56:04 +02:00
8dd8bd0be1 3.0.0 2022-07-31 15:37:57 +02:00
0bd91c2bda BREAKING CHANGE(core): switch to esm 2022-07-31 15:37:57 +02:00
6ef3e6e6f5 2.0.5 2022-07-31 15:19:20 +02:00
93709f920e fix(core): update 2022-07-31 15:19:19 +02:00
75fa530f73 2.0.4 2022-07-31 15:18:04 +02:00
f5617d9d45 fix(core): update 2022-07-31 15:18:04 +02:00
b46d1e19a7 2.0.3 2022-07-31 15:16:06 +02:00
c8d173807d fix(core): update 2022-07-31 15:16:06 +02:00
5944c7e96f 2.0.2 2022-07-31 15:14:19 +02:00
39ea160fdf fix(core): update 2022-07-31 15:14:18 +02:00
91ca5e53f1 2.0.1 2021-10-22 01:42:42 +02:00
778267bb36 fix(core): update 2021-10-22 01:42:42 +02:00
61407e4854 2.0.0 2021-10-21 19:09:14 +02:00
2771413723 BREAKING CHANGE(dependencies): switch to isomorphic git 2021-10-21 19:09:14 +02:00
b83752a98a 1.0.18 2020-08-15 14:17:09 +00:00
48f71ed1c2 fix(core): update 2020-08-15 14:17:08 +00:00
54ed2f97b8 1.0.17 2020-08-15 13:53:02 +00:00
92198a75c9 fix(core): update 2020-08-15 13:53:02 +00:00
f82a34b1ea 1.0.16 2020-08-15 13:51:39 +00:00
c3b68fa0fc fix(core): update 2020-08-15 13:51:38 +00:00
1af7afd723 1.0.15 2020-08-15 13:51:25 +00:00
66e45154e3 fix(core): update 2020-08-15 13:51:24 +00:00
dcc58a312e 1.0.14 2020-08-15 13:46:57 +00:00
90f57bee1a fix(core): update 2020-08-15 13:46:56 +00:00
98d1f8aea2 1.0.13 2019-08-27 18:21:39 +02:00
1f542367e6 1.0.12 2019-08-27 16:02:04 +02:00
201a5014ed fix(core): update 2019-08-27 16:02:04 +02:00
6cc245ae7e 1.0.11 2019-06-20 14:19:54 +02:00
1377fb6eb7 fix(core): update 2019-06-20 14:19:54 +02:00
daf8c80513 1.0.10 2019-06-20 14:10:42 +02:00
46fce49356 fix(core): update 2019-06-20 14:10:42 +02:00
8616613a95 1.0.9 2019-06-19 14:10:17 +02:00
352e4d8e96 fix(core): update 2019-06-19 14:10:16 +02:00
c2105ce78f 1.0.8 2019-06-19 14:00:44 +02:00
2864fc5507 fix(core): update 2019-06-19 14:00:44 +02:00
fea523ff5c 1.0.7 2019-06-18 15:41:04 +02:00
872f2354c5 fix(core): update 2019-06-18 15:41:03 +02:00
ff0318534f 1.0.6 2019-06-18 15:17:50 +02:00
e103074684 fix(core): update 2019-06-18 15:17:50 +02:00
f72beabd90 remove some white space 2016-12-31 23:20:38 +01:00
958a625633 1.0.5 2016-12-31 23:17:07 +01:00
871fd55c5c fix .addAll 2016-12-31 23:17:03 +01:00
07fd9b9fa7 1.0.4 2016-11-26 23:28:41 +01:00
62d6a8d685 add npmextra.json 2016-11-26 23:28:37 +01:00
047cf02e6a 1.0.3 2016-11-26 23:24:52 +01:00
69127cacdd remove postinstall 2016-11-26 23:24:48 +01:00
7529098a50 1.0.2 2016-11-22 22:22:32 +01:00
15c331690b added some tests 2016-11-22 22:22:24 +01:00
29d176bafa 1.0.1 2016-11-22 21:51:50 +01:00
8763926288 1.0.0 2016-11-22 21:51:38 +01:00
da16094e36 implement new class approach 2016-11-22 21:49:40 +01:00
5fd2b07266 Update README 2016-11-22 00:24:11 +01:00
6618463e0a update 2016-11-22 00:07:36 +01:00
93af3cd0e1 0.1.10 2016-11-21 19:35:02 +01:00
854598ab25 update deps 2016-11-21 19:34:59 +01:00
dffc390637 0.1.9 2016-07-05 03:47:43 +02:00
ae5b6b5afd improve typings and tests 2016-07-05 03:47:38 +02:00
c7f87eebae 0.1.8 2016-07-04 04:59:46 +02:00
63c54ff790 fix push 2016-07-04 04:59:39 +02:00
65 changed files with 7859 additions and 868 deletions

View 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

View 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 @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

28
.gitignore vendored
View File

@ -1,14 +1,20 @@
node_modules/
.settings/
.idea/
test/temp/
test/temp2/
.nogit/
# artifacts
coverage/
docs/
public/
pages/
#npm devug
npm-debug.log
# installs
node_modules/
ts/*.js
ts/*.js.map
ts/typings/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,49 +0,0 @@
image: hosttoday/ht-docker-node:npmts
stages:
- test
- release
- trigger
before_script:
- npmci prepare ssh
testLEGACY:
stage: test
script:
- npmci test legacy
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker

View File

@ -1,19 +0,0 @@
language: node_js
node_js:
- 4
- stable
before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install libstdc++-4.9-dev -y
deploy:
provider: npm
email: npm@lossless.digital
api_key:
secure: o/3H4keWRAvHZaJnUN9UX+hqu+prKGtBsOEWVIaRXUpf6nIHIDm9zlJrS5cv2VUseOZqLAOkzeGYPqlOJlxccy5frKEYMhtCY97BjKvUOf01roL82OGiahw5Bv04NcaBoSepCliyyXihlgZO/5tSoR1seY4ycul2qWLktaEmh8HcTPjem8gB49Svpfk8yPKLpq6cv/sSakt2X24Cq+vfdxYiz7GcgBfv3EVAndUmQ9KMQfkSbq8XgYEZKrLi5kdpXX0y1LRdsbn2rwuMwLOmefCenmQSuBCbYmbOxPgVHHHjVm9To/rhx8YHBCcZSH9go2pdDLwrd7VPOCK+vMHCz/rlASwVM/BGr+aJHCFLAyovrIU7cvbbjLPOUjto6xY2XckMmDBD1YDxYnAJAON1QrdXE9hVVRfMNfaC2leFAwhla1WMok5DcEv+/Q9cUXQCBGQHtBhkhmCCt54ERLFnjXCDZr1icR/0lhtQY54hin5jSHqnU2hTZtTpQX7sF0yZM2sbhTBpV5FTDAGH/ohNWSEnTwAXmL9iwZCTvtWUbBeOUSDRj8BLS54uiaIcIVytNY0p2PdnhwJAWO+4FGjSOT+RuK8RiKzyVXjPiX8TCzaOqBFs947m8SSNMSt6zyqOI27gOSzU7szgsKY769Fl+X9sdzFXaSa72rj4EdvgiBA=
on:
tags: true
repo: pushrocks/smartgit
notifications:
slack:
secure: f5Uss0z9RPl/QcA/DroB8loyE93aOYI6bqCkrsiUscmZtlv/TVQtT4dxqGA6uvcG6iTQDBi3Ul88dQxWkRm4IqbhY35/iMaV2dHW4FVYMAh8GQMbsfL2sALCcufxD9blw47awv3iFcwhV1EeyesscjgL0JIjduk96v/7G/6QIO2838M1lzlgtj+kRUkim8qkaEs1je3gRrhMUIjLuAdscMXyUKYFMjWo9ACSjVUl30R/ZNemb18itIja6i92GotreBgcfEMczvy58ovDC7xdJUsY8LjMI01DwY+WPRnI0tAhsuI8moBwwcdM4e3bAjKjucQRjO33O5bMWRZ6QCiYd0DnCEFyCPQLJ4GSy/tkD00n8ijLHAOSV3AH1zNbdK1EAdSPQXDvlI36KJn/2hyQLoitGHVUPr76ujJWP82ypO2tgIp3XQU0dJVCxDuHnwJO2+hjdI+gCPqxNTpjeujHx3UdkTGNRjuuf9dlZ/D08fApjYxy2fxItTqo3QjP/nrqvBXUOPP8yPHpjIT4H2t5Pr4SJjBGI6X4qhKyFj6s9rA/Xu1rL+45zu1C3uC3z+u3T9UwrbzJ/cZM6r6UQvQmUvIfBNaMlg4I/diQCDIPL+Rhop2nylY3IcHmJnk2itn7kOqj1tohCpFEml5pRuSZy4udWywkdtyBAsHWFLF7oiQ=

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,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Push.Rocks
Copyright (c) 2015 Lossless GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,23 +0,0 @@
# smartgit is an easy wrapper for nodegit
a wrapper for git. This plugin does not use nodegit as nodegit appears to have too many bugs for now.
### Buildstatus/Dependencies
[![build status](https://gitlab.com/pushrocks/smartgit/badges/master/build.svg)](https://gitlab.com/pushrocks/smartgit/commits/master)
[![devDependency Status](https://david-dm.org/pushrocks/smartgit/dev-status.svg)](https://david-dm.org/pushrocks/smartgit#info=devDependencies)
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/smartgit/badge.svg?branch=master)](https://coveralls.io/github/pushrocks/smartgit?branch=master)
### Usage
This plugin exposes some easified method wrappers for nodegit.
This limits options but reduces errors (TypeScript) and speeds up usage.
Features:
* clone a git repo
* init a new repo
* create a new git repo
* add changes and make a new commit
* commit changes
* push changes
* add/remove remotes
Tip: use [smartssh](https://npmjs.com/smartssh) to setup your SSH environment

63
changelog.md Normal file
View File

@ -0,0 +1,63 @@
# Changelog
## 2024-06-23 - 3.1.1 - fix(documentation)
Remove outdated changelog entries
## 2024-06-23 - 3.1.0 - gitrepo
Enhancements and fixes to GitRepo
- Enhance GitRepo to include commit date and version information
## 2024-06-22 - 3.0.3 to 3.0.4 - core & GitRepo
General updates and new feature addition
- Fixed core functionality
- Added diff function in GitRepo
## 2023-11-15 - 3.0.1 to 3.0.2 - core, tsconfig, npmextra
Minor updates and fixes
- Fixed core functionality
- Updated tsconfig and npmextra.json
## 2023-07-10 - 3.0.0 - core
Structural changes to organization scheme
- Switched to a new organizational scheme
## 2023-07-27 - 3.0.0 to 3.0.1 - core
Structural changes and updates
- Fixed core functionality
- Switched to new organizational scheme
## 2022-07-31 - 2.0.2 to 3.0.0 - core
Breaking changes and updates
- Switching to ESM for core
- Fixed core functionality
## 2021-10-22 - 1.0.18 to 2.0.1 - dependencies, core
Breaking changes and updates
- Switched to isomorphic git dependencies
- Fixed core functionality
## 2020-08-15 - 1.0.14 to 1.0.18 - core
Fixes
- Fixed core functionality in multiple patches
## 2019-06-18 - 1.0.5 to 1.0.10 - core
Fixes
- Fixed core functionality in multiple patches
## 2016-06-23 - 0.0.10 to 0.1.11 - gitlab & other fixes
Initial implementations and setup
- Fixed README and merge issues
- Updated gitlab.yml and CI settings
- Implemented new class approach and other updates
- Removed unnecessary imports, postinstall
- Added npmextra.json, CI tests, SSH key support

8
dist/index.d.ts vendored
View File

@ -1,8 +0,0 @@
export { add } from "./smartgit.add";
export { clone } from "./smartgit.clone";
export { commit } from "./smartgit.commit";
export { init } from "./smartgit.init";
export { pull } from "./smartgit.pull";
export { push } from "./smartgit.push";
export { remote } from "./smartgit.remote";
export { status } from "./smartgit.status";

18
dist/index.js vendored
View File

@ -1,18 +0,0 @@
"use strict";
var smartgit_add_1 = require("./smartgit.add");
exports.add = smartgit_add_1.add;
var smartgit_clone_1 = require("./smartgit.clone");
exports.clone = smartgit_clone_1.clone;
var smartgit_commit_1 = require("./smartgit.commit");
exports.commit = smartgit_commit_1.commit;
var smartgit_init_1 = require("./smartgit.init");
exports.init = smartgit_init_1.init;
var smartgit_pull_1 = require("./smartgit.pull");
exports.pull = smartgit_pull_1.pull;
var smartgit_push_1 = require("./smartgit.push");
exports.push = smartgit_push_1.push;
var smartgit_remote_1 = require("./smartgit.remote");
exports.remote = smartgit_remote_1.remote;
var smartgit_status_1 = require("./smartgit.status");
exports.status = smartgit_status_1.status;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsNkJBQWtCLGdCQUFnQixDQUFDO0FBQTNCLGlDQUEyQjtBQUNuQywrQkFBb0Isa0JBQWtCLENBQUM7QUFBL0IsdUNBQStCO0FBQ3ZDLGdDQUFxQixtQkFBbUIsQ0FBQztBQUFqQywwQ0FBaUM7QUFDekMsOEJBQW1CLGlCQUFpQixDQUFDO0FBQTdCLG9DQUE2QjtBQUNyQyw4QkFBbUIsaUJBQWlCLENBQUM7QUFBN0Isb0NBQTZCO0FBQ3JDLDhCQUFtQixpQkFBaUIsQ0FBQztBQUE3QixvQ0FBNkI7QUFDckMsZ0NBQXFCLG1CQUFtQixDQUFDO0FBQWpDLDBDQUFpQztBQUN6QyxnQ0FBcUIsbUJBQW1CLENBQUM7QUFBakMsMENBQWlDIn0=

View File

3
dist/postinstall.js vendored
View File

@ -1,3 +0,0 @@
"use strict";
var shelljs = require("shelljs");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9zdGluc3RhbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wb3N0aW5zdGFsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDIn0=

View File

@ -1,3 +0,0 @@
export declare let add: {
addAll: (dirPathArg: string) => any;
};

20
dist/smartgit.add.js vendored
View File

@ -1,20 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
var addAll = function (dirPathArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.add expects a valid git directory!");
done.reject();
return done.promise;
}
;
// if everything is ok proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git add -A && git status)");
done.resolve(dirPathArg);
return done.promise;
};
exports.add = {
addAll: addAll
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuYWRkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuYWRkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFOUMsSUFBSSxNQUFNLEdBQUcsVUFBQyxVQUFpQjtJQUMzQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUsQ0FBQSxDQUFDLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDcEMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsNkNBQTZDLENBQUMsQ0FBQztRQUN2RSxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7UUFDZCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLDhCQUE4QjtJQUM5QixPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFPLFVBQVUsa0NBQStCLENBQUMsQ0FBQztJQUN2RSxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQztBQUVTLFdBQUcsR0FBRztJQUNiLE1BQU0sRUFBRSxNQUFNO0NBQ2pCLENBQUEifQ==

View File

@ -1,2 +0,0 @@
declare var _default: (repoArg: any) => boolean;
export = _default;

View File

@ -1,5 +0,0 @@
"use strict";
module.exports = function (repoArg) {
return true;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2hlY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jaGVjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsaUJBQVMsVUFBUyxPQUFPO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUM7QUFDaEIsQ0FBQyxDQUFDIn0=

View File

@ -1,7 +0,0 @@
export declare let clone: (optionsArg: {
from: string;
to: string;
key?: string;
keyPath?: string;
keyPassphrase?: string;
}) => any;

View File

@ -1,10 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
exports.clone = function (optionsArg) {
var done = plugins.Q.defer();
plugins.smartfile.fs.ensureDir(optionsArg.to);
plugins.shelljs.exec("git clone " + optionsArg.from + " " + optionsArg.to);
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2xvbmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jbG9uZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBTyxPQUFPLFdBQVcsb0JBQW9CLENBQUMsQ0FBQztBQUdwQyxhQUFLLEdBQUcsVUFBQyxVQU1uQjtJQUNHLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsU0FBUyxDQUFDLFVBQVUsQ0FBQyxFQUFFLENBQUMsQ0FBQztJQUM5QyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxlQUFhLFVBQVUsQ0FBQyxJQUFJLFNBQUksVUFBVSxDQUFDLEVBQUksQ0FBQyxDQUFDO0lBQ3RFLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9

View File

@ -1 +0,0 @@
export declare let commit: (dirPathArg: string, commitMessage: string) => any;

View File

@ -1,17 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
exports.commit = function (dirPathArg, commitMessage) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.commit expects a valid git directory");
done.reject();
return done.promise;
}
;
// if everything is all right proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git commit -m \"" + commitMessage + "\")");
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuY29tbWl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsY0FBTSxHQUFHLFVBQUMsVUFBaUIsRUFBQyxhQUFvQjtJQUN2RCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUsQ0FBQSxDQUFDLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDcEMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsK0NBQStDLENBQUMsQ0FBQztRQUN6RSxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7UUFDZCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLHFDQUFxQztJQUNyQyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFPLFVBQVUsNEJBQXNCLGFBQWEsUUFBSSxDQUFDLENBQUM7SUFDL0UsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0=

View File

@ -1 +0,0 @@
export declare let isGitDirectory: (dirPathArg: any) => boolean;

View File

@ -1,11 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
exports.isGitDirectory = function (dirPathArg) {
try {
return plugins.smartfile.fs.isDirectory(plugins.path.join(dirPathArg, ".git"));
}
catch (err) {
return false;
}
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsc0JBQWMsR0FBRyxVQUFDLFVBQVU7SUFDbkMsSUFBSSxDQUFDO1FBQ0QsTUFBTSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFdBQVcsQ0FDbkMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxFQUFDLE1BQU0sQ0FBQyxDQUN2QyxDQUFDO0lBQ04sQ0FDQTtJQUFBLEtBQUssQ0FBQSxDQUFDLEdBQUcsQ0FBQyxDQUFBLENBQUM7UUFDUCxNQUFNLENBQUMsS0FBSyxDQUFDO0lBQ2pCLENBQUM7QUFDTCxDQUFDLENBQUEifQ==

View File

@ -1 +0,0 @@
export declare let init: (dirPathArg: string) => any;

15
dist/smartgit.init.js vendored
View File

@ -1,15 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
exports.init = function (dirPathArg) {
var done = plugins.Q.defer();
if (typeof dirPathArg == "undefined") {
plugins.beautylog.error("smartgit.init requires an absolute directory path!");
return;
}
;
plugins.smartfile.fs.ensureDir(dirPathArg);
plugins.shelljs.exec("(cd " + dirPathArg + " && git init)");
done.resolve(dirPathArg);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuaW5pdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LmluaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFcEMsWUFBSSxHQUFHLFVBQUMsVUFBaUI7SUFDaEMsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUMsQ0FBQyxPQUFPLFVBQVUsSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1FBQ25DLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLG9EQUFvRCxDQUFDLENBQUM7UUFDOUUsTUFBTSxDQUFDO0lBQ1gsQ0FBQztJQUFBLENBQUM7SUFDRixPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDLENBQUM7SUFDM0MsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBTyxVQUFVLGtCQUFlLENBQUMsQ0FBQztJQUN2RCxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9

View File

@ -1,8 +0,0 @@
import "typings-global";
export import path = require("path");
export import beautylog = require("beautylog");
export declare let Q: any;
export declare let shelljs: any;
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");
export import smartstring = require("smartstring");

View File

@ -1,10 +0,0 @@
"use strict";
require("typings-global");
exports.path = require("path");
exports.beautylog = require("beautylog");
exports.Q = require("q");
exports.shelljs = require("shelljs");
exports.smartfile = require("smartfile");
exports.smartpath = require("smartpath");
exports.smartstring = require("smartstring");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUVWLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ3BDLFNBQUMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDakIsZUFBTyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUMxQixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsbUJBQVcsV0FBVyxhQUFhLENBQUMsQ0FBQyJ9

View File

@ -1 +0,0 @@
export declare let pull: (dirPathArg: string, sourceArg?: string, branchArg?: string) => any;

19
dist/smartgit.pull.js vendored
View File

@ -1,19 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
exports.pull = function (dirPathArg, sourceArg, branchArg) {
if (sourceArg === void 0) { sourceArg = ""; }
if (branchArg === void 0) { branchArg = ""; }
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.pull expects a valid git directory");
done.reject();
return done.promise;
}
;
// if everything is allright proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git pull " + sourceArg + " " + branchArg + ")");
done.resolve(dirPathArg);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1bGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUVuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFDLFNBQXFCLEVBQUUsU0FBcUI7SUFBNUMseUJBQXFCLEdBQXJCLGNBQXFCO0lBQUUseUJBQXFCLEdBQXJCLGNBQXFCO0lBQzdFLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUEsQ0FBQztRQUNwQyxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO1FBQ3ZFLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUNkLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0lBQ3hCLENBQUM7SUFBQSxDQUFDO0lBQ0Ysb0NBQW9DO0lBQ3BDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFNBQU8sVUFBVSxxQkFBZ0IsU0FBUyxTQUFJLFNBQVMsTUFBRyxDQUFDLENBQUM7SUFDakYsSUFBSSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUN6QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUMifQ==

View File

@ -1 +0,0 @@
export declare let push: (dirPathArg: string, sourceArg?: string, branchArg?: string) => any;

18
dist/smartgit.push.js vendored
View File

@ -1,18 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
exports.push = function (dirPathArg, sourceArg, branchArg) {
if (sourceArg === void 0) { sourceArg = ""; }
if (branchArg === void 0) { branchArg = ""; }
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.push expects a valid git directory");
done.reject();
return done.promise;
}
// if everything seems allright proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git status)");
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1c2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUVuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFFLFNBQXFCLEVBQUUsU0FBcUI7SUFBNUMseUJBQXFCLEdBQXJCLGNBQXFCO0lBQUUseUJBQXFCLEdBQXJCLGNBQXFCO0lBQzlFLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUEsQ0FBQztRQUNwQyxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO1FBQ3ZFLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUNkLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0lBQ3hCLENBQUM7SUFDRCx1Q0FBdUM7SUFDdkMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBTyxVQUFVLG9CQUFpQixDQUFDLENBQUM7SUFDekQsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0=

View File

@ -1,5 +0,0 @@
export declare let remote: {
add: (dirPathArg: any, remoteNameArg: string, remoteLinkArg: string) => any;
list: (dirPathArg: any) => any;
remove: (dirPathArg: string) => any;
};

View File

@ -1,61 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
var add = function (dirPathArg, remoteNameArg, remoteLinkArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.remote.add expects a valid git directory");
done.reject();
return done.promise;
}
;
if (!remoteNameArg) {
plugins.beautylog.error("smartgit.remote.add expects a valid remote name");
done.reject();
return done.promise;
}
;
if (!remoteLinkArg) {
plugins.beautylog.error("smartgit.remote.add expects a valid remote link");
done.reject();
return done.promise;
}
;
// if everything is all right proceed
plugins.shelljs.exec("cd " + dirPathArg + " && git remote add " + remoteNameArg + " " + remoteLinkArg);
exports.remote.list(dirPathArg);
done.resolve();
return done.promise;
};
var check = function (dirPathArg, remoteNameArg, remoteLinkArg) {
};
var list = function (dirPathArg) {
var done = plugins.Q.defer();
var remotes = {};
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.remote.list expects a valid git directory");
done.reject();
return done.promise;
}
;
// if everything is all right proceed
plugins.shelljs.exec("cd " + dirPathArg + " && git remote -v").stdout;
done.resolve(remotes);
return done.promise;
};
var remove = function (dirPathArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.remote.remove expects a valid git directory");
done.reject();
return done.promise;
}
;
// if everything is all right
};
exports.remote = {
add: add,
list: list,
remove: remove
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucmVtb3RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQucmVtb3RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFOUMsSUFBSSxHQUF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UMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDcEMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsc0RBQXNELENBQUMsQ0FBQztRQUNoRixJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7UUFDZCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLDhCQUE4QjtBQUNsQyxDQUFDLENBQUE7QUFFVSxjQUFNLEdBQUc7SUFDaEIsR0FBRyxFQUFFLEdBQUc7SUFDUixJQUFJLEVBQUUsSUFBSTtJQUNWLE1BQU0sRUFBRSxNQUFNO0NBQ2pCLENBQUEifQ==

View File

@ -1 +0,0 @@
export declare let status: (dirPathArg: string) => any;

View File

@ -1,16 +0,0 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
exports.status = function (dirPathArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
plugins.beautylog.error("smartgit.status expects a valid git directory");
done.reject();
return done.promise;
}
// if everything seems allright proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git status)");
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuc3RhdHVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuc3RhdHVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsY0FBTSxHQUFHLFVBQUMsVUFBaUI7SUFDbEMsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUEsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQ3BDLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLCtDQUErQyxDQUFDLENBQUM7UUFDekUsSUFBSSxDQUFDLE1BQU0sRUFBRSxDQUFDO1FBQ2QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7SUFDeEIsQ0FBQztJQUNELHVDQUF1QztJQUN2QyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFPLFVBQVUsb0JBQWlCLENBQUMsQ0FBQztJQUN6RCxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7SUFDZixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUMifQ==

View File

@ -1,90 +0,0 @@
/// <reference path="./index.ts" />
var SmartgitPlugins;
(function (SmartgitPlugins) {
SmartgitPlugins.init = function () {
var plugins = {
path: require("path"),
beautylog: require("beautylog"),
nodegit: require("nodegit"),
Q: require("q")
};
return plugins;
};
})(SmartgitPlugins || (SmartgitPlugins = {}));
/// <reference path="./index.ts" />
var SmartgitClone;
(function (SmartgitClone) {
function init() {
var clone = function (options) {
/***** URL Checks ******/
if (options.from == "undefined" || options.to == "undefined") {
plugins.beautylog.error("smartgit.clone".blue + " : Something is strange about the way you invoked the function");
return;
}
/***** Path Checks ******/
if (!/^\/.*/.test(options.to)) {
plugins.beautylog.error("It seems that the given path " + options.to + " is not absolute.");
return;
}
plugins.beautylog.log("Now cloning " + options.from);
var cloneOptions = {};
var cloneRepository = plugins.nodegit.Clone(options.from, options.to, cloneOptions);
smartgit.check(cloneRepository);
};
return clone;
}
SmartgitClone.init = init;
})(SmartgitClone || (SmartgitClone = {}));
/// <reference path="./index.ts" />
var SmartgitInit;
(function (SmartgitInit) {
SmartgitInit.init = function () {
var gitinit = function (dest) {
if (dest === void 0) { dest = "undefined"; }
if (dest == "undefined") {
return; // ...and return function here if not
}
var isBare = 0; //lets create a subfolder
plugins.nodegit.Repository.init(dest, isBare).then(function (repo) {
// do something with repo here.
});
};
return gitinit;
};
})(SmartgitInit || (SmartgitInit = {}));
/// <reference path="./index.ts" />
var SmartgitCommit;
(function (SmartgitCommit) {
SmartgitCommit.init = function () {
var commit = function (pathArg, commitMessage) {
var result = plugins.nodegit.index.addByPath(pathArg);
if (result == 0) {
}
};
return commit;
};
})(SmartgitCommit || (SmartgitCommit = {}));
/// <reference path="./index.ts" />
var SmartgitCheck;
(function (SmartgitCheck) {
SmartgitCheck.init = function () {
var check = function () {
return true;
};
return check;
};
})(SmartgitCheck || (SmartgitCheck = {}));
/// <reference path="typings/tsd.d.ts" />
/// <reference path="smartgit.plugins.ts" />
/// <reference path="smartgit.clone.ts" />
/// <reference path="smartgit.init.ts" />
/// <reference path="smartgit.commit.ts" />
/// <reference path="smartgit.check.ts" />
var plugins = SmartgitPlugins.init();
//Build the smartgit object
var smartgit = {};
smartgit.clone = SmartgitClone.init();
smartgit.commit = SmartgitCommit.init();
smartgit.check = SmartgitCheck.init();
smartgit.init = SmartgitInit.init();
module.exports = smartgit;

31
npmextra.json Normal file
View File

@ -0,0 +1,31 @@
{
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartgit",
"description": "A smart wrapper for nodegit that simplifies Git operations in Node.js.",
"npmPackagename": "@push.rocks/smartgit",
"license": "MIT",
"keywords": [
"git",
"nodegit",
"version control",
"git wrapper",
"programming",
"development",
"code management",
"repository management",
"git operations"
]
}
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -1,5 +0,0 @@
{
"mode":"default",
"codecov":true,
"coverageTreshold":71
}

View File

@ -1,42 +1,69 @@
{
"name": "smartgit",
"version": "0.1.7",
"description": "an easy wrapper for git",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"name": "@push.rocks/smartgit",
"version": "3.1.1",
"description": "A smart wrapper for nodegit that simplifies Git operations in Node.js.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": {
"cleanTest": "rm -rf test/temp*",
"test": "(npm run cleanTest && npmts)",
"install": "node dist/postinstall.js"
"test": "(tstest test/)",
"build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
"url": "https://gitlab.com/pushrocks/smartgit.git"
"url": "https://code.foss.global/push.rocks/smartgit.git"
},
"keywords": [
"json",
"jade",
"template"
"git",
"nodegit",
"version control",
"git wrapper",
"programming",
"development",
"code management",
"repository management",
"git operations"
],
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/pushrocks/smartgit/issues"
},
"homepage": "https://gitlab.com/pushrocks/smartgit",
"homepage": "https://code.foss.global/push.rocks/smartgit",
"dependencies": {
"@types/minimatch": "*",
"beautylog": "^5.0.13",
"q": "^1.4.1",
"shelljs": "^0.7.0",
"smartfile": "^4.0.10",
"smartpath": "^3.2.2",
"smartstring": "^2.0.10",
"typings-global": "^1.0.5"
"@push.rocks/smartenv": "^5.0.12",
"@push.rocks/smartfile": "^11.0.20",
"@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartpromise": "^4.0.2",
"@push.rocks/smartshell": "^3.0.5",
"@push.rocks/smartstring": "^4.0.15",
"@push.rocks/smarttime": "^4.0.6",
"@types/diff": "^5.2.1",
"@types/minimatch": "^5.1.2",
"diff": "^5.2.0",
"isomorphic-git": "^1.25.10"
},
"devDependencies": {
"npmts-g": "^5.2.6",
"should": "^9.0.2",
"typings-test": "^1.0.1"
}
"@git.zone/tsbuild": "^2.1.80",
"@git.zone/tsrun": "^1.2.44",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.0.23"
},
"private": false,
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

6971
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

137
readme.md Normal file
View File

@ -0,0 +1,137 @@
# @push.rocks/smartgit
smart wrapper for nodegit
## Install
To install @push.rocks/smartgit, use the following command with npm:
```bash
npm install @push.rocks/smartgit --save
```
Or if you prefer using yarn:
```bash
yarn add @push.rocks/smartgit
```
Make sure you have `node` installed on your system to use this package.
## Usage
This guide assumes familiarity with TypeScript and basic Git operations. The `@push.rocks/smartgit` module offers a sophisticated, promise-based interface to interact with Git repositories in a Node.js environment, abstracting over the `isomorphic-git` library and adding additional functionality.
### Setting Up
First, you need to import `Smartgit` and other necessary classes from the package. This is also when you'd typically configure any additional settings or dependencies required by your project.
```typescript
import { Smartgit } from '@push.rocks/smartgit';
// Initialize the Smartgit instance
const smartgit = new Smartgit();
await smartgit.init();
```
### Creating, Cloning, and Opening Repositories
With `Smartgit`, you can easily manage local repositories by creating new ones, cloning existing repositories, or opening an already existing local repository.
#### Creating a New Repository
```typescript
const pathToNewRepo = '/path/to/your/new/repo';
const newRepo = await smartgit.createRepoByInit(pathToNewRepo);
```
#### Cloning a Repository
```typescript
const cloneUrl = 'https://github.com/yourusername/your-repo.git';
const pathToClone = '/path/to/clone/repo';
const clonedRepo = await smartgit.createRepoByClone(cloneUrl, pathToClone);
```
#### Opening an Existing Repository
```typescript
const pathToExistingRepo = '/path/to/your/existing/repo';
const existingRepo = await smartgit.createRepoByOpen(pathToExistingRepo);
```
### Working with Git Operations
`Smartgit` simplifies common Git operations, making it easy to execute commands like add, commit, push, and more programmatically.
#### Adding Changes
To stage changes, you can add all changes or specify particular files.
```typescript
// Add all changes to staging
await existingRepo.addAll();
// Or specify particular files
await existingRepo.add(['file1.txt', 'path/to/file2.txt']);
```
#### Committing Changes
Once changes are staged, you can commit them.
```typescript
await existingRepo.commit('Your commit message');
```
#### Pushing to a Remote
Before pushing, ensure a remote is set up correctly, then push your changes.
```typescript
await existingRepo.ensureRemote('origin', 'https://github.com/yourusername/your-repo.git');
await existingRepo.pushBranchToRemote('main', 'origin');
```
### Advanced Features
`Smartgit` also supports more advanced Git functionalities, such as dealing with branches, managing remotes, and checking repository status.
#### Listing Remotes
```typescript
const remotes = await existingRepo.listRemotes();
console.log(remotes);
```
#### Working with Branches
Branch management such as creating new branches or checking out existing ones can be done through the underlying `isomorphic-git` functions, with `Smartgit` making the setup and usage straightforward.
### Practical Tips
- When dealing with asynchronous operations, especially in sequences that depend on the outcome of previous steps (e.g., staging, committing, and pushing), ensure proper error handling, either using `.then().catch()` chains or `try/catch` blocks with async/await.
- For complex Git workflows, consider combining `Smartgit`'s capabilities with other Node.js modules or scripts to automate and streamline your processes.
### Conclusion
`@push.rocks/smartgit` provides a versatile and powerful toolkit for Git operations in Node.js applications. By abstracting the complexities of interacting with Git repositories, it enables developers to focus more on developing their logic and less on the intricacies of Git commands. Whether you're managing local repositories, automating deployment workflows, or integrating Git operations into your applications, `Smartgit` offers a comprehensive set of features to address your needs.
For further examples, contributions, and issues, please refer to the [project's repository](https://gitlab.com/pushrocks/smartgit) and consider contributing to or starring the project if you find it useful.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

View File

@ -1,9 +0,0 @@
/// <reference path="typings/tsd.d.ts" />
var smartgit = require("./index.js");
var beautylog = require("beautylog");
var path = require("path");
smartgit.clone({
from: "https://github.com/pushrocks/docs.git",
to: path.resolve("./test/temp/")
});
beautylog.success("Test successfull");

2
test/test.d.ts vendored
View File

@ -1,2 +0,0 @@
import "typings-test";
import "should";

View File

@ -1,84 +0,0 @@
"use strict";
require("typings-test");
var shelljs = require("shelljs");
var path = require("path");
require("should");
var smartgit = require("../dist/index");
var paths = {
temp: path.resolve("./test/temp/"),
temp2: path.resolve("./test/temp2/"),
temp3: path.resolve("./test/temp3"),
temp4: path.resolve("./test/temp4"),
noGit: path.resolve("./test/")
};
describe("smartgit", function () {
describe(".clone", function () {
it("should clone a repository using ssh and sshkey", function (done) {
this.timeout(40000);
smartgit.clone({
from: "git@gitlab.com:sandboxzone/sandbox-testrepo.git",
to: paths.temp
}).then(function () {
done();
});
});
it("should clone a repository using https", function (done) {
this.timeout(40000);
smartgit.clone({
from: "https://gitlab.com/sandboxzone/sandbox-testrepo.git",
to: paths.temp2
}).then(function () {
done();
});
});
});
describe(".add", function () {
it("should error for noGit", function () {
smartgit.add.addAll(paths.noGit);
});
it("should add a file to an existing repository", function () {
shelljs.exec("(cd " + paths.temp + " && cp ../test.js .)");
smartgit.add.addAll(paths.temp);
});
});
describe("commit", function () {
it("should error for noGit", function () {
smartgit.commit(paths.noGit, "some commit message");
});
it("should commit a new file to an existing repository", function () {
smartgit.commit(paths.temp, "added a new file");
});
});
describe("init", function () {
it("should error for noGit", function () {
smartgit.init(paths.noGit);
});
it("should init a new git", function () {
smartgit.init(paths.temp3);
});
});
describe("pull", function () {
this.timeout(40000);
it("should error for noGit", function () {
smartgit.pull(paths.noGit);
});
it("should pull from origin", function () {
smartgit.pull(paths.temp);
});
});
describe("remote", function () {
it("should error for noGit", function () {
smartgit.remote.add(paths.noGit, null, null);
});
it("should error for no remote name", function () {
smartgit.remote.add(paths.temp, null, null);
});
it("should error for no remote link", function () {
smartgit.remote.add(paths.temp, "origin", null);
});
it("should add a remote", function () {
smartgit.remote.add(paths.temp, "origin2", "https://github.com/pushrocks/somerepo");
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFFdEIsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQ2pDLElBQU8sSUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFDO0FBQzlCLFFBQU8sUUFFUCxDQUFDLENBRmM7QUFFZixJQUFPLFFBQVEsV0FBVyxlQUFlLENBQUMsQ0FBQ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LENBQUM7UUFDSCxFQUFFLENBQUMscUJBQXFCLEVBQUM7WUFDckIsUUFBUSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLElBQUksRUFBQyxTQUFTLEVBQUMsdUNBQXVDLENBQUMsQ0FBQztRQUN0RixDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDO0FBQ1AsQ0FBQyxDQUFDLENBQUMifQ==

View File

@ -1 +0,0 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC3C,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,UAAU,EAAC;IAChB,QAAQ,CAAC,QAAQ,EAAC;QACd,EAAE,CAAC,2BAA2B,EAAC,UAAS,IAAI;YACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,QAAQ,CAAC,KAAK,CAAC;gBACX,IAAI,EAAC,uCAAuC;gBAC5C,EAAE,EAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;aAClC,CAAC,CAAC,IAAI,CAAC;gBACJ,IAAI,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAC;IAElB,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAC;IAElB,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,MAAM,EAAC;IAEhB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

View File

@ -1,85 +1,51 @@
import "typings-test";
import beautylog = require("beautylog");
let shelljs = require("shelljs");
import path = require("path");
import "should"
import { tap, expect } from '@push.rocks/tapbundle';
import * as smartgit from '../ts/index.js';
import smartgit = require("../dist/index");
let paths = {
temp: path.resolve("./test/temp/"),
temp2: path.resolve("./test/temp2/"),
temp3: path.resolve("./test/temp3"),
temp4: path.resolve("./test/temp4"),
noGit: path.resolve("./test/")
}
import * as smartpath from '@push.rocks/smartpath';
import * as path from 'path';
describe("smartgit",function(){
describe(".clone",function(){
it("should clone a repository using ssh and sshkey",function(done){
this.timeout(40000);
smartgit.clone({
from:"git@gitlab.com:sandboxzone/sandbox-testrepo.git",
to:paths.temp
}).then(function(){
done();
});
});
it("should clone a repository using https",function(done){
this.timeout(40000);
smartgit.clone({
from:"https://gitlab.com/sandboxzone/sandbox-testrepo.git",
to:paths.temp2
}).then(function(){
done();
});
});
});
describe(".add",function(){
it("should error for noGit",function(){
smartgit.add.addAll(paths.noGit);
})
it("should add a file to an existing repository",function(){
shelljs.exec(`(cd ${paths.temp} && cp ../test.js .)`)
smartgit.add.addAll(paths.temp);
})
});
describe("commit",function(){
it("should error for noGit",function(){
smartgit.commit(paths.noGit,"some commit message");
})
it("should commit a new file to an existing repository",function(){
smartgit.commit(paths.temp,"added a new file");
})
});
describe("init",function(){
it("should error for noGit",function(){
smartgit.init(paths.noGit);
});
it("should init a new git",function(){
smartgit.init(paths.temp3);
})
});
describe("pull",function(){
this.timeout(40000);
it("should error for noGit",function(){
smartgit.pull(paths.noGit);
});
it("should pull from origin",function(){
smartgit.pull(paths.temp);
})
});
describe("remote",function(){
it("should error for noGit",function(){
smartgit.remote.add(paths.noGit,null,null);
});
it("should error for no remote name",function(){
smartgit.remote.add(paths.temp,null,null);
});
it("should error for no remote link",function(){
smartgit.remote.add(paths.temp,"origin",null);
});
it("should add a remote",function(){
smartgit.remote.add(paths.temp,"origin2","https://github.com/pushrocks/somerepo");
});
});
});
let testSmartgitInstance: smartgit.Smartgit;
const packageDir = path.join(smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
const testRepoDir = path.join(packageDir, './.nogit/testrepo');
const testRepoDirSmartfile = path.join(packageDir, './.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/push.rocks/smartfile.git',
testRepoDirSmartfile
);
});
tap.test('should open a repo', async () => {
const gitRepo = await testSmartgitInstance.createRepoByOpen(packageDir);
const diff = await gitRepo.getUncommittedDiff([
'pnpm-lock.yaml',
]);
console.log(diff);
});
tap.test('should get the diff to HEAD', async () => {
const gitRepo = await testSmartgitInstance.createRepoByOpen(packageDir);
const diff = await gitRepo.getUncommittedDiff([
'pnpm-lock.yaml',
]);
console.log(diff);
});
tap.test('should print all commit messages', async () => {
const gitRepo = await testSmartgitInstance.createRepoByOpen(packageDir);
const commitMessages = await gitRepo.getAllCommitMessages();
console.log(commitMessages);
});
await tap.start();

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartgit',
version: '3.1.1',
description: 'A smart wrapper for nodegit that simplifies Git operations in Node.js.'
}

View File

@ -1,10 +1,2 @@
import plugins = require("./smartgit.plugins");
export {add} from "./smartgit.add";
export {clone} from "./smartgit.clone";
export {commit} from "./smartgit.commit";
export {init} from "./smartgit.init";
export {pull} from "./smartgit.pull";
export {push} from "./smartgit.push";
export {remote} from "./smartgit.remote";
export {status} from "./smartgit.status";
export * from './smartgit.classes.gitrepo.js';
export * from './smartgit.classes.smartgit.js';

View File

@ -1,2 +0,0 @@
let shelljs = require("shelljs");
import beautylog = require("beautylog");

View File

@ -1,19 +0,0 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
let addAll = (dirPathArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.add expects a valid git directory!");
done.reject();
return done.promise;
};
// if everything is ok proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git add -A && git status)`);
done.resolve(dirPathArg);
return done.promise;
};
export let add = {
addAll: addAll
}

View File

@ -1,4 +0,0 @@
import plugins = require("./smartgit.plugins");
export = function(repoArg) {
return true;
};

View File

@ -0,0 +1,228 @@
import * as plugins from './smartgit.plugins.js';
import { Smartgit } from './smartgit.classes.smartgit.js';
/**
* class GitRepo allows access to git directories from node
*/
export class GitRepo {
// STATIC
/**
* creates a new GitRepo Instance after cloning a project
*/
public static async fromCloningIntoDir(
smartgitRefArg: Smartgit,
fromArg: string,
toArg: string
): Promise<GitRepo> {
const dirArg = plugins.path.resolve(toArg);
await plugins.isomorphicGit.clone({
dir: toArg,
fs: smartgitRefArg.envDeps.fs,
http: smartgitRefArg.envDeps.http,
url: fromArg,
});
return new GitRepo(smartgitRefArg, toArg);
}
public static async fromCreatingRepoInDir(
smartgitRefArg: Smartgit,
dirArg: string
): Promise<GitRepo> {
dirArg = plugins.path.resolve(dirArg);
await plugins.isomorphicGit.init({
dir: dirArg,
fs: smartgitRefArg.envDeps.fs,
});
return new GitRepo(smartgitRefArg, dirArg);
}
public static async fromOpeningRepoDir(smartgitRefArg: Smartgit, dirArg: string) {
dirArg = plugins.path.resolve(dirArg);
return new GitRepo(smartgitRefArg, dirArg);
}
// INSTANCE
public smartgitRef: Smartgit;
public repoDir: string;
constructor(smartgitRefArg: Smartgit, repoDirArg: string) {
this.smartgitRef = smartgitRefArg;
this.repoDir = repoDirArg;
}
/**
* lists remotes
*/
public async listRemotes(): Promise<
{
remote: string;
url: string;
}[]
> {
const remotes = await plugins.isomorphicGit.listRemotes({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
});
return remotes;
}
/**
* ensures the existence of a remote within a repository
* @param remoteNameArg
* @param remoteUrlArg
*/
public async ensureRemote(remoteNameArg: string, remoteUrlArg: string): Promise<void> {
const remotes = await this.listRemotes();
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,
});
} else {
return;
}
}
await plugins.isomorphicGit.addRemote({
remote: remoteNameArg,
fs: this.smartgitRef.envDeps.fs,
url: remoteUrlArg,
});
}
/**
* gets the url for a specific remote
*/
public async getUrlForRemote(remoteName: string): Promise<string> {
const remotes = await this.listRemotes();
const existingRemote = remotes.find((remoteArg) => remoteArg.remote === remoteName);
return existingRemote?.url;
}
public async pushBranchToRemote(branchName: string, remoteName: string) {
await plugins.isomorphicGit.push({
fs: this.smartgitRef.envDeps.fs,
http: this.smartgitRef.envDeps.http,
ref: branchName,
remote: remoteName,
});
}
/**
* Get the diff of the current uncommitted changes while excluding specified files
*/
public async getUncommittedDiff(excludeFiles: string[] = []): Promise<string[]> {
const statusMatrix = await plugins.isomorphicGit.statusMatrix({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
});
const diffs: string[] = [];
for (const row of statusMatrix) {
const [filepath, head, workdir] = row;
if (excludeFiles.includes(filepath)) {
continue; // Skip excluded files
}
let headContent = '';
let workdirContent = '';
// Handle modified files
if (head !== 0 && workdir !== 0 && head !== workdir) {
headContent = await plugins.isomorphicGit
.readBlob({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
oid: await plugins.isomorphicGit.resolveRef({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
ref: 'HEAD',
}),
filepath,
})
.then((result) => new TextDecoder().decode(result.blob));
workdirContent = await this.smartgitRef.envDeps.fs.promises.readFile(
plugins.path.join(this.repoDir, filepath),
'utf8'
);
}
// Handle added files
if (head === 0 && workdir !== 0) {
workdirContent = await this.smartgitRef.envDeps.fs.promises.readFile(
plugins.path.join(this.repoDir, filepath),
'utf8'
);
}
// Handle deleted files
if (head !== 0 && workdir === 0) {
headContent = await plugins.isomorphicGit
.readBlob({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
oid: await plugins.isomorphicGit.resolveRef({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
ref: 'HEAD',
}),
filepath,
})
.then((result) => new TextDecoder().decode(result.blob));
}
if (headContent || workdirContent) {
const diff = plugins.diff.createTwoFilesPatch(
filepath,
filepath,
headContent,
workdirContent
);
diffs.push(diff);
}
}
return diffs;
}
/**
* Get all commit messages with their dates and package.json version at each commit
*/
public async getAllCommitMessages(): Promise<
{ date: string; version: string; message: string }[]
> {
const commits = await plugins.isomorphicGit.log({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
});
const results = [];
for (const commit of commits) {
let version = 'unknown';
try {
const packageJsonBlob = await plugins.isomorphicGit.readBlob({
fs: this.smartgitRef.envDeps.fs,
dir: this.repoDir,
oid: commit.oid,
filepath: 'package.json',
});
const packageJson = JSON.parse(new TextDecoder().decode(packageJsonBlob.blob));
version = packageJson.version;
} catch (error) {
// If package.json does not exist or any error occurs, leave version as 'unknown'
}
results.push({
date: new plugins.smarttime.ExtendedDate(commit.commit.committer.timestamp * 1000).exportToHyphedSortableDate(),
version: version,
message: commit.commit.message,
});
}
return results;
}
}

View File

@ -0,0 +1,40 @@
import * as plugins from './smartgit.plugins.js';
import { GitRepo } from './smartgit.classes.gitrepo.js';
export class Smartgit {
public smartenvInstance = new plugins.smartenv.Smartenv();
public envDeps: {
fs: any;
http: any;
} = {
fs: null,
http: null,
};
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'
);
} 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);
}
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;
}
}

View File

@ -1,16 +0,0 @@
import plugins = require("./smartgit.plugins");
import SmartgitCheck = require("./smartgit.check");
export let clone = (optionsArg: {
from: string,
to: string,
key?: string,
keyPath?: string,
keyPassphrase?: string
}) => {
let done = plugins.Q.defer();
plugins.smartfile.fs.ensureDir(optionsArg.to);
plugins.shelljs.exec(`git clone ${optionsArg.from} ${optionsArg.to}`);
done.resolve();
return done.promise;
};

View File

@ -1,15 +0,0 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export let commit = (dirPathArg:string,commitMessage:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.commit expects a valid git directory");
done.reject();
return done.promise;
};
// if everything is all right proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git commit -m "${commitMessage}")`);
done.resolve();
return done.promise;
};

View File

@ -1,12 +0,0 @@
import * as plugins from "./smartgit.plugins";
export let isGitDirectory = (dirPathArg):boolean => {
try {
return plugins.smartfile.fs.isDirectory(
plugins.path.join(dirPathArg,".git")
);
}
catch(err){
return false;
}
}

View File

@ -1,13 +0,0 @@
import plugins = require("./smartgit.plugins");
export let init = (dirPathArg:string) => {
let done = plugins.Q.defer();
if (typeof dirPathArg == "undefined") { //lets check if a destination is defined...
plugins.beautylog.error("smartgit.init requires an absolute directory path!");
return;
};
plugins.smartfile.fs.ensureDir(dirPathArg);
plugins.shelljs.exec(`(cd ${dirPathArg} && git init)`);
done.resolve(dirPathArg);
return done.promise;
};

View File

@ -1,9 +1,19 @@
import "typings-global";
// node native
import * as path from 'path';
export import path = require("path");
export import beautylog = require("beautylog");
export let Q = require("q");
export let shelljs = require("shelljs");
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");
export import smartstring = require("smartstring");
export { path };
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';
import * as smarttime from '@push.rocks/smarttime';
export { smartenv, smartfile, smartpath, smartpromise, smartstring, smarttime };
// third party
import * as diff from 'diff';
import isomorphicGit from 'isomorphic-git';
export { diff, isomorphicGit };

View File

@ -1,15 +0,0 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export let pull = (dirPathArg:string,sourceArg:string = "", branchArg:string = "") => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.pull expects a valid git directory");
done.reject();
return done.promise;
};
// if everything is allright proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git pull ${sourceArg} ${branchArg})`);
done.resolve(dirPathArg);
return done.promise;
};

View File

@ -1,15 +0,0 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export let push = (dirPathArg:string, sourceArg:string = "", branchArg:string = "") => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.push expects a valid git directory");
done.reject();
return done.promise;
}
// if everything seems allright proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git status)`);
done.resolve();
return done.promise;
};

View File

@ -1,60 +0,0 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
let add = (dirPathArg,remoteNameArg:string, remoteLinkArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.remote.add expects a valid git directory");
done.reject();
return done.promise;
};
if(!remoteNameArg) {
plugins.beautylog.error("smartgit.remote.add expects a valid remote name");
done.reject();
return done.promise;
};
if(!remoteLinkArg) {
plugins.beautylog.error("smartgit.remote.add expects a valid remote link");
done.reject();
return done.promise;
};
// if everything is all right proceed
plugins.shelljs.exec(`cd ${dirPathArg} && git remote add ${remoteNameArg} ${remoteLinkArg}`);
remote.list(dirPathArg);
done.resolve();
return done.promise;
};
let check = (dirPathArg:string, remoteNameArg:string, remoteLinkArg) => {
}
let list = (dirPathArg) => {
let done = plugins.Q.defer();
let remotes = {};
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.remote.list expects a valid git directory");
done.reject();
return done.promise;
};
// if everything is all right proceed
plugins.shelljs.exec(`cd ${dirPathArg} && git remote -v`).stdout;
done.resolve(remotes);
return done.promise;
};
let remove = (dirPathArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.remote.remove expects a valid git directory");
done.reject();
return done.promise;
};
// if everything is all right
}
export let remote = {
add: add,
list: list,
remove: remove
}

View File

@ -1,15 +0,0 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export let status = (dirPathArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.status expects a valid git directory");
done.reject();
return done.promise;
}
// if everything seems allright proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git status)`);
done.resolve();
return done.promise;
};

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}