Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .envrc.example

This file was deleted.

25 changes: 15 additions & 10 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Node.js CI

on:
push:
branches: [ master ]
branches: [ master, main ]
pull_request:
branches: [ master ]
branches: [ master, main ]

jobs:
build:
Expand All @@ -16,17 +16,22 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# package.json "engines" is >=18.0.0, and the dependencies (AWS SDK v3, rollup 4,
# husky 9, commitlint 19, lint-staged 15) need Node 18 or later. pnpm 10 needs >=18.12.
node-version: [18.x, 20.x, 22.x, 24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn
- run: yarn run lint
- run: yarn run test -- --ci
- run: yarn run build
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run lint
- run: pnpm run typecheck
- run: pnpm run test --ci
- run: pnpm run build
17 changes: 17 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"branches": ["main"],
"tagFormat": "v${version}",
"plugins": [
["@semantic-release/commit-analyzer", { "preset": "conventionalcommits" }],
["@semantic-release/release-notes-generator", { "preset": "conventionalcommits" }],
"@semantic-release/npm",
[
"@semantic-release/github",
{
"successComment": false,
"failComment": false,
"releasedLabels": false
}
]
]
}
107 changes: 24 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ The project includes comprehensive examples and testing utilities in the `exampl
1. **Install dependencies:**
```bash
# Install project dependencies
npm install
pnpm install

# Install examples dependencies
cd examples
Expand All @@ -138,7 +138,7 @@ npm install
2. **Build the library:**
```bash
# From project root
npm run build
pnpm run build
```

3. **Configure environment:**
Expand Down Expand Up @@ -166,13 +166,13 @@ DEBUG=true
#### Unit Tests
```bash
# Run all unit tests
npm test
pnpm test

# Run tests in watch mode
npm run test:watch
pnpm run test:watch

# Run tests with coverage
npm run test:dev
pnpm run test:dev
```

#### Integration Tests
Expand Down Expand Up @@ -209,29 +209,33 @@ The examples directory provides:

### Prerequisites

