Generate a command line interface for local scripts.
Often projects have local scripts:
scripts
└── lint.ts
This package generates a command line interface for them:
toolchains <command>
Commands:
toolchains lint Run linters
Options:
-p, --path Set the search path [default: "scripts"]
-i, --include Set the include pattern [default: "*.ts"]
-d, --debug Enable debug logging [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
The scripts can be written in TypeScript:
export default {
name: "lint",
description: "Run linters",
action: () => {
console.log("Running linters...");
},
};
Then the command line interface can be invoked:
toolchains lint
Running linters...
npm install toolchains
Documentation and more detailed examples are hosted on Github Pages.
You can use named exports for the name
, description
and action
:
export const name = "example";
export const description = "Does nothing";
export const action = () => {
console.log("Running");
};
You can also default export a function on its own:
export default function () {
console.log("Running");
}
--path
- Set the search path--include
- Set the include patternUnfortunately ts-node
does not allow you to consume the parsed module contents and dynamic imports won't accept typescript syntax without transpilation first.
To parse TypeScript files while respecting any tsconfig.json
options tscw-config
is used and the transpilation is performed in a temporary directory.
Libraries imported from the scripts aren't resolved by the TypeScript compiler.
To install dependencies:
yarn install
To run tests:
yarn test
To generate the documentation locally:
yarn docs
To run linters:
yarn lint
To run formatters:
yarn format
Please read this repository's Code of Conduct which outlines our collaboration standards and the Changelog for details on breaking changes that have been made.
This repository adheres to semantic versioning standards. For more information on semantic versioning visit SemVer.
Bump2version is used to version and tag changes. For example:
bump2version patch
Lots of love to the open source community!