Pliz is a cli tool that invokes JS functions (typically development, build, or deploy tasks).
Pliz can be supercharged with Google's zx for ultimate shell power.
When calling:
$ pliz bump minor
A function like this may be invoked:
// plizers.js
import { $ } from 'zx';
export async function bump([versionType]) {
await $`npm version ${versionType}`;
await $`git push`;
await $`git push --tags`;
}
- All tasks are written in javascript and can be easily invoked from command line1.
- Single source of truth, in a single file/folder.
- Reduction of cognitive load.
1 Existing shell scripts do not need migration as their invocation is still possible (via javascript).
Modern Javascript projects involve a multitude of development tasks. Typically these live in:
package.json
script commands:- shell syntax
- no comments
- sometimes require extra dependencies (eg,
cross-env
) - parametrisation and branching can be tricky
- shell scripts:
- another syntax to learn and maintain
- shells may differ across machines
scripts
folder- onboarding and discoverability may be sub-optimal
- our heads:
- What's the command to kill a process? Do everyone remember
-9
? What about Windows? - What's the command to enter a docker image interactive shell again?
- What's the command to kill a process? Do everyone remember
$ npm i -g pliz
Create the following plizers.js
file (or plizers/index.js
) in your project root:
const say = ([text]) => {
console.log(`${text}!`);
};
module.exports = {
say,
};
đź’ˇ Using ES6
yarn add --dev @babel/core @babel/register @babel/preset-env
pliz.config.js
:
require('@babel/register')({
presets: [
[
'@babel/preset-env',
{
targets: { node: 'current' },
},
],
],
});
plizers.js
:
export const say = ([text]) => {
console.log(`${text}!`);
};
In your shell:
$ pliz say Hello