diff --git a/.all-contributorsrc b/.all-contributorsrc
index c15cb88..234ef9f 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -388,6 +388,16 @@
"contributions": [
"code"
]
+ },
+ {
+ "login": "samijaber",
+ "name": "Sami Jaber",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/1393142?v=4",
+ "profile": "http://twitter.com/samjabz",
+ "contributions": [
+ "bug",
+ "code"
+ ]
}
],
"repoType": "github"
diff --git a/README.md b/README.md
index 85b4b58..814bcb4 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ All the benefits of npm scripts without the cost of a bloated package.json and l
[![downloads][downloads-badge]][npm-stat]
[![MIT License][license-badge]][LICENSE]
-[![All Contributors](https://img.shields.io/badge/all_contributors-38-orange.svg?style=flat-square)](#contributors)
+[![All Contributors](https://img.shields.io/badge/all_contributors-39-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Donate][donate-badge]][donate]
[![Code of Conduct][coc-badge]][coc]
@@ -491,7 +491,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [
Sorin Muntean](https://github.com/sxn)
[💻](https://github.com/kentcdodds/p-s/commits?author=sxn "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=sxn "Tests") [📖](https://github.com/kentcdodds/p-s/commits?author=sxn "Documentation") | [
Keith Gunn](https://github.com/gunnx)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Agunnx "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=gunnx "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=gunnx "Tests") | [
Joe Martella](http://martellaj.github.io)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Amartellaj "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=martellaj "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=martellaj "Tests") | [
Martin Segado](https://github.com/msegado)
[📖](https://github.com/kentcdodds/p-s/commits?author=msegado "Documentation") | [
Bram Borggreve](http://colmena.io/)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Abeeman "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=beeman "Code") | [
Elijah Manor](http://elijahmanor.com)
[📹](#video-elijahmanor "Videos") | [
Ragu Ramaswamy](https://github.com/rrag)
[💻](https://github.com/kentcdodds/p-s/commits?author=rrag "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=rrag "Tests") [🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Arrag "Bug reports") |
| [
Erik Fox](http://www.erikfox.co/)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Aerikfox "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=erikfox "Code") [📖](https://github.com/kentcdodds/p-s/commits?author=erikfox "Documentation") [⚠️](https://github.com/kentcdodds/p-s/commits?author=erikfox "Tests") | [
Aditya Pratap Singh](http://blog.adityapsingh.com)
[👀](#review-addityasingh "Reviewed Pull Requests") | [
bumbleblym](https://github.com/bumbleblym)
[💻](https://github.com/kentcdodds/p-s/commits?author=bumbleblym "Code") [📖](https://github.com/kentcdodds/p-s/commits?author=bumbleblym "Documentation") | [
Islam Attrash](https://twitter.com/IslamAttrash)
[💻](https://github.com/kentcdodds/p-s/commits?author=Attrash-Islam "Code") | [
JasonSooter](https://github.com/JasonSooter)
[📖](https://github.com/kentcdodds/p-s/commits?author=JasonSooter "Documentation") | [
Nate Cavanaugh](http://alterform.com)
[💻](https://github.com/kentcdodds/p-s/commits?author=natecavanaugh "Code") | [
Wissam Abirached](https://designingforscale.com)
[💻](https://github.com/kentcdodds/p-s/commits?author=wabirached "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=wabirached "Tests") |
| [
Paweł Mikołajczyk](https://github.com/Miklet)
[💻](https://github.com/kentcdodds/p-s/commits?author=Miklet "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=Miklet "Tests") | [
Kyle Welch](http://www.krwelch.com)
[💻](https://github.com/kentcdodds/p-s/commits?author=kwelch "Code") [⚠️](https://github.com/kentcdodds/p-s/commits?author=kwelch "Tests") | [
Lufty Wiranda](http://instagram.com/luftywiranda13)
[💻](https://github.com/kentcdodds/p-s/commits?author=luftywiranda13 "Code") | [
Bhargav Ponnapalli](http://imbhargav5.com)
[💻](https://github.com/kentcdodds/p-s/commits?author=imbhargav5 "Code") | [
falieson](https://github.com/Falieson)
[📖](https://github.com/kentcdodds/p-s/commits?author=Falieson "Documentation") [🔧](#tool-Falieson "Tools") | [
Suhas Karanth](https://github.com/sudo-suhas)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Asudo-suhas "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=sudo-suhas "Code") | [
Eric Skram](http://www.ericskram.com)
[📖](https://github.com/kentcdodds/p-s/commits?author=Vpr99 "Documentation") |
-| [
Kether Saturnius](http://www.k3th3r.com)
[💻](https://github.com/kentcdodds/p-s/commits?author=iamkether "Code") [📖](https://github.com/kentcdodds/p-s/commits?author=iamkether "Documentation") | [
Sviatoslav](https://github.com/SleepWalker)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3ASleepWalker "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=SleepWalker "Code") | [
Wei Wang](https://github.com/onlywei)
[💻](https://github.com/kentcdodds/p-s/commits?author=onlywei "Code") |
+| [
Kether Saturnius](http://www.k3th3r.com)
[💻](https://github.com/kentcdodds/p-s/commits?author=iamkether "Code") [📖](https://github.com/kentcdodds/p-s/commits?author=iamkether "Documentation") | [
Sviatoslav](https://github.com/SleepWalker)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3ASleepWalker "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=SleepWalker "Code") | [
Wei Wang](https://github.com/onlywei)
[💻](https://github.com/kentcdodds/p-s/commits?author=onlywei "Code") | [
Sami Jaber](http://twitter.com/samjabz)
[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Asamijaber "Bug reports") [💻](https://github.com/kentcdodds/p-s/commits?author=samijaber "Code") |
This project follows the [all-contributors][all-contributors] specification.
diff --git a/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.js b/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.js
index b8ce517..69361ec 100644
--- a/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.js
+++ b/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.js
@@ -2,7 +2,8 @@ module.exports = {
scripts: {
default: {
default: 'echo start',
- stuff: 'echo start:stuff'
+ stuff: 'echo start:stuff',
+ fooBar: 'echo start:foo-bar'
},
test: 'echo test',
prefoo: {
diff --git a/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.yml b/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.yml
index 78fa95e..7dc2988 100644
--- a/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.yml
+++ b/src/bin-utils/initialize/__tests__/fixtures/_package-scripts.yml
@@ -2,6 +2,7 @@ scripts:
default:
default: echo start
stuff: 'echo start:stuff'
+ fooBar: 'echo start:foo-bar'
test: echo test
prefoo:
default: echo prefoo
diff --git a/src/bin-utils/initialize/__tests__/fixtures/_package.json b/src/bin-utils/initialize/__tests__/fixtures/_package.json
index 0304d1d..839c81a 100644
--- a/src/bin-utils/initialize/__tests__/fixtures/_package.json
+++ b/src/bin-utils/initialize/__tests__/fixtures/_package.json
@@ -2,6 +2,7 @@
"scripts": {
"start": "echo start",
"start:stuff": "echo start:stuff",
+ "start:foo-bar": "echo start:foo-bar",
"test": "echo test",
"prefoo": "echo prefoo",
"foo": "npm run foo -- --bar=1",
diff --git a/src/bin-utils/initialize/index.js b/src/bin-utils/initialize/index.js
index a043e66..4ddb7d5 100644
--- a/src/bin-utils/initialize/index.js
+++ b/src/bin-utils/initialize/index.js
@@ -113,14 +113,16 @@ function structureScripts(scripts) {
const keyParts = scriptKey.split(':')
const isKeyScriptHook = isScriptHook(keyParts[0])
const deepKey = convertToNpsScript(keyParts)
- let defaultDeepKey = `${deepKey}.default`
- if (scriptKey.indexOf('start') === 0) {
- defaultDeepKey = [
+
+ const isStartScript = scriptKey.indexOf('start') === 0
+ const defaultDeepKey = isStartScript ?
+ convertToNpsScript([
'default',
...keyParts.slice(1, keyParts.length),
'default',
- ].join('.')
- }
+ ]) :
+ `${deepKey}.default`
+
let script = scripts[scriptKey]
if (!isKeyScriptHook) {
const {preHook, postHook} = getPrePostHooks(