diff --git a/source/helpers.ts b/source/helpers.ts index ac57a9e..a696aef 100644 --- a/source/helpers.ts +++ b/source/helpers.ts @@ -150,11 +150,13 @@ namespace _ivaldi { "declaration": declaration = false, "libs": libs = [], + "head": head = "tsc" } : { declaration ?: boolean; libs ?: Array; + head ?: string; } = { @@ -162,8 +164,9 @@ namespace _ivaldi ) : string { return lib_plankton.string.coin( - "tsc{{libs}} {{source_paths}} --outFile {{target_path}}{{declaration}}", + "{{head}}{{libs}} {{source_paths}} --outFile {{target_path}}{{declaration}}", { + "head": head, "libs": ( libs .map( diff --git a/source/main.ts b/source/main.ts index 3ea503e..efb64c3 100644 --- a/source/main.ts +++ b/source/main.ts @@ -218,6 +218,12 @@ namespace _ivaldi ?? "node" ), + "settings": { + "typescript": { + "command": (((data_raw["settings"] ?? {})["typescript"] ?? {})["command"] ?? "tsc"), + "libs": (((data_raw["settings"] ?? {})["typescript"] ?? {})["libs"] ?? ["es2020"]), + }, + }, "directories": { "lib": ( (data_raw["misc"] ?? {})["lib"] @@ -250,13 +256,6 @@ namespace _ivaldi lib_plankton.string.coin("/tmp/", {}) ), }, - "commands": { - "typescript_compile": ( - (data_raw["commands"] ?? {})["typescript_compile"] - ?? - "tsc" - ), - }, "libs": (data_raw["libs"] ?? {}), "core": data_raw["core"], "apps": ( @@ -267,7 +266,7 @@ namespace _ivaldi "sources": app_raw["sources"], "additional_dependencies": (app_raw["additional_dependencies"] ?? []), "destination": (app_raw["destination"] ?? "{{project}}-{{app}}"), - "shebang": (app_raw["shebang"] ?? null), + "head": (app_raw["head"] ?? null), "executable": (app_raw["executable"] ?? false), } ) @@ -533,8 +532,9 @@ namespace _ivaldi ["$^"], path_core_implementation, { - "libs": ["es2020"], "declaration": true, + "head": data.settings.typescript.command, + "libs": data.settings.typescript.libs, } ), ] @@ -610,10 +610,8 @@ namespace _ivaldi ["$^"], "$@", { - /** - * @todo var - */ - "libs": ["es2020"], + "head": data.settings.typescript.command, + "libs": data.settings.typescript.libs, } ), ] @@ -638,7 +636,7 @@ namespace _ivaldi [ _ivaldi.command_log(lib_plankton.string.coin("app:{{name}} | linking …", {"name": app.name})), _ivaldi.command_mkdir("$(dir $@)"), - lib_plankton.string.coin("echo '{{head}}' > {{path}}", {"head": (app.shebang ?? ""), "path": path_result}), + lib_plankton.string.coin("echo '{{head}}' > {{path}}", {"head": (app.head ?? ""), "path": path_result}), _ivaldi.command_cat(["$^"], "$@", {"append": true}), ] ) diff --git a/source/types.ts b/source/types.ts index 8903068..d34bf86 100644 --- a/source/types.ts +++ b/source/types.ts @@ -46,7 +46,7 @@ namespace _ivaldi sources : Array; additional_dependencies : Array; destination : string; - shebang : (null | string); + head : (null | string); executable : boolean; }; @@ -57,6 +57,12 @@ namespace _ivaldi version : string; name : string; target : ("node" | "web"); + settings : { + typescript : { + command : string; + libs : Array; + }; + }; directories : { lib : string; source : string; @@ -65,9 +71,6 @@ namespace _ivaldi build : string; makefile : string; }; - commands : { - typescript_compile : string; - }; libs : { plankton : (null | Array); node : (null | Array);