From 6bfe5566887ef47e0a2c457fbe7c009f37679912 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Thu, 3 Mar 2016 16:50:16 -0800 Subject: [PATCH] index: throw error if `start` is not defined. --- lib/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/index.js b/lib/index.js index 6f610a2..fc20f91 100644 --- a/lib/index.js +++ b/lib/index.js @@ -37,6 +37,11 @@ export default class Now extends EventEmitter { throw new Error(`Failed to read JSON in "${path}/package.json"`); } + if (!pkg.scripts || !pkg.scripts.start) { + throw new Error('Missing `start` script in `package.json`. ' + + 'See: https://docs.npmjs.com/cli/start.'); + } + if (this._debug) console.time('> [debug] Getting files'); const files = await getFiles(path, pkg, { limit: ONEMB, debug: this._debug }); if (this._debug) console.timeEnd('> [debug] Getting files');