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
9 changes: 9 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

17 changes: 17 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"docs",
"@repo/ui",
"@repo/eslint-config",
"@repo/uix-config"
]
}

2 changes: 2 additions & 0 deletions .changeset/sour-onions-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
59 changes: 59 additions & 0 deletions .github/workflows/changeset-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Changeset Check

on:
pull_request:
branches:
- main
paths:
- 'packages/commons-contract/**'
- 'packages/cf-admin-contract/**'
- 'packages/cf-editor-contract/**'
- 'packages/universal-editor/**'

jobs:
check:
name: Check for changeset
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.0.0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check for changesets
run: |
if [ ! -d ".changeset" ]; then
echo "❌ No .changeset directory found"
exit 1
fi

# Count markdown files (excluding README.md)
changeset_count=$(find .changeset -name "*.md" ! -name "README.md" -type f | wc -l)

if [ $changeset_count -eq 0 ]; then
echo "❌ No changeset found!"
echo ""
echo "It looks like you've made changes to publishable packages without adding a changeset."
echo ""
echo "Please run 'pnpm changeset' to create one, or add an empty changeset with 'pnpm changeset --empty' if this is intentional."
echo ""
echo "Learn more: https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md"
exit 1
fi

echo "✅ Found $changeset_count changeset(s)"

54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Packages

on:
push:
branches:
- main
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
publish:
name: Publish to NPM
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.0.0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm run build

- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
version: pnpm run version
commit: 'chore: version packages'
title: 'chore: version packages'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}

2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
access=public
138 changes: 138 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Publishing Packages

