1.0.0 • Published 10 months ago
@sumor/git-builder v1.0.0
git-builder
A Sumor Cloud Tool.
More Documentation
A git version library, easily packaging version and generate specific package with env.
Installation
npm i @sumor/git-builder --save
Prerequisites
Node.JS version
Require Node.JS version 18.x or above
require Node.JS ES module
As this package is written in ES module,
please change the following code in your package.json
file:
{
"type": "module"
}
Usage
import gitBuilder from '@sumor/git-builder'
const result = await gitBuilder({
// git url and credentials
url: '<git url>', // mandatory
token: '<git token>', // mandatory, if username and password are not provided
username: '<git username>', // mandatory, if token is not provided
password: '<git password>', // mandatory, if token is not provided
// target commit
target: '<target commit>', // mandatory, can be a branch or a tag or a commit
// post actions
assets: [
// optional, it will be copied to the git project root path
'<asset 1 path>',
'<asset 2 path>'
],
build: async env => {
// optional
// env is the git project root path
// you can do anything you want before packaging
}
})
console.log(result)
/*
{
commit: '<commit id>',
path: '<output zip path>'
}
*/
1.0.0
10 months ago