From 8f7fe70de291f4896a5f3e366c837c5e54250da8 Mon Sep 17 00:00:00 2001 From: Cody Olsen <81981+stipsan@users.noreply.github.com> Date: Tue, 2 Apr 2024 09:27:40 +0200 Subject: [PATCH] chore: add prettier-plugin-packagejson (#6155) --- .prettierrc | 3 +- dev/embedded-studio/package.json | 4 +- dev/studio-e2e-testing/package.json | 8 ++-- package.json | 3 +- packages/@sanity/codegen/package.json | 10 ++--- packages/@sanity/import-cli/package.json | 6 +-- packages/@sanity/migrate/package.json | 12 +++--- .../@sanity/portable-text-editor/package.json | 2 +- perf/studio/package.json | 4 +- perf/tests/package.json | 18 ++++----- pnpm-lock.yaml | 40 ++++++++++++++++++- 11 files changed, 75 insertions(+), 35 deletions(-) diff --git a/.prettierrc b/.prettierrc index ad1e3081fcc..0e679b57f31 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,5 +2,6 @@ "semi": false, "printWidth": 100, "bracketSpacing": false, - "singleQuote": true + "singleQuote": true, + "plugins": ["prettier-plugin-packagejson"] } diff --git a/dev/embedded-studio/package.json b/dev/embedded-studio/package.json index a722a61fd0d..242485b4a7e 100644 --- a/dev/embedded-studio/package.json +++ b/dev/embedded-studio/package.json @@ -1,10 +1,10 @@ { "name": "embedded-studio", - "private": true, "version": "3.36.2", + "private": true, "scripts": { - "dev": "vite", "build": "tsc && vite build", + "dev": "vite", "preview": "vite preview" }, "dependencies": { diff --git a/dev/studio-e2e-testing/package.json b/dev/studio-e2e-testing/package.json index 15209cc2282..6e5977ffa3a 100644 --- a/dev/studio-e2e-testing/package.json +++ b/dev/studio-e2e-testing/package.json @@ -1,7 +1,10 @@ { "name": "studio-e2e-testing", - "private": true, "version": "3.36.2", + "private": true, + "keywords": [ + "sanity" + ], "license": "MIT", "author": "Sanity.io ", "scripts": { @@ -10,9 +13,6 @@ "lint": "eslint .", "start": "sanity start --port 3339" }, - "keywords": [ - "sanity" - ], "dependencies": { "@sanity/google-maps-input": "^3.0.1", "@sanity/icons": "^2.11.0", diff --git a/package.json b/package.json index 7d7d62a8d4a..96031e7bef4 100644 --- a/package.json +++ b/package.json @@ -63,8 +63,8 @@ "perf:studio:build": "pnpm build --filter=perf-studio", "perf:studio:dev": "cd perf/studio && pnpm dev", "perf:test": "cd perf/tests && pnpm perf:test", - "postinstall": "husky", "preinstall": "npx only-allow pnpm", + "postinstall": "husky", "prettier": "prettier --cache .", "prettify": "lerna run clean && prettier --write .", "prettify:dts": "prettier --loglevel warn --write packages/@sanity/*/lib/dts && prettier --loglevel warn --write packages/*/lib/dts", @@ -144,6 +144,7 @@ "npm-run-all": "^4.1.5", "ora": "^6.3.1", "prettier": "^3.2.5", + "prettier-plugin-packagejson": "^2.4.14", "rimraf": "^3.0.2", "rxjs": "^7.8.1", "sanity": "workspace:*", diff --git a/packages/@sanity/codegen/package.json b/packages/@sanity/codegen/package.json index be2be943c7b..9fcee69f2d4 100644 --- a/packages/@sanity/codegen/package.json +++ b/packages/@sanity/codegen/package.json @@ -14,9 +14,6 @@ "bugs": { "url": "https://github.com/sanity-io/sanity/issues" }, - "publishConfig": { - "access": "public" - }, "repository": { "type": "git", "url": "git+https://github.com/sanity-io/sanity.git", @@ -55,8 +52,8 @@ "check:package": "pkg-utils --strict --tsconfig tsconfig.lib.json", "clean": "rimraf lib coverage", "lint": "eslint .", - "watch": "pkg-utils watch --tsconfig tsconfig.lib.json", - "test": "jest" + "test": "jest", + "watch": "pkg-utils watch --tsconfig tsconfig.lib.json" }, "dependencies": { "@babel/core": "^7.23.9", @@ -86,5 +83,8 @@ }, "engines": { "node": ">=18" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/@sanity/import-cli/package.json b/packages/@sanity/import-cli/package.json index e680bce681e..901b5ec40ef 100644 --- a/packages/@sanity/import-cli/package.json +++ b/packages/@sanity/import-cli/package.json @@ -30,6 +30,9 @@ "files": [ "src" ], + "scripts": { + "lint": "eslint ." + }, "dependencies": { "@sanity/client": "^6.15.7", "@sanity/import": "3.36.2", @@ -40,8 +43,5 @@ }, "engines": { "node": ">=18" - }, - "scripts": { - "lint": "eslint ." } } diff --git a/packages/@sanity/migrate/package.json b/packages/@sanity/migrate/package.json index aaf32ea320e..5ef552d8830 100644 --- a/packages/@sanity/migrate/package.json +++ b/packages/@sanity/migrate/package.json @@ -36,6 +36,10 @@ }, "./package.json": "./package.json" }, + "main": "./lib/_exports/index.js", + "module": "./lib/_exports/index.esm.js", + "source": "./src/_exports/index.ts", + "types": "./lib/dts/src/_exports/index.d.ts", "typesVersions": { "*": { "mutations": [ @@ -43,10 +47,6 @@ ] } }, - "main": "./lib/_exports/index.js", - "module": "./lib/_exports/index.esm.js", - "source": "./src/_exports/index.ts", - "types": "./lib/dts/src/_exports/index.d.ts", "files": [ "lib", "src", @@ -59,8 +59,8 @@ "check:package": "pkg-utils --strict --tsconfig tsconfig.lib.json", "clean": "rimraf lib coverage", "lint": "eslint .", - "watch": "pkg-utils watch --tsconfig tsconfig.lib.json", - "test": "jest" + "test": "jest", + "watch": "pkg-utils watch --tsconfig tsconfig.lib.json" }, "dependencies": { "@bjoerge/mutiny": "^0.5.1", diff --git a/packages/@sanity/portable-text-editor/package.json b/packages/@sanity/portable-text-editor/package.json index 1b7db490997..60accd952f3 100644 --- a/packages/@sanity/portable-text-editor/package.json +++ b/packages/@sanity/portable-text-editor/package.json @@ -55,9 +55,9 @@ "postbuild": "run-s check:package", "check:package": "pkg-utils --strict --tsconfig tsconfig.lib.json", "clean": "rimraf lib", + "dev": "cd ./e2e-tests/ && ts-node serve", "lint": "eslint .", "prettier": "prettier --write './**/*.{ts,tsx,js,css,html}'", - "dev": "cd ./e2e-tests/ && ts-node serve", "test": "jest", "test:e2e": "jest --config=e2e-tests/e2e.config.cjs", "test:watch": "jest --watch", diff --git a/perf/studio/package.json b/perf/studio/package.json index 33ba66b6aa8..537c1fe26f0 100644 --- a/perf/studio/package.json +++ b/perf/studio/package.json @@ -10,8 +10,8 @@ "clean": "rimraf .sanity dist", "dev": "sanity dev --port 3300", "lint": "eslint .", - "start": "sanity start --port 3300", - "preview": "pnpm build && pnpm start" + "preview": "pnpm build && pnpm start", + "start": "sanity start --port 3300" }, "dependencies": { "react": "^18.2.0", diff --git a/perf/tests/package.json b/perf/tests/package.json index 66fb5768975..34ce653be8d 100644 --- a/perf/tests/package.json +++ b/perf/tests/package.json @@ -7,21 +7,13 @@ "author": "Sanity.io ", "scripts": { "build": "pnpm build:cli && (cd studio && pnpm build)", + "lint": "eslint .", "perf:codegen": "ts-node --files -r dotenv/config codegen", "perf:test": "ts-node --files cli", "perf:test:ci": "ts-node --files cli", - "lint": "eslint .", "studio": "cd perf/studio && (pnpm build && pnpm start)", "studio:dev": "cd perf/studio && SANITY_STUDIO_DATASET=dev pnpm dev" }, - "devDependencies": { - "@jest/globals": "^29.7.0", - "@types/lodash": "^4.14.149", - "@types/node": "^18.15.3", - "esbuild": "^0.20.2", - "ts-node": "^10.9.1", - "typescript": "^5.4.2" - }, "dependencies": { "@playwright/test": "^1.41.2", "@sanity/client": "^6.15.7", @@ -32,5 +24,13 @@ "lodash": "^4.17.21", "rxjs": "^7.8.0", "sanity": "workspace:*" + }, + "devDependencies": { + "@jest/globals": "^29.7.0", + "@types/lodash": "^4.14.149", + "@types/node": "^18.15.3", + "esbuild": "^0.20.2", + "ts-node": "^10.9.1", + "typescript": "^5.4.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 79070e564d6..53f549f2b26 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -180,6 +180,9 @@ importers: prettier: specifier: ^3.2.5 version: 3.2.5 + prettier-plugin-packagejson: + specifier: ^2.4.14 + version: 2.4.14(prettier@3.2.5) rimraf: specifier: ^3.0.2 version: 3.0.2 @@ -6323,7 +6326,7 @@ packages: parse-git-config: 3.0.0 pkg-up: 3.1.0 prettier: 3.2.5 - prettier-plugin-packagejson: 2.4.12(prettier@3.2.5) + prettier-plugin-packagejson: 2.4.14(prettier@3.2.5) pretty-bytes: 5.6.0 prompts: 2.4.2 rimraf: 4.4.1 @@ -16009,6 +16012,19 @@ packages: sort-package-json: 2.8.0 synckit: 0.9.0 + /prettier-plugin-packagejson@2.4.14(prettier@3.2.5): + resolution: {integrity: sha512-sli+gV5tW7uxvzDZQscaBtSfbyAW2ToL6n/HGt51PipwX9vI7M54vefG0mKSfklVkT29TNGO6Mo6g8c6Z79gmw==} + peerDependencies: + prettier: '>= 1.16.0' + peerDependenciesMeta: + prettier: + optional: true + dependencies: + prettier: 3.2.5 + sort-package-json: 2.10.0 + synckit: 0.9.0 + dev: true + /prettier@3.2.5: resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} engines: {node: '>=14'} @@ -17106,6 +17122,14 @@ packages: dependencies: lru-cache: 6.0.0 + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -17417,6 +17441,20 @@ packages: /sort-object-keys@1.1.3: resolution: {integrity: sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==} + /sort-package-json@2.10.0: + resolution: {integrity: sha512-MYecfvObMwJjjJskhxYfuOADkXp1ZMMnCFC8yhp+9HDsk7HhR336hd7eiBs96lTXfiqmUNI+WQCeCMRBhl251g==} + hasBin: true + dependencies: + detect-indent: 7.0.1 + detect-newline: 4.0.1 + get-stdin: 9.0.0 + git-hooks-list: 3.1.0 + globby: 13.2.2 + is-plain-obj: 4.1.0 + semver: 7.6.0 + sort-object-keys: 1.1.3 + dev: true + /sort-package-json@2.8.0: resolution: {integrity: sha512-PxeNg93bTJWmDGnu0HADDucoxfFiKkIr73Kv85EBThlI1YQPdc0XovBgg2llD0iABZbu2SlKo8ntGmOP9wOj/g==} hasBin: true