Skip to content

Commit 9fc30d8

Browse files
committed
Add typescript to project
1 parent 8fd96ba commit 9fc30d8

File tree

5 files changed

+45
-8
lines changed

5 files changed

+45
-8
lines changed

.docker/ts.Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM mcr.microsoft.com/devcontainers/typescript-node:1.0.3-20
2+
3+
RUN mkdir /code
4+
WORKDIR /code
5+
6+
CMD /code/scripts/docker/run-ts.sh

.gitignore

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.cache
2+
.calva/
3+
.DS_Store
4+
.vscode
15
*.exe
26
*.hi
37
*.log
@@ -6,14 +10,11 @@
610
*.py[oc]
711
*.swp
812
*~
9-
.DS_Store
10-
.cache
11-
.calva/
12-
.vscode
13-
Main.class
14-
Main.java
1513
\?/
16-
!.clojure/\?
14+
compiledFromTSFile.js
15+
Main.class
1716
main.cmi
1817
main.cmo
18+
Main.java
1919
result-*.txt
20+
!.clojure/\?

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ RS = rs
3333
SCALA = scala
3434
SH = sh
3535
SQL = sql
36+
TS = ts
3637

3738
SUPPORTED_LANGUAGES = \
3839
$(C) \
@@ -114,13 +115,13 @@ clean:
114115
@find . -name '*.hi' -delete
115116
@find . -name '*.o' -delete
116117
@find . -name '*.out' -delete
118+
@find . -name 'compiledFromTSFile.js' -delete
117119
@find . -name 'Main.java' -delete
118120
@find . -name 'result-*.txt' -delete
119121
@find . -type d -name "META-INF" -exec rm -rf {} +
120122
@find solutions -type d -name "\?" -exec rm -rf {} +
121123
@rm -rf \? || true
122124

123-
124125
languages:
125126
@./scripts/languages.sh
126127

scripts/docker/run-ts.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
echo
6+
echo "TYPESCRIPT"
7+
echo
8+
9+
for folder in ${FOLDERS}; do
10+
[[ -f "${folder}WRONG" ]] && continue
11+
12+
if [[ "$(find "${folder}" -name '*.ts' | wc -l)" -eq 1 ]]; then
13+
echo "${folder}"
14+
cd "${folder}" || exit 1
15+
tsc ./*.ts --outfile compiledFromTSFile.js
16+
17+
if [[ -f in.txt ]]; then
18+
node ./compiledFromTSFile.js < in.txt > result-ts.txt
19+
else
20+
node ./compiledFromTSFile.js > result-ts.txt
21+
fi
22+
23+
rm compiledFromTSFile.js
24+
diff result-ts.txt out.txt
25+
26+
cd - > /dev/null
27+
fi
28+
done

solutions/beecrowd/1000/1000.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Hello World!')

0 commit comments

Comments
 (0)