├── .all-contributorsrc ├── .babelrc ├── .eslintignore ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .npmignore ├── .npmrc ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── cli-test └── __tests__ │ ├── __snapshots__ │ └── cli.js.snap │ ├── cli.js │ ├── fixtures │ ├── es6-package-scripts.js │ ├── p-s.js │ ├── package-script-silent.js │ ├── package-scripts-with-default.js │ ├── package-scripts.js │ └── package-scripts.yml │ └── helpers │ └── run-nps.js ├── other ├── CODE_OF_CONDUCT.md ├── ERRORS_AND_WARNINGS.md ├── EXAMPLES.md ├── MAINTAINING.md ├── ROADMAP.md └── video-screenshot.png ├── package-scripts.js ├── package.json ├── src ├── __mocks__ │ ├── console.js │ ├── find-up.js │ ├── get-logger.js │ └── readline-sync.js ├── __tests__ │ ├── get-logger.js │ ├── get-script-to-run.js │ ├── get-scripts-from-config.js │ ├── index.js │ ├── kebab-and-camel-casify.js │ └── resolve-script-object-to-string.js ├── bin-utils │ ├── __tests__ │ │ ├── autocomplete-get-scripts.js │ │ ├── fixtures │ │ │ ├── bad-data-type-config.js │ │ │ ├── bad-empty-module.js │ │ │ ├── bad-function-data-type-config.js │ │ │ ├── bad-function-empty-module.js │ │ │ ├── fake-config.yml │ │ │ ├── fake-es6-module.js │ │ │ ├── fake-npsrc.json │ │ │ ├── function-config.js │ │ │ ├── my-module.js │ │ │ ├── other-error-module.js │ │ │ ├── syntax-error-config.yml │ │ │ ├── syntax-error-module.js │ │ │ └── syntax-error-npsrc.json │ │ ├── get-script-by-prefix.js │ │ ├── index.js │ │ └── parser.js │ ├── autocomplete-get-scripts.js │ ├── get-script-by-prefix.js │ ├── index.js │ ├── initialize │ │ ├── __tests__ │ │ │ ├── __snapshots__ │ │ │ │ └── stringify-object.js.snap │ │ │ ├── fixtures │ │ │ │ ├── _package-core-scripts.json │ │ │ │ ├── _package-no-scripts.json │ │ │ │ ├── _package-no-test.json │ │ │ │ ├── _package-scripts.js │ │ │ │ ├── _package-scripts.yml │ │ │ │ └── _package.json │ │ │ ├── index.js │ │ │ └── stringify-object.js │ │ ├── index.js │ │ └── stringify-object.js │ └── parser.js ├── bin │ └── nps.js ├── get-logger.js ├── get-script-to-run.js ├── get-scripts-from-config.js ├── index.js ├── kebab-and-camel-casify.js └── resolve-script-object-to-string.js └── test ├── jest.cli.config.js └── jest.src.config.js /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "p-s", 3 | "projectOwner": "kentcdodds", 4 | "files": [ 5 | "README.md" 6 | ], 7 | "imageSize": 100, 8 | "commit": false, 9 | "contributors": [ 10 | { 11 | "login": "kentcdodds", 12 | "name": "Kent C. Dodds", 13 | "avatar_url": "https://avatars.githubusercontent.com/u/1500684?v=3", 14 | "profile": "http://kent.doddsfamily.us", 15 | "contributions": [ 16 | "code", 17 | "doc", 18 | "infra", 19 | "example", 20 | "video", 21 | "review" 22 | ] 23 | }, 24 | { 25 | "login": "DavidWells", 26 | "name": "David Wells", 27 | "avatar_url": "https://avatars.githubusercontent.com/u/532272?v=3", 28 | "profile": "http://davidwells.io", 29 | "contributions": [ 30 | "code" 31 | ] 32 | }, 33 | { 34 | "login": "abhishekisnot", 35 | "name": "Abhishek Shende", 36 | "avatar_url": "https://avatars.githubusercontent.com/u/802242?v=3", 37 | "profile": "https://twitter.com/abhishekisnot", 38 | "contributions": [ 39 | "code", 40 | "test" 41 | ] 42 | }, 43 | { 44 | "login": "rowanoulton", 45 | "name": "Rowan Oulton", 46 | "avatar_url": "https://avatars.githubusercontent.com/u/185649?v=3", 47 | "profile": "http://travelog.io", 48 | "contributions": [ 49 | "code", 50 | "doc", 51 | "test" 52 | ] 53 | }, 54 | { 55 | "login": "giladgo", 56 | "name": "Gilad Goldberg", 57 | "avatar_url": "https://avatars.githubusercontent.com/u/1915716?v=3", 58 | "profile": "https://github.com/giladgo", 59 | "contributions": [ 60 | "code" 61 | ] 62 | }, 63 | { 64 | "login": "tim-mcgee", 65 | "name": "Tim McGee", 66 | "avatar_url": "https://avatars.githubusercontent.com/u/14267457?v=3", 67 | "profile": "https://github.com/tim-mcgee", 68 | "contributions": [ 69 | "code", 70 | "doc" 71 | ] 72 | }, 73 | { 74 | "login": "nkbt", 75 | "name": "Nik Butenko", 76 | "avatar_url": "https://avatars.githubusercontent.com/u/175264?v=3", 77 | "profile": "http://butenko.me", 78 | "contributions": [ 79 | "example", 80 | "code" 81 | ] 82 | }, 83 | { 84 | "login": "tleunen", 85 | "name": "Tommy", 86 | "avatar_url": "https://avatars.githubusercontent.com/u/1972567?v=3", 87 | "profile": "http://www.tommyleunen.com", 88 | "contributions": [ 89 | "bug", 90 | "code", 91 | "test", 92 | "review" 93 | ] 94 | }, 95 | { 96 | "login": "Hypercubed", 97 | "name": "Jayson Harshbarger", 98 | "avatar_url": "https://avatars.githubusercontent.com/u/509946?v=3", 99 | "profile": "http://www.hypercubed.com", 100 | "contributions": [ 101 | "example", 102 | "review" 103 | ] 104 | }, 105 | { 106 | "login": "jisaacks", 107 | "name": "JD Isaacks", 108 | "avatar_url": "https://avatars.githubusercontent.com/u/1355481?v=3", 109 | "profile": "http://www.jisaacks.com", 110 | "contributions": [ 111 | "code", 112 | "test" 113 | ] 114 | }, 115 | { 116 | "login": "boneskull", 117 | "name": "Christopher Hiller", 118 | "avatar_url": "https://avatars.githubusercontent.com/u/924465?v=3", 119 | "profile": "https://boneskull.com", 120 | "contributions": [ 121 | "review", 122 | "bug", 123 | "code", 124 | "doc", 125 | "test" 126 | ] 127 | }, 128 | { 129 | "login": "RobinMalfait", 130 | "name": "Robin Malfait", 131 | "avatar_url": "https://avatars.githubusercontent.com/u/1834413?v=3", 132 | "profile": "https://robinmalfait.com", 133 | "contributions": [ 134 | "example" 135 | ] 136 | }, 137 | { 138 | "login": "edm00se", 139 | "name": "Eric McCormick", 140 | "avatar_url": "https://avatars.githubusercontent.com/u/622118?v=3", 141 | "profile": "https://ericmccormick.io", 142 | "contributions": [ 143 | "review", 144 | "doc" 145 | ] 146 | }, 147 | { 148 | "login": "SamVerschueren", 149 | "name": "Sam Verschueren", 150 | "avatar_url": "https://avatars.githubusercontent.com/u/1913805?v=3", 151 | "profile": "https://twitter.com/SamVerschueren", 152 | "contributions": [ 153 | "review" 154 | ] 155 | }, 156 | { 157 | "login": "sxn", 158 | "name": "Sorin Muntean", 159 | "avatar_url": "https://avatars.githubusercontent.com/u/1155589?v=3", 160 | "profile": "https://github.com/sxn", 161 | "contributions": [ 162 | "code", 163 | "test", 164 | "doc" 165 | ] 166 | }, 167 | { 168 | "login": "gunnx", 169 | "name": "Keith Gunn", 170 | "avatar_url": "https://avatars.githubusercontent.com/u/1970063?v=3", 171 | "profile": "https://github.com/gunnx", 172 | "contributions": [ 173 | "bug", 174 | "code", 175 | "test" 176 | ] 177 | }, 178 | { 179 | "login": "martellaj", 180 | "name": "Joe Martella", 181 | "avatar_url": "https://avatars.githubusercontent.com/u/1019478?v=3", 182 | "profile": "http://martellaj.github.io", 183 | "contributions": [ 184 | "bug", 185 | "code", 186 | "test" 187 | ] 188 | }, 189 | { 190 | "login": "msegado", 191 | "name": "Martin Segado", 192 | "avatar_url": "https://avatars.githubusercontent.com/u/1887854?v=3", 193 | "profile": "https://github.com/msegado", 194 | "contributions": [ 195 | "doc" 196 | ] 197 | }, 198 | { 199 | "login": "beeman", 200 | "name": "Bram Borggreve", 201 | "avatar_url": "https://avatars.githubusercontent.com/u/36491?v=3", 202 | "profile": "http://colmena.io/", 203 | "contributions": [ 204 | "bug", 205 | "code" 206 | ] 207 | }, 208 | { 209 | "login": "elijahmanor", 210 | "name": "Elijah Manor", 211 | "avatar_url": "https://avatars.githubusercontent.com/u/86454?v=3", 212 | "profile": "http://elijahmanor.com", 213 | "contributions": [ 214 | "video" 215 | ] 216 | }, 217 | { 218 | "login": "rrag", 219 | "name": "Ragu Ramaswamy", 220 | "avatar_url": "https://avatars.githubusercontent.com/u/10691183?v=3", 221 | "profile": "https://github.com/rrag", 222 | "contributions": [ 223 | "code", 224 | "test", 225 | "bug" 226 | ] 227 | }, 228 | { 229 | "login": "erikfox", 230 | "name": "Erik Fox", 231 | "avatar_url": "https://avatars.githubusercontent.com/u/2915616?v=3", 232 | "profile": "http://www.erikfox.co/", 233 | "contributions": [ 234 | "bug", 235 | "code", 236 | "doc", 237 | "test" 238 | ] 239 | }, 240 | { 241 | "login": "addityasingh", 242 | "name": "Aditya Pratap Singh", 243 | "avatar_url": "https://avatars.githubusercontent.com/u/5351262?v=3", 244 | "profile": "http://blog.adityapsingh.com", 245 | "contributions": [ 246 | "review" 247 | ] 248 | }, 249 | { 250 | "login": "bumbleblym", 251 | "name": "bumbleblym", 252 | "avatar_url": "https://avatars.githubusercontent.com/u/7687132?v=3", 253 | "profile": "https://github.com/bumbleblym", 254 | "contributions": [ 255 | "code", 256 | "doc" 257 | ] 258 | }, 259 | { 260 | "login": "Attrash-Islam", 261 | "name": "Islam Attrash", 262 | "avatar_url": "https://avatars.githubusercontent.com/u/7091543?v=3", 263 | "profile": "https://twitter.com/IslamAttrash", 264 | "contributions": [ 265 | "code" 266 | ] 267 | }, 268 | { 269 | "login": "JasonSooter", 270 | "name": "JasonSooter", 271 | "avatar_url": "https://avatars.githubusercontent.com/u/7215306?v=3", 272 | "profile": "https://github.com/JasonSooter", 273 | "contributions": [ 274 | "doc" 275 | ] 276 | }, 277 | { 278 | "login": "natecavanaugh", 279 | "name": "Nate Cavanaugh", 280 | "avatar_url": "https://avatars1.githubusercontent.com/u/116871?v=3", 281 | "profile": "http://alterform.com", 282 | "contributions": [ 283 | "code" 284 | ] 285 | }, 286 | { 287 | "login": "wabirached", 288 | "name": "Wissam Abirached", 289 | "avatar_url": "https://avatars2.githubusercontent.com/u/3534924?v=3", 290 | "profile": "https://designingforscale.com", 291 | "contributions": [ 292 | "code", 293 | "test" 294 | ] 295 | }, 296 | { 297 | "login": "Miklet", 298 | "name": "Paweł Mikołajczyk", 299 | "avatar_url": "https://avatars1.githubusercontent.com/u/12592677?v=3", 300 | "profile": "https://github.com/Miklet", 301 | "contributions": [ 302 | "code", 303 | "test" 304 | ] 305 | }, 306 | { 307 | "login": "kwelch", 308 | "name": "Kyle Welch", 309 | "avatar_url": "https://avatars0.githubusercontent.com/u/1295580?v=3", 310 | "profile": "http://www.krwelch.com", 311 | "contributions": [ 312 | "code", 313 | "test" 314 | ] 315 | }, 316 | { 317 | "login": "luftywiranda13", 318 | "name": "Lufty Wiranda", 319 | "avatar_url": "https://avatars3.githubusercontent.com/u/22868432?v=3", 320 | "profile": "http://instagram.com/luftywiranda13", 321 | "contributions": [ 322 | "code" 323 | ] 324 | }, 325 | { 326 | "login": "imbhargav5", 327 | "name": "Bhargav Ponnapalli", 328 | "avatar_url": "https://avatars6.githubusercontent.com/u/2936644?v=4", 329 | "profile": "http://imbhargav5.com", 330 | "contributions": [ 331 | "code" 332 | ] 333 | }, 334 | { 335 | "login": "Falieson", 336 | "name": "falieson", 337 | "avatar_url": "https://avatars0.githubusercontent.com/u/1538572?v=4", 338 | "profile": "https://github.com/Falieson", 339 | "contributions": [ 340 | "doc", 341 | "tool" 342 | ] 343 | }, 344 | { 345 | "login": "sudo-suhas", 346 | "name": "Suhas Karanth", 347 | "avatar_url": "https://avatars2.githubusercontent.com/u/22251956?v=4", 348 | "profile": "https://github.com/sudo-suhas", 349 | "contributions": [ 350 | "bug", 351 | "code" 352 | ] 353 | }, 354 | { 355 | "login": "Vpr99", 356 | "name": "Eric Skram", 357 | "avatar_url": "https://avatars3.githubusercontent.com/u/1228867?v=4", 358 | "profile": "http://www.ericskram.com", 359 | "contributions": [ 360 | "doc" 361 | ] 362 | }, 363 | { 364 | "login": "iamkether", 365 | "name": "Kether Saturnius", 366 | "avatar_url": "https://avatars2.githubusercontent.com/u/11901111?v=4", 367 | "profile": "http://www.k3th3r.com", 368 | "contributions": [ 369 | "code", 370 | "doc" 371 | ] 372 | }, 373 | { 374 | "login": "SleepWalker", 375 | "name": "Sviatoslav", 376 | "avatar_url": "https://avatars2.githubusercontent.com/u/2536916?v=4", 377 | "profile": "https://github.com/SleepWalker", 378 | "contributions": [ 379 | "bug", 380 | "code" 381 | ] 382 | }, 383 | { 384 | "login": "onlywei", 385 | "name": "Wei Wang", 386 | "avatar_url": "https://avatars2.githubusercontent.com/u/1470998?v=4", 387 | "profile": "https://github.com/onlywei", 388 | "contributions": [ 389 | "code" 390 | ] 391 | }, 392 | { 393 | "login": "samijaber", 394 | "name": "Sami Jaber", 395 | "avatar_url": "https://avatars2.githubusercontent.com/u/1393142?v=4", 396 | "profile": "http://twitter.com/samjabz", 397 | "contributions": [ 398 | "bug", 399 | "code" 400 | ] 401 | }, 402 | { 403 | "login": "schottilol", 404 | "name": "Florian Löchle", 405 | "avatar_url": "https://avatars3.githubusercontent.com/u/28313487?v=4", 406 | "profile": "https://github.com/schottilol", 407 | "contributions": [ 408 | "code" 409 | ] 410 | }, 411 | { 412 | "login": "kevjin", 413 | "name": "Kevin J", 414 | "avatar_url": "https://avatars2.githubusercontent.com/u/15851351?v=4", 415 | "profile": "https://github.com/kevjin", 416 | "contributions": [ 417 | "code" 418 | ] 419 | }, 420 | { 421 | "login": "effervescentia", 422 | "name": "Ben Teichman", 423 | "avatar_url": "https://avatars2.githubusercontent.com/u/3784470?v=4", 424 | "profile": "http://www.benteichman.ca", 425 | "contributions": [ 426 | "code", 427 | "doc" 428 | ] 429 | }, 430 | { 431 | "login": "sezna", 432 | "name": "Alex Hansen", 433 | "avatar_url": "https://avatars3.githubusercontent.com/u/12157751?v=4", 434 | "profile": "http://alex-hansen.com", 435 | "contributions": [ 436 | "code", 437 | "infra", 438 | "review" 439 | ] 440 | }, 441 | { 442 | "login": "ameobea", 443 | "name": "Casey Primozic", 444 | "avatar_url": "https://avatars3.githubusercontent.com/u/4335849?v=4", 445 | "profile": "https://cprimozic.com", 446 | "contributions": [ 447 | "infra", 448 | "review" 449 | ] 450 | }, 451 | { 452 | "login": "VivekFitkariwala", 453 | "name": "Vivek Fitkariwala", 454 | "avatar_url": "https://avatars2.githubusercontent.com/u/3822890?v=4", 455 | "profile": "https://github.com/VivekFitkariwala", 456 | "contributions": [ 457 | "code" 458 | ] 459 | }, 460 | { 461 | "login": "dannycoates", 462 | "name": "Danny Coates", 463 | "avatar_url": "https://avatars1.githubusercontent.com/u/87619?v=4", 464 | "profile": "http://dannycoates.com", 465 | "contributions": [ 466 | "code" 467 | ] 468 | } 469 | ], 470 | "repoType": "github" 471 | } 472 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "targets": { 5 | "node": 4 6 | } 7 | }], 8 | "stage-2" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .nyc_output 3 | coverage 4 | dist 5 | fixtures/ 6 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [kentcdodds, sezna] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | - `nps` version: 12 | - `node` version: 13 | - `npm` version: 14 | 15 | Scripts file (or at least the relevant bits): 16 | 17 | ```javascript 18 | 19 | ``` 20 | 21 | The command executed: 22 | 23 | ```console 24 | 25 | ``` 26 | 27 | The output: 28 | 29 | ```console 30 | 31 | ``` 32 | 33 | Problem description: 34 | 35 | 36 | 37 | Suggested solution: 38 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | **What**: 19 | 20 | 21 | **Why**: 22 | 23 | 24 | **How**: 25 | 26 | 27 | **Checklist**: 28 | 29 | 30 | - [ ] Documentation 31 | - [ ] Tests 32 | - [ ] Ready to be merged 33 | - [ ] Added myself to contributors table 34 | 35 | 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .nyc_output 3 | coverage 4 | dist 5 | .opt-in 6 | .opt-out 7 | npm-debug.log 8 | .idea/ 9 | .vscode/ 10 | yarn.lock 11 | package-lock.json 12 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .all-contributorsrc 3 | .babelrc 4 | .git 5 | .github 6 | .travis.yml 7 | .vscode 8 | cli-test 9 | test 10 | yarn.lock 11 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | save-exact = true 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | cache: 4 | directories: 5 | - node_modules 6 | notifications: 7 | email: false 8 | node_js: 9 | - node 10 | before_install: npm i -g npm@latest 11 | script: 12 | - npm start validate 13 | after_success: 14 | - npx codecov@^3 15 | branches: 16 | only: 17 | - master 18 | deploy: 19 | api_key: 20 | secure: lwScVlyKn606QB57DkpfpXqGP8WSEycQzTcGGkXZNrj7Gf1gQZbbBqVbGoH4Mc6Zqjg8vgZw9XbqMzPSdPXrcWcI5igfoebkAdN/fofIOfRsZUM7+KC4cgm6Van1hCixLZN21ZCzsYq+/imPUTuLogxyE/GgSdKM7tf13MLgN6ccYkaG/sdwtMiclfxZrSbvKEQAJlr3pZp2yb9zHvplmA6w06wea1l3A2O8zDhMiY96lidAz8ykzqInkIGIqdAwlDjX1wX2qEwYuWu/yy89S3ooB3Eal1Ps84dXFLHSNLX44GUwLAJRY25ZlQgf9u54UMYn4URdt0LbI10EkflB9DgNluq9xzZJOzf3xnDeRiVTx0glEdf3n0h4stBzBTmB5jLUZjgenmfwa5ZSM4CHlybMGACGTiNnzd9dZUq5decAaKMueo3qns+hJR8AVm4j3Mc50L7hJ2bayX6P3hMpUgc2mipxub59tecggMYayYw8HIpCj2s0mxstTfJRVNtZzvDZFnJqEPTSsorVf3LPd7eIuW1fnMl7rHjMGXoej4YKpdeNVf5/pWdga1x5iLYpr2cJU/vhXKlELUF1PTC0tvG4JFWO9LFsn1ECordyDr1/hA3d2ayALa7n5l2N5gMz9r3Ml2SXjDrcpCPdor1lxNXnxjyRa+6grXbgtx+zslY= 21 | provider: npm 22 | email: "alex@alex-hansen.com" 23 | skip_cleanup: true 24 | on: 25 | tags: true 26 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thanks for being willing to contribute! 4 | 5 | **Working on your first Pull Request?** You can learn how from this *free* series 6 | [How to Contribute to an Open Source Project on GitHub][egghead] 7 | 8 | ## Project setup 9 | 10 | 1. Fork and clone the repo 11 | 2. `$ npm install` to install dependencies 12 | 3. `$ npm start validate` to validate you've got it working 13 | 4. Create a branch for your PR 14 | 15 | This project uses [`nps`][nps] and you can run `npm start help` to see what 16 | scripts are available. 17 | 18 | > Tip: Keep your `master` branch pointing at the original repository and make 19 | > pull requests from branches on your fork. To do this, run: 20 | > 21 | > ``` 22 | > git remote add upstream https://github.com/sezna/nps.git 23 | > git fetch upstream 24 | > git branch --set-upstream-to=upstream/master master 25 | > ``` 26 | > 27 | > This will add the original repository as a "remote" called "upstream," 28 | > Then fetch the git information from that remote, then set your local `master` 29 | > branch to use the upstream master branch whenever you run `git pull`. 30 | > Then you can make all of your pull request branches based on this `master` 31 | > branch. Whenever you want to update your version of `master`, do a regular 32 | > `git pull`. 33 | 34 | ## Add yourself as a contributor 35 | 36 | This project follows the [all contributors][all-contributors] specification. 37 | To add yourself to the table of contributors on the README.md, please use the 38 | automated script as part of your PR: 39 | 40 | ```console 41 | npm start contributors.add 42 | ``` 43 | 44 | Follow the prompt. If you've already added yourself to the list and are making 45 | a new type of contribution, you can run it again and select the added 46 | contribution type. 47 | 48 | ## Committing and Pushing changes 49 | 50 | This project uses [`semantic-release`][semantic-release] to do automatic 51 | releases and generate a changelog based on the commit history. So we follow 52 | [a convention][convention] for commit messages. You don't have to follow this 53 | convention if you don't like to. Just know that when we merge your commit, we'll 54 | probably use "Squash and Merge" so we can change the commit message :) 55 | 56 | Please make sure to run the tests before you commit your changes. You can run 57 | `npm start test.update` which will update any snapshots that need updating. 58 | Make sure to include those changes (if they exist) in your commit. 59 | 60 | ### opt into git hooks 61 | 62 | There are git hooks set up with this project that are automatically installed 63 | when you install dependencies. They're really handy, but are turned off by 64 | default (so as to not hinder new contributors). You can opt into these by 65 | creating a file called `.opt-in` at the root of the project and putting this 66 | inside: 67 | 68 | ``` 69 | pre-commit 70 | ``` 71 | 72 | ## Help needed 73 | 74 | Please checkout the [the open issues][issues] 75 | 76 | Also, please watch the repo and respond to questions/bug reports/feature requests! Thanks! 77 | 78 | [egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github 79 | [semantic-release]: https://npmjs.com/package/semantic-release 80 | [convention]: https://github.com/conventional-changelog/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md 81 | [all-contributors]: https://github.com/kentcdodds/all-contributors 82 | [issues]: https://github.com/sezna/nps/issues 83 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2016 Kent C. Dodds 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Sponsorship 3 | NPS is being sponsored by the following tool; please help to support us by taking a look and signing up for a free trial. 4 | 5 | GitAds 6 | 7 | # nps 8 | 9 | All the benefits of npm scripts without the cost of a bloated package.json and limits of json 10 | 11 | > `nps` is short for `npm-package-scripts` 12 | 13 | > [What happened to p-s?](#what-happened-to-p-s) 14 | 15 | [![Build Status][build-badge]][build] 16 | [![Code Coverage][coverage-badge]][coverage] 17 | [![Dependencies][dependencyci-badge]][dependencyci] 18 | [![version][version-badge]][package] 19 | [![downloads][downloads-badge]][npm-stat] 20 | [![MIT License][license-badge]][license] 21 | 22 | [![All Contributors](https://img.shields.io/badge/all_contributors-46-orange.svg?style=flat-square)](#contributors) 23 | [![PRs Welcome][prs-badge]][prs] 24 | [![Donate][donate-badge]][donate] 25 | [![Code of Conduct][coc-badge]][coc] 26 | [![Roadmap][roadmap-badge]][roadmap] 27 | [![Examples][examples-badge]][examples] 28 | [![nps friendly][nps-badge]](#badge) 29 | 30 | ## The problem 31 | 32 | Even though npm scripts have a ton of advantages ([learn more][scripts-advantages]), it can grow into an 33 | [unmaintainable mess][mess] in your `package.json` file. Part of the problem is we're configuring scripts in `json` 34 | which has fundamental issues (like no comments). 35 | 36 | ## This solution 37 | 38 | `nps` is a package that solves this problem by allowing you to move your scripts to a `package-scripts.js` file. Because 39 | this file is a JavaScript file, you can do a lot more with your project scripts. Here's an example of a 40 | `package-scripts.js` file: 41 | 42 | ```javascript 43 | const npsUtils = require("nps-utils"); // not required, but handy! 44 | 45 | module.exports = { 46 | scripts: { 47 | default: "node index.js", 48 | lint: "eslint .", 49 | test: { 50 | // learn more about Jest here: https://facebook.github.io/jest 51 | default: "jest", 52 | watch: { 53 | script: "jest --watch", 54 | description: "run in the amazingly intelligent Jest watch mode" 55 | } 56 | }, 57 | build: { 58 | // learn more about Webpack here: https://webpack.js.org/ 59 | default: "webpack", 60 | prod: "webpack -p" 61 | }, 62 | // learn more about npsUtils here: https://npm.im/nps-utils 63 | validate: npsUtils.concurrent.nps("lint", "test", "build") 64 | } 65 | }; 66 | ``` 67 | 68 | Or in case you prefer YAML, here's an example of how that would look in a `package-scripts.yml` file: 69 | 70 | ```yml 71 | scripts: 72 | default: node index.js 73 | lint: eslint . 74 | test: 75 | # learn more about Jest here: https://kcd.im/egghead-jest 76 | default: jest 77 | watch: 78 | script: jest --watch 79 | description: run in the amazingly intelligent Jest watch mode 80 | build: 81 | default: webpack 82 | prod: webpack -p 83 | validate: concurrent "nps lint" "nps test" "nps build" 84 | ``` 85 | 86 | To use `nps`, it's recommended that you either install it globally (`npm i -g nps`) or add `./node_modules/bin` to your 87 | `$PATH` (be careful that you know what you're doing when doing this, find out how [here](https://youtu.be/2WZ5iS_3Jgs)). 88 | 89 | Then you can run: 90 | 91 | ```console 92 | nps help 93 | ``` 94 | 95 | Which will output: 96 | 97 | ```console 98 | Usage: nps [options]