Skip to content

Commit

Permalink
Add typescript to project
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Nov 21, 2024
1 parent 8fd96ba commit 9fc30d8
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .docker/ts.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.cache
.calva/
.DS_Store
.vscode
*.exe
*.hi
*.log
Expand All @@ -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/\?
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RS = rs
SCALA = scala
SH = sh
SQL = sql
TS = ts

SUPPORTED_LANGUAGES = \
$(C) \
Expand Down Expand Up @@ -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

Expand Down
28 changes: 28 additions & 0 deletions scripts/docker/run-ts.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions solutions/beecrowd/1000/1000.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('Hello World!')

0 comments on commit 9fc30d8

Please sign in to comment.