Skip to content

Add Oxc checks and PR preview publishing#18

Merged
AmanVarshney01 merged 2 commits intomainfrom
aman/setup-oxc-pr-previews
Mar 11, 2026
Merged

Add Oxc checks and PR preview publishing#18
AmanVarshney01 merged 2 commits intomainfrom
aman/setup-oxc-pr-previews

Conversation

@AmanVarshney01
Copy link
Member

@AmanVarshney01 AmanVarshney01 commented Mar 10, 2026

Summary

  • add oxlint and oxfmt to the repo with lint, lint:fix, format, and format:check scripts
  • add baseline Oxc config and format the supported repo files
  • keep templates/**/*.hbs out of oxfmt for now because some Handlebars templates do not parse cleanly yet
  • update the publish workflow so same-repo PRs automatically publish preview builds to npm with dist-tags like create-prisma@pr18
  • keep the existing main release flow, but gate it on lint, format check, typecheck, and build

Preview publish behavior

For a PR like #18, GitHub Actions now publishes a unique prerelease version of create-prisma and tags it with pr18 on npm.

That means reviewers can install the latest build for the PR with:

  • bunx create-prisma@pr18
  • npm install create-prisma@pr18
  • yarn add create-prisma@pr18
  • pnpm add create-prisma@pr18

Each new push to the PR republishes a fresh preview version behind the same pr18 tag.

Verification

  • bun run lint
  • bun run format:check
  • bun run typecheck
  • bun run build

Summary by CodeRabbit

  • New Features

    • Added PR preview npm package publishing with per-PR distribution tags.
  • Documentation

    • Expanded template support list; added new scripts (check, lint, format) to documentation; clarified preview package publishing workflow.
  • Chores

    • Integrated code quality and formatting tools; enhanced release workflow with automated version validation and tagging.

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

Walkthrough

This PR introduces linting and formatting tools (oxlint and oxfmt) to the project, restructures CI/CD workflows for npm package previews and releases, updates package metadata configuration, and applies comprehensive code formatting across source and template files.

Changes

Cohort / File(s) Summary
CI/CD Workflows
.github/workflows/publish.yml
Modified root-level permissions to read-only, restructured concurrency handling for pull requests, and added new "preview" job for PR-based npm package publishing with tag derivation from PR numbers. Release workflow now triggers on commit messages starting with chore(release): and includes conditional version checks, git tag creation, and GitHub release steps.
Linting & Formatting Configuration
.oxfmtrc.json, .oxlintrc.json
Added new configuration files for OxFormat and Oxlint tools, including schema paths, ignore patterns for templates, rule disablement (unicorn/no-empty-file), and environment settings.
Package Metadata & Scripts
package.json
Updated to declare package as non-private, added repository metadata, files array, module type declaration, new scripts for linting/formatting (check, lint, lint:fix, format, format:check), and devDependencies for oxfmt and oxlint. Added engine constraints for Bun and Node.js versions.
Documentation
README.md
Expanded usage section with new bun run check command, updated Prisma scaffolding paths, listed additional supported templates (hono, next, svelte, astro, nuxt, tanstack-start, turborepo), and documented new PR preview packaging workflow with dist-tag examples.
Source Code Formatting
src/commands/create.ts, src/constants/db-packages.ts, src/index.ts, src/tasks/install.ts, src/tasks/prisma-postgres.ts, src/tasks/setup-addons.ts, src/tasks/setup-prisma.ts, src/templates/render-create-template.ts, src/templates/shared.ts, src/types.ts, src/ui/branding.ts, src/utils/package-manager.ts
Comprehensive code formatting changes including consolidation of multi-line imports to single-line, addition of trailing commas in parameter lists and object declarations, and reformatting of string literals and array expressions. Function signatures updated with trailing comma formatting but no behavioral changes.
Template Files
templates/create/next/..., templates/create/svelte/..., templates/create/tanstack-start/..., templates/create/turborepo/...
Formatting normalization across template configuration and source files including indentation standardization (tabs to spaces), quote style normalization (single to double quotes), removal of trailing blank lines, and reformatting of array declarations and CSS font-family declarations.

