claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 274 forks source link

--npm-options=--ignore-scripts ignores --post-package-script #195

Closed SMGitAdmin closed 5 years ago

SMGitAdmin commented 5 years ago

I have a package.json with a "postinstall" that I do not want to execute when packaging for lambda, but has a script that I do want claudia to use for --post-package-script. Something like this:

{
  ...
  "scripts": {
    "postinstall": "(cd unused; npm install)",
    "claudia-post-package": "dosomething.sh"
  }
  ...
$ NODE_ENV=dev npx claudia pack --post-package-script claudia-post-package --output ~/tmp/claud.zip --force --npm-options=--ignore-scripts

That command does ignore the "postinstall" script, but it seems the "claudia-post-package" script was ignored as well. I can understand the argument that "you asked claudia to ignore scripts!", but I also explicitly asked claudia to post-package.

gojko commented 5 years ago

I don't think this is something we can fix with the current NPM invocation system, but I'll keep it in mind if we redesign that part. npm options are passed to all npm invocations, using the post-package script, without trying to contextually understand what they are.