Web Analytics

nx-serverless

⭐ 146 stars Simplified Chinese by sudokar

nx-serverless-monorepo

serverless esbuild npm peer dependency version (scoped) code style: prettier GitHub license Percentage of issues still open PRs Welcome Maintained

TypeScript GitHub Actions

一个采用 Nx monorepo 工具包 🛠 和 aws-nodejs-typescript serverless 模板,基于 Serverless framework 的 monorepo 风格现代样板或模板项目

目录

包含内容

模板布局

.
├── stacks/    # stack for each serverless configuration/template and its associated files
├── libs/      # shared libraries
├── tools/
├── README.md
├── jest.config.js
├── jest.preset.js
├── nx.json
├── package.json
├── serverless.base.ts  # base configuration for serverless
├── tsconfig.base.json
├── workspace.json
├── .editorconfig
├── .eslintrc.json
├── .gitignore
├── .husky              # git hooks
├── .nvmrc
├── .prettierignore
├── .prettierrc

前提条件

> :warning: 版本lts/iron (v20)。如果你使用的是 nvm,运行 nvm use 确保本地和你的 lambda 运行时使用相同的 Node 版本。

> 在你喜欢的代码编辑器中,安装上述工具列表的插件

使用方法

根据你喜欢的包管理器,按照以下说明构建和部署无服务器堆栈。

``shell yarn install `

  • 生成一个新的堆栈
`shell nx g serverless `

> 使用 -d--dry-run 标志进行模拟运行

`shell nx g @nx/node:lib --skipBabelrc --tags lib `

> 使用 -d--dry-run 标志进行模拟运行

`shell nx run :build --stage= `

  • 对受更改影响的包堆进行打包
`shell nx affected:build --stage= `

  • 打包所有堆栈
`shell nx run-many --target=build --stage= `

  • 将堆栈部署到云端
  • 部署单个堆栈
`shell nx run :deploy --stage= `
  • 部署受更改影响的堆栈
`shell nx affected:deploy --stage= `
  • 部署所有堆栈
`shell nx run-many --target=deploy --all --stage= `

  • 从云中移除堆栈
  • 移除单个堆栈
`shell nx run :remove --stage= `
  • 删除受更改影响的堆栈
`shell nx affected:remove --stage= `
  • 删除所有堆栈
`shell nx run-many --target=remove --all --stage= `

  • 运行测试
  • 在单个堆栈中运行测试
`shell nx run :test --stage= `
  • 运行受更改影响的测试
`shell nx affected:test --stage= `

  • 在所有堆栈中运行测试
`shell nx run-many --target=test --all --stage= `

`shell nx run :serve --stage= `

  • 了解您的工作区
` nx dep-graph ``

进一步帮助

Nx Cloud

##### 云端计算备忘

​ Nx Cloud 与 Nx 配合使用,使您能够更快地构建和测试代码,速度提升可达 10 倍。

​ 访问 Nx Cloud 了解更多并启用它

贡献

发现问题?欢迎提交包含复现信息的问题。

欢迎通过拉取请求进行改进。

支持

喜欢此模板?

点击 Buy Me A Coffee

或者,为仓库添加一个星标 :star:

维护者

此模板由 sudokar 编写并维护

许可证

MIT

--- Tranlated By Open Ai Tx | Last indexed: 2026-05-27 ---