Skip to content

Commit

Permalink
Add gulp task to verify successful compilation of API
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Jul 14, 2023
1 parent c6f3e68 commit ec70719
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
20 changes: 18 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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']));
Expand Down
2 changes: 1 addition & 1 deletion pythonExtensionApi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "..."
},
}
```
Expand Down
8 changes: 4 additions & 4 deletions pythonExtensionApi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"compilerOptions": {
"composite": true,
"incremental": true,
"baseUrl": ".",
"paths": {
"*": ["types/*"]
},
"module": "commonjs",
"target": "es2018",
"outDir": "./out",
Expand All @@ -24,8 +25,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true,
"removeComments": true,
"tsBuildInfoFile": "./out/tsconfig.tsbuildInfo",
"removeComments": true
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit ec70719

Please sign in to comment.