This commit is contained in:
fenris 2026-09-18 09:53:28 +02:00
parent d3d24c75a0
commit 66ddcbb717
6 changed files with 795 additions and 596 deletions

View file

@ -185,4 +185,77 @@ namespace _ivaldi
) )
} }
/**
* @todo outsource
*/
export function execute(
command : string,
{
"log_only": log_only = false,
"working_directory": working_directory = null,
} : {
log_only ?: boolean;
working_directory ?: (null | string);
} = {
}
) : Promise<
{
code : int;
stdout : string;
stderr : string;
}
>
{
const nm_child_process = require("child_process");
return (
new Promise(
(resolve, reject) => {
lib_plankton.log._info(
"execute",
{
"details": {
"command": command,
}
}
);
if (log_only) {
resolve(
{
"code": 0,
"stdout": "",
"stderr": "",
}
);
}
else {
nm_child_process.exec(
command,
{
"cwd": ((working_directory === null) ? undefined : working_directory),
},
(error, stdout, stderr) => {
if (error) {
reject(error);
}
else {
resolve(
{
/**
* @todo assign correct value
*/
"code": 0,
"stdout": stdout,
"stderr": stderr,
}
);
}
}
);
}
}
)
);
}
} }

File diff suppressed because it is too large Load diff

View file

@ -53,7 +53,7 @@ namespace _ivaldi
/** /**
*/ */
export type type_data = { export type type_definition = {
version : string; version : string;
name : string; name : string;
target : ("node" | "web"); target : ("node" | "web");
@ -67,9 +67,6 @@ namespace _ivaldi
lib : string; lib : string;
source : string; source : string;
misc : string; misc : string;
temp : string;
build : string;
makefile : string;
}; };
libs : { libs : {
plankton : (null | Array<string>); plankton : (null | Array<string>);

View file

@ -7,10 +7,22 @@ import argparse as _argparse
def main(): def main():
argument_parser = _argparse.ArgumentParser( argument_parser = _argparse.ArgumentParser(
) )
argument_parser.add_argument(
"-o",
"--output-directory",
type = str,
default = "/tmp/ivaldi",
metavar = "<output-directory>",
)
args = argument_parser.parse_args() args = argument_parser.parse_args()
if True: if True:
_os.system("make -f tools/makefile") _os.system(
"make dir_build=%s --file=tools/makefile"
% (
args.output_directory
)
)
main() main()

31
tools/install Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env python3
import os as _os
import argparse as _argparse
def main():
argument_parser = _argparse.ArgumentParser(
)
argument_parser.add_argument(
"-b",
"--build-directory",
type = str,
default = "/tmp/ivaldi",
metavar = "<build-directory>",
)
argument_parser.add_argument(
"-t",
"--target-directory",
type = str,
default = "~/.local/bin",
metavar = "<target-directory>",
)
args = argument_parser.parse_args()
_os.system("mkdir -p %s" % (args.target_directory, ))
_os.system("cp %s/ivaldi %s/ivaldi" % (args.build_directory, args.target_directory, ))
main()

View file

@ -9,30 +9,35 @@ cmd_echo := echo
cmd_chmod := chmod cmd_chmod := chmod
## args
dir_lib := libs
dir_source := source
dir_temp := temp
dir_build := build
## rules ## rules
.PHONY: _default .PHONY: _default
_default: _root _default: _root
temp/ivaldi-unlinked.js: \ ${dir_temp}/ivaldi-unlinked.js: \
libs/plankton/plankton.d.ts \ ${dir_lib}/plankton/plankton.d.ts \
source/types.ts \ ${dir_source}/types.ts \
source/helpers.ts \ ${dir_source}/helpers.ts \
source/main.ts ${dir_source}/main.ts
@ ${cmd_log} "compiling …" @ ${cmd_log} "compiling …"
@ ${cmd_mkdir} temp @ ${cmd_mkdir} $(dir $@)
@ ${cmd_tsc} $^ --lib es2020,dom --target es6 --outFile $@ @ ${cmd_tsc} $^ --lib es2020,dom --target es6 --outFile $@
build/ivaldi: libs/plankton/plankton.js temp/ivaldi-unlinked.js ${dir_build}/ivaldi: ${dir_lib}/plankton/plankton.js ${dir_temp}/ivaldi-unlinked.js
@ ${cmd_log} "linking …" @ ${cmd_log} "linking …"
@ ${cmd_echo} "#!/usr/bin/env node" > temp/head.js @ ${cmd_mkdir} $(dir $@)
@ ${cmd_mkdir} build @ ${cmd_echo} "#!/usr/bin/env node" > $@
@ ${cmd_cat} temp/head.js $^ > $@ @ ${cmd_cat} $^ >> $@
@ ${cmd_chmod} +x $@ @ ${cmd_chmod} +x $@
.PHONY: sources
sources: build/ivaldi
.PHONY: _root .PHONY: _root
_root: sources _root: ${dir_build}/ivaldi