1
0
Fork 0

Simplify package creation

pull/6/head
Jonathan Clem 2019-04-22 11:54:05 -04:00
parent 9ef78f1807
commit d3cfce8cf0
No known key found for this signature in database
GPG Key ID: 48C5B22E9FD6E80F
3 changed files with 17 additions and 9 deletions

View File

@ -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.

View File

@ -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": {

13
scripts/create-package Executable file
View File

@ -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