sulu / skeleton

Project template for starting your new project based on the Sulu content management system
https://sulu.io
MIT License
261 stars 81 forks source link

Add support for NPM 8, 9, 10 and PNPM 8, remove support for NPM 6 #235

Closed alexander-schranz closed 7 months ago

alexander-schranz commented 8 months ago
Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Fixed tickets fixes #88
Related issues/PRs #issuenum
License MIT
Documentation PR sulu/sulu-docs#prnum

What's in this PR?

Add support for NPM 8, 9, 10 and PNPM 8, remove support for NPM 6

Why?

Node 16 is going for end of life: https://nodejs.org/en/about/previous-releases

Example Usage

rm -rf ./**/node_modules/
rm -rf ./**/package-lock.json

cd assets/admin
npm -g i npm@10

npm install
npm run build
rm -rf ./**/node_modules/
rm -rf ./**/package-lock.json
rm -rf ./**/pnpm-lock.yaml

cd assets/admin
curl -fsSL https://get.pnpm.io/install.sh | sh -

pnpm install
pnpm run build

BC Breaks/Deprecations

No support for NPM 6 / symlinked local packages.

Disadvantages

No watch task over vendor package developments as install requires install-links=true which ends not longer uses symlinks. Instead a tarball is created and install, but it installs correctly dependencies of local dependencies. Which does not work for file: packages.

Why this opens a wider range for support of modern npm and pnpm versions. Yarn is still a problem and not supported by sulu. This includes not only yarn 1 but also 2,3,4.

chirimoya commented 8 months ago

@alexander-schranz how will development work change with the missing watch task? Always reinstall and build? Can that be done with some kind of automation?

alexander-schranz commented 8 months ago

@chirimoya

how will development work change with the missing watch task? Always reinstall and build? Can that be done with some kind of automation?

Developing in core would be easier for most when just work in the sulu/sulu itself not longer over the sulu/skeleton.

Developing of third party bundles is more an issue, normally npm link would solve it but it ignores the install-links flag which make it not usable for sulu. Still manually symlinks would allow still have the same behaviour as today, aslong as there are no conflicting dependencies:

npm install # install all dependencies

rm -rf node_modules/sulu-admin-bundle
ln -s @sulu/vendor/sulu/sulu/src/Sulu/Bundle/AdminBundle/Resources/js node_modules/sulu-admin-bundle

We could provide a script doing this mechanism something like npm run prepare-dev-links.