-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Idea after reading comment by @andidev in #3
Add a package-changed check command that simply logs a warning that dependencies should be installed manually.
Now this is what we are trying to achieve:
- A developer checks out some branch and runs
npm run startwithout running npm install since they are not aware that installed dependencies has changed. We want to make sure they run code with correct dependencies and install dependencies automatically.
Solution: we add a script to run package install with options --lockfile, npm install and echo dependencies are updated
"start:localhost": "npm run package-changed:npm-install && npm run start",
"package-changed:npm-install": "npx --yes package-changed run \"echo \\\"\\\\033[0;32mDEPENDENCY CHANGES DETECTED running 'npm install' since package.json dependencies or package-lock.json has changed\\\\033[0m\\\" && npm install\" --lockfile",- A developer checks out some code that requires npm install (package.json or package-lock.json is changed).
We want them to get informed that new dependencies needs to be installed. We don't want to install them because that could be annoying if they are not gonna run code.
Solution: we create apost-checkoutgithook where we runpackage-changedwith options --lockfile --skip-write-hash and echo warning dependencies needs to be install. We don't want to update hash since we want npm install to be triggered by 1).
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
red='\033[0;31m'
no_color='\033[0m'
npx --yes package-changed run "echo \"${red}WARNING run 'npm install' since package.json dependencies or package-lock.json has changed${no_color}\"" --lockfile --skip-write-hash- A developer pulls or merges or pulls some code that requires npm install. We want to run npm install to make sure developer installs and runs correct dependencies automatically.
Solution: we create apost-mergegithook where we run package install with options --lockfile, npm install and echo dependencies are updated.
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yellow="\033[0;32m"
no_color='\033[0m'
npx --yes package-changed run "echo \"${yellow}DEPENDENCY CHANGES DETECTED running 'npm install' since package.json dependencies or package-lock.json has changed${no_color}\" && npm install" --lockfileOriginally posted by @andidev in #3 (comment)
Metadata
Metadata
Assignees
Labels
No labels


