├── .gitignore ├── README.md ├── frontend ├── .env ├── .gitignore ├── README.md ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── reportWebVitals.js │ └── setupTests.js ├── lerna.json ├── lib ├── Service1Stack.js ├── Service2Stack.js ├── WebsiteStack.js └── index.js ├── package.json ├── src ├── packages │ └── sample-package │ │ ├── index.js │ │ └── package.json ├── services │ ├── service1 │ │ ├── handler.js │ │ └── package.json │ └── service2 │ │ ├── handler.js │ │ └── package.json └── util │ └── index.js ├── sst.json ├── test └── MyStack.test.ts └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | 15 | # sst build output 16 | .build 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | # vim 23 | .*.sw* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SST Lerna + Yarn Workspaces Starter [![Seed Status](https://api.seed.run/serverless-stack/lerna-yarn-starter/stages/dev/build_badge)](https://console.seed.run/serverless-stack/lerna-yarn-starter) 2 | 3 | A [Serverless Stack Framework (SST)](https://github.com/serverless-stack/serverless-stack) monorepo starter that uses [Lerna](https://lerna.js.org) and [Yarn Workspaces](https://classic.yarnpkg.com/en/docs/workspaces/). 4 | 5 | - A full-stack serverless app 6 | - Designed to scale for larger teams 7 | - Maintains internal dependencies as packages 8 | - Supports publishing dependencies as private NPM packages 9 | - Uses Yarn Workspaces to hoist packages to the root `node_modules/` directory 10 | 11 | ----- 12 | 13 | ## Installation 14 | 15 | Start by cloning this repo 16 | 17 | ``` bash 18 | $ git clone https://github.com/serverless-stack/lerna-yarn-starter my-project 19 | ``` 20 | 21 | Enter the new directory 22 | 23 | ``` bash 24 | $ cd my-project 25 | ``` 26 | 27 | Install npm packages for the entire project 28 | 29 | ``` bash 30 | $ yarn 31 | ``` 32 | 33 | ## How It Works 34 | 35 | The directory structure roughly looks like: 36 | 37 | ``` 38 | package.json 39 | /lib 40 | /frontend 41 | package.json 42 | /src 43 | /services 44 | /service1 45 | handler.js 46 | package.json 47 | /service2 48 | handler.js 49 | package.json 50 | /packages 51 | /sample-package 52 | index.js 53 | package.json 54 | /util 55 | ``` 56 | 57 | This repo is split into a few parts. Each with a different purpose: 58 | 59 | - `lib/` 60 | 61 | This is where the CDK code for your app lives. It defines the infrastructure of your serverless app. 62 | 63 | - `src/` 64 | 65 | This is where the code for your Lambda function are. It is further organized into services. Where each service is a collection of Lambda functions. 66 | 67 | - `src/services/` 68 | 69 | These are services that are deployed as Lambda functions. Has a `package.json` and an entry point. There are two sample services. 70 | 71 | 1. `service1`: Depends on the `sample-package`. 72 | 2. `service2`: Does not depend on any internal packages. 73 | 74 | - `src/packages/` 75 | 76 | These are internal packages that are used in our services. Each contains a `package.json` and can be optionally published to npm. 77 | 78 | - `src/util/` 79 | 80 | Any common code that you might not want to maintain as a package. Does NOT have a `package.json`. 81 | 82 | - `frontend/` 83 | 84 | A sample frontend React app that is a part of our serverless app. 85 | 86 | The `src/packages/`, `src/services/`, and `frontend/` directories are Yarn Workspaces. 87 | 88 | ### Services 89 | 90 | Each service is a collection of Lambda functions with a similar purpose. They are meant to be managed on their own. They each have their own `package.json` and the versions of the dependencies should be kept separate from the other services. SST internally uses [esbuild](https://github.com/evanw/esbuild) to optimally package each Lambda function in a service. 91 | 92 | This is good for keeping your Lambda packages small. But Yarn Workspaces also ensures that it hoists all your npm packages to the project root. 93 | 94 | ### Packages 95 | 96 | Since each package has its own `package.json`, you can manage it just like you would any other npm package. 97 | 98 | To add a new package: 99 | 100 | ``` bash 101 | $ mkdir src/packages/new-package 102 | $ yarn init 103 | ``` 104 | 105 | Packages can also be optionally published to npm. 106 | 107 | To use a package: 108 | 109 | ```bash 110 | $ yarn add new-package@1.0.0 111 | ``` 112 | 113 | Note that packages should be added by specifying the version number declared in their `package.json`. Otherwise, Yarn tries to find the dependency in the registry. 114 | 115 | ### Util 116 | 117 | If you need to add any other common code in your repo that won't be maintained as a package, add it to the util directory. It does not contain a `package.json`. This means that you'll need to install any npm packages as dependencies in the root. 118 | 119 | To install an npm package at the root. 120 | 121 | ``` bash 122 | $ yarn add -W some-npm-package 123 | ``` 124 | 125 | While it's convenient to add all the common code to the util, it has a downside. If a team updates the util, all the services that are dependent on it will need to test this change before deploying. In contrast, a package can be locked to a specific version and can be upgraded when the team chooses to. 126 | 127 | ## Deployment 128 | 129 | SST will handle all the dependencies internally and deploy all the services (and the frontend) in order. 130 | 131 | ## Deploying Through Seed 132 | 133 | [Seed](https://seed.run) supports deploying SST monorepo projects that use Lerna and Yarn Workspaces out of the box. 134 | 135 | ------- 136 | 137 | This repo is maintained by [Serverless Stack](https://serverless-stack.com/). 138 | -------------------------------------------------------------------------------- /frontend/.env: -------------------------------------------------------------------------------- 1 | SKIP_PREFLIGHT_CHECK=true 2 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `yarn start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `yarn test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `yarn build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `yarn eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `yarn build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.11.4", 7 | "@testing-library/react": "^11.1.0", 8 | "@testing-library/user-event": "^12.1.10", 9 | "react": "^17.0.2", 10 | "react-dom": "^17.0.2", 11 | "react-scripts": "4.0.3", 12 | "web-vitals": "^1.0.1" 13 | }, 14 | "scripts": { 15 | "start": "react-scripts start", 16 | "build": "react-scripts build", 17 | "test": "react-scripts test", 18 | "eject": "react-scripts eject" 19 | }, 20 | "eslintConfig": { 21 | "extends": [ 22 | "react-app", 23 | "react-app/jest" 24 | ] 25 | }, 26 | "browserslist": { 27 | "production": [ 28 | ">0.2%", 29 | "not dead", 30 | "not op_mini all" 31 | ], 32 | "development": [ 33 | "last 1 chrome version", 34 | "last 1 firefox version", 35 | "last 1 safari version" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sst/lerna-yarn-starter/ac012a6c728a270b6d685bfe160a62028e460b80/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sst/lerna-yarn-starter/ac012a6c728a270b6d685bfe160a62028e460b80/frontend/public/logo192.png -------------------------------------------------------------------------------- /frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sst/lerna-yarn-starter/ac012a6c728a270b6d685bfe160a62028e460b80/frontend/public/logo512.png -------------------------------------------------------------------------------- /frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import logo from './logo.svg'; 2 | import './App.css'; 3 | 4 | function App() { 5 | return ( 6 |
7 |
8 | logo 9 |

