Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19d0b42

Browse files
committed
fix: Use JSON to parsenpm pack output.
1 parente298008 commit19d0b42

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎pre_commit/languages/node.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
importcontextlib
44
importfunctools
5+
importjson
56
importos
67
importsys
78
fromcollections.abcimportGenerator
@@ -98,9 +99,9 @@ def install_environment(
9899
)
99100
lang_base.setup_cmd(prefix,local_install_cmd)
100101

101-
_,pkg,_=cmd_output('npm','pack',cwd=prefix.prefix_dir)
102-
# Process only the last line of output
103-
pkg=prefix.path(pkg.splitlines()[-1].strip())
102+
_,pkg,_=cmd_output('npm','pack','--json',cwd=prefix.prefix_dir)
103+
pkg_json=json.loads(pkg)
104+
pkg=prefix.path(pkg_json[0].get('filename'))
104105

105106
install= ('npm','install','-g',pkg,*additional_dependencies)
106107
lang_base.setup_cmd(prefix,install)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp