Files
vscode-extension-samples/.scripts/update-lsif.js

31 lines
768 B
JavaScript
Raw Permalink Normal View History

2021-04-23 18:45:30 +02:00
const fs = require('fs').promises;
const path = require('path');
const { samples, lspSamples } = require('./samples')
const root = path.join(__dirname, '..');
async function main() {
const references = [];
for (const sample of samples) {
try {
const stat = await fs.stat(path.join(root, sample.path, 'tsconfig.json'));
if (stat.isFile()) {
2021-07-07 15:23:56 +02:00
references.push(`./${sample.path}/tsconfig.json`);
2021-04-23 18:45:30 +02:00
}
} catch (error) {
// Ignore error of stat call.
}
}
const tsconfig = {
compilerOptions: {
},
files: [
],
references: references.map(reference => { return { path: reference }})
}
2021-07-07 15:23:56 +02:00
await fs.writeFile(path.join(root, 'tsconfig.lsif.json'), JSON.stringify(tsconfig, undefined, '\t'), { encoding: 'utf8' });
2021-04-23 18:45:30 +02:00
}
main().catch(console.error);