forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: use typescript for internal Electron JS code (electron#16441)
- Loading branch information
1 parent
858781b
commit 26df999
Showing
19 changed files
with
683 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
{ | ||
"extends": "standard", | ||
"parser": "typescript-eslint-parser", | ||
"plugins": ["typescript"], | ||
"env": { | ||
"browser": true | ||
}, | ||
"rules": { | ||
"no-var": "error", | ||
"no-unused-vars": 0, | ||
"no-global-assign": 0, | ||
"typescript/no-unused-vars": "error", | ||
"prefer-const": ["error", { | ||
"destructuring": "all" | ||
}] | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import("npm.gni") | ||
|
||
template("typescript_build") { | ||
assert(defined(invoker.tsconfig), "Need tsconfig name to run") | ||
assert(defined(invoker.sources), "Need tsc sources to run") | ||
assert(defined(invoker.output_dir_name), | ||
"Need output_dir_name to run, should be 'lib' or other top level dir") | ||
assert(defined(invoker.output_gen_dir), | ||
"Need output_gen_dir to run, should be relative to the root gen dir") | ||
|
||
npm_action(target_name) { | ||
forward_variables_from(invoker, | ||
[ | ||
"deps", | ||
"public_deps", | ||
"outputs", | ||
]) | ||
script = "tsc" | ||
|
||
sources = invoker.sources | ||
inputs = [ | ||
invoker.tsconfig, | ||
"//electron/tsconfig.json", | ||
"//electron/package-lock.json", | ||
] | ||
|
||
type_roots = "node_modules/@types,typings" | ||
if (defined(invoker.type_root)) { | ||
type_roots += "," + invoker.type_root | ||
} | ||
|
||
base_out_path = invoker.output_gen_dir + "/electron/" | ||
args = [ | ||
"-p", | ||
rebase_path(invoker.tsconfig), | ||
"--outDir", | ||
rebase_path("$base_out_path" + invoker.output_dir_name), | ||
"--typeRoots", | ||
type_roots, | ||
] | ||
|
||
outputs = [] | ||
|
||
foreach(invoker_source, invoker.sources) { | ||
# The output of TSC is all inputs but with JS instead of TS as the extension | ||
outputs += [ "$base_out_path" + get_path_info(invoker_source, "dir") + | ||
"/" + get_path_info(invoker_source, "name") + ".js" ] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.