forked from DataDog/datadog-api-client-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-examples.sh
More file actions
executable file
·25 lines (17 loc) · 969 Bytes
/
check-examples.sh
File metadata and controls
executable file
·25 lines (17 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo "No arguments supplied"
exit 2
fi
# install dependencies
yarn install --ignore-scripts
./extract-code-blocks.sh examples $1
# temporary fix to compile example files
find examples/$1 -type f -name "*.ts" | xargs sed -i.bak 's_@datadog/datadog-api-client_../../../index_1'
touch examples/$1/tsconfig.json
echo '{"compilerOptions":{"strict":true,"target":"es5","module":"commonjs","moduleResolution":"node","declaration":true,"esModuleInterop":true,"resolveJsonModule":true,"noImplicitAny":true,"noImplicitThis":true,"noUnusedLocals":false,"noUnusedParameters":false,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"sourceMap":true,"noLib":false,"lib":["es5","es6","es7"],"outDir":"../../dist"},"exclude":["dist","features","node_modules"],"include":["./**/*.ts"]}' > examples/$1/tsconfig.json
yarn tsc --build examples/$1
if [ $? -ne 0 ]; then
echo -e "Failed to build examples"
exit 1
fi