Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use settings entries if paths are passed in #140

Merged
merged 2 commits into from
Mar 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [Commit](#commit)
* [Deploy](#deploy)
* [Lint](#lint)
* [Prepublish](#prepublish)
* [Test](#test)
* [Lint Messages](#lint-messages)

Expand Down Expand Up @@ -157,6 +158,14 @@ $ mastarm lint "src/util/**/*.js" "test/**/*.js"

Note: by default standard will look for all files matching the patterns: `"**/*.js"`, `"**/*.jsx"`. Always quote the globs. Needed when used as an `npm` command.

### `prepublish`

Transpile a library using [Babel](http://babeljs.io/) and our custom config. Usually used as a prepublish step for libraries written in ES6+ that will be published to NPM. Pass it a directory and it will look for `.js` files to transpile.

```shell
$ mastarm prepublish lib:build
```

### `test`

Run the [Jest](http://facebook.github.io/jest/) test runner on your project. By default, mastarm will run Jest and generate coverage reports on all .js files in the `lib` folder of your project. The `patterns` argument will make Jest run only tests whose filename match the provided pattern.
Expand Down
13 changes: 10 additions & 3 deletions bin/mastarm
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,22 @@ commander
commander
.command('prepublish [entries...]')
.description('Transpile JavaScript down to ES5 with Babel')
.action(function (entries, options) {
.action(function (cliEntries, options) {
const prepublish = require('../lib/prepublish')
const config = loadConfig(process.cwd(), commander.config, commander.env)
const get = util.makeGetFn([options, commander, config.settings])

const outdir = get('outdir')
const entries = util.parseEntries(cliEntries && cliEntries.length > 0
? cliEntries
: get('entries') || [],
outdir
)

prepublish({
entries: util.parseEntries([...entries, ...(get('entries') || [])], get('outdir')),
entries,
env: get('env'),
outdir: get('outdir')
outdir
})
})

Expand Down