https://github.com/izhaki/pliz
A minimalistic task router for Node.
https://github.com/izhaki/pliz
cli development nodes tasks
Last synced: 14 days ago
JSON representation
A minimalistic task router for Node.
- Host: GitHub
- URL: https://github.com/izhaki/pliz
- Owner: Izhaki
- License: mit
- Created: 2019-11-12T00:18:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-19T19:43:50.000Z (over 2 years ago)
- Last Synced: 2025-02-15T00:32:48.149Z (over 1 year ago)
- Topics: cli, development, nodes, tasks
- Language: JavaScript
- Homepage:
- Size: 1.3 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Pliz is a cli tool that invokes JS functions (typically development, build, or deploy tasks).
Pliz can be supercharged with [Google's zx](https://github.com/google/zx) for ultimate shell power.
# Example
When calling:
```shell
$ pliz bump minor
```
A function like this may be invoked:
```js
// plizers.js
import { $ } from 'zx';
export async function bump([versionType]) {
await $`npm version ${versionType}`;
await $`git push`;
await $`git push --tags`;
}
```
# Rationale
## With pliz
- 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)._
## Without pliz
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?
# Quick Start
## 1. Install Globally
```shell
$ npm i -g pliz
```
## 2. Create plizers
Create the following `plizers.js` file (or `plizers/index.js`) in your project root:
```js
const say = ([text]) => {
console.log(`${text}!`);
};
module.exports = {
say,
};
```
💡 Using ES6
```shell
yarn add --dev @babel/core @babel/register @babel/preset-env
```
`pliz.config.js`:
```js
require('@babel/register')({
presets: [
[
'@babel/preset-env',
{
targets: { node: 'current' },
},
],
],
});
```
`plizers.js`:
```js
export const say = ([text]) => {
console.log(`${text}!`);
};
```
## 3. Use
In your shell:
```shell
$ pliz say Hello
```