mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
31 lines
785 B
TypeScript
31 lines
785 B
TypeScript
import * as fs from 'fs/promises';
|
|
import * as path from 'path';
|
|
import { samples } from './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()) {
|
|
references.push(`./${sample.path}/tsconfig.json`);
|
|
}
|
|
} catch (error) {
|
|
// Ignore error of stat call.
|
|
}
|
|
}
|
|
const tsconfig = {
|
|
compilerOptions: {
|
|
},
|
|
files: [
|
|
],
|
|
references: references.map(reference => { return { path: reference } })
|
|
}
|
|
await fs.writeFile(path.join(root, 'tsconfig.lsif.json'), JSON.stringify(tsconfig, undefined, '\t'), { encoding: 'utf8' });
|
|
}
|
|
|
|
if (require.main === module) {
|
|
main().catch(console.error);
|
|
} |