You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/01/06 03:25:08 UTC
[incubator-echarts-examples] branch next updated: test: generate
tsconfig for typechecking in vscode
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-examples.git
The following commit(s) were added to refs/heads/next by this push:
new c18897d test: generate tsconfig for typechecking in vscode
c18897d is described below
commit c18897d4319e3d17029d82ed9e2ee6e37468dd58
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Jan 6 11:24:54 2021 +0800
test: generate tsconfig for typechecking in vscode
---
common/buildCode.js | 2 ++
test/main.js | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/common/buildCode.js b/common/buildCode.js
index 2c729b3..e5d3050 100644
--- a/common/buildCode.js
+++ b/common/buildCode.js
@@ -90,6 +90,8 @@ Object.keys(CHARTS_MAP).forEach(key => {
module.exports.collectDeps = function collectDeps(option) {
let deps = [];
if (option.options) {
+
+ // TODO getOption() doesn't have baseOption and options.
option.options.forEach((opt) => {
deps = deps.concat(collectDeps(opt));
});
diff --git a/test/main.js b/test/main.js
index 27520bf..d62231e 100644
--- a/test/main.js
+++ b/test/main.js
@@ -199,13 +199,15 @@ async function buildRunCode() {
async function compileTs(tsTestFiles, result) {
const config = JSON.parse(fs.readFileSync(nodePath.join(__dirname, 'tsconfig.json'), 'utf-8'));
- const {options, errors} = ts.convertCompilerOptionsFromJson({
+ const compilerOptions = {
...config.compilerOptions,
"paths": {
"echarts": [ECHARTS_DIR],
"echarts/*": [ECHARTS_DIR + '/*']
}
- }, nodePath.resolve(__dirname));
+ };
+
+ const {options, errors} = ts.convertCompilerOptionsFromJson(compilerOptions, nodePath.resolve(__dirname));
if (errors.length) {
let errMsg = 'tsconfig parse failed: '
@@ -214,6 +216,11 @@ async function compileTs(tsTestFiles, result) {
assert(false, errMsg);
}
+ // Generate this config file for checking the source code in vscode.
+ fs.writeFileSync(nodePath.join(RUN_CODE_DIR, 'tsconfig.json'), JSON.stringify({
+ compilerOptions
+ }, null, 2), 'utf-8');
+
// See: https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API
let program = ts.createProgram(tsTestFiles, options);
let emitResult = program.emit();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org