mirror of https://github.com/actions/toolkit
Simplify package creation
parent
9ef78f1807
commit
d3cfce8cf0
12
README.md
12
README.md
|
@ -27,18 +27,12 @@ This repository uses [Lerna](https://github.com/lerna/lerna#readme) to manage mu
|
||||||
1. In a new branch, create a new Lerna package:
|
1. In a new branch, create a new Lerna package:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ lerna create @actions/new-package
|
$ npm run create-package new-package
|
||||||
```
|
```
|
||||||
|
|
||||||
This will ask you some questions about the new package. Start with `0.0.0` as the first version (look generally at some of the other packages for how the package.json is structured).
|
This will ask you some questions about the new package. Start with `0.0.0` as the first version (look generally at some of the other packages for how the package.json is structured).
|
||||||
|
|
||||||
2. Add a `tsconfig.json` file for the new package (you can probably just reuse one from another existing package):
|
1. Add `tsc` script to the new package's package.json file:
|
||||||
|
|
||||||
```console
|
|
||||||
$ cp packages/toolkit/tsconfig.json packages/new-package/tsconfig.json
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Add `tsc` script to the new package's package.json file:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -46,4 +40,4 @@ $ cp packages/toolkit/tsconfig.json packages/new-package/tsconfig.json
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Start developing 😄 and open a pull request.
|
1. Start developing 😄 and open a pull request.
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"bootstrap": "lerna bootstrap",
|
"bootstrap": "lerna bootstrap",
|
||||||
"build": "lerna run tsc",
|
"build": "lerna run tsc",
|
||||||
"format": "prettier --check packages/*/src/**/*.ts",
|
"format": "prettier --check packages/*/src/**/*.ts",
|
||||||
|
"new-package": "scripts/create-package",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
name=$1
|
||||||
|
|
||||||
|
if [[ -z "$name" ]]; then
|
||||||
|
>&2 echo "Usage: npm run new-package [name]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
lerna create @actions/$name
|
||||||
|
cp packages/toolkit/tsconfig.json packages/$name/tsconfig.json
|
Loading…
Reference in New Issue