diff --git a/.docker/ts.Dockerfile b/.docker/ts.Dockerfile new file mode 100644 index 00000000..7e3d6709 --- /dev/null +++ b/.docker/ts.Dockerfile @@ -0,0 +1,6 @@ +FROM mcr.microsoft.com/devcontainers/typescript-node:1.0.3-20 + +RUN mkdir /code +WORKDIR /code + +CMD /code/scripts/docker/run-ts.sh diff --git a/.gitignore b/.gitignore index 5b667109..085ca855 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +.cache +.calva/ +.DS_Store +.vscode *.exe *.hi *.log @@ -6,14 +10,11 @@ *.py[oc] *.swp *~ -.DS_Store -.cache -.calva/ -.vscode -Main.class -Main.java \?/ -!.clojure/\? +compiledFromTSFile.js +Main.class main.cmi main.cmo +Main.java result-*.txt +!.clojure/\? diff --git a/Makefile b/Makefile index 362d7ea8..7eb7f033 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ RS = rs SCALA = scala SH = sh SQL = sql +TS = ts SUPPORTED_LANGUAGES = \ $(C) \ @@ -114,13 +115,13 @@ clean: @find . -name '*.hi' -delete @find . -name '*.o' -delete @find . -name '*.out' -delete + @find . -name 'compiledFromTSFile.js' -delete @find . -name 'Main.java' -delete @find . -name 'result-*.txt' -delete @find . -type d -name "META-INF" -exec rm -rf {} + @find solutions -type d -name "\?" -exec rm -rf {} + @rm -rf \? || true - languages: @./scripts/languages.sh diff --git a/scripts/docker/run-ts.sh b/scripts/docker/run-ts.sh new file mode 100755 index 00000000..0917c738 --- /dev/null +++ b/scripts/docker/run-ts.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo +echo "TYPESCRIPT" +echo + +for folder in ${FOLDERS}; do + [[ -f "${folder}WRONG" ]] && continue + + if [[ "$(find "${folder}" -name '*.ts' | wc -l)" -eq 1 ]]; then + echo "${folder}" + cd "${folder}" || exit 1 + tsc ./*.ts --outfile compiledFromTSFile.js + + if [[ -f in.txt ]]; then + node ./compiledFromTSFile.js < in.txt > result-ts.txt + else + node ./compiledFromTSFile.js > result-ts.txt + fi + + rm compiledFromTSFile.js + diff result-ts.txt out.txt + + cd - > /dev/null + fi +done diff --git a/solutions/beecrowd/1000/1000.ts b/solutions/beecrowd/1000/1000.ts new file mode 100644 index 00000000..7e2c8770 --- /dev/null +++ b/solutions/beecrowd/1000/1000.ts @@ -0,0 +1 @@ +console.log('Hello World!')