From b7c7af5f9ec033c301c30c4b1f2171d89bd27052 Mon Sep 17 00:00:00 2001 From: Divya Sasidharan Date: Wed, 10 Apr 2019 12:38:21 -0400 Subject: [PATCH] fix: Add Nuxt --- src/detectors/nuxt.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/detectors/nuxt.js diff --git a/src/detectors/nuxt.js b/src/detectors/nuxt.js new file mode 100644 index 0000000..2336e89 --- /dev/null +++ b/src/detectors/nuxt.js @@ -0,0 +1,36 @@ +const { + hasRequiredDeps, + hasRequiredFiles, + getYarnOrNPMCommand, + scanScripts +} = require("./utils/jsdetect"); + +module.exports = function() { + // REQUIRED FILES + if (!hasRequiredFiles(["package.json"])) return false; + // REQUIRED DEPS + if (!hasRequiredDeps(["nuxt"])) return false; + + /** everything below now assumes that we are within vue */ + + const possibleArgsArrs = scanScripts({ + preferredScriptsArr: ["start", "dev", "run"], + preferredCommand: "nuxt start" + }); + + if (!possibleArgsArrs.length) { + // ofer to run it when the user doesnt have any scripts setup! 🤯 + possibleArgsArrs.push(["nuxt", "start"]); + } + + return { + type: "yarn", + command: getYarnOrNPMCommand(), + port: 8888, + proxyPort: 3000, + env: { ...process.env }, + possibleArgsArrs, + urlRegexp: new RegExp(`(http://)([^:]+:)${3000}(/)?`, "g"), + dist: ".nuxt" + }; +}; \ No newline at end of file