Skip to content

Commit 391096c

Browse files
author
Charlike Mike Reagent
committed
major: docs + v1 release
Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>
1 parent 2fa6e68 commit 391096c

5 files changed

Lines changed: 203 additions & 366 deletions

File tree

.verb.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ Project is [semantically](https://semver.org) & automatically released on [Circl
3737
3838
-->
3939

40+
## Features
41+
- Super composable scripts/tasks.
42+
- Powerful, fast and simple.
43+
- Built-in monorepo support.
44+
- Infinitly extensible shareable configs/presets of scripts/tasks.
45+
- Future-proof, intuitive API and resolving design.
46+
- "Task runner" or "Command executor"
47+
- Great for building `exec` commands on top of it
48+
- Main goal: standardized method for executing
49+
+ we can build `pnpm exec` and `npm exec` on top of it
50+
+ improve Yarn's main command-less call, e.g. `yarn` without params/arguments/flags
51+
4052
## Table of Contents
4153

4254
<!-- toc -->
@@ -51,9 +63,77 @@ _We highly recommend to use Yarn when you think to contribute to this project._
5163
$ yarn add {%= name %}
5264
```
5365

66+
## CLI
67+
68+
To start using it is just enough to execute
69+
70+
```bash
71+
scripts # or tunnckocore-scripts, or @tunnckocore/scripts
72+
```
73+
74+
It will list you all the available tasks/scripts.
75+
The cool thing is that it can load shareable configs, such as the `scripts.config.js` file in this repository. To do that, you need to pass some npm module as `extends` script.
76+
77+
For example
78+
79+
```json
80+
{
81+
"scripts": {
82+
"start": "scripts",
83+
"extends": "@myorg/our-scripts"
84+
}
85+
}
86+
```
87+
88+
Then everything will be available through running `yarn start` or `npm start`.
89+
The tasks in those "preset / config" files are nothing more than a string, array of strings
90+
(executed in sequence), or function which may return string or array of mixed types.
91+
92+
93+
Feature number X. You can create hooks for any installed CLI program.
94+
95+
Lets say we have `eslint` install, right? Then we can create such `pre` and `post` hooks
96+
in our config:
97+
98+
```js
99+
export const preeslint = 'echo "Before ESLint run"'
100+
export const posteslint = 'echo "After ESLint run"'
101+
```
102+
103+
And just run `yarn start eslint index.js --fix`
104+
105+
Another feature is that you all this works in monorepo environment too.
106+
Normally, if you didn't know to now, you can run any install CLI program with yarn.
107+
For example `yarn eslint ...` or `yarn babel`. Yes, but this not works well in monorepo environments and that's why projects such as Yarn Workspaces, Pnpm's `pnpm recurisve` and Lerna exists. All of them
108+
have their Pros and Cons, same here with `@tunnckocore/scripts`.
109+
110+
The thing is, that we can do that with `yarn start`.
111+
112+
With shareable configs/tasks/scripts everything goes great. You can share even between monorepos,
113+
or extend each other configs.
114+
115+
54116
## API
55117

56118
<!-- docks-start -->
119+
_Generated using [docks](http://npm.im/docks)._
120+
121+
### [src/index.js](/src/index.js)
122+
123+
#### [scripts](/src/index.js#L20)
124+
Collecting tasks/scripts from various places such as `scripts.config.js`
125+
or even all the defined ones from `package.json`'s field `scripts`.
126+
You can also pass `scripts.extends` and pass local javascript file
127+
or some npm module which in turn can be either CJS or ESM written.
128+
129+
**Params**
130+
- `[argv]` **{Array}** array of string, defaults to `process.argv.slice(2)`
131+
- `[options]` **{object}** optioanl settings, like `cwd` and `manager`, also can pass `tasks` from here
132+
133+
**Returns**
134+
- `Promise` if object is resolved, then it's all the collected tasks/scripts from configs,
135+
if array, then it's array of [execa][] results.
136+
57137
<!-- docks-end -->
58138

59139

README.md

Lines changed: 99 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,48 +37,127 @@ Project is [semantically](https://semver.org) & automatically released on [Circl
3737
3838
-->
3939

40+
## Features
41+
- Super composable scripts/tasks.
42+
- Powerful, fast and simple.
43+
- Built-in monorepo support.
44+
- Infinitly extensible shareable configs/presets of scripts/tasks.
45+
- Future-proof, intuitive API and resolving design.
46+
- "Task runner" or "Command executor"
47+
- Great for building `exec` commands on top of it
48+
- Main goal: standardized method for executing
49+
+ we can build `pnpm exec` and `npm exec` on top of it
50+
+ improve Yarn's main command-less call, e.g. `yarn` without params/arguments/flags
51+
4052
## Table of Contents
4153

4254
- [Install](#install)
55+
- [CLI](#cli)
4356
- [API](#api)
57+
* [src/index.js](#srcindexjs)
58+
+ [scripts](#scripts)
4459
- [See Also](#see-also)
4560
- [Contributing](#contributing)
46-
- [Follow the Guidelines](#follow-the-guidelines)
47-
- [Support the project](#support-the-project)
48-
- [OPEN Open Source](#open-open-source)
49-
- [Wonderful Contributors](#wonderful-contributors)
61+
* [Follow the Guidelines](#follow-the-guidelines)
62+
* [Support the project](#support-the-project)
63+
* [OPEN Open Source](#open-open-source)
64+
* [Wonderful Contributors](#wonderful-contributors)
5065
- [License](#license)
5166

5267
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
5368

5469
## Install
5570

56-
This project requires [**Node.js**](https://nodejs.org) **^8.11.0 || ^10.12.0**. Install it using
71+
This project requires [**Node.js**](https://nodejs.org) **^8.11.0 || >=10.13.0**. Install it using
5772
[**yarn**](https://yarnpkg.com) or [**npm**](https://npmjs.com).
5873
_We highly recommend to use Yarn when you think to contribute to this project._
5974

6075
```bash
6176
$ yarn add @tunnckocore/scripts
6277
```
6378

79+
## CLI
80+
81+
To start using it is just enough to execute
82+
83+
```bash
84+
scripts # or tunnckocore-scripts, or @tunnckocore/scripts
85+
```
86+
87+
It will list you all the available tasks/scripts.
88+
The cool thing is that it can load shareable configs, such as the `scripts.config.js` file in this repository. To do that, you need to pass some npm module as `extends` script.
89+
90+
For example
91+
92+
```json
93+
{
94+
"scripts": {
95+
"start": "scripts",
96+
"extends": "@myorg/our-scripts"
97+
}
98+
}
99+
```
100+
101+
Then everything will be available through running `yarn start` or `npm start`.
102+
The tasks in those "preset / config" files are nothing more than a string, array of strings
103+
(executed in sequence), or function which may return string or array of mixed types.
104+
105+
Feature number X. You can create hooks for any installed CLI program.
106+
107+
Lets say we have `eslint` install, right? Then we can create such `pre` and `post` hooks
108+
in our config:
109+
110+
```js
111+
export const preeslint = 'echo "Before ESLint run"'
112+
export const posteslint = 'echo "After ESLint run"'
113+
```
114+
115+
And just run `yarn start eslint index.js --fix`
116+
117+
Another feature is that you all this works in monorepo environment too.
118+
Normally, if you didn't know to now, you can run any install CLI program with yarn.
119+
For example `yarn eslint ...` or `yarn babel`. Yes, but this not works well in monorepo environments and that's why projects such as Yarn Workspaces, Pnpm's `pnpm recurisve` and Lerna exists. All of them
120+
have their Pros and Cons, same here with `@tunnckocore/scripts`.
121+
122+
The thing is, that we can do that with `yarn start`.
123+
124+
With shareable configs/tasks/scripts everything goes great. You can share even between monorepos,
125+
or extend each other configs.
126+
64127
## API
65128

66129
<!-- docks-start -->
130+
_Generated using [docks](http://npm.im/docks)._
131+
132+
### [src/index.js](/src/index.js)
133+
134+
#### [scripts](/src/index.js#L20)
135+
Collecting tasks/scripts from various places such as `scripts.config.js`
136+
or even all the defined ones from `package.json`'s field `scripts`.
137+
You can also pass `scripts.extends` and pass local javascript file
138+
or some npm module which in turn can be either CJS or ESM written.
139+
140+
**Params**
141+
- `[argv]` **{Array}** array of string, defaults to `process.argv.slice(2)`
142+
- `[options]` **{object}** optioanl settings, like `cwd` and `manager`, also can pass `tasks` from here
143+
144+
**Returns**
145+
- `Promise` if object is resolved, then it's all the collected tasks/scripts from configs,
146+
if array, then it's array of [execa][] results.
147+
67148
<!-- docks-end -->
68149

69-
**[back to top](#thetop)**
150+
__[back to top](#thetop)__
70151

71152
## See Also
72153

73154
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your
74155
existance!
75-
76-
- [asia](https://www.npmjs.com/package/asia): Blazingly fast, magical and minimalist testing framework, for Today and… [more](https://github.com/olstenlarck/asia#readme) | [homepage](https://github.com/olstenlarck/asia#readme 'Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow')
77-
- [charlike](https://www.npmjs.com/package/charlike): Small & fast project scaffolder with sane defaults. Supports hundreds… [more](https://github.com/tunnckoCoreLabs/charlike) | [homepage](https://github.com/tunnckoCoreLabs/charlike 'Small & fast project scaffolder with sane defaults. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options')
78-
- [docks](https://www.npmjs.com/package/docks): Extensible system for parsing and generating documentation. It just freaking… [more](https://github.com/tunnckoCore/docks) | [homepage](https://github.com/tunnckoCore/docks 'Extensible system for parsing and generating documentation. It just freaking works!')
79-
- [gitcommit](https://www.npmjs.com/package/gitcommit): Lightweight and joyful `git commit` replacement. Conventional Commits compliant. | [homepage](https://github.com/tunnckoCore/gitcommit 'Lightweight and joyful `git commit` replacement. Conventional Commits compliant.')
80-
- [new-release](https://www.npmjs.com/package/new-release): A stable alternative to [semantic-release][]. Only handles NPM publishing and… [more](https://github.com/tunnckoCore/new-release#readme) | [homepage](https://github.com/tunnckoCore/new-release#readme 'A stable alternative to [semantic-release][]. Only handles NPM publishing and nothing more. For creating GitHub releases use the Semantic Release GitHub App')
81-
- [parse-commit-message](https://www.npmjs.com/package/parse-commit-message): An extensible parser for commit message that follows Conventional Commits… [more](https://github.com/olstenlarck/parse-commit-message) | [homepage](https://github.com/olstenlarck/parse-commit-message 'An extensible parser for commit message that follows Conventional Commits v1 spec')
156+
- [asia](https://www.npmjs.com/package/asia): Blazingly fast, magical and minimalist testing framework, for Today and… [more](https://github.com/olstenlarck/asia#readme) | [homepage](https://github.com/olstenlarck/asia#readme "Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow")
157+
- [charlike](https://www.npmjs.com/package/charlike): Small & fast project scaffolder with sane defaults. Supports hundreds… [more](https://github.com/tunnckoCoreLabs/charlike) | [homepage](https://github.com/tunnckoCoreLabs/charlike "Small & fast project scaffolder with sane defaults. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options")
158+
- [docks](https://www.npmjs.com/package/docks): Extensible system for parsing and generating documentation. It just freaking… [more](https://github.com/tunnckoCore/docks) | [homepage](https://github.com/tunnckoCore/docks "Extensible system for parsing and generating documentation. It just freaking works!")
159+
- [gitcommit](https://www.npmjs.com/package/gitcommit): Lightweight and joyful `git commit` replacement. Conventional Commits compliant. | [homepage](https://github.com/tunnckoCore/gitcommit "Lightweight and joyful `git commit` replacement. Conventional Commits compliant.")
160+
- [new-release](https://www.npmjs.com/package/new-release): A stable alternative to [semantic-release][]. Only handles NPM publishing and… [more](https://github.com/tunnckoCore/new-release#readme) | [homepage](https://github.com/tunnckoCore/new-release#readme "A stable alternative to [semantic-release][]. Only handles NPM publishing and nothing more. For creating GitHub releases use the Semantic Release GitHub App")
82161

83162
**[back to top](#thetop)**
84163

@@ -138,9 +217,11 @@ _This file was generated by [verb-generate-readme](https://github.com/verbose/ve
138217

139218
[npmv-url]: https://www.npmjs.com/package/@tunnckocore/scripts
140219
[npmv-img]: https://badgen.net/npm/v/@tunnckocore/scripts?icon=npm
220+
141221
[ghrelease-url]: https://github.com/tunnckoCoreLabs/scripts/releases/latest
142222
[ghrelease-img]: https://badgen.net/github/release/tunnckoCoreLabs/scripts?icon=github
143223
[license-url]: https://github.com/tunnckoCoreLabs/scripts/blob/master/LICENSE
224+
144225
[license-img]: https://badgen.net/npm/license/@tunnckocore/scripts
145226

146227
<!-- Front line badges -->
@@ -157,9 +238,11 @@ _This file was generated by [verb-generate-readme](https://github.com/verbose/ve
157238
[ccommits-img]: https://badgen.net/badge/conventional%20commits/v1.0.0/dfb317
158239
[new-release-url]: https://ghub.io/new-release
159240
[new-release-img]: https://badgen.net/badge/semantically/released/05c5ff
241+
160242
[downloads-weekly-img]: https://badgen.net/npm/dw/@tunnckocore/scripts
161243
[downloads-monthly-img]: https://badgen.net/npm/dm/@tunnckocore/scripts
162244
[downloads-total-img]: https://badgen.net/npm/dt/@tunnckocore/scripts
245+
163246
[renovateapp-url]: https://renovatebot.com
164247
[renovateapp-img]: https://badgen.net/badge/renovate/enabled/green
165248
[prs-welcome-img]: https://badgen.net/badge/PRs/welcome/green
@@ -172,5 +255,7 @@ _This file was generated by [verb-generate-readme](https://github.com/verbose/ve
172255
[shareu]: https://twitter.com/intent/tweet?text=https://github.com/tunnckoCoreLabs/scripts&via=tunnckoCore
173256
[shareb]: https://badgen.net/badge/twitter/share/1da1f2?icon=twitter
174257
[open-issue-url]: https://github.com/tunnckoCoreLabs/scripts/issues/new
258+
259+
[execa]: https://github.com/sindresorhus/execa
175260
[new-release]: https://github.com/tunnckoCore/new-release
176-
[semantic-release]: https://github.com/semantic-release/semantic-release
261+
[semantic-release]: https://github.com/semantic-release/semantic-release

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@
6767
"charlike",
6868
"docks",
6969
"gitcommit",
70-
"new-release",
71-
"parse-commit-message"
70+
"new-release"
7271
]
7372
},
7473
"lint": {

src/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ import { shell } from '@tunnckocore/execa';
44

55
const ENV = Object.assign({}, proc.env);
66

7+
/**
8+
* Collecting tasks/scripts from various places such as `scripts.config.js`
9+
* or even all the defined ones from `package.json`'s field `scripts`.
10+
* You can also pass `scripts.extends` and pass local javascript file
11+
* or some npm module which in turn can be either CJS or ESM written.
12+
*
13+
* @name scripts
14+
* @param {Array} [argv] array of string, defaults to `process.argv.slice(2)`
15+
* @param {object} [options] optioanl settings, like `cwd` and `manager`, also can pass `tasks` from here
16+
* @returns {Promise} if object is resolved, then it's all the collected tasks/scripts from configs,
17+
* if array, then it's array of [execa][] results.
18+
* @public
19+
*/
720
export default async function monora(argv = proc.argv.slice(2), options) {
821
const { cwd, tasks, manager, nonStrictBehavior } = Object.assign(
922
{ cwd: proc.cwd() },

0 commit comments

Comments
 (0)