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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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)
5 changes: 5 additions & 0 deletions .changeset/add-husky.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nylas/connect": patch
---

Add Husky git hooks: pre-commit and pre-push run ggshield secret scans.
14 changes: 14 additions & 0 deletions .changeset/add-oxlint-linter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@nylas/connect": none
---

Add Oxlint as the linter across the workspace and standardize scripts/CI.

- Add `oxlint` as a workspace devDependency
- Use `lint` (auto-fix) and `lint:check` (no fix) across packages
- Configure Nx to cache `lint:check` and skip caching for `lint`
- Update PR workflow to run `pnpm lint:check`

This is a tooling-only change; no runtime impact.


15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "{tag}-{datetime}"
}
}
5 changes: 5 additions & 0 deletions .changeset/silent-eggs-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nylas/connect": patch
---

Validating the github actions workflow
98 changes: 98 additions & 0 deletions .github/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Release Process

This repository uses [Changesets](https://github.com/changesets/changesets) for automated package versioning and publishing.

## How It Works

### 1. Creating Changes
When you make changes that should trigger a release:

```bash
# Add a changeset describing your changes
pnpm changeset

# Follow the prompts to:
# - Select which packages are affected
# - Choose the type of change (patch, minor, major)
# - Write a description of the change
```

This creates a markdown file in `.changeset/` describing the change.

### 2. Automated Release Process

When changesets are pushed to `main`:

1. **Release PR Creation**: The GitHub Action automatically creates a "Version Packages" PR
2. **Review Process**: The PR shows exactly what will be released and requires review
3. **Publishing**: When the PR is merged, packages are automatically published to NPM
4. **GitHub Releases**: Release notes are automatically created with changelogs

### 3. Manual Testing

You can test releases locally:

```bash
# See what would be published (dry run)
pnpm publish:dry-run

# Build and publish locally (requires NPM_TOKEN)
pnpm publish
```

## Setup Requirements


## Changeset Types

- **patch**: Bug fixes, documentation updates, internal changes
- **minor**: New features, non-breaking changes
- **major**: Breaking changes, API changes

## Example Workflow

```bash
# 1. Make your changes
git checkout -b feature/new-auth-method
# ... make changes ...

# 2. Add changeset
pnpm changeset
# Select: @nylas/connect → minor → "Add new OAuth flow support"

# 3. Commit and push
git add .changeset/
git commit -m "feat: add new OAuth flow support"
git push origin feature/new-auth-method

# 4. Create PR and merge to main
# 5. Release PR is automatically created
# 6. Review and merge release PR
# 7. Packages are published automatically!
```

## Troubleshooting

### Release PR Not Created
- Check that changesets exist in `.changeset/` (not just config files)
- Verify the GitHub Action ran successfully
- Ensure you have the required permissions

### Publishing Fails
- Verify `NPM_TOKEN` secret is set correctly
- Check NPM token has publish permissions for `@nylas` scope
- Ensure package versions don't already exist on NPM

### Manual Recovery
If automation fails, you can manually release:

```bash
# Update versions
pnpm version

# Build and publish
pnpm publish

# Create git tags
git push --follow-tags
```
73 changes: 73 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: PR Tests

on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
# Also run on pushes to main for consistency
push:
branches: [main]

# Cancel in-progress runs for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test Suite
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 15

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch full history for Nx affected commands (optional optimization)
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "10.6.3"
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

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

- name: Type check
run: pnpm typecheck

- name: Lint (check only)
run: pnpm lint:check

- name: Check formatting
run: pnpm format:check

- name: Build packages
run: pnpm build

- name: Run tests
run: pnpm test

- name: Run tests with coverage
run: pnpm --filter @nylas/connect coverage
87 changes: 87 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

# Prevent multiple releases from running at the same time
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: blacksmith-2vcpu-ubuntu-2404
permissions:
contents: write # to create release commits and tags
pull-requests: write # to create release PRs
id-token: write # for NPM provenance
timeout-minutes: 15

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Need full history for changesets
fetch-depth: 0
# Use a token that can trigger workflows (for release PR creation)
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "10.6.3"
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

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

- name: Type check
run: pnpm typecheck

- name: Check formatting
run: pnpm format:check

- name: Build packages
run: pnpm build

- name: Run tests
run: pnpm test

- name: Run tests with coverage
run: pnpm --filter @nylas/connect coverage

- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
with:
# This expects a script called "version" and "publish"
version: pnpm version
publish: pnpm publish:dry-run
title: "chore: version packages"
commit: "chore: version packages"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,14 @@ area51

###### Docker ######
!.docker/**



.nx/cache
.nx/workspace-data
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md

# Nx Project Graph export assets
static/
project-graph.html
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm format
pnpm lint
pnpm typecheck
11 changes: 11 additions & 0 deletions .nxignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Nx ignore patterns
node_modules/
dist/
.git/
.changeset/
*.log
.DS_Store
coverage/
.nyc_output/
*.html
static/
20 changes: 20 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"node": true,
"es2022": true
},
"ignorePatterns": ["node_modules/", "dist/", "coverage/", "**/*.d.ts"],
"rules": {
"no-console": "warn",
"no-debugger": "error",
"eqeqeq": ["error", "always"],
"curly": "error",
"no-var": "error",
"prefer-const": "warn",
"no-unused-vars": [
"warn",
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }
]
}
}
9 changes: 0 additions & 9 deletions .pre-commit-config.yaml

This file was deleted.

Loading