Compare commits

...

60 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
35 changed files with 7843 additions and 939 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

23
.gitignore vendored
View File

@ -1,13 +1,20 @@
node_modules/
test/temp/
test/temp2/
.nogit/
# artifacts
coverage/
public/
pages/
#npm debug
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,68 +0,0 @@
# smartgit
smart git wrapper for node.
smartgit expects git to be installed on target machine.
## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartgit)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/smartgit)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartgit)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartgit/)
## Status for master
[![build status](https://gitlab.com/pushrocks/smartgit/badges/master/build.svg)](https://gitlab.com/pushrocks/smartgit/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartgit/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartgit/commits/master)
[![Dependency Status](https://david-dm.org/pushrocks/smartgit.svg)](https://david-dm.org/pushrocks/smartgit)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartgit/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartgit/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartgit/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartgit)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
We recommend the use of TypeScript for best in class intellisense
```javascript
// import smartgit:
import { GitRepo } from 'smartgit'
// Initialize smartgit:
// -- note: there are 3 ways to initialize smartgit
// -- -- 1. with a existing Git repo
// -- -- 2. with a cloned Git repo
// -- -- 3. with a new Git repo
// -- 1. existing Git Repo:
let myExistingGitRepo = new GitRepo('/path/to/existing/git/repo/')
// -- 2. cloned Git Repo:
let myClonedGitRepo: GitRepo
smartgit.createRepoFromClone('git@github.com:username/reponame.git')
.then(gitRepo => { // non blocking
myClonedGitRepo = gitRepo
})
// -- 3. new Git Repo
let myNewGitRepo: GitRepo
smartgit.createRepoFromInit('/path/to/new/folder') // smartgit will create any new folder, be careful
.then(gitRepo => { // non blocking
myNewGitRepo = gitRepo
})
// Using smartgit instance
// -- most used actions
// -- all actions return promises, so make sure to use promise chaining for any dependent tasks
myExistingGitRepo.addAll() // returns promise, stages all changed files
myExistingGitRepo.add(['relative/path/to/file.txt','another/file2.txt']) // returns promise, stages specific files
myExistingGitRepo.commit('my commit message') // returns promise, commits staged files
myExistingGitRepo.status() // returns promise
.then(status => { // Use TypeScript for status type information
})
myExistingGitRepo.check() // returns promise, checks repo health
myExistingGitRepo.remoteAdd('git@github.com:username/reponame.git')
```
Tip: use [smartssh](https://npmjs.com/smartssh) to setup your SSH environment
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)

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

12
dist/index.d.ts vendored
View File

@ -1,12 +0,0 @@
/// <reference types="q" />
import * as q from 'q';
import { GitRepo } from './smartgit.classes.gitrepo';
export { GitRepo };
/**
* creates a new GitRepo Instance after cloning a project
*/
export declare let createRepoFromClone: (fromArg: string, toArg: string) => q.Promise<GitRepo>;
/**
* creates a new GitRepo instance after initializing a new Git Repository
*/
export declare let createRepoFromInit: (destinationDirArg: string) => q.Promise<GitRepo>;

28
dist/index.js vendored
View File

@ -1,28 +0,0 @@
"use strict";
const q = require("q");
const plugins = require("./smartgit.plugins");
const smartgit_classes_gitrepo_1 = require("./smartgit.classes.gitrepo");
exports.GitRepo = smartgit_classes_gitrepo_1.GitRepo;
/**
* creates a new GitRepo Instance after cloning a project
*/
exports.createRepoFromClone = (fromArg, toArg) => {
let done = q.defer();
plugins.smartfile.fs.ensureDir(toArg);
plugins.shelljs.exec(`git clone ${fromArg} ${toArg}`);
let newRepo = new smartgit_classes_gitrepo_1.GitRepo(toArg);
done.resolve(newRepo);
return done.promise;
};
/**
* creates a new GitRepo instance after initializing a new Git Repository
*/
exports.createRepoFromInit = (destinationDirArg) => {
let done = q.defer();
plugins.smartfile.fs.ensureDir(destinationDirArg);
plugins.shelljs.exec(`cd ${destinationDirArg} && git init`);
let newRepo = new smartgit_classes_gitrepo_1.GitRepo(destinationDirArg);
done.resolve(newRepo);
return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GtDQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FBQTtJQUM1QyxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3ZCLENBQUMsQ0FBQSJ9

View File

@ -1,58 +0,0 @@
/// <reference types="q" />
import * as q from 'q';
/**
* class GitRepo allows access to git directories from node
*/
export declare class GitRepo {
repoBase: string;
constructor(repoBaseArg: string);
/**
* checks if the Repo is valid
*/
check(): boolean;
/**
* stage all files in working directory
* @executes SYNC
*/
addAll(): q.Promise<{}>;
/**
* add a remote to the GitRepo
*/
remoteAdd(remoteNameArg: string, remoteLinkArg: string): q.Promise<{}>;
/**
* list remotes for a Gip
*/
remoteList(): q.Promise<{}>;
/**
* remove remote
*/
remoteRemove(dirPathArg: string): q.Promise<{}>;
/**
* commit all files that are currently staged
*/
commit(commitMessage: string): q.Promise<{}>;
/**
* pull latest changes from remote
*/
pull(sourceArg?: string, branchArg?: string): q.Promise<{}>;
/**
* push new commits to remote
*/
push(remoteNameArg?: string, remoteBranchArg?: string): q.Promise<{}>;
/**
* sync
*/
sync(): void;
/**
* get the current status
*/
status(): q.Promise<{}>;
}
/**
* creates a new GitRepo Instance after cloning a project
*/
export declare let createRepoFromClone: (fromArg: string, toArg: string) => q.Promise<GitRepo>;
/**
* creates a new GitRepo instance after initializing a new Git Repository
*/
export declare let createRepoFromInit: (destinationDirArg: string) => void;

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
import 'typings-global';
export import path = require('path');
export import beautylog = require('beautylog');
export import shelljs = require('shelljs');
export import smartfile = require('smartfile');
export import smartpath = require('smartpath');
export import smartstring = require('smartstring');

View File

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

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;

View File

@ -1,12 +1,31 @@
{
"npmts": {
"mode": "default",
"codecov": true,
"coverageTreshold": 71
},
"npmci": {
"globalNpmTools": [
"npmts"
]
"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,44 +1,69 @@
{
"name": "smartgit",
"version": "1.0.5",
"description": "smart git wrapper for node",
"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)"
"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": "*",
"@types/shelljs": "^0.3.32",
"beautylog": "^6.0.0",
"q": "^1.4.1",
"shelljs": "^0.7.5",
"simple-git": "^1.62.0",
"smartfile": "^4.1.0",
"smartpath": "^3.2.5",
"smartstring": "^2.0.22",
"typings-global": "^1.0.14"
"@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": {
"@types/should": "^8.1.30",
"npmts-g": "^5.2.8",
"should": "^11.1.1",
"typings-test": "^1.0.3"
}
"@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");

@ -1 +0,0 @@
Subproject commit a261a2ea02b39d8ff8c66b078a894a75a0d4f457

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import 'typings-test';

View File

@ -1,110 +0,0 @@
"use strict";
require("typings-test");
let shelljs = require('shelljs');
const path = require("path");
const should = require("should");
const smartgit = require("../dist/index");
let paths = {
temp1: 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 () {
let testGitRepo;
let testGitRepoCloned;
let testGitRepoInit;
describe('instance', function () {
it('should error for invalid path', function (done) {
try {
testGitRepo = new smartgit.GitRepo(paths.temp1);
}
catch (err) {
should(testGitRepo).not.be.instanceOf(smartgit.GitRepo);
done();
}
});
it('should init a new repo', function (done) {
this.timeout(40000);
smartgit.createRepoFromInit(paths.temp1)
.then((gitRepo) => {
should(gitRepo).be.instanceOf(smartgit.GitRepo);
done();
}).catch(err => {
throw err;
});
});
it('should create am instance for an existing repo', function () {
testGitRepo = new smartgit.GitRepo(paths.temp1);
should(testGitRepo).be.instanceOf(smartgit.GitRepo);
});
it('should clone a repository using ssh and sshkey', function (done) {
this.timeout(40000);
smartgit.createRepoFromClone('git@gitlab.com:sandboxzone/sandbox-testrepo.git', paths.temp2)
.then((gitRepo) => {
should(gitRepo).be.instanceOf(smartgit.GitRepo);
done();
}).catch(err => {
throw err;
});
});
it('should clone a repository using https', function (done) {
this.timeout(40000);
smartgit.createRepoFromClone('https://gitlab.com/sandboxzone/sandbox-testrepo.git', paths.temp3)
.then((gitRepo) => {
should(gitRepo).be.instanceOf(smartgit.GitRepo);
done();
}).catch(err => {
throw err;
});
});
});
describe('.add', function () {
it('should add a file to an existing repository', function () {
shelljs.exec(`(cd ${paths.temp1} && cp ../test.js .)`);
testGitRepo.addAll();
});
});
describe('.check()', function () {
it('should check a git repo', function () {
let checkResult = testGitRepo.check();
should(checkResult).be.true();
});
});
describe('commit', function () {
it('should commit a new file to an existing repository', function () {
testGitRepo.commit('added a new file');
});
});
describe('pull', function () {
this.timeout(40000);
it('should pull from origin', function (done) {
testGitRepo.pull()
.then(() => {
done();
});
});
});
describe('push', function () {
this.timeout(40000);
it('should push to origin', function (done) {
testGitRepo.push('origin', 'master')
.then(() => {
done();
});
});
});
describe('remote', function () {
it('should add a remote', function () {
testGitRepo.remoteAdd('origin2', 'https://github.com/pushrocks/somerepo');
});
it('should', function (done) {
testGitRepo.remoteList()
.then(() => {
done();
});
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUVyQixJQUFJLE9BQU8sR0FBRyxPQU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CAAC"}

View File

@ -1,112 +1,51 @@
import 'typings-test'
import beautylog = require('beautylog')
let shelljs = require('shelljs')
import path = require('path')
import * as should from 'should'
import { tap, expect } from '@push.rocks/tapbundle';
import * as smartgit from '../ts/index.js';
import smartgit = require('../dist/index')
let paths = {
temp1: 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';
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);
});
describe('smartgit', function () {
let testGitRepo: smartgit.GitRepo
let testGitRepoCloned: smartgit.GitRepo
let testGitRepoInit: smartgit.GitRepo
describe('instance', function () {
it('should error for invalid path', function (done) {
try {
testGitRepo = new smartgit.GitRepo(paths.temp1)
} catch (err) {
should(testGitRepo).not.be.instanceOf(smartgit.GitRepo)
done()
}
})
it('should init a new repo', function (done) {
this.timeout(40000)
smartgit.createRepoFromInit(paths.temp1)
.then((gitRepo) => {
should(gitRepo).be.instanceOf(smartgit.GitRepo)
done()
}).catch(err => {
throw err
})
})
it('should create am instance for an existing repo', function () {
testGitRepo = new smartgit.GitRepo(paths.temp1)
should(testGitRepo).be.instanceOf(smartgit.GitRepo)
})
it('should clone a repository using ssh and sshkey', function (done) {
this.timeout(40000)
smartgit.createRepoFromClone('git@gitlab.com:sandboxzone/sandbox-testrepo.git', paths.temp2)
.then((gitRepo) => {
should(gitRepo).be.instanceOf(smartgit.GitRepo)
done()
}).catch(err => {
throw err
})
})
it('should clone a repository using https', function (done) {
this.timeout(40000)
smartgit.createRepoFromClone('https://gitlab.com/sandboxzone/sandbox-testrepo.git', paths.temp3)
.then((gitRepo) => {
should(gitRepo).be.instanceOf(smartgit.GitRepo)
done()
}).catch(err => {
throw err
})
})
})
describe('.add', function () {
it('should add a file to an existing repository', function () {
shelljs.exec(`(cd ${paths.temp1} && cp ../test.js .)`)
testGitRepo.addAll()
})
})
describe('.check()', function() {
it('should check a git repo', function() {
let checkResult = testGitRepo.check()
should(checkResult).be.true()
})
})
describe('commit', function () {
it('should commit a new file to an existing repository', function () {
testGitRepo.commit('added a new file')
})
})
describe('pull', function () {
this.timeout(40000)
it('should pull from origin', function (done) {
testGitRepo.pull()
.then(() => {
done()
})
})
})
describe('push', function () {
this.timeout(40000)
it('should push to origin', function (done) {
testGitRepo.push('origin', 'master')
.then(() => {
done()
})
})
})
describe('remote', function () {
it('should add a remote', function () {
testGitRepo.remoteAdd('origin2', 'https://github.com/pushrocks/somerepo')
})
it('should', function(done) {
testGitRepo.remoteList()
.then(() => {
done()
})
})
})
})
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,31 +1,2 @@
import * as q from 'q'
import plugins = require("./smartgit.plugins");
import { GitRepo } from './smartgit.classes.gitrepo'
export {
GitRepo
}
/**
* creates a new GitRepo Instance after cloning a project
*/
export let createRepoFromClone = (fromArg: string, toArg: string) => {
let done = q.defer<GitRepo>()
plugins.smartfile.fs.ensureDir(toArg)
plugins.shelljs.exec(`git clone ${fromArg} ${toArg}`)
let newRepo = new GitRepo(toArg)
done.resolve(newRepo)
return done.promise
}
/**
* creates a new GitRepo instance after initializing a new Git Repository
*/
export let createRepoFromInit = (destinationDirArg: string) => {
let done = q.defer<GitRepo>()
plugins.smartfile.fs.ensureDir(destinationDirArg)
plugins.shelljs.exec(`cd ${destinationDirArg} && git init`)
let newRepo = new GitRepo(destinationDirArg)
done.resolve(newRepo)
return done.promise
}
export * from './smartgit.classes.gitrepo.js';
export * from './smartgit.classes.smartgit.js';

View File

@ -1,151 +1,228 @@
import * as q from 'q'
import * as plugins from './smartgit.plugins'
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 {
repoBase: string
constructor(repoBaseArg: string) {
this.repoBase = repoBaseArg
if (!this.check()) {
throw new Error('no valid git repo')
}
// 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);
}
}
/**
* checks if the Repo is valid
*/
check(): boolean {
return plugins.smartfile.fs.isDirectory(plugins.path.join(this.repoBase, '.git'))
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,
});
}
/**
* stage all files in working directory
* @executes SYNC
*/
addAll() {
let done = q.defer()
plugins.shelljs.exec(`(cd ${this.repoBase} && git add -A && git status)`)
done.resolve(this.repoBase)
return done.promise
};
/**
* add a remote to the GitRepo
*/
remoteAdd(remoteNameArg: string, remoteLinkArg: string) {
let done = q.defer()
if (!remoteNameArg) {
let err = new Error('smartgit.remote.add expects a valid remote name')
plugins.beautylog.error(err.message)
done.reject(err)
return done.promise
};
if (!remoteLinkArg) {
let err = new Error()
plugins.beautylog.error(err.message)
done.reject(err)
return done.promise
};
// if everything is all right proceed
plugins.shelljs.exec(`cd ${this.repoBase} && git remote add ${remoteNameArg} ${remoteLinkArg}`)
done.resolve()
return done.promise
}
/**
* list remotes for a Gip
*/
remoteList() {
let done = q.defer()
let remotes = {}
plugins.shelljs.exec(`cd ${this.repoBase} && git remote -v`)
done.resolve(remotes)
return done.promise
};
/**
* remove remote
*/
remoteRemove(dirPathArg: string) {
let done = q.defer()
return done.promise
}
/**
* commit all files that are currently staged
*/
commit(commitMessage: string) {
let done = q.defer()
plugins.shelljs.exec(`(cd ${this.repoBase} && git commit -m "${commitMessage}")`)
done.resolve()
return done.promise
}
/**
* pull latest changes from remote
*/
pull(sourceArg: string = '', branchArg: string = '') {
let done = q.defer()
// if everything is allright proceed
plugins.shelljs.exec(`(cd ${this.repoBase} && git pull ${sourceArg} ${branchArg})`)
done.resolve()
return done.promise
}
/**
* push new commits to remote
*/
push(remoteNameArg: string = '', remoteBranchArg: string = '') {
let done = q.defer()
// if everything seems allright proceed
plugins.shelljs.exec(`(cd ${this.repoBase} && git push ${remoteNameArg} ${remoteBranchArg})`)
done.resolve()
return done.promise
}
/**
* sync
*/
sync() {
this.pull().then(() => {
this.push()
})
}
/**
* get the current status
*/
status() {
let done = q.defer()
plugins.shelljs.exec(`(cd ${this.repoBase} && git status)`)
done.resolve()
return done.promise
}
}
/**
* creates a new GitRepo Instance after cloning a project
*/
export let createRepoFromClone = (fromArg: string, toArg: string) => {
let done = q.defer<GitRepo>()
plugins.smartfile.fs.ensureDir(toArg)
plugins.shelljs.exec(`git clone ${fromArg} ${toArg}`)
let newRepo = new GitRepo(toArg)
done.resolve(newRepo)
return done.promise
}
/**
* creates a new GitRepo instance after initializing a new Git Repository
*/
export let createRepoFromInit = (destinationDirArg: string) => {
let done = q.defer<GitRepo>()
plugins.smartfile.fs.ensureDir(destinationDirArg)
plugins.shelljs.exec(`cd destinationDirArg && git init`)
let newRepo = new GitRepo(destinationDirArg)
done.resolve(newRepo)
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,7 +1,19 @@
import 'typings-global'
export import path = require('path')
export import beautylog = require('beautylog')
export import shelljs = require('shelljs')
export import smartfile = require('smartfile')
export import smartpath = require('smartpath')
export import smartstring = require('smartstring')
// node native
import * as path from 'path';
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 };

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"
]
}

View File

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