Closed DanielRuf closed 9 months ago
We are using and testing currently only for npm
but feel free to add a version
1.0.0
or whatever make sense for a none versioned package to the package.json
not sure what the best value is there. Think then should it also work with yarn. Not sure if yarn does cache something based on the version. I once created an issue about the problem here for yarn https://github.com/yarnpkg/yarn/issues/6979 but seems like it never was tackled by the yarn team.
Not sure if yarn does cache something based on the version
I did the following test:
"version": "0.0.0"
to vendor/sulu/headless-bundle/Resources/js-website/package.json
yarn
in assets/headless
As you can see it does not contain any integrity hashes, as these are normally generated on npmjs and are part of the tarball metadata on the registries.
I've tried to change a few files in js-website and also package.json, but any yarn
command after this still uses 0.0.0
and the old files.
I think the cleaner approach would be npm / yarn link as this would prevent caching.
"sulu-headless-bundle": "link:../../vendor/sulu/headless-bundle/Resources/js-website",
In our setup we will inject the version 0.0.0 via composer-patches and use link:...
as we mainly use yarn.
But best is probably proper versioning like in the other packages for the admin area.
I'm fine to add version 0.0.0
, do you want to create a pull request for it? The file:
when using npm@6 should create a symlink. The file:../../
is a known not working with yarn
only work with npm
when using npm 6 with workaround. Thats why sulu core itself uses a preinstall script to avoid that problem. So easier would be moving from assets/website
your package.json to root directory. Then file:vendor/sulu/..
works better and you do not run into this strange behaviour of npm and yarn. If yarn does here strange tests I would as said go with npm as that is what is tested and used currently in our headless bundle projects. But as it is your project code and link:
behave the way you want it you can use also that.
I'm not sure if it is the right solution to add 0.0.0
in general since this will probably not pick up newer changes then. So what is really needed is a complete (SemVer) versioning scheme, that you and your team sets up for this small npm package in the vendor folder.
We had to swtich back to file:
protocol since some bundlers seem to have issues with symlinks.
When trying to install the dependencies of the headless front end (
assets/headless
) withyarn
, there is an error thrown, thatvendor/sulu/headless-bundle/Resources/js-website/package.json
needs a version.This can be temporarily / individually fixed locally by adding a version manually, but should be added by the sulu team.
See https://github.com/sulu/SuluHeadlessBundle/blob/0.x/Resources/js-website/package.json