Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Asuha: the Webhook server for online git hosting services.
WIP
Currently only support for Bitbucket. There are other great packages for Github (e.g. probot) that you can have a try ;)
npm i asuha
npm i asuha -g
npm install
commander.js
and express
, if in your use case, none of those above is required (i.e. you are not using as CLI command and you prefer builtin http
/https
server), you can install dependencies without them through
npm install --no-optional
Document is WIP
See Configuration for available configs.
configObj
objectconfigKey
stringconfigValue
anyIt is an alias for net.Server#listen(). Read the document from Node official for information about parameters.
cb
FunctionSee Events for available events and listener parameters.
Note that listener can be either a normal function or an async function (or a function with
Promise
return type). Asuha adoptsawait-event-emitter
as her event handling system; therefore, listeners are executed one by one in the order they were defined.
event
objectlistener
FunctionJust like EventEmitter API, you can call this method with one parameter event
to remove all listeners related to this event or specified the listener as the second parameter.
MUST be called after
Asuha#listen()
has been called; otherwise, nothing happens.
event
objectlistener
FunctionCreating a http server with Asuha as the request handler.
Creating a https server with Asuha as the request handler.
httpsOptions
object
Same as options for https.createServer()
Optional dependencies
express
is required!
Creating an express server with Asuha as an express middleware. You can pass your custom express app as the first argument.
app
express.ApplicationThis is the default public configuration for Asuha. Use Asuha#set()
to change the settings.
{
cwd: process.cwd(),
/**
* Auto-scan the working directory to find local repositories.
* Local Repo Scanning Algorithm is described as below.
*/
autoScan: true,
/**
* default to ignore repository directories whose names start with '.' or '#';
* you can use it to disable a repository
* @type {string|RegExp}
*/
match: /^[^.#].*$/,
/**
* Pre-configured repository mappings with local path. See the example.
* @type {{ [repoHost: string]: { [repoFullname: string]: string } }}
* @example {
* "github.com": {
* "momocow/Asuha": "/repo/asuha"
* }
* }
*/
repoMappings: {},
/**
* Each element is first constructed to a RegExp
* then call its RegExp#test() to compare against the remote git event header.
* @type {Array(string|RegExp)}
*/
subscribeEvents: [ 'push' ],
/**
* Commands executed in serial by child_process#exec()
* @type {string[]}
*/
actions: [
'git pull'
],
/**
* Stdio piping for each action
*/
stdio: {
/**
* @type {Writable}
*/
stdout: process.stdout,
/**
* @type {Writable}
*/
stderr: process.stderr
}
}
The following events are listed in the order which they are fired when a remote event is received.
Note that
action.pre
andaction.post
can be fired multiple times in pair according to the number of configured actions.
init
fired only once after Asuha#init() called
repoPath
stringrepoFullname
stringhost
stringremote
repo
RepoMetaactions.pre
repo
RepoMetaactions
string[]repoPath
stringaction.pre
repo
RepoMetaaction
stringrepoPath
stringaction.post
repo
RepoMetaaction
stringrepoPath
stringactions.post
repo
RepoMetaactions
string[]repoPath
stringdone
repo
RepoMetaFor all remote events, see Github or Bitbucket webhook doc for more info.
{
/**
* @example 'Asuha'
*/
name: string,
/**
* @example 'momocow/Asuha'
*/
fullname: string,
/**
* @example 'momocow'
*/
owner: string,
/**
* the format of this field is host-specified
* @example 'push' for Github; 'repo:push' for Bitbucket
*/
event: string,
/**
* Empty if the event is not a push event
* @example [{
* hash: '709d658dc5b6d6afcd46049c2f332ee3f515a67d',
* author: 'momocow <momocow.me@gmail.com>', // host-specified!
* message: 'new commit message\n',
* timestamp: new Date('2015-06-09T03:34:49+00:00'),
* }]
*/
commits: {
hash: string,
message: string,
author: string,
timestamp: Date
}[]
}
http
server with Asuha// use .set() to configure
// use .on()/.once() to listen for Asuha events
const asuha = Asuha.http()
.set('actions', [ 'git pull --rebase' ])
.set('cwd', __dirname)
.on('debug', console.debug.bind(console))
.listen(/* Same args as http.Server.listen() */ function () {
const { port, address } = asuha.server.address() // http.Server.address()
console.debug('Asuha is listening at %s:%d', address, port)
})
FAQs
Asuha: the Webhook server for online git hosting services.
We found that asuha demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.