コツコツと

npmパッケージを最新バージョンに更新する手順

March 01, 2022

npmパッケージを最新バージョンに更新する手順

% yarn outdated
% yarn upgrade-interactive --latest

コマンドの実行結果

% yarn outdated
yarn outdated v1.22.17
info Color legend : 
 "<red>"    : Major Update backward-incompatible updates 
 "<yellow>" : Minor Update backward-compatible features 
 "<green>"  : Patch Update backward-compatible bug fixes
Package                         Current Wanted  Latest  Package Type    URL                                                                                           
@types/react                    17.0.35 17.0.39 17.0.39 devDependencies https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react                    
@types/react-helmet             6.1.4   6.1.5   6.1.5   devDependencies https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-helmet             
gatsby                          4.2.0   4.9.0   4.9.0   dependencies    https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby#readme                                                                                          
prettier                        2.4.1   2.5.1   2.5.1   devDependencies https://prettier.io                                                                           
...

% yarn upgrade-interactive --latest
yarn upgrade-interactive v1.22.17
info Color legend : 
 "<red>"    : Major Update backward-incompatible updates 
 "<yellow>" : Minor Update backward-compatible features 
 "<green>"  : Patch Update backward-compatible bug fixes
? Choose which packages to update. 
? Choose which packages to update. 
? Choose which packages to update. 

# シフトキーでアップデートするパッケージの選択状態を変更できる
# aをタイプすると一括でパッケージの選択状態を変更できる
 devDependencies
   name                             range   from        to       url
❯◯ @types/react                     latest  17.0.35  ❯  17.0.39  https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react
 ◯ @types/react-helmet              latest  6.1.4    ❯  6.1.5    https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-helmet
 ◯ prettier                         latest  2.4.1    ❯  2.5.1    https://prettier.io
  
 dependencies
   name                             range   from        to       url
 ◯ gatsby                           latest  4.2.0    ❯  4.9.0    https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby#readme
...

参考


© 2020 jiri3