New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow script execution and management via packagerOptions #343

Closed
HyperBrain opened this Issue Mar 9, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@HyperBrain
Copy link
Member

HyperBrain commented Mar 9, 2018

This is a Feature Proposal

Description

Currently the webpack plugin does not allow for custom scripts to be executed while packaging the functions/service. The packager part creates a small package.json that only contains the dependencies to make sure that they are bundled correctly.

Issues like #342 show, that there are cases where invoking a script after the packager install might be needed.

A possible approach would be to add a list of inline scripts as packageOptions.scripts[] that are added to the package.json and executed serially with "npm/yarn run" after the install has finshed. The script entries can be anything that is allowed for a package.json script entry. This will give users more power to cover these situations.

Sample for the referenced issue:

# serverless.yml
custom:
  webpack:
    packagerOptions:
      scripts:
        - npm rebuild grpc --target=6.1.0 --target_arch=x64 --target_platform=linux

Similar or dependent issue(s):

Additional Data

N/A

@HyperBrain HyperBrain added the feature label Mar 9, 2018

@pflugs30

This comment has been minimized.

Copy link

pflugs30 commented Mar 9, 2018

Thank you, @HyperBrain. For others who may be interested, here's a link to a comment on the gRPC project issues page that describes the use case in your sample (and in issue #342 ).

Also, as I was doing research for on this issue, I spent a lot of time going through the Webpack documentation. Is this really a Webpack or serverless-webpack issue, or does it not matter?

@HyperBrain

This comment has been minimized.

Copy link
Member Author

HyperBrain commented Mar 9, 2018

It is a serverless-webpack issue. As soon as it allows to execute the rebuild, everything should be fine. On Windows this will happen frequently if you use compiled binaries, because the local "build" will guess that the package is for Windows.

@HyperBrain HyperBrain referenced this issue Mar 9, 2018

Merged

Support custom packager scripts #344

7 of 7 tasks complete

@HyperBrain HyperBrain added this to the 5.1.0 milestone Mar 9, 2018

@HyperBrain

This comment has been minimized.

Copy link
Member Author

HyperBrain commented Mar 14, 2018

Released with 5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment