Pack the package to target out dir

Issue: https://gitee.com/openharmony/third_party_typescript/issues/I9610E

Signed-off-by: zhangchen <zhangchen168@huawei.com>
Change-Id: Ifb2f574e48f1cddebc313a2a4c11ecccab672faf
This commit is contained in:
zhangchen 2024-03-05 17:25:02 +08:00
parent 8083c1fbc0
commit f85015649d
2 changed files with 21 additions and 5 deletions

View File

@ -119,6 +119,9 @@ typescript_sources = [
action("build_typescript") {
sources = typescript_sources
script = "compile_typescript.py"
args = [ rebase_path(get_path_info("./", "abspath")) ]
outputs = [ "${target_out_dir}/${target_name}.stamp" ]
args = [
rebase_path(get_path_info("./", "abspath")),
rebase_path("${target_out_dir}"),
]
outputs = [ "${target_out_dir}/ohos-typescript-4.9.5-r4.tgz" ]
}

View File

@ -29,14 +29,27 @@ def run_cmd(cmd, execution_path=None):
print(stdout.decode(), stderr.decode())
raise Exception(stderr.decode())
target_files = [
"lib",
"bin",
"package.json",
"LICENSE",
"README.md",
"README.OpenSource",
"SECURITY.md",
"ThirdPartyNoticeText.txt"
]
def run_pack(execution_path):
run_cmd(["npm", "pack"], execution_path)
def run_pack(execution_path, dest_out_path):
copy_cmd = ["cp", "-r"] + target_files + [dest_out_path]
run_cmd(copy_cmd, execution_path)
run_cmd(["npm", "pack"], dest_out_path)
def main(args):
source_path = args[0]
run_pack(source_path)
dest_out_path = args[1]
run_pack(source_path, dest_out_path)
if __name__ == '__main__':