[*] i really cant be arsed anymore

This commit is contained in:
Reece Wilson 2024-11-02 21:27:49 +00:00
parent f28545cabd
commit 9e8647cd86

View File

@ -1,4 +1,5 @@
local kPathPrefix = "!" local kPathPrefix = "!"
local kOldMode = false
local function processJson(meta, object, result) local function processJson(meta, object, result)
auMergeTable(object, auMergeTable(object,
@ -72,6 +73,7 @@ local function processProject(meta, object)
args = args .. ' --sourceMap' args = args .. ' --sourceMap'
args = args .. ' --declarationMap' args = args .. ' --declarationMap'
args = args .. ' --inlineSources' args = args .. ' --inlineSources'
args = args .. ' --resolveJsonModule'
args = args .. ' --module ' .. object.module args = args .. ' --module ' .. object.module
args = args .. ' --moduleDetection ' .. object.moduleDetection args = args .. ' --moduleDetection ' .. object.moduleDetection
args = args .. ' --sourceRoot \"' .. rootdir .. "\"" args = args .. ' --sourceRoot \"' .. rootdir .. "\""
@ -148,11 +150,13 @@ local function processProject(meta, object)
table.insert(ew3, rootdir .. "/" .. func:gsub("%*%*.", "**/*.")) table.insert(ew3, rootdir .. "/" .. func:gsub("%*%*.", "**/*."))
table.insert(ew3, rootdir .. "/" .. func:gsub("%*%*.", "*.")) table.insert(ew3, rootdir .. "/" .. func:gsub("%*%*.", "*."))
end) end)
auAddBuildAction("pre", "cmd", "tsc", false, args) if (kOldMode) then
auAddBuildAction("pre", "cmd", "tsc", false, args)
else
auAddBuildAction("pre", "cmd", "tsc", false, "--project \"" .. rootdir .. "\"")
end
local requiredDirs = {} local requiredDirs = {}
local requiredCopies = {} local requiredCopies = {}
@ -167,6 +171,8 @@ local function processProject(meta, object)
mkdir = "mkdir -p \"PATH\""; mkdir = "mkdir -p \"PATH\"";
end end
local primarySourceList = {}
local primaryTypeList = {}
if (object.bundle) then if (object.bundle) then
else else
@ -193,6 +199,8 @@ local function processProject(meta, object)
local dbg2p = part .. ".d.ts.map" local dbg2p = part .. ".d.ts.map"
if (not isD) then if (not isD) then
table.insert(primarySourceList, part)
auForEach(meta.out, function(dest) auForEach(meta.out, function(dest)
if (dest:starts(kPathPrefix)) then if (dest:starts(kPathPrefix)) then
dest = Aurora.Settings.sAbsWd .. dest:sub(#kPathPrefix + 1) dest = Aurora.Settings.sAbsWd .. dest:sub(#kPathPrefix + 1)
@ -222,6 +230,8 @@ local function processProject(meta, object)
path.translate(path.normalize(path.join(compilerPath, link)), path.getDefaultSeparator()), path.translate(path.normalize(path.join(compilerPath, link)), path.getDefaultSeparator()),
path.translate(path.normalize(path.join(linkPath, link2)), path.getDefaultSeparator()), pathSuffix)) path.translate(path.normalize(path.join(linkPath, link2)), path.getDefaultSeparator()), pathSuffix))
else else
table.insert(primaryTypeList, part)
prebuildcommands(string.format("{COPY} \"%s\" \"%s%s", prebuildcommands(string.format("{COPY} \"%s\" \"%s%s",
file, file,
path.translate(path.normalize(path.join(linkPath, link2)), path.getDefaultSeparator()), pathSuffix)) path.translate(path.normalize(path.join(linkPath, link2)), path.getDefaultSeparator()), pathSuffix))
@ -233,18 +243,58 @@ local function processProject(meta, object)
local compilerOptions = {} local compilerOptions = {}
auMergeTable(compilerOptions, object.flags) auMergeTable(compilerOptions, object.flags)
if (not kOldMode) then
table.remove(typeDirs, 1)
end
compilerOptions.typeRoots = typeDirs compilerOptions.typeRoots = typeDirs
compilerOptions.target = object.targetVersion compilerOptions.target = object.targetVersion
compilerOptions.module = object.module compilerOptions.module = object.module
compilerOptions.moduleDetection = object.moduleDetection
if (not kOldMode) then
if (object.bundle) then
compilerOptions.outFile = path.normalize(path.join(compilerPath, meta.name)) .. ".js"
end
compilerOptions.declaration = true
compilerOptions.moduleDetection = object.moduleDetection
compilerOptions.resolveJsonModule = true
compilerOptions.inlineSources = true
compilerOptions.declarationMap = true
compilerOptions.sourceMap = true
compilerOptions.sourceRoot = rootdir
compilerOptions.mapRoot = path.normalize(symPath)
compilerOptions.rootDir = rootdir
compilerOptions.outDir = compilerPath
compilerOptions.moduleResolution = "classic"
end
local IDE = { local IDE = {
autogeneratedfile = "DO NOT MODIFY OR ATTEMPT TO COMPILE. IDE LINT, TOOLTIP, AND AUTOCOMPLETE USAGE ONLY", --autogeneratedfile = "DO NOT MODIFY OR ATTEMPT TO COMPILE. IDE LINT, TOOLTIP, AND AUTOCOMPLETE USAGE ONLY",
include = auMergeArray(ew3, ew2), include = auMergeArray(ew3, ew2),
compilerOptions = compilerOptions compilerOptions = compilerOptions
} }
local extended = {
base = IDE,
files = object.files,
out = meta.out,
typeSources = ew3,
expandedSources = ew2,
settings = Aurora.Settings,
dependsNoSource = object.depends2,
dependsWithSource = object.depends,
primarySourceList = primarySourceList,
primaryTypeList = primaryTypeList
}
io.writefile("tsconfig.json", json.encode(IDE, 4)) io.writefile("tsconfig.json", json.encode_pretty(IDE))
if (Aurora.Settings.bWantExtendedTSConfig) then
io.writefile("tsconfig.extended.json", json.encode_pretty(extended))
end
files "tsconfig.json" files "tsconfig.json"
end end
end end