This repository was archived by the owner on Sep 12, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ;
Original file line number Diff line number Diff line change
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 ( [ "svelte" ] ) ) return false ;
13
+
14
+ /** everything below now assumes that we are within vue */
15
+
16
+ const possibleArgsArrs = scanScripts ( {
17
+ preferredScriptsArr : [ "dev" , "start" , "run" ] ,
18
+ preferredCommand : "npm run dev"
19
+ } ) ;
20
+
21
+ if ( possibleArgsArrs . length === 0 ) {
22
+ // ofer to run it when the user doesnt have any scripts setup! 🤯
23
+ possibleArgsArrs . push ( [ "npm" , "dev" ] ) ;
24
+ }
25
+
26
+ return {
27
+ type : "svelte" ,
28
+ command : getYarnOrNPMCommand ( ) ,
29
+ port : 8888 ,
30
+ proxyPort : 5000 ,
31
+ env : { ...process . env } ,
32
+ possibleArgsArrs,
33
+ urlRegexp : new RegExp ( `(http://)([^:]+:)${ 5000 } (/)?` , "g" ) ,
34
+ dist : "dist"
35
+ } ;
36
+ } ;
You can’t perform that action at this time.
0 commit comments