12/11/2023 0 Comments Yarn workspaces vs npm workspacesFor ex, if sample-package is changed, then service1 should be deployed. If a package is changed, then only the service that depends on this package should be deployed. For ex, if you change any code in service1, then service2 should not be deployed. Only the service that has been changed should be deployed. We want to ensure that only the services that have been updated get deployed. Without Webpack, you’ll need to disable hoisting since Serverless Framework does not package the dependencies of a service correctly on its own. But it also ensures that you can have Yarn hoist all your NPM packages to the project root. This is good for keeping your Lambda packages small. It uses the serverless-bundle plugin (based on Webpack) to create optimized Lambda packages. Each service is based on our Serverless Node.js Starter. The Serverless Framework services are meant to be managed on their own. The packages/ and services/ directories are Yarn Workspaces. Any changes here should redeploy all our services. service2: Does not depend on any internal packages.Īny common code that you might not want to maintain as a package.This means that if it changes, we want to deploy service1. service1: Depends on the sample-package.These are Serverless Framework services that are deployed. Any changes to a package should only deploy the service that depends on it. Each contains a package.json and can be optionally published to NPM. These are internal packages that are used in our services. The directory structure roughly looks like: package.json But if you are not familiar with Lerna or Yarn Workspaces, make sure to check out their docs.Ĭheck out the repo here - /AnomalyInnovations/serverless-lerna-yarn-starter Installation This will help get you started with this setup. Uses Yarn Workspaces to hoist packages to the root node_modules/ directory.Supports publishing dependencies as private npm packages.Uses Lerna to figure out which services have been updated.Maintains internal dependencies as packages.SST Lerna + Yarn Workspaces Monorepo Starter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |