LoginSignup
2

More than 5 years have passed since last update.

npm publishするまえにdry-run的な感じでuploadされるファイル調べたい。

Last updated at Posted at 2016-09-01

結論: npm packtarコマンドを組み合わせる。

残念ながら今のところnpm publish --dry-runオプションとかは無い。
(出典:https://github.com/npm/npm/issues/6351#issuecomment-119051586)

$ tar -tf $(npm pack)
package/package.json
package/README.md
package/index.js

npm packすると、publishの代わりとしてtarで固められるので、その出力をtar -tfに通すと一覧が出てくるという寸法。頭いい。

yarnでもyarn packはあるが、出力がうまくいかないのでそのまま使えなそう


npm publishのhelpを見ると、一応下記のような記述までは存在してる。

$ npm help publish

For a "dry run" that does everything except actually publishing to the
registry, see npm help npm-pack, which figures out the files to be
included and packs them into a tarball to be uploaded to the registry.

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2