Denogent is a tool for creating and running build pipelines

Denogent is a tool for creating and running build pipelines

Disclaimer: This tool is in active development.* .Denogent is a tool for creating and running build pipelines

denogent

Disclaimer: This tool is in active development.

Actions Status

denogent is a tool for creating and running build pipelines.

Installation

To install the latest version of the denogent CLI tool, run

deno install -A --unstable https://deno.land/x/denogent/denogent.ts

The Build File

The build file is the place where you define your build pipeline. To create one, run

denogent create

By default, denogent create will create the build file at build/build.ts. To create the file at a different path, run

denogent create --file path/to/buid/file.ts

Once you open the newly created build file, you'll see

import { createBuilder } from "https://deno.land/x/denogent/lib/core/builder.ts";
import { task } from "https://deno.land/x/denogent/lib/core/task.ts";

const someTask = task('some task')
    .does(async ctx => {
        // do something here
        ctx?.logger.info('doing something');
    });

createBuilder({
    name: 'build',
    targetTasks: someTask,
    ciIntegrations: [] // define CI integrations here
});

Task

A task is a function that executes code inside of the build pipeline.

Dependencies

Tasks can have dependencies on other tasks. For example,

const compile = task('compile')
    .does(async ctx => {
        // compile program
    });

const test = task('test')
    .dependsOn(compile)
    .does(async ctx => {
        // run tests
    });

const buildImage = task('build image')
    .dependsOn(compile)
    .does(async ctx => {
        // build image
    });

const publishImage = task('publish image')
    .dependsOn([test, buildImage])
    .does(async ctx => {
        // publish image
    });

In this scenario, task compile will run at the beginning and then will triggers tasks test and buildImage which will run in parallel and will then trigger the publush image task.

Conditions

Tasks can define conditions for their run. For example,

import git from "https://deno.land/x/denogent/lib/git/git.ts";

...

const publishImage = task('publish image')
    .dependsOn([test, buildImage])
    .when(async ctx => await git.isTagged({ logger: false }))
    .does(async ctx => {
        // publish image
    });

In this scenario, we tell the publish image to run only when the the commit that has triggered the build is tagged.

Execute Build Pipeline

To execute the build pipeline locally, run

denogent run --file build/build.ts

CI Systems Integration

Although denogent provides a tool for executing build pipelines, it's no a CI system. However, you can run denogent pipelines from a CI system, and denogent provides convenient way to integrate with popular CI systems.

In the build.ts file, in the call to createBuilder, you can add a CI system integration. Once you've defined your CI system integration in the build file, run

denogent generate --file build/build.ts --ci {the name of the CI system}

to generate manifests files for said CI system.

GitHub Actions

Here's an example of integrating with GitHub Actions.

In build.ts

import { createGitHubActions } from "https://deno.land/x/denogent/lib/ci/github_actions/github_actions.ts";

...

createBuilder({
    name: 'build',
    targetTasks: someTask,
    ciIntegrations: [
        createGitHubActions({
            image: 'ubuntu-latest',
            onPRBranches: ['master'] // run pipeline on PR that merges to master
        })
    ]
});
denogent generate --file build/build.ts --ci github_actions

Download Details:

Author: areller

Source Code: https://github.com/areller/denogent

deno nodejs node javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, it’s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Node’s shortcomings