Skip to content

Commit

Permalink
Add prepare script to generated project (#334)
Browse files Browse the repository at this point in the history
* add prepare script

* remove yarn-or-npm
  • Loading branch information
joeflateau authored and jaredpalmer committed Dec 13, 2019
1 parent 5ee9dfc commit ef93d1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ node_modules
dist
tester
tester-react
package-lock.json
# Local Netlify folder
.netlify
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Despite all the recent hype, setting up a new TypeScript (x React) library can b
- [`npm run build` or `yarn build`](#npm-run-build-or-yarn-build)
- [`npm test` or `yarn test`](#npm-test-or-yarn-test)
- [`npm run lint` or `yarn lint`](#npm-run-lint-or-yarn-lint)
- [`prepare` script](#prepare-script)
- [Optimizations](#optimizations)
- [Development-only Expressions + Treeshaking](#development-only-expressions--treeshaking)
- [Rollup Treeshaking](#rollup-treeshaking)
Expand Down Expand Up @@ -89,6 +90,11 @@ By default, runs tests related to files changed since the last commit.
Runs Eslint with Prettier on .ts and .tsx files.
If you want to customize eslint you can add an `eslint` block to your package.json, or you can run `yarn lint --write-file` and edit the generated `.eslintrc.js` file.

### `prepare` script

Bundles and packages to the `dist` folder.
Runs automatically when you run either `npm publish` or `yarn publish`. The `prepare` script will run the equivalent of `npm run build` or `yarn build`. It will also be run if your module is installed as a git dependency (ie: `"mymodule": "github:myuser/mymodule#some-branch"`) so it can be depended on without checking the transpiled code into git.

## Optimizations

Aside from just bundling your module into different formats, TSDX comes with some optimizations for your convenience. They yield objectively better code and smaller bundle sizes.
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ prog
? 'tsdx test --env=jsdom --passWithNoTests'
: 'tsdx test',
lint: 'tsdx lint',
prepare: 'tsdx build',
},
peerDependencies: template === 'react' ? { react: '>=16' } : {},
husky: {
Expand Down

0 comments on commit ef93d1d

Please sign in to comment.