From ec70719c90a4d6f0c54b2dc8fbe7cb8d387e987b Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Fri, 14 Jul 2023 19:58:43 +0000 Subject: [PATCH] Add gulp task to verify successful compilation of API --- gulpfile.js | 20 ++++++++++++++++++-- pythonExtensionApi/README.md | 2 +- pythonExtensionApi/tsconfig.json | 8 ++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 0d47127f187e0..8dacb02bb93a1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,11 +23,11 @@ const os = require('os'); const rmrf = require('rimraf'); const typescript = require('typescript'); -const tsProject = ts.createProject('./tsconfig.json', { typescript }); +const tsProject = ts.createProject('./pythonExtensionApi/tsconfig.json', { typescript }); const isCI = process.env.TRAVIS === 'true' || process.env.TF_BUILD !== undefined; -gulp.task('compile', (done) => { +gulp.task('compileCore', (done) => { let failed = false; tsProject .src() @@ -39,6 +39,22 @@ gulp.task('compile', (done) => { .on('finish', () => (failed ? done(new Error('TypeScript compilation errors')) : done())); }); +const apiTsProject = ts.createProject('./pythonExtensionApi/tsconfig.json', { typescript }); + +gulp.task('compileApi', (done) => { + let failed = false; + apiTsProject + .src() + .pipe(apiTsProject()) + .on('error', () => { + failed = true; + }) + .js.pipe(gulp.dest('./pythonExtensionApi/out')) + .on('finish', () => (failed ? done(new Error('TypeScript compilation errors')) : done())); +}); + +gulp.task('compile', gulp.series('compileCore', 'compileApi')); + gulp.task('precommit', (done) => run({ exitOnError: true, mode: 'staged' }, done)); gulp.task('output:clean', () => del(['coverage'])); diff --git a/pythonExtensionApi/README.md b/pythonExtensionApi/README.md index 700eac741822b..d7ca4ccfdae4c 100644 --- a/pythonExtensionApi/README.md +++ b/pythonExtensionApi/README.md @@ -19,7 +19,7 @@ First we need to define a `package.json` for the extension that wants to use the // Depend on the Python extension facade npm module to get easier API access to the // core extension. "dependencies": { - "@vscode/pythonExtensionApi": "..." + "@vscode/python-extension": "..." }, } ``` diff --git a/pythonExtensionApi/tsconfig.json b/pythonExtensionApi/tsconfig.json index 1d8e33d7c95db..d90209b3a4b6a 100644 --- a/pythonExtensionApi/tsconfig.json +++ b/pythonExtensionApi/tsconfig.json @@ -1,8 +1,9 @@ { "compilerOptions": { - "composite": true, - "incremental": true, "baseUrl": ".", + "paths": { + "*": ["types/*"] + }, "module": "commonjs", "target": "es2018", "outDir": "./out", @@ -24,8 +25,7 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "resolveJsonModule": true, - "removeComments": true, - "tsBuildInfoFile": "./out/tsconfig.tsbuildInfo", + "removeComments": true }, "exclude": [ "node_modules",