diff options
author | dankolesnikov <[email protected]> | 2022-02-10 16:51:07 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:51:07 +0300 |
commit | 69eb1eb80b4c5ddfb3b550e7ce5b10f87f6a7dc3 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /build/plugins/nots.py | |
parent | 98174ab8f0e6dbed8894c8226f62cac4bf36171d (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'build/plugins/nots.py')
-rw-r--r-- | build/plugins/nots.py | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/build/plugins/nots.py b/build/plugins/nots.py index b8ec11b5218..5018256ddc9 100644 --- a/build/plugins/nots.py +++ b/build/plugins/nots.py @@ -1,46 +1,46 @@ -import os - -from _common import to_yesno -from lib.nots.package_manager import manager -from lib.nots.typescript import TsConfig - - -def _create_pm(unit): - return manager( - sources_path=unit.resolve(unit.path()), - build_root="$B", - build_path=unit.path().replace("$S", "$B", 1), - contribs_path=unit.get("NPM_CONTRIBS_PATH"), - nodejs_bin_path=None, - script_path=None, - ) - - -def on_from_npm_lockfiles(unit, *args): - lf_paths = map(lambda p: unit.resolve(unit.resolve_arc_path(p)), args) - - for pkg in _create_pm(unit).extract_packages_meta_from_lockfiles(lf_paths): - unit.onfrom_npm([pkg.name, pkg.version, pkg.sky_id, pkg.integrity, pkg.integrity_algorithm, pkg.tarball_path]) - - -def onnode_modules(unit): - pm = _create_pm(unit) - unit.onpeerdir(pm.get_peer_paths_from_package_json()) - ins, outs = pm.calc_node_modules_inouts() +import os + +from _common import to_yesno +from lib.nots.package_manager import manager +from lib.nots.typescript import TsConfig + + +def _create_pm(unit): + return manager( + sources_path=unit.resolve(unit.path()), + build_root="$B", + build_path=unit.path().replace("$S", "$B", 1), + contribs_path=unit.get("NPM_CONTRIBS_PATH"), + nodejs_bin_path=None, + script_path=None, + ) + + +def on_from_npm_lockfiles(unit, *args): + lf_paths = map(lambda p: unit.resolve(unit.resolve_arc_path(p)), args) + + for pkg in _create_pm(unit).extract_packages_meta_from_lockfiles(lf_paths): + unit.onfrom_npm([pkg.name, pkg.version, pkg.sky_id, pkg.integrity, pkg.integrity_algorithm, pkg.tarball_path]) + + +def onnode_modules(unit): + pm = _create_pm(unit) + unit.onpeerdir(pm.get_peer_paths_from_package_json()) + ins, outs = pm.calc_node_modules_inouts() unit.on_node_modules(["IN"] + sorted(ins) + ["OUT"] + sorted(outs)) - - -def on_ts_configure(unit, tsconfig_path): - abs_tsconfig_path = unit.resolve(unit.resolve_arc_path(tsconfig_path)) - if not abs_tsconfig_path: - raise Exception("tsconfig not found: {}".format(tsconfig_path)) - - tsconfig = TsConfig.load(abs_tsconfig_path) - tsconfig.validate() - - unit.set(["TS_CONFIG_ROOT_DIR", tsconfig.compiler_option("rootDir")]) - unit.set(["TS_CONFIG_OUT_DIR", tsconfig.compiler_option("outDir")]) - unit.set(["TS_CONFIG_SOURCE_MAP", to_yesno(tsconfig.compiler_option("sourceMap"))]) - unit.set(["TS_CONFIG_DECLARATION", to_yesno(tsconfig.compiler_option("declaration"))]) - unit.set(["TS_CONFIG_DECLARATION_MAP", to_yesno(tsconfig.compiler_option("declarationMap"))]) - unit.set(["TS_CONFIG_PRESERVE_JSX", to_yesno(tsconfig.compiler_option("jsx") == "preserve")]) + + +def on_ts_configure(unit, tsconfig_path): + abs_tsconfig_path = unit.resolve(unit.resolve_arc_path(tsconfig_path)) + if not abs_tsconfig_path: + raise Exception("tsconfig not found: {}".format(tsconfig_path)) + + tsconfig = TsConfig.load(abs_tsconfig_path) + tsconfig.validate() + + unit.set(["TS_CONFIG_ROOT_DIR", tsconfig.compiler_option("rootDir")]) + unit.set(["TS_CONFIG_OUT_DIR", tsconfig.compiler_option("outDir")]) + unit.set(["TS_CONFIG_SOURCE_MAP", to_yesno(tsconfig.compiler_option("sourceMap"))]) + unit.set(["TS_CONFIG_DECLARATION", to_yesno(tsconfig.compiler_option("declaration"))]) + unit.set(["TS_CONFIG_DECLARATION_MAP", to_yesno(tsconfig.compiler_option("declarationMap"))]) + unit.set(["TS_CONFIG_PRESERVE_JSX", to_yesno(tsconfig.compiler_option("jsx") == "preserve")]) |