Skip to content

Commit

Permalink
Dev: Replace Node.js-based http server by Python-based http server
Browse files Browse the repository at this point in the history
Remove the dependency on Node.js and npm (as well as the npm package
`http-server`) in favor of using a Python one-liner to use as an HTTP
server for the ades web-app during development. This reduces the number
of direct dependencies, removes the need for a registry dependency
(reducing the relience of Dependabot), and arguably makes contributing
easier as Python seems to be more commonly used across language
ecosystems than Node.js is (though from the provided dev-env experience,
nothing much changes).

Signed-off-by: Eric Cornelissen <ericornelissen@gmail.com>
  • Loading branch information
ericcornelissen committed Oct 22, 2024
1 parent 1069fd8 commit cc12e5d
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 577 deletions.
8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,3 @@ updates:
labels:
- ci/cd
- dependencies
- package-ecosystem: npm
directory: /web
open-pull-requests-limit: 1
schedule:
interval: daily
time: "04:00"
labels:
- dependencies
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ test/**
# Website
!web/
web/**
!web/.npmrc
!web/Makefile
!web/ades.go
!web/index.css
!web/index.html
!web/index.js
!web/package-lock.json
!web/package.json
2 changes: 1 addition & 1 deletion Containerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
FROM docker.io/golang:1.23.0-alpine3.19

RUN apk add --no-cache \
bash git npm perl-utils zip \
bash git perl-utils python3 zip \
&& \
echo "alias gask='go run tasks.go'" >~/.bashrc \
&& \
Expand Down
7 changes: 1 addition & 6 deletions tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ func TaskClean(t *T) error {
var (
items = []string{
"_compiled/",
"web/node_modules/",
"web/ades.wasm",
"web/COPYING.txt",
"web/wasm_exec.js",
Expand Down Expand Up @@ -625,11 +624,7 @@ func TaskWebServe(t *T) error {

t.Log("Serving locally...")
t.Cd(webDir)
if err := t.Exec("npm install"); err != nil {
return err
}

return t.Exec("npx http-server . --port 8080")
return t.Exec("python3 -m http.server 8080")
}

// -------------------------------------------------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions web/.npmrc

This file was deleted.

Loading

0 comments on commit cc12e5d

Please sign in to comment.