- Node.js >= 14.0.0
- Node.js >= 18.18.0 (pnpm 10 needs 18.12+, and the pinned `@typescript-eslint/parser` 7.x needs `^18.18.0 || >=20`)
- [pnpm](https://pnpm.io/) (the version is pinned by `packageManager` in `package.json`; `corepack enable` picks it up)
- AWS credentials with CloudFront permissions
- TypeScript knowledge

### Development Commands

```bash
# Install dependencies
npm install
pnpm install

# Run linter
npm run lint
npm run lint --fix
pnpm run lint
pnpm run lint --fix

# Type check
pnpm run typecheck

# Run tests
npm test
npm run test:watch
pnpm test
pnpm run test:watch

# Build
npm run build
pnpm run build

# Generate documentation
npm run doc
pnpm run doc
```

### Required IAM Permissions
Expand All @@ -254,78 +258,15 @@ npm run doc

## Release Process

### Prerequisites

- All changes committed and pushed to remote repository
- GitHub access token configured for `conventional-github-releaser`
- npm account access for publishing
Releases are automated. Merging to `main` runs [semantic-release](https://github.com/semantic-release/semantic-release) on CircleCI
(config: `workflows/publish/npm-polyrepo-semantic-release.yaml` in `hideokamoto/circleci-configurations`, settings: `.releaserc.json`).

### Release Steps

1. **Commit and push changes:**
```bash
git add .
git commit -m "feat: add new feature" # Use conventional commit format
git push origin main
```

2. **Build the library:**
```bash
npm run build
```

3. **Update version and create release:**
```bash
npm version patch # or minor, major
```
This command automatically:
- Updates version in `package.json`
- Creates Git tag
- Pushes tag to remote repository
- Creates GitHub release
- Updates `CHANGELOG.md`

4. **Verify release artifacts:**
```bash
# Check if tag was created
git tag -l | tail -3

# Check if CHANGELOG was updated
git log --oneline -2
```

5. **Publish to npm:**
```bash
npm publish
```

### Version Management

- **patch**: Bug fixes and minor updates (1.2.1 → 1.2.2)
- **minor**: New features (1.2.1 → 1.3.0)
- **major**: Breaking changes (1.2.1 → 2.0.0)

### Automated Processes

The release process uses several npm scripts that run automatically:

- **`postversion`**: Automatically executes after `npm version`
- **`push:tag`**: Pushes Git tag to remote repository
- **`create:release`**: Creates GitHub release with conventional changelog
- **`create:changelog`**: Updates local `CHANGELOG.md` file

### Troubleshooting

If the automated release process fails:

```bash
# Manually execute release scripts
npm run push:tag
npm run create:release
npm run create:changelog
```
1. Merge a pull request whose commits follow [Conventional Commits](https://www.conventionalcommits.org/).
2. CircleCI runs lint / typecheck / build / test, decides the next version from the commits since the last `v*` tag
(`fix:` → patch, `feat:` → minor, `feat!:` or `BREAKING CHANGE` → major; `chore:`, `docs:`, `ci:`, `build:` etc. do not release),
pushes the tag, publishes to npm with OIDC trusted publishing (no npm token), and creates the GitHub Release.

Check GitHub repository settings and ensure proper authentication tokens are configured.
Do not run `npm version` or `npm publish` by hand, and do not bump `version` in `package.json` (the published version comes from the tag).

## Architecture

Expand Down
42 changes: 29 additions & 13 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ new LambdaEdgeController(
1. **依存関係のインストール:**
```bash
# プロジェクト依存関係のインストール
npm install
pnpm install

# 例の依存関係のインストール
cd examples
Expand All @@ -138,7 +138,7 @@ npm install
2. **ライブラリのビルド:**
```bash
# プロジェクトルートから
npm run build
pnpm run build
```

3. **環境設定:**
Expand Down Expand Up @@ -166,13 +166,13 @@ DEBUG=true
#### ユニットテスト
```bash
# すべてのユニットテストを実行
npm test
pnpm test

# ウォッチモードでテストを実行
npm run test:watch
pnpm run test:watch

# カバレッジ付きでテストを実行
npm run test:dev
pnpm run test:dev
```

#### 統合テスト
Expand Down Expand Up @@ -209,29 +209,33 @@ examplesディレクトリは以下を提供します:

### 前提条件

- Node.js >= 14.0.0
- Node.js >= 18.18.0(pnpm 10 は 18.12 以上、固定している `@typescript-eslint/parser` 7.x は `^18.18.0 || >=20` が必要)
- [pnpm](https://pnpm.io/)(バージョンは `package.json` の `packageManager` で固定。`corepack enable` で使われる)
- CloudFront権限を持つAWS認証情報
- TypeScriptの知識

### 開発コマンド

```bash
# 依存関係のインストール
npm install
pnpm install

# リンターの実行
npm run lint
npm run lint --fix
pnpm run lint
pnpm run lint --fix

# 型チェック
pnpm run typecheck

# テストの実行
npm test
npm run test:watch
pnpm test
pnpm run test:watch

# ビルド
npm run build
pnpm run build

# ドキュメントの生成
npm run doc
pnpm run doc
```

### 必要なIAM権限
Expand All @@ -252,6 +256,18 @@ npm run doc
}
```

## リリース

リリースは自動です。`main` へのマージで、CircleCI が [semantic-release](https://github.com/semantic-release/semantic-release) を実行します
(config: `hideokamoto/circleci-configurations` の `workflows/publish/npm-polyrepo-semantic-release.yaml`、設定: `.releaserc.json`)。

1. [Conventional Commits](https://www.conventionalcommits.org/) に沿ったコミットの PR をマージする。
2. CircleCI が lint / typecheck / build / test を実行し、前回の `v*` タグ以降のコミットから次の版を決め
(`fix:` → patch、`feat:` → minor、`feat!:` または `BREAKING CHANGE` → major。`chore:`・`docs:`・`ci:`・`build:` などはリリースしない)、
タグの push、OIDC(npm トークン不要)での npm 公開、GitHub Release の作成まで行う。

`npm version` や `npm publish` を手で実行しないこと。`package.json` の `version` も手で上げない(公開される版はタグで決まる)。

## アーキテクチャ

このライブラリは3つの主要コンポーネントで構成されています:
Expand Down
12 changes: 4 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Lambda@Edge Controllerの全機能をテストする統合スクリプトです

**実行方法:**
```bash
# ライブラリをビルド
npm run build
# ライブラリをビルド(プロジェクトルートで)
pnpm run build

# スクリプトを実行
node examples/aws-test.js
Expand All @@ -29,9 +29,7 @@ cd examples && npm test
### 1. 依存関係のインストール
```bash
# プロジェクトルートで
npm install
# または
yarn install
pnpm install

# examplesディレクトリで
cd examples
Expand All @@ -41,9 +39,7 @@ npm install
### 2. ライブラリのビルド
```bash
# プロジェクトルートで
npm run build
# または
yarn build
pnpm run build
```

### 3. 環境設定ファイルの作成
Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
"scripts": {
"build": "rollup -c",
"tsc": "tsc",
"typecheck": "tsc --noEmit",
"test": "jest",
"lint": "eslint 'libs/*.ts'",
"doc": "typedoc --out docs libs/ && touch docs/.nojekyll",
"test:watch": "jest --watch",
"test:dev": "jest --watch --silent=false --verbose false --coverage",
"postversion": "npm run push:tag && npm run create:release && npm run create:changelog",
"push:tag": "git push origin $(git describe --abbrev=0 --tags)",
"create:release": "conventional-github-releaser -p angular",
"create:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'"
"test:dev": "jest --watch --silent=false --verbose false --coverage"
},
"keywords": [],
"bugs": {
Expand Down Expand Up @@ -69,8 +66,6 @@
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"conventional-changelog-cli": "^4.0.0",
"conventional-github-releaser": "^3.1.5",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.0",
Expand All @@ -91,5 +86,6 @@
"@aws-sdk/client-cloudfront": "^3.0.0",
"bunyan": "^1.8.12",
"bunyan-format": "^0.2.1"
}
},
"packageManager": "pnpm@10.34.9"
}
Loading
Loading