Skip to content

Commit a1d9a0f

Browse files
authoredMar 3, 2017
Merge pull request #140 from conveyal/only-use-one-entry
Don't use settings entries if paths are passed in
2 parents c4c6765 + 928989e commit a1d9a0f

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed
 

‎README.md

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* [Commit](#commit)
1717
* [Deploy](#deploy)
1818
* [Lint](#lint)
19+
* [Prepublish](#prepublish)
1920
* [Test](#test)
2021
* [Lint Messages](#lint-messages)
2122

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

158159
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.
159160

161+
### `prepublish`
162+
163+
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.
164+
165+
```shell
166+
$ mastarm prepublish lib:build
167+
```
168+
160169
### `test`
161170

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

‎bin/mastarm

+10-3
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,22 @@ commander
163163
commander
164164
.command('prepublish [entries...]')
165165
.description('Transpile JavaScript down to ES5 with Babel')
166-
.action(function (entries, options) {
166+
.action(function (cliEntries, options) {
167167
const prepublish = require('../lib/prepublish')
168168
const config = loadConfig(process.cwd(), commander.config, commander.env)
169169
const get = util.makeGetFn([options, commander, config.settings])
170170

171+
const outdir = get('outdir')
172+
const entries = util.parseEntries(cliEntries && cliEntries.length > 0
173+
? cliEntries
174+
: get('entries') || [],
175+
outdir
176+
)
177+
171178
prepublish({
172-
entries: util.parseEntries([...entries, ...(get('entries') || [])], get('outdir')),
179+
entries,
173180
env: get('env'),
174-
outdir: get('outdir')
181+
outdir
175182
})
176183
})
177184

0 commit comments

Comments
 (0)
Please sign in to comment.