Service 1‘s API Endpoint: %%SERVICE_1_ENDPOINT%%

10 |

Service 2‘s API Endpoint: %%SERVICE_2_ENDPOINT%%

11 | 17 | Learn React 18 | 19 |
20 |
21 | ); 22 | } 23 | 24 | export default App; 25 | -------------------------------------------------------------------------------- /frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /frontend/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /frontend/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "independent", 3 | "npmClient": "yarn", 4 | "useWorkspaces": true 5 | } 6 | -------------------------------------------------------------------------------- /lib/Service1Stack.js: -------------------------------------------------------------------------------- 1 | import * as sst from "@serverless-stack/resources"; 2 | 3 | export default class Service1Stack extends sst.Stack { 4 | constructor(scope, id, props) { 5 | super(scope, id, props); 6 | 7 | // Create a HTTP API 8 | const api = new sst.Api(this, "Api", { 9 | defaultFunctionProps: { 10 | srcPath: "src/services/service1", 11 | }, 12 | routes: { 13 | "GET /": "handler.main", 14 | }, 15 | }); 16 | 17 | this.api = api; 18 | 19 | // Show the endpoint in the output 20 | this.addOutputs({ 21 | Service1Endpoint: api.url, 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/Service2Stack.js: -------------------------------------------------------------------------------- 1 | import * as sst from "@serverless-stack/resources"; 2 | 3 | export default class Service2Stack extends sst.Stack { 4 | constructor(scope, id, props) { 5 | super(scope, id, props); 6 | 7 | // Create a HTTP API 8 | const api = new sst.Api(this, "Api", { 9 | defaultFunctionProps: { 10 | srcPath: "src/services/service2", 11 | }, 12 | routes: { 13 | "GET /": "handler.main", 14 | }, 15 | }); 16 | 17 | this.api = api; 18 | 19 | // Show the endpoint in the output 20 | this.addOutputs({ 21 | Service2Endpoint: api.url, 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/WebsiteStack.js: -------------------------------------------------------------------------------- 1 | import * as sst from "@serverless-stack/resources"; 2 | 3 | export default class WebsiteStack extends sst.Stack { 4 | constructor(scope, id, props) { 5 | super(scope, id, props); 6 | 7 | const site = new sst.StaticSite(this, "Site", { 8 | path: "frontend", 9 | buildOutput: "build", 10 | buildCommand: "npm run build", 11 | errorPage: sst.StaticSiteErrorOptions.REDIRECT_TO_INDEX_PAGE, 12 | replaceValues: [ 13 | { 14 | files: "**/*.js", 15 | search: "%%SERVICE_1_ENDPOINT%%", 16 | replace: props.api1.url, 17 | }, 18 | { 19 | files: "**/*.js", 20 | search: "%%SERVICE_2_ENDPOINT%%", 21 | replace: props.api2.url, 22 | } 23 | ], 24 | }); 25 | 26 | // Show the endpoint in the output 27 | this.addOutputs({ 28 | WebsiteURL: site.url, 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | import Service1Stack from "./Service1Stack"; 2 | import Service2Stack from "./Service2Stack"; 3 | import WebsiteStack from "./WebsiteStack"; 4 | 5 | export default function main(app) { 6 | // Set default runtime for all functions 7 | app.setDefaultFunctionProps({ 8 | runtime: "nodejs12.x" 9 | }); 10 | 11 | const service1 = new Service1Stack(app, "service1-stack"); 12 | const service2 = new Service2Stack(app, "service2-stack"); 13 | new WebsiteStack(app, "website-stack", { 14 | api1: service1.api, 15 | api2: service2.api, 16 | }); 17 | 18 | // Add more stacks 19 | } 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sst-lerna-yarn-starter", 3 | "version": "0.1.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "private": true, 7 | "workspaces": [ 8 | "frontend", 9 | "src/packages/*", 10 | "src/services/*" 11 | ], 12 | "scripts": { 13 | "test": "sst test", 14 | "start": "sst start", 15 | "build": "sst build", 16 | "deploy": "sst deploy", 17 | "remove": "sst remove" 18 | }, 19 | "devDependencies": { 20 | "@aws-cdk/assert": "1.105.0", 21 | "lerna": "^3.22.1" 22 | }, 23 | "dependencies": { 24 | "@serverless-stack/cli": "0.29.2", 25 | "@serverless-stack/resources": "0.29.2", 26 | "@aws-cdk/core": "1.105.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/packages/sample-package/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function sample() { 2 | return "sample package"; 3 | } 4 | -------------------------------------------------------------------------------- /src/packages/sample-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample", 3 | "version": "0.0.1", 4 | "main": "index.js", 5 | "license": "MIT" 6 | } 7 | -------------------------------------------------------------------------------- /src/services/service1/handler.js: -------------------------------------------------------------------------------- 1 | import sample from "sample"; 2 | import util from "../../util"; 3 | 4 | export async function main(event) { 5 | return { 6 | statusCode: 200, 7 | body: `Hello World! Via ${sample()} and ${util()} at ${event.requestContext.time}.`, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /src/services/service1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "service1", 3 | "version": "0.0.1", 4 | "main": "handler.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "sample": "^0.0.1" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/services/service2/handler.js: -------------------------------------------------------------------------------- 1 | export async function main(event) { 2 | return { 3 | statusCode: 200, 4 | body: `Hello World! Via service2 at ${event.requestContext.time}.`, 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /src/services/service2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "service2", 3 | "version": "0.0.1", 4 | "main": "handler.js", 5 | "license": "MIT" 6 | } 7 | -------------------------------------------------------------------------------- /src/util/index.js: -------------------------------------------------------------------------------- 1 | export default function util() { 2 | return "util"; 3 | } 4 | -------------------------------------------------------------------------------- /sst.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sst-lerna-yarn-starter", 3 | "stage": "dev", 4 | "region": "us-east-1", 5 | "lint": true 6 | } 7 | -------------------------------------------------------------------------------- /test/MyStack.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, haveResource } from "@aws-cdk/assert"; 2 | import * as sst from "@serverless-stack/resources"; 3 | import MyStack from "../lib/MyStack"; 4 | 5 | test("Test Stack", () => { 6 | const app = new sst.App(); 7 | // WHEN 8 | const stack = new MyStack(app, "test-stack"); 9 | // THEN 10 | expect(stack).to(haveResource("AWS::Lambda::Function")); 11 | }); 12 | --------------------------------------------------------------------------------