diff --git a/src/detectors/vuepress.js b/src/detectors/vuepress.js new file mode 100644 index 0000000..e2b19cf --- /dev/null +++ b/src/detectors/vuepress.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(["vuepress"])) return false; + + /** everything below now assumes that we are within vue */ + + const possibleArgsArrs = scanScripts({ + preferredScriptsArr: ["docs:dev", "dev", "run"], + preferredCommand: "vuepress dev" + }); + + if (!possibleArgsArrs.length) { + // ofer to run it when the user doesnt have any scripts setup! 🤯 + possibleArgsArrs.push(["vuepress", "dev"]); + } + + return { + type: "vuepress", + command: getYarnOrNPMCommand(), + port: 8888, + proxyPort: 8080, + env: { ...process.env }, + possibleArgsArrs, + urlRegexp: new RegExp(`(http://)([^:]+:)${8080}(/)?`, "g"), + dist: ".vuepress/dist" + }; +}; \ No newline at end of file