Possibly related PRs

Suggested reviewers

  • mhartington
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Oxc checks and PR preview publishing' clearly and concisely summarizes the two main changes in the pull request: introducing Oxc linting/formatting tooling and adding PR preview package publishing to npm.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aman/setup-oxc-pr-previews

Comment @coderabbitai help to get the list of available commands and usage tips.

@AmanVarshney01 AmanVarshney01 marked this pull request as ready for review March 10, 2026 22:39
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/tasks/setup-prisma.ts (1)

420-428: 🧹 Nitpick | 🔵 Trivial

Consider extracting the nested ternary to improve readability.

The deeply nested ternary chain for resolving singletonPath works correctly but is difficult to scan. A helper function or early-return pattern would improve maintainability.

♻️ Optional refactor using a lookup array
+async function resolveSingletonPath(prismaProjectDir: string): Promise<string> {
+  const candidates = [
+    "src/lib/prisma.ts",
+    "src/lib/prisma.server.ts",
+    "src/lib/server/prisma.ts",
+    "server/utils/prisma.ts",
+  ];
+
+  for (const candidate of candidates) {
+    if (await fs.pathExists(path.join(prismaProjectDir, candidate))) {
+      return path.join(prismaProjectDir, candidate);
+    }
+  }
+
+  return path.join(prismaProjectDir, "src/client.ts");
+}

Then replace the nested ternary:

-  const singletonPath = (await fs.pathExists(path.join(prismaProjectDir, "src/lib/prisma.ts")))
-    ? path.join(prismaProjectDir, "src/lib/prisma.ts")
-    : (await fs.pathExists(path.join(prismaProjectDir, "src/lib/prisma.server.ts")))
-      ? path.join(prismaProjectDir, "src/lib/prisma.server.ts")
-      : (await fs.pathExists(path.join(prismaProjectDir, "src/lib/server/prisma.ts")))
-        ? path.join(prismaProjectDir, "src/lib/server/prisma.ts")
-        : (await fs.pathExists(path.join(prismaProjectDir, "server/utils/prisma.ts")))
-          ? path.join(prismaProjectDir, "server/utils/prisma.ts")
-          : path.join(prismaProjectDir, "src/client.ts");
+  const singletonPath = await resolveSingletonPath(prismaProjectDir);

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1681bc9a-ef42-4a87-9eb4-5775df886d04

📥 Commits

Reviewing files that changed from the base of the PR and between 19a9560 and f68f64b.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (32)
  • .github/workflows/publish.yml
  • .oxfmtrc.json
  • .oxlintrc.json
  • README.md
  • package.json
  • src/commands/create.ts
  • src/constants/db-packages.ts
  • src/index.ts
  • src/tasks/install.ts
  • src/tasks/prisma-postgres.ts
  • src/tasks/setup-addons.ts
  • src/tasks/setup-prisma.ts
  • src/templates/render-create-template.ts
  • src/templates/shared.ts
  • src/types.ts
  • src/ui/branding.ts
  • src/utils/package-manager.ts
  • templates/create/next/eslint.config.mjs
  • templates/create/next/src/app/globals.css
  • templates/create/svelte/.vscode/extensions.json
  • templates/create/svelte/src/app.d.ts
  • templates/create/svelte/src/app.html
  • templates/create/svelte/svelte.config.js
  • templates/create/svelte/tsconfig.json
  • templates/create/svelte/vite.config.ts
  • templates/create/tanstack-start/prisma.config.ts
  • templates/create/tanstack-start/src/router.tsx
  • templates/create/tanstack-start/src/styles.css
  • templates/create/tanstack-start/vite.config.ts
  • templates/create/turborepo/apps/api/tsconfig.json
  • templates/create/turborepo/packages/db/tsconfig.json
  • templates/create/turborepo/turbo.json
💤 Files with no reviewable changes (3)
  • templates/create/tanstack-start/src/styles.css
  • templates/create/tanstack-start/src/router.tsx
  • templates/create/tanstack-start/prisma.config.ts

@AmanVarshney01 AmanVarshney01 merged commit 22b01f8 into main Mar 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants