Skip to content

Commit

Permalink
refac(cross): fluidattacks#1290 update makenodejslock
Browse files Browse the repository at this point in the history
- Update makeNodeJsLock utility to support the lock_file version

Signed-off-by: John Perez <mrjohnjairo10@gmail.com>
  • Loading branch information
jpverde committed Feb 14, 2024
1 parent ca42c62 commit 1b8c6ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/src/api/builtins/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ like this:
```bash
m github:fluidattacks/makes@24.02 /utils/makeNodeJsLock \
"${node_js_version}" \
"${package_json_dir}"
"${package_json_dir}" \
"${lockfile_version}"
```

- Supported `node_js_version`s are: `18`, `20` and `21`.
- `package_json_dir` is the **absolute path** to the directory that contains
the `package.json` file in your project.
- The `package-lock.json` file will be generated in the same directory that
contains the `package.json` file.
- The `lockfile_version` is an optional argument, defaults to `2` and can be
`1` or `2`.

## makePythonLock

Expand Down
3 changes: 2 additions & 1 deletion makes/utils/makeNodeJsLock/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
function main {
local node_js_version="${1}"
local package_json_dir="${2}"
local lockfile_version="${3:2}"
local npm_install_args=(
--audit false
--ignore-scripts true
Expand All @@ -15,7 +16,7 @@ function main {
*) critical NodeJs version not supported: "${node_js_version}" ;;
esac \
&& pushd "${package_json_dir}" \
&& "${npm}" install "${npm_install_args[@]}" \
&& "${npm}" install "${npm_install_args[@]}" --lockfile-version "${lockfile_version}" \
&& popd || return 1
}

Expand Down

0 comments on commit 1b8c6ef

Please sign in to comment.