@gammarers/projen-projects

中文文档
0.8.0发布于 2026/11/09Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 2573
原始使用文档
文档目录9 节
  1. Features
  2. Installation
  3. npm
  4. yarn
  5. pnpm
  6. Usage
  7. Options
  8. Requirements
  9. License

Projen Projects

npm version license Node.js build

Opinionated projen project types for AWS CDK construct libraries, jsii libraries, and TypeScript packages.

Features

  • ProjenCdkConstructLibrary — an AwsCdkConstructLibrary wrapper with shared defaults
  • ProjenJsiiProject — a JsiiProject wrapper with the same shared defaults
  • ProjenTypeScriptProject — a TypeScriptProject wrapper with the same shared defaults
  • Requires only name and repositoryUrl to get started (cdkVersion is also required for CDK libraries)
  • Shared author, Node (>= 20), TypeScript (6.0.x), and jsii (6.0.x, jsii / CDK libraries) settings
  • GitHub App credentials for workflow authentication
  • Weekly dependency upgrades with auto-approve / auto-merge labels
  • Generates a consistent .editorconfig and sets ESLint max-len to 160
  • Runs Jest with --silent so test logs stay quiet
  • Enables TypeScript strict in the development tsconfig
  • Defaults discovered AWS Lambda handlers to Node.js 24, with @aws-sdk/* external and source maps
  • Generates .devcontainer/devcontainer.json on Node 24, aligned with workflow Node 24.x

Installation

npm

npm install @gammarers/projen-projects

yarn

yarn add @gammarers/projen-projects

pnpm

pnpm add @gammarers/projen-projects

Usage

Create a .projenrc.ts that uses ProjenCdkConstructLibrary:

import { ProjenCdkConstructLibrary } from '@gammarers/projen-projects';

const project = new ProjenCdkConstructLibrary({
  name: '@example/my-cdk-construct',
  repositoryUrl: 'https://github.com/example/my-cdk-construct.git',
  cdkVersion: '2.170.0',
});

project.synth();

Or use ProjenJsiiProject for a multi-language jsii library:

import { ProjenJsiiProject } from '@gammarers/projen-projects';

const project = new ProjenJsiiProject({
  name: '@example/my-jsii-library',
  repositoryUrl: 'https://github.com/example/my-jsii-library.git',
});

project.synth();

Or use ProjenTypeScriptProject for a TypeScript package:

import { ProjenTypeScriptProject } from '@gammarers/projen-projects';

const project = new ProjenTypeScriptProject({
  name: '@example/my-typescript-project',
  repositoryUrl: 'https://github.com/example/my-typescript-project.git',
});

project.synth();

Then generate the project files:

npx projen

Options

ProjenCdkConstructLibrary accepts ProjenCdkConstructLibraryOptions, which extends AwsCdkConstructLibraryOptions (most fields optional) while requiring the following:

OptionTypeRequiredDescription
namestringYesPackage name
repositoryUrlstringYesGit repository URL (jsii derives repository from this value)
cdkVersionstringYesAWS CDK version

Optional highlights:

OptionDescription
Other AwsCdkConstructLibrary optionsPassed through and can override the built-in defaults, including lambdaOptions. devContainer stays false

Built-in defaults include author yicr, npm as the package manager, releaseToNpm: false, public npm access, workflow Node 24.x, and GitHub App-based projen credentials. Discovered Lambda handlers use Node.js 24, exclude @aws-sdk/* from the bundle, and emit source maps. Passing lambdaOptions replaces that default. A library with no Lambda handler is unchanged.

ProjenJsiiProject accepts ProjenJsiiProjectOptions, which extends JsiiProjectOptions (most fields optional) while requiring the following:

OptionTypeRequiredDescription
namestringYesPackage name
repositoryUrlstringYesGit repository URL (jsii derives repository from this value)

Other JsiiProject options are passed through and can override the built-in defaults. devContainer stays false. The same author, Node, TypeScript, jsii (6.0.x), npm, and GitHub App defaults as ProjenCdkConstructLibrary apply (without CDK / Lambda settings).

ProjenTypeScriptProject accepts ProjenTypeScriptProjectOptions, which extends TypeScriptProjectOptions (most fields optional) while requiring the following:

OptionTypeRequiredDescription
namestringYesPackage name
repositoryUrlstringYesGit repository URL (passed through as projen's repository)

Other TypeScriptProject options are passed through and can override the built-in defaults. devContainer stays false. The same author, Node, TypeScript, npm, and GitHub App defaults as ProjenCdkConstructLibrary apply (jsiiVersion is not set because this type is not a jsii project).

All three types write .devcontainer/devcontainer.json and add /.devcontainer to .npmignore. jsii projects (including CDK construct libraries) also install the .NET, Python, and Java Dev Container features. After the container is created, it fixes ownership of the node_modules volume, marks the workspace as a Git safe directory, and runs the project's immutable install command (npm ci with the default package manager).

Requirements

  • Node.js >= 20.0.0

License

This project is licensed under the Apache-2.0 License.

版本与发布记录

@gammarers/projen-projects 共发布 29 个版本,首次发布于 2026/08/24;过去 12 个月发布了 29 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.0latest2026/11/096 天前
0.7.12026/11/087 天前
0.7.02026/11/0411 天前
0.6.32026/11/0114 天前
0.6.22026/10/2521 天前
0.6.12026/10/2522 天前

关于 @gammarers/projen-projects 的常见问题

@gammarers/projen-projects 是什么?

[](https://www.npmjs

如何安装 @gammarers/projen-projects?

在项目目录运行 npm install @gammarers/projen-projects,或使用 pnpm add / yarn add / bun add。

@gammarers/projen-projects 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gammarers/projen-projects 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@gammarers/projen-projects 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gammarers/projen-projects 可以商用吗?

@gammarers/projen-projects 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@gammarers/projen-projects 的下载量有多少?

根据 npm 官方下载统计,@gammarers/projen-projects 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,573 次,日均约 86 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gammarers/projen-projects 还在维护吗?

最新版本 0.8.0 发布于 2026/11/09(6 天前);至今共发布 29 个版本,其中过去 12 个月发布了 29 个;首次发布于 2026/08/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。