Gathering detailed insights and metrics for swig-cli-modules
Gathering detailed insights and metrics for swig-cli-modules
Gathering detailed insights and metrics for swig-cli-modules
Gathering detailed insights and metrics for swig-cli-modules
npm install swig-cli-modules
Typescript
Module System
Node Version
NPM Version
72.4
Supply Chain
81.1
Quality
75.3
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Built with Next.js • Fully responsive • SEO optimized • Open source ready
Total Downloads
15,926
Last Day
2
Last Week
18
Last Month
113
Last Year
5,086
MIT License
30 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Oct 02, 2023
Latest Version
0.3.3
Package Id
swig-cli-modules@0.3.3
Unpacked Size
349.35 kB
Size
52.39 kB
File Count
124
NPM Version
10.2.3
Node Version
20.10.0
Published on
Feb 10, 2024
Cumulative downloads
Total Downloads
Last Day
0%
2
Compared to previous day
Last Week
800%
18
Compared to previous week
Last Month
222.9%
113
Compared to previous month
Last Year
-53.1%
5,086
Compared to previous year
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)
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:
1import dotenv from 'dotenv' 2import config from 'swig-cli-modules/ConfigDotnetReactSandbox' 3 4config.init(dotenv.config) 5 6export * from 'swig-cli-modules/DotnetReactSandbox'
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:
1import * as swigDocker from 'swig-cli-modules/DockerCompose' 2 3async function runThisFirst() { 4 // Do stuff 5} 6 7export const dockerUp = series(runThisFirst, swigDocker.dockerUp) 8
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.
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.
No vulnerabilities found.