Minimal backend typescript support (#3207)

* minimal ts support

Co-authored-by: Matt Godbolt <matt@godbolt.org>
This commit is contained in:
Patrick Quist
2021-12-22 20:44:51 +01:00
committed by GitHub
parent b11155c792
commit 6e79e098c4
9 changed files with 131 additions and 24 deletions

View File

@@ -43,7 +43,7 @@ $(NODE_MODULES): package.json | node-installed
WEBPACK:=./node_modules/webpack-cli/bin/cli.js
$(WEBPACK): $(NODE_MODULES)
lint: $(NODE_MODULES) ## Checks if the source currently matches code conventions
lint: $(NODE_MODULES) ts-compile ## Checks if the source currently matches code conventions
$(NPM) run lint
lint-fix: $(NODE_MODULES) ## Checks if everything matches code conventions & fixes those which are trivial to do so
@@ -72,20 +72,25 @@ clean: ## Cleans up everything
run: export NODE_ENV=production
run: export WEBPACK_ARGS="--node-env=production"
run: prereqs webpack ## Runs the site normally
./node_modules/.bin/supervisor -w app.js,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' --exec $(NODE) $(NODE_ARGS) -- -r esm ./app.js $(EXTRA_ARGS)
./node_modules/.bin/supervisor -w app.js,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' --exec $(NODE) $(NODE_ARGS) -- -r esm -r ts-node/register ./app.js $(EXTRA_ARGS)
dev: export NODE_ENV=development
dev: prereqs ## Runs the site as a developer; including live reload support and installation of git hooks
./node_modules/.bin/supervisor -w app.js,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(NODE) $(NODE_ARGS) -- -r esm ./app.js $(EXTRA_ARGS)
./node_modules/.bin/supervisor -w app.js,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(NODE) $(NODE_ARGS) -- -r esm -r ts-node/register ./app.js $(EXTRA_ARGS)
debug: export NODE_ENV=development
debug: prereqs ## Runs the site as a developer with full debugging; including live reload support and installation of git hooks
./node_modules/.bin/supervisor -w app.js,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --inspect 9229 --exec $(NODE) $(NODE_ARGS) -- -r esm ./app.js --debug $(EXTRA_ARGS)
./node_modules/.bin/supervisor -w app.js,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --inspect 9229 --exec $(NODE) $(NODE_ARGS) -- -r esm -r ts-node/register ./app.js --debug $(EXTRA_ARGS)
.PHONY: ts-compile
# one day we'll put `--strict` in this
ts-compile: prereqs
./node_modules/.bin/tsc
HASH := $(shell git rev-parse HEAD)
dist: export NODE_ENV=production
dist: export WEBPACK_ARGS="--node-env=production"
dist: prereqs webpack ## Creates a distribution
dist: prereqs webpack ts-compile ## Creates a distribution
echo $(HASH) > out/dist/git_hash
RELEASE_FILE_NAME=$(GITHUB_RUN_NUMBER)