You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:white_check_mark:**Do:** Yarn and npm latest introduction of package-lock.json introduced a serious challenge (the road to hell is paved with good intentions) — by default now, packages are no longer getting updates. Even a team running many fresh deployments with ‘npm install’ & ‘npm update’ won’t get any new updates. This leads to subpar dependent packages versions at best or to vulnerable code at worst. Teams now rely on developers goodwill and memory to manually update the package.json or use tools [like ncu](https://www.npmjs.com/package/npm-check-updates) manually. A more reliable way could be to automate the process of getting the most reliable dependency versions, though there are no silver bullet solutions yet there are two possible automation roads:
(1) CI can fail builds that have obsolete dependencies — using tools like [‘npm outdated’](https://docs.npmjs.com/cli/outdated)or ‘npm-check-updates (ncu)’ . Doing so will enforce developers to update dependencies.
1792
+
(1) 使用 [npm outdated](https://docs.npmjs.com/cli/outdated)或 npm-check-updates (ncu),當有過時的相依套件時,讓 CI 的建置失敗。這樣可以強制開發人員來更新相依套件。
1793
1793
1794
-
(2) Use commercial tools that scan the code and automatically send pull requests with updated dependencies. One interesting question remaining is what should be the dependency update policy — updating on every patch generates too many overhead, updating right when a major is released might point to an unstable version (many packages found vulnerable on the very first days after being released, [see the](https://nodesource.com/blog/a-high-level-post-mortem-of-the-eslint-scope-security-incident/) eslint-scope incident).
An efficient update policy may allow some ‘vesting period’ — let the code lag behind the @latest for some time and versions before considering the local copy as obsolete (e.g. local version is 1.3.1 and repository version is 1.3.8)
1797
1798
<br/>
1798
1799
1799
-
❌ **Otherwise:**Your production will run packages that have been explicitly tagged by their author as risky
1800
+
❌ **否則:**你在 production 環境所使用的相依套件,可能已經被該作者標示為是有風險的。
### :clap:Example: [ncu](https://www.npmjs.com/package/npm-check-updates)can be used manually or within a CI pipeline to detect to which extent the code lag behind the latest versions
1808
+
### :clap:正例:[ncu](https://www.npmjs.com/package/npm-check-updates)可以手動或在 CI pipeline 中使用,以檢測程式落後最新版本多少。
1808
1809
1809
1810

0 commit comments