Git Product home page Git Product logo

swig-cli-modules's Introduction

swig-cli-modules

The swig-cli-modules package is a collection of utility classes for setting up common swig tasks by project type or other generic grouping.

Swig documentation: https://github.com/mikey-t/swig

Example use: https://github.com/mikey-t/dotnet-react-sandbox (swigfile.ts)

Basic Info and Example

Swig is a CLI script that can execute any exported function from a swigfile (which is just a plain javascript or typescript file). To reduce repetition across projects, a "swig cli module" can be created in order to group together related tasks.

A medium-sized project like dotnet-react-sandbox might end up having a lot of dev automation tasks spanning several different types of activities. Rather than copy/paste what would normally be a relatively large swigfile.ts to each project that is based on the dotnet-react-sandbox template, we can encapsulate the functionality in a swig cli module and then import, configure and re-export all the relevant functions. This is the entire swigfile.ts for a dotnet-react-sandbox project:

import dotenv from 'dotenv'
import config from 'swig-cli-modules/ConfigDotnetReactSandbox'

config.init(dotenv.config)

export * from 'swig-cli-modules/DotnetReactSandbox'

Customization

If you want to run another task before a task from the swig cli module, you can import the function from the module and compose it together with your own like this:

import * as swigDocker from 'swig-cli-modules/DockerCompose'

async function runThisFirst() {
  // Do stuff
}

export const dockerUp = series(runThisFirst, swigDocker.dockerUp)

Ejecting

If you start out using a swig cli module and decide it doesn't do what you want, you can "eject" by simply copying and pasting the contents of the file from this library directly into your swigfile and customize it from there.

Make Your Own Swig CLI Module

You're welcome to create a module within this library, but note that these are simply groups of exported functions, so you could easily create your own library of modules in any location and in any format you like.

swig-cli-modules's People

Contributors

mikey-t avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.