For docker builds it would be nice to be able to run yarn with only the lock file, i.e. without the package.json file. Currently, whenever we run npm version patch we have to re-install all dependencies even though nothing has changed... :/
Yarn needs both package.json and yarn.lock files by design and I don't think that will change anytime soon if ever.
I think instead of copying all files in the directory, you can find a way to leverage Docker's layered file system with selectively copying files over.
@BYK I don't see anyway to resolve this otherwise? Since the package.json is changed during versioning and it has to be included before you run yarn you always have to re-install all dependencies even if they haven't changed...
May be using another file to save the version, like VERSION. use semver -i patch <version> to generate the new version and use fs.writeFileSync to save it to VERSION file
This is an awful experience when using offline workspaces with Docker as the primary yarn.lock does contain information for unpacking files.
Most helpful comment
@BYK I don't see anyway to resolve this otherwise? Since the package.json is changed during versioning and it has to be included before you run
yarnyou always have to re-install all dependencies even if they haven't changed...