@sanity/pkg-utils 6.7.2 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "6.7.2",
3
+ "version": "6.8.0",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -65,6 +65,7 @@
65
65
  ]
66
66
  },
67
67
  "browserslist": "extends @sanity/browserslist-config",
68
+ "prettier": "@sanity/prettier-config",
68
69
  "dependencies": {
69
70
  "@babel/core": "^7.24.4",
70
71
  "@babel/types": "^7.24.0",
@@ -95,7 +96,6 @@
95
96
  "parse-git-config": "^3.0.0",
96
97
  "pkg-up": "^3.1.0",
97
98
  "prettier": "^3.2.5",
98
- "prettier-plugin-packagejson": "^2.5.0",
99
99
  "pretty-bytes": "^5.6.0",
100
100
  "prompts": "^2.4.2",
101
101
  "rimraf": "^4.4.1",
@@ -110,6 +110,7 @@
110
110
  "devDependencies": {
111
111
  "@commitlint/cli": "^19.2.2",
112
112
  "@commitlint/config-conventional": "^19.2.2",
113
+ "@sanity/prettier-config": "^1.0.0",
113
114
  "@types/babel__core": "^7.20.5",
114
115
  "@types/cpx": "^1.5.5",
115
116
  "@types/find-config": "^1.0.4",
@@ -143,7 +144,7 @@
143
144
  "typescript": "5.4.5",
144
145
  "vitest": "^1.5.0",
145
146
  "vitest-github-actions-reporter": "^0.11.1",
146
- "@sanity/pkg-utils": "6.7.2"
147
+ "@sanity/pkg-utils": "6.8.0"
147
148
  },
148
149
  "peerDependencies": {
149
150
  "typescript": "5.4.x"
@@ -1,5 +1,6 @@
1
1
  import {resolve} from 'node:path'
2
2
 
3
+ import prettierConfig from '@sanity/prettier-config'
3
4
  import getLatestVersion from 'get-latest-version'
4
5
  import gitUrlParse from 'git-url-parse'
5
6
  import {outdent} from 'outdent'
@@ -133,28 +134,8 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
133
134
  .filter(Boolean)
134
135
  .join(' ') ?? undefined
135
136
 
136
- const prettierConfig: PrettierConfig | undefined = features['prettier']
137
- ? {
138
- bracketSpacing: false,
139
- plugins: ['prettier-plugin-packagejson'],
140
- printWidth: 100,
141
- quoteProps: 'consistent',
142
- semi: false,
143
- singleQuote: true,
144
- tabWidth: 2,
145
- overrides: [
146
- {
147
- files: ['*.yml'],
148
- options: {
149
- singleQuote: false,
150
- },
151
- },
152
- ],
153
- }
154
- : undefined
155
-
156
137
  const pkgJson: PackageJSON & {
157
- prettier?: PrettierConfig
138
+ prettier?: '@sanity/prettier-config'
158
139
  ['lint-staged']?: Record<string, string[]>
159
140
  } = {
160
141
  name,
@@ -197,7 +178,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
197
178
  '*': ['prettier --write --cache --ignore-unknown'],
198
179
  }
199
180
  : undefined,
200
- // prettier: prettierConfig,
181
+ 'prettier': features['prettier'] ? '@sanity/prettier-config' : undefined,
201
182
  'browserslist': 'extends @sanity/browserslist-config',
202
183
  'dependencies': {},
203
184
  'devDependencies': {
@@ -262,15 +243,6 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
262
243
  pnpm-lock.yaml
263
244
  `,
264
245
  })
265
-
266
- files.push({
267
- name: '.prettierrc',
268
- contents: await format(
269
- resolve(packagePath, '.prettierrc.json'),
270
- JSON.stringify(prettierConfig, null, 2) + '\n',
271
- prettierConfig,
272
- ),
273
- })
274
246
  }
275
247
 
276
248
  if (repo) {