Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

fix: Add Nuxt #115

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/detectors/nuxt.js
Original file line number Diff line number Diff line change
@@ -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"
};
};