Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typecheck for node.mk #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion make/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ $(eval $(call node-version-check,$(NODE_VERSION)))
check-coffee-file-count:
$(call node-coffeescript-file-count-check,$(COFFEE_FILE_COUNT))

typechecker:
$(call node-typecheck,backend/server.ts)

run:
NODE_ENV=development node_modules/node-dev/bin/node-dev server.coffee
NODE_ENV=development node_modules/.bin/ts-node --ignoreWarnings 2307 backend/server.ts
```

## Thrift
Expand Down
11 changes: 11 additions & 0 deletions make/node.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ else \
fi
endef

# node-typecheck is a target for calling the typescript type checker on a repo.
# It takes a single argument which is the entrypoint for the app.
define node-typecheck
./node_modules/.bin/ts-node --ignoreWarnings 2307 -e 'import "$(1)"; process.exit(0)' > /tmp/node-mk-typecheck 2>&1 || true
-@grep "compile TypeScript" /tmp/node-mk-typecheck | wc -l > /tmp/node-mk-typecheck-fail-count
@if [ "`cat /tmp/node-mk-typecheck-fail-count`" -gt "0" ]; then \
cat /tmp/node-mk-typecheck; \
exit 1; \
fi
endef

# node-coffee-edit-check exits non-zero if this branch adds any lines to
# coffeescript files. NOTE: Uses the merge-base, as otherwise we would get
# changes in master that were merged after this branch diverged from master.
Expand Down