-
Notifications
You must be signed in to change notification settings - Fork 2
Dan/migrate nylas connect #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
45bb486
Start
radenkovic 5fd59dc
add license
radenkovic 51f7d37
nx
radenkovic a8ea754
changeset releases
radenkovic 0274ddd
add sample changeset
radenkovic 2ad854e
cleanup methods, make private
radenkovic 21a20c4
removed react mentions
radenkovic 013b68c
remove example app
radenkovic 33d12b0
Updated README and fixed typo in api URLs
AaronDDM 46e0e9f
fix formatting
radenkovic 5659b61
improve tooling
radenkovic b8fe579
chore(git): ignore Nx graph static assets and untrack /static
radenkovic c0dc232
linter fixes
radenkovic ef3aded
fix formatting
radenkovic 93ead70
add husky
radenkovic fc20b8e
new precommit
radenkovic c4e87b7
improve cicd
radenkovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@nylas/connect": patch | ||
| --- | ||
|
|
||
| Validating the github actions workflow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # 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 | ||
|
|
||
| ### NPM Token Setup | ||
|
|
||
| 1. **Create NPM Token**: | ||
| - Go to [npmjs.com](https://www.npmjs.com) → Account → Access Tokens | ||
| - Create a new "Automation" token with "Publish" permissions | ||
| - For scoped packages (`@nylas/*`), ensure you have publish access to the `@nylas` organization | ||
|
|
||
| 2. **Add to GitHub Secrets**: | ||
| - Go to your GitHub repository → Settings → Secrets and variables → Actions | ||
| - Add a new secret named `NPM_TOKEN` with your token value | ||
|
|
||
| ### Branch Protection (Recommended) | ||
|
|
||
| Set up branch protection for the release process: | ||
|
|
||
| 1. Go to Settings → Branches → Add rule for `main` | ||
| 2. Enable: | ||
| - "Require a pull request before merging" | ||
| - "Require status checks to pass before merging" | ||
| - Select the "PR Tests" check | ||
| 3. This ensures release PRs are reviewed and tests pass | ||
|
|
||
| ## 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 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: ubuntu-latest | ||
|
radenkovic marked this conversation as resolved.
Outdated
|
||
| 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: "22" | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: ubuntu-latest | ||
|
radenkovic marked this conversation as resolved.
Outdated
|
||
| 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: "22" | ||
|
radenkovic marked this conversation as resolved.
Outdated
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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": "^_" } | ||
| ] | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.