-
Notifications
You must be signed in to change notification settings - Fork 13
Added typescript support and hello world test #45
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| load("@aspect_rules_ts//ts:defs.bzl", "ts_project") | ||
| load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
| load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
|
||
| npm_link_all_packages(name = "node_modules") | ||
|
|
||
| ts_project( | ||
| name = "typescript", | ||
| srcs = ["main.ts"], | ||
| declaration = True, | ||
| out_dir = ".", | ||
| deps = [ | ||
| "//typescript:node_modules/@types/node", | ||
| ], | ||
| ) | ||
|
|
||
| build_test( | ||
| name = "typesctript_test", | ||
| targets = [ | ||
| ":typescript", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export const hello: String = "Hello "; | ||
| export const world: String = "World " | ||
|
|
||
| console.log(hello, world) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know nothing about typescript: do we need to track external dependencies like this though? For other languages, you can do most things through
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the documentation, we need those files as bazel builds entire projects. I have checked it works as it translated the code into a Just for your information, these are the rules I am using: https://github.com/aspect-build/rules_ts |
||
| "private": true, | ||
| "dependencies": { | ||
| "@types/node": "18.6.1", | ||
| "typescript": "4.8.2" | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "declaration": true, | ||
| "baseUrl": ".", | ||
| "types": ["node"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need this type? We generally aren't transpiling for Node.js (for the browser instead)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't really have a requirement here. I just added typescript support with rules_ts and to execute a simple example. I think, however, that line 5 is not necessary. I will remove it. |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: semicolons after each line (ideally this would pass our linter tests which are not configured for this package)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.