tweak generation of propsal file a little bit

This commit is contained in:
Johannes Rieken
2021-11-11 12:55:28 +01:00
parent 6eac98960d
commit b48a7f385e
5 changed files with 25 additions and 22 deletions

View File

@@ -223,11 +223,11 @@ function apiProposalNamesGenerator() {
try {
const t1 = Date.now();
const proposalNames: string[] = [];
const proposalNames: [name: string, url: string][] = [];
for (let file of fs.readdirSync(dtsFolder)) {
const match = pattern.exec(file);
if (match) {
proposalNames.push(match[1]);
proposalNames.push([match[1], `https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/${file}`]);
}
}
@@ -239,11 +239,11 @@ function apiProposalNamesGenerator() {
'',
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
'',
'const apiProposals = {',
`${proposalNames.map(name => `\t${name}: true`).join(',\n')}`,
'};',
'export type ApiProposalName = keyof typeof apiProposals;',
'export const apiProposalNames: ReadonlySet<ApiProposalName> = new Set(<ApiProposalName[]>Object.keys(apiProposals));',
'export const allApiProposals = Object.freeze({',
`${proposalNames.map(t => `\t${t[0]}: '${t[1]}'`).join(',\n')}`,
'});',
'export type ApiProposalName = keyof typeof allApiProposals;',
'export const allApiProposalNames = <readonly ApiProposalName[]><unknown>Object.keys(allApiProposals);',
'',
].join('\n');