This repository uses [Changesets](https://github.com/changesets/changesets) for version management and publishing packages to NPM.

## Published Packages

The following packages are published to NPM:
- `@adobe/uix-commons-contract` (shared dependency)
- `@adobe/uix-cf-admin-contract`
- `@adobe/uix-cf-editor-contract`
- `@adobe/uix-universal-editor-contract`

Note: `@adobe/uix-commons-contract` is also published because the other three packages depend on it.

## Workflow

### 1. Making Changes

When you make changes to one or more packages that need to be published:

```bash
# After making your changes, create a changeset
pnpm changeset
```

This will prompt you to:
1. Select which packages have changed
2. Choose the type of change (major, minor, or patch)
3. Write a summary of the changes

The changeset will be saved as a markdown file in the `.changeset` directory.

### 2. Versioning

When changes are pushed to the `main` branch, the GitHub Actions workflow will:
- Detect any changesets
- Create or update a "Version Packages" pull request
- The PR will update package versions and CHANGELOG files based on all pending changesets

### 3. Publishing

When you merge the "Version Packages" pull request:
- The GitHub Actions workflow will automatically publish the updated packages to NPM
- Changesets will be consumed and removed
- Git tags will be created for the new versions

### 4. Manual Trigger

You can also manually trigger the publish workflow from the GitHub Actions UI:
1. Go to the "Actions" tab in GitHub
2. Select the "Publish Packages" workflow
3. Click "Run workflow"

## Manual Publishing (Local)

If needed, you can also publish manually from your local machine:

```bash
# 1. Make sure you have the NPM token set
export NPM_TOKEN=your_npm_token_here

# 2. Build all packages
pnpm run build

# 3. Publish (this will prompt for OTP if 2FA is enabled)
pnpm run release
```

## Changeset Types

- **Patch** (0.0.x): Bug fixes and minor changes
- **Minor** (0.x.0): New features that are backward compatible
- **Major** (x.0.0): Breaking changes

## Example Changeset

```markdown
---
"@adobe/uix-cf-admin-contract": minor
"@adobe/uix-cf-editor-contract": minor
---

Add new field validation API
```

## Configuration

The publishing workflow is configured in:
- `.github/workflows/publish.yml` - GitHub Actions workflow
- `.changeset/config.json` - Changesets configuration
- `.npmrc` - NPM registry authentication
- Root `package.json` - Scripts for version and release

## NPM Token

The workflow uses the `ADOBE_BOT_NPM_TOKEN` repository secret for authentication with NPM. Make sure this secret is configured in your repository settings.

## What if I Forget to Create a Changeset?

### Prevention: CI Check

A GitHub Actions workflow (`changeset-check.yml`) runs on pull requests that modify publishable packages. It will **fail the CI check** if:
- You modify a package in `packages/commons-contract/`, `packages/cf-admin-contract/`, `packages/cf-editor-contract/`, or `packages/universal-editor/`
- AND there's no changeset in the `.changeset` directory

This prevents merging PRs without changesets.

### If Already Merged Without a Changeset

If changes are already on `main` without a changeset:

1. **Create a changeset now**:
```bash
git checkout main
git pull
pnpm changeset
```

2. **Commit and push**:
```bash
git add .changeset
git commit -m "chore: add missing changeset"
git push origin main
```

3. The next workflow run will pick up the changeset and create the Version Packages PR.

### Intentional Changes Without Publishing

If you make changes that shouldn't trigger a release (e.g., internal refactoring, tests):

```bash
# Create an empty changeset to satisfy the CI check
pnpm changeset --empty
```

This documents that the lack of version bump is intentional.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
"yalc": "turbo run yalc",
"prepare": "husky",
"regression": "tsx scripts/regress.ts",
"test": "npx jest scripts"
"test": "npx jest scripts",
"changeset": "changeset",
"version": "changeset version && pnpm install --no-frozen-lockfile",
"release": "pnpm run build && changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@types/jest": "^30.0.0",
"@types/node": "^22.15.3",
"expect-type": "^1.2.1",
Expand Down
7 changes: 5 additions & 2 deletions packages/cf-admin-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "@adobe/uix-cf-admin-contract",
"type": "module",
"version": "1.0.0",
"version": "0.0.1",
"description": "UIX Commons Contracts for Content Fragment Admin",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"dev": "typedoc src --json docs/index.json --excludePrivate --excludeProtected --excludeInternal --watch",
"build": "tsc",
Expand All @@ -24,7 +27,7 @@
"react": "^19.1.0"
},
"devDependencies": {
"@adobe/uix-config": "workspace:*",
"@repo/uix-config": "workspace:*",
"typedoc": "^0.28.5",
"typescript": "latest"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cf-admin-contract/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@adobe/uix-config/base.json",
"extends": "@repo/uix-config/base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
Expand Down
7 changes: 5 additions & 2 deletions packages/cf-editor-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "@adobe/uix-cf-editor-contract",
"type": "module",
"version": "1.0.0",
"version": "0.0.1",
"description": "UIX Commons Contracts for Content Fragment Editor",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"dev": "typedoc src --json docs/index.json --excludePrivate --excludeProtected --excludeInternal --watch",
"build": "tsc",
Expand All @@ -23,7 +26,7 @@
"@adobe/uix-commons-contract": "workspace:*"
},
"devDependencies": {
"@adobe/uix-config": "workspace:*",
"@repo/uix-config": "workspace:*",
"typedoc": "^0.28.5",
"typescript": "latest"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cf-editor-contract/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@adobe/uix-config/base.json",
"extends": "@repo/uix-config/base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
Expand Down
10 changes: 8 additions & 2 deletions packages/commons-contract/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"name": "@adobe/uix-commons-contract",
"type": "module",
"version": "1.0.0",
"version": "0.0.1",
"description": "UIX Commons Contracts",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"dev": "typedoc src --json docs/index.json --excludePrivate --excludeProtected --excludeInternal --watch",
"build": "tsc",
Expand All @@ -17,7 +23,7 @@
}
},
"devDependencies": {
"@adobe/uix-config": "workspace:*",
"@repo/uix-config": "workspace:*",
"tsx": "^4.20.3",
"typedoc": "^0.28.5",
"typescript": "latest"
Expand Down
Loading