fix lib comp opts

This commit is contained in:
Seth Trowbridge 2023-10-14 12:06:11 -04:00
parent c44c1df257
commit 69f902c927

View File

@ -196,18 +196,30 @@ export async function Check()
const confTasks = (config.json.tasks || {}) as Record<string, string>; const confTasks = (config.json.tasks || {}) as Record<string, string>;
config.json.tasks = {...confTasks, ...tasks}; config.json.tasks = {...confTasks, ...tasks};
const options = const optionsRequired =
{ {
"lib": ["deno.window", "dom", "dom.asynciterable"], "lib": ["deno.window", "dom", "dom.iterable", "dom.asynciterable"],
"jsx": "react-jsx", "jsx": "react-jsx",
"jsxImportSource": "react" "jsxImportSource": "react"
} }
const compOpts = config.json.compilerOptions as Record<string, string|string[]> || {}; const optionsCurrent = config.json.compilerOptions as Record<string, string|string[]> || {};
const compLib:string[] = compOpts.lib as string[] || []; //const compLib:string[] = compOpts.lib as string[] || [];
compOpts.jsx = options.jsx;
compOpts.jsxImportSource = options.jsxImportSource; if(!optionsCurrent.lib)
compOpts.lib = [...compLib, ...options.lib]; {
config.json.compilerOptions = compOpts; optionsCurrent.lib = [];
}
optionsRequired.lib.forEach(s=>
{
if(!optionsCurrent.lib.includes(s))
{
(optionsCurrent.lib as string[]).push(s);
}
});
optionsCurrent.jsx = optionsRequired.jsx;
optionsCurrent.jsxImportSource = optionsRequired.jsxImportSource;
config.json.compilerOptions = optionsCurrent;
await bake(imports); await bake(imports);
await bake(config); await bake(config);