Skip to content

Commit

Permalink
Simplify package creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jclem committed Apr 22, 2019
1 parent 9ef78f1 commit d3cfce8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,17 @@ This repository uses [Lerna](https://github.com/lerna/lerna#readme) to manage mu
1. In a new branch, create a new Lerna package:

```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).

2. Add a `tsconfig.json` file for the new package (you can probably just reuse one from another existing package):

```console
$ cp packages/toolkit/tsconfig.json packages/new-package/tsconfig.json
```

3. Add `tsc` script to the new package's package.json file:
1. Add `tsc` script to the new package's package.json file:

```json
"scripts": {
"tsc": "tsc"
}
```

4. Start developing 😄 and open a pull request.
1. Start developing 😄 and open a pull request.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"bootstrap": "lerna bootstrap",
"build": "lerna run tsc",
"format": "prettier --check packages/*/src/**/*.ts",
"new-package": "scripts/create-package",
"test": "jest"
},
"devDependencies": {
Expand Down
13 changes: 13 additions & 0 deletions scripts/create-package
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d3cfce8

Please sign in to comment.