diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ad151ec..6a5c3d5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -24,6 +24,10 @@ jobs: - name: Install dependencies run: yarn install --immutable + - name: Build + run: | + yarn nx run-many --target=build + - name: Lint run: yarn nx run-many --target=lint @@ -37,15 +41,3 @@ jobs: uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} - - - name: Build - run: | - yarn nx run-many --target=build --projects=playground - - - name: Deploy Playground to Github Pages 🚀 - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: chore/gh-pages - target-folder: . - folder: apps/playground/dist - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-and-publish.yml b/.github/workflows/release-and-publish.yml index 02df485..8f2e05f 100644 --- a/.github/workflows/release-and-publish.yml +++ b/.github/workflows/release-and-publish.yml @@ -11,11 +11,13 @@ on: dry_run: type: boolean description: | - Dry run: preview versioning/publish without tagging, publishing, or deploying to S3. + Dry run: preview versioning/publish without tagging, publishing, or deploying. nx release decides which packages need a bump from conventional commits and runs the steps for the monorepo: - json-difference: published to npm and browser bundle deployed to S3 - json-difference-cli: published to npm + - playground: versioned/tagged/changelogged (private, not published to npm) and deployed to GitHub Pages + - mcp-json-diff: versioned/tagged/changelogged (private, not published to npm); in-repo json-difference dep kept in sync default: false required: false @@ -87,3 +89,12 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + - name: Deploy Playground to Github Pages 🚀 + if: github.event.inputs.dry_run != 'true' + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: chore/gh-pages + target-folder: . + folder: apps/playground/dist + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CLAUDE.md b/CLAUDE.md index 7d03c27..fe31235 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -104,7 +104,7 @@ Changing a project's tags in `project.json` changes who can import it — update # Release flow -Each publishable lib (`json-difference`, `json-difference-cli`) versions **independently** via the built-in `nx release` (config in `nx.json` → `release`). Driven by **conventional commits**: `feat` → minor, `fix`/`docs`/`chore`/`refactor` → patch, `BREAKING CHANGE` → major (custom mapping in `release.conventionalCommits.types`). Tag pattern is `{projectName}-{version}` (no leading `v`). `release.version.preVersionCommand` runs `nx run-many -t build` first. `nx release` handles version + CHANGELOG.md + git commit/tag/push + GitHub release + npm publish in one shot. +`json-difference`, `json-difference-cli`, `playground`, and `mcp-json-diff` each version **independently** via the built-in `nx release` (config in `nx.json` → `release`). Driven by **conventional commits**: `feat` → minor, `fix`/`docs`/`chore`/`refactor` → patch, `BREAKING CHANGE` → major (custom mapping in `release.conventionalCommits.types`). Tag pattern is `{projectName}-{version}` (no leading `v`). `release.version.preVersionCommand` runs `nx run-many -t build` first. `nx release` handles version + CHANGELOG.md + git commit/tag/push + GitHub release + npm publish in one shot. Since all projects in `release.projects` participate, nx release also syncs in-repo `json-difference` dependency versions across `json-difference-cli` and `mcp-json-diff`'s `package.json` whenever the library bumps. `playground` and `mcp-json-diff` are marked `"private": true`, so they get versioned/tagged/changelogged but are skipped by `npm publish`. Run via `yarn release` (= `yarn nx release`); `yarn release:dry-run` previews. Do not hand-edit versions; do not amend published commits. CI workflows live in `.github/workflows/` (`ci.yml`, `cd.yml`, `release-and-publish.yml`). diff --git a/apps/playground/package.json b/apps/playground/package.json index 321e62e..27db8ca 100644 --- a/apps/playground/package.json +++ b/apps/playground/package.json @@ -8,7 +8,7 @@ "react": "^19.2.5", "lucide-react": "^1.8.0", "@chakra-ui/react": "^3.35.0", - "json-difference": "1.16.1", + "json-difference": "1.16.2", "react-dom": "^19.2.5", "react-monaco-editor": "^0.59.0" }, diff --git a/libs/json-difference/project.json b/libs/json-difference/project.json index eb02ea3..7b1b8cc 100644 --- a/libs/json-difference/project.json +++ b/libs/json-difference/project.json @@ -7,7 +7,8 @@ "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "{projectRoot}/dist" + "outputPath": "{projectRoot}/dist", + "generatePackageJson": false } }, "build-browser": { @@ -15,7 +16,8 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "{projectRoot}/dist.browser", - "configFile": "{projectRoot}/vite.config.browser.mts" + "configFile": "{projectRoot}/vite.config.browser.mts", + "generatePackageJson": false } }, "build-to-s3": { diff --git a/libs/json-difference/vite.config.mts b/libs/json-difference/vite.config.mts index 2ed0796..999e3ae 100644 --- a/libs/json-difference/vite.config.mts +++ b/libs/json-difference/vite.config.mts @@ -3,14 +3,13 @@ import { defineConfig } from 'vite' import dts from 'vite-plugin-dts' import * as path from 'path' -import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin' import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin' export default defineConfig({ root: import.meta.dirname, cacheDir: '../../node_modules/.vite/libs/json-difference', + resolve: { tsconfigPaths: true }, plugins: [ - nxViteTsPaths(), nxCopyAssetsPlugin(['*.md']), dts({ entryRoot: 'src', tsconfigPath: path.join(import.meta.dirname, 'tsconfig.lib.json'), pathsToAliases: false }) ], diff --git a/nx.json b/nx.json index 3968c67..fb0783d 100644 --- a/nx.json +++ b/nx.json @@ -26,7 +26,7 @@ "packageManager": "yarn", "analytics": false, "release": { - "projects": ["json-difference", "json-difference-cli"], + "projects": ["json-difference", "json-difference-cli", "playground", "mcp-json-diff"], "projectsRelationship": "independent", "releaseTagPattern": "{projectName}-{version}", "version": { diff --git a/package.json b/package.json index 505e79c..4518ce6 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "eslint-plugin-react-refresh": "^0.5.2", "framer-motion": "^12.38.0", "jest": "^30.3.0", - "json-difference": "1.16.1", + "json-difference": "1.16.2", "jsonc-eslint-parser": "^3.1.0", "lucide-react": "^1.8.0", "monaco-editor": "^0.55.1", diff --git a/tools/mcp-json-diff/package.json b/tools/mcp-json-diff/package.json index 2dcb241..e3d238a 100644 --- a/tools/mcp-json-diff/package.json +++ b/tools/mcp-json-diff/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@modelcontextprotocol/sdk": "^1.29.0", - "json-difference": "1.16.1", + "json-difference": "1.16.2", "zod": "^3.23.0" } } diff --git a/yarn.lock b/yarn.lock index fbb2a45..ed0b138 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10329,10 +10329,10 @@ __metadata: languageName: node linkType: hard -"json-difference@npm:1.16.1": - version: 1.16.1 - resolution: "json-difference@npm:1.16.1" - checksum: 10/52b2564afdfdae4abc0bbd380c8555426e55c46a1ce362e6d7a4865a6a8575cb6b9b27b7184dfdb991a85fbf513fb2f253de5615ad777b22cf17e5828357f754 +"json-difference@npm:1.16.2": + version: 1.16.2 + resolution: "json-difference@npm:1.16.2" + checksum: 10/5fbd64efdbfd917cc9120ba8352cd1e5d685471156502df7c909d4848884f321f2b1695542cc57121a84e4e74e6acc4e5714aed35a6b6986ce7e4837139e9a01 languageName: node linkType: hard @@ -12456,7 +12456,7 @@ __metadata: eslint-plugin-react-refresh: "npm:^0.5.2" framer-motion: "npm:^12.38.0" jest: "npm:^30.3.0" - json-difference: "npm:1.16.1" + json-difference: "npm:1.16.2" jsonc-eslint-parser: "npm:^3.1.0" lucide-react: "npm:^1.8.0" monaco-editor: "npm:^0.55.1"