-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade default deno to 2.0.4, try to detect more deno apps, add test…
… for extremely minimal deno app
- Loading branch information
Showing
4 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
package scanner | ||
|
||
import "github.com/superfly/flyctl/internal/command/launch/plan" | ||
import ( | ||
"fmt" | ||
"path/filepath" | ||
|
||
"github.com/superfly/flyctl/internal/command/launch/plan" | ||
) | ||
|
||
func configureDeno(sourceDir string, config *ScannerConfig) (*SourceInfo, error) { | ||
if !checksPass( | ||
sourceDir, | ||
// default config files: https://deno.land/[email protected]/getting_started/configuration_file | ||
fileExists("deno.json", "deno.jsonc"), | ||
// deno.land and denopkg.com imports | ||
dirContains("*.ts", "\"https?://deno\\.land/.*\"", "\"https?://denopkg\\.com/.*\""), | ||
dirContains("*.ts", `"https?://deno\.land/.*"`, `"https?://denopkg\.com/.*"`, `import "(.*)\.tsx{0,}"`, `from "npm:.*"`, `from "jsr:.*"`, `Deno\.serve\(.*`, `Deno\.listen\(.*`), | ||
) { | ||
return nil, nil | ||
} | ||
|
||
var entrypoint string | ||
|
||
for _, path := range []string{"index.ts", "app.ts", "server.ts"} { | ||
if absFileExists(filepath.Join(sourceDir, path)) { | ||
entrypoint = path | ||
break | ||
} | ||
} | ||
|
||
s := &SourceInfo{ | ||
Files: templates("templates/deno"), | ||
Family: "Deno", | ||
Port: 8080, | ||
Processes: map[string]string{ | ||
"app": "run --allow-net ./example.ts", | ||
"app": fmt.Sprintf("run -A ./%s", entrypoint), | ||
}, | ||
Env: map[string]string{ | ||
"PORT": "8080", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Deno.serve({ port: 8080, hostname: "0.0.0.0" }, (_req) => { | ||
return new Response("Hello, World!"); | ||
}); |