aem-packager icon indicating copy to clipboard operation
aem-packager copied to clipboard

Possible to remove preinstall script?

Open IGx89 opened this issue 3 years ago • 3 comments

Hello! We're using your package in frontend projects worked on by developers without Java/Maven installed on their systems. That should normally be just fine, since we're only running this package in our CI system (local development doesn't require packaging for AEM). However, due to your preinstall script that runs mvn -v, developers get an error about mvn not being found when they attempt to do a simple npm install on the frontend project. Would it be possible to remove that preinstall script so that developers aren't required to install Java/Maven?

Our workaround in the meantime is to run npm install --ignore-scripts instead.

Thanks!

IGx89 avatar Jul 29 '22 15:07 IGx89

Hmmm..... that's a pretty critical dependency for executing this package, so I'm hesitant to remove the check or move it to be runtime instead of install time.

@IGx89 Have you considered running npx aem-packager instead of npm run aem-packager so that this package doesn't need to be included as a dependency, and thus doesn't need Maven to be installed on your developers' workstations?

developher-net avatar Aug 04 '22 19:08 developher-net

npx aem-packager isn't ideal since it still prompts to install. We ended up working around it by making aem-packager an optional dependency so it silently fails to install and doesn't block the installing of other packages. On our CI server it will succeed since it has mvn installed, though we also use --ignore-scripts there so it won't actually run the postinstall script either :p

IGx89 avatar Jan 18 '23 15:01 IGx89

@IGx89 I've been looking into this more, and installing as an optional dependency seems to be the most "correct" approach in the NPM ecosystem since there is no explicit way to have install for CI vs. install for local development.

I'll get a note added to readme about this

developher-net avatar Oct 08 '23 04:10 developher-net