0.3.3 • Published 3 months ago

swig-cli-modules v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

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.

0.3.3

3 months ago

0.3.2

5 months ago

0.3.1

5 months ago

0.0.17

6 months ago

0.0.18

6 months ago

0.1.0

6 months ago

0.3.0

5 months ago

0.2.1

5 months ago

0.1.2

6 months ago

0.2.0

5 months ago

0.1.1

6 months ago

0.2.3

5 months ago

0.2.2

5 months ago

0.0.15

7 months ago

0.0.16

7 months ago

0.0.13

7 months ago

0.0.12

7 months ago

0.0.11

7 months ago

0.0.10

7 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago