serverless-plugin-typescript
serverless-plugin-typescript copied to clipboard
Generate js for other plugins
Is it possible to generate the JavaScript into the .build folder for other plugins to use? I.e. The mocha unit testing plugin and the offline plugin?
Could you describe your use case with a bit more details pls?
Currently your plugin only generates the JavaScript before deployment. This means that all other serverless plugins are unable to work if they don't do a deployment. The best example is the SC5 serverless-mocha-plugin
So you'd like to have a separate command to build from typescript to javascript?
I think so. Or a way to configure it to trigger on a much earlier hook.
On 23/04/2017 10:36 pm, "Johannes Schickling" [email protected] wrote:
So you'd like to have a separate command to build from typescript to javascript?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/graphcool/serverless-plugin-typescript/issues/1#issuecomment-296434007, or mute the thread https://github.com/notifications/unsubscribe-auth/AAq3huFqutb7iCJUehpV-a6o5Wc0oJ4dks5ryymdgaJpZM4NDgm3 .
A separate command is certainly doable. However, combining this plugin with other plugins could be problematic with the current plugin infrastructure provided by Serverless. Maybe @pmuens can provide some feedback on when this might change?
Hey @silver2k the TypeScript plugin could expose own lifecycle events which can then be used to hook into via your own custom plugin.
Here you can e.g. see the lifecycle events of the main Serverless package plugin (https://github.com/serverless/serverless/blob/e82e6265e3f9bcd62ac907f576b284f35c7863f4/lib/plugins/package/package.js#L26-L34) and here's an example how to hook into the package:createDeploymentArtifacts
lifecycle event (https://github.com/serverless/serverless/blob/e82e6265e3f9bcd62ac907f576b284f35c7863f4/lib/plugins/package/package.js#L61-L62).
The only thing to note is that you'll then have a dependency to the TypeScript plugin. So you need to make sure that both plugins are installed / usable.
having a custom lifecycle would also make it easier to test i think
@kandros would you be up for creating a PR for this?