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

Commit 3179ffc

Browse files
committed
add sapper
1 parent bd755cc commit 3179ffc

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/detectors/sapper.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const {
2+
hasRequiredDeps,
3+
hasRequiredFiles,
4+
getYarnOrNPMCommand,
5+
scanScripts
6+
} = require("./utils/jsdetect");
7+
8+
module.exports = function() {
9+
// REQUIRED FILES
10+
if (!hasRequiredFiles(["package.json"])) return false;
11+
// REQUIRED DEPS
12+
if (!hasRequiredDeps(["sapper"])) return false;
13+
14+
/** everything below now assumes that we are within vue */
15+
16+
const possibleArgsArrs = scanScripts({
17+
preferredScriptsArr: ["dev", "start"],
18+
preferredCommand: "sapper dev"
19+
});
20+
21+
if (possibleArgsArrs.length === 0) {
22+
// ofer to run it when the user doesnt have any scripts setup! 🤯
23+
possibleArgsArrs.push(["sapper", "dev"]);
24+
}
25+
26+
return {
27+
type: "vue-cli",
28+
command: getYarnOrNPMCommand(),
29+
port: 8888,
30+
proxyPort: 3000,
31+
env: { ...process.env },
32+
possibleArgsArrs,
33+
urlRegexp: new RegExp(`(http://)([^:]+:)${3000}(/)?`, "g"),
34+
dist: "dist"
35+
};
36+
};

0 commit comments

Comments
 (0)