From 2cbb72d5c6d942ecc1fc5e9165f4fbe1c300cf06 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 11 Feb 2020 16:50:38 -0500 Subject: [PATCH] adds boilerplate for cli --- package.json | 3 +++ src/bin/index.js | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 src/bin/index.js diff --git a/package.json b/package.json index d3e688db0f..c352ef331d 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,9 @@ "build": "webpack --env.platform=web --config ./src/client/config/webpack.prod.config.js --mode production", "lint": "eslint **/*.js" }, + "bin": { + "payload": "./src/bin/index.js" + }, "author": "", "license": "ISC", "dependencies": { diff --git a/src/bin/index.js b/src/bin/index.js new file mode 100755 index 0000000000..5e403b24a7 --- /dev/null +++ b/src/bin/index.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node + +const args = process.argv.slice(2); + +const scriptIndex = args.findIndex( + x => x === 'build' || x === 'test', +); + +const script = scriptIndex === -1 ? args[0] : args[scriptIndex]; + +switch (script) { + case 'build': { + console.log('building'); + break; + } + + case 'test': { + console.log('testing'); + break; + } + default: + console.log(`Unknown script "${script}".`); + break; +}