@sanity/pkg-utils 6.6.5 → 6.6.7

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.6.5",
3
+ "version": "6.6.7",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -92,7 +92,7 @@
92
92
  "pretty-bytes": "^5.6.0",
93
93
  "prompts": "^2.4.2",
94
94
  "rimraf": "^4.4.1",
95
- "rollup": "^4.14.2",
95
+ "rollup": "^4.14.3",
96
96
  "rollup-plugin-esbuild": "^6.1.1",
97
97
  "rxjs": "^7.8.1",
98
98
  "treeify": "^1.1.0",
@@ -101,8 +101,8 @@
101
101
  "zod-validation-error": "3.1.0"
102
102
  },
103
103
  "devDependencies": {
104
- "@commitlint/cli": "^19.2.1",
105
- "@commitlint/config-conventional": "^19.1.0",
104
+ "@commitlint/cli": "^19.2.2",
105
+ "@commitlint/config-conventional": "^19.2.2",
106
106
  "@types/babel__core": "^7.20.5",
107
107
  "@types/cpx": "^1.5.5",
108
108
  "@types/find-config": "^1.0.4",
@@ -114,8 +114,8 @@
114
114
  "@types/semver": "^7.5.8",
115
115
  "@types/treeify": "^1.0.3",
116
116
  "@types/uuid": "^9.0.8",
117
- "@typescript-eslint/eslint-plugin": "^7.6.0",
118
- "@typescript-eslint/parser": "^7.6.0",
117
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
118
+ "@typescript-eslint/parser": "^7.7.0",
119
119
  "browserslist-to-esbuild": "2.1.1",
120
120
  "commitizen": "^4.3.0",
121
121
  "cpx": "^1.5.0",
@@ -136,12 +136,11 @@
136
136
  "typescript": "5.4.5",
137
137
  "vitest": "^1.5.0",
138
138
  "vitest-github-actions-reporter": "^0.11.1",
139
- "@sanity/pkg-utils": "6.6.5"
139
+ "@sanity/pkg-utils": "6.6.7"
140
140
  },
141
141
  "peerDependencies": {
142
142
  "typescript": "5.4.x"
143
143
  },
144
- "packageManager": "pnpm@8.15.7",
145
144
  "engines": {
146
145
  "node": ">=18.17.0"
147
146
  },
@@ -26,11 +26,11 @@ export function printPackageTree(ctx: BuildContext): void {
26
26
  const tree: Record<string, unknown> = {}
27
27
 
28
28
  if (pkg.type) {
29
- tree.type = chalk.yellow(pkg.type)
29
+ tree['type'] = chalk.yellow(pkg.type)
30
30
  }
31
31
 
32
32
  if (pkg.bin) {
33
- tree.bin = Object.fromEntries(
33
+ tree['bin'] = Object.fromEntries(
34
34
  Object.entries(pkg.bin).map(([name, file]) => [chalk.cyan(name), fileInfo(file)]),
35
35
  )
36
36
  }
@@ -45,7 +45,7 @@ export function printPackageTree(ctx: BuildContext): void {
45
45
  return `${chalk.yellow(file)} ${chalk.gray(info.size)}`
46
46
  }
47
47
 
48
- tree.exports = Object.fromEntries(
48
+ tree['exports'] = Object.fromEntries(
49
49
  Object.entries(exports)
50
50
  .filter(([, entry]) => entry._exported)
51
51
  .map(([exportPath, entry]) => {
@@ -1,6 +1,6 @@
1
1
  import {expectTypeOf, test} from 'vitest'
2
2
 
3
- import {InferredStrictOptions, StrictOptions} from './strict'
3
+ import type {InferredStrictOptions, StrictOptions} from './strict'
4
4
 
5
5
  test('the zod schema types matches the manual types', () => {
6
6
  expectTypeOf<StrictOptions>().toEqualTypeOf<Partial<InferredStrictOptions>>()
@@ -80,7 +80,7 @@ export function resolveRollupConfig(
80
80
  },
81
81
  'process.env.PKG_FORMAT': JSON.stringify(format),
82
82
  'process.env.PKG_RUNTIME': JSON.stringify(runtime),
83
- 'process.env.PKG_VERSION': JSON.stringify(process.env.PKG_VERSION || pkg.version),
83
+ 'process.env.PKG_VERSION': JSON.stringify(process.env['PKG_VERSION'] || pkg.version),
84
84
  ...replacements,
85
85
  }),
86
86
  },
@@ -48,7 +48,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
48
48
  name: 'pkgName',
49
49
  type: 'string',
50
50
  description: 'package name',
51
- initial: (options) => options.repo?.name || undefined,
51
+ initial: (options) => options['repo']?.name || undefined,
52
52
  validate: (v) => {
53
53
  if (!v) return 'package name is required'
54
54
 
@@ -85,13 +85,13 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
85
85
  name: 'authorName',
86
86
  type: 'string',
87
87
  description: 'package author name',
88
- initial: gitConfig?.user?.name,
88
+ initial: gitConfig?.['user']?.name,
89
89
  }),
90
90
  defineTemplateOption({
91
91
  name: 'authorEmail',
92
92
  type: 'string',
93
93
  description: 'package author email',
94
- initial: gitConfig?.user?.email,
94
+ initial: gitConfig?.['user']?.email,
95
95
  }),
96
96
  defineTemplateOption({
97
97
  name: 'license',
@@ -129,11 +129,11 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
129
129
  const {fullName: name} = pkgName
130
130
 
131
131
  const author =
132
- [options.authorName, options.authorEmail && `<${options.authorEmail}>`]
132
+ [options['authorName'], options['authorEmail'] && `<${options['authorEmail']}>`]
133
133
  .filter(Boolean)
134
134
  .join(' ') ?? undefined
135
135
 
136
- const prettierConfig: PrettierConfig | undefined = features.prettier
136
+ const prettierConfig: PrettierConfig | undefined = features['prettier']
137
137
  ? {
138
138
  bracketSpacing: false,
139
139
  plugins: ['prettier-plugin-packagejson'],
@@ -159,19 +159,19 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
159
159
  } = {
160
160
  name,
161
161
  'version': '0.0.0',
162
- 'description': options.description ?? undefined,
162
+ 'description': options['description'] ?? undefined,
163
163
  'keywords': [],
164
164
  'homepage': undefined,
165
165
  'bugs': undefined,
166
166
  'repository': undefined,
167
- 'license': options.license,
167
+ 'license': options['license'],
168
168
  author,
169
169
  'sideEffects': false,
170
170
  'type': 'module',
171
171
  'exports': {
172
172
  '.': {
173
173
  types: undefined,
174
- source: features.typescript ? './src/index.ts' : './src/index.js',
174
+ source: features['typescript'] ? './src/index.ts' : './src/index.js',
175
175
  import: './dist/index.js',
176
176
  require: './dist/index.cjs',
177
177
  default: './dist/index.js',
@@ -180,17 +180,19 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
180
180
  },
181
181
  'main': './dist/index.cjs',
182
182
  'module': './dist/index.js',
183
- 'source': features.typescript ? './src/index.ts' : './src/index.js',
183
+ 'source': features['typescript'] ? './src/index.ts' : './src/index.js',
184
184
  'types': undefined,
185
185
  'files': ['dist', 'src'],
186
186
  'scripts': {
187
187
  'build': 'run-s clean pkg:build pkg:check',
188
188
  'clean': 'rimraf dist',
189
- 'format': features.prettier ? 'prettier --write --cache --ignore-unknown .' : undefined,
189
+ 'format': features['prettier']
190
+ ? 'prettier --write --cache --ignore-unknown .'
191
+ : undefined,
190
192
  'pkg:build': 'pkg build --strict',
191
193
  'pkg:check': 'pkg check --strict',
192
194
  },
193
- 'lint-staged': features.prettier
195
+ 'lint-staged': features['prettier']
194
196
  ? {
195
197
  '*': ['prettier --write --cache --ignore-unknown'],
196
198
  }
@@ -209,8 +211,8 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
209
211
  'eslint-plugin-simple-import-sort': undefined,
210
212
  'lint-staged': '*',
211
213
  'npm-run-all': '*',
212
- 'prettier': features.prettier ? '*' : undefined,
213
- 'prettier-plugin-packagejson': features.prettier ? '*' : undefined,
214
+ 'prettier': features['prettier'] ? '*' : undefined,
215
+ 'prettier-plugin-packagejson': features['prettier'] ? '*' : undefined,
214
216
  'rimraf': '*',
215
217
  'typescript': undefined,
216
218
  },
@@ -252,7 +254,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
252
254
  `,
253
255
  })
254
256
 
255
- if (features.prettier) {
257
+ if (features['prettier']) {
256
258
  files.push({
257
259
  name: '.prettierignore',
258
260
  contents: outdent`
@@ -282,7 +284,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
282
284
  pkgJson.homepage = `https://${repo.source}/${repo.owner}/${repo.name}#readme`
283
285
  }
284
286
 
285
- if (features.typescript) {
287
+ if (features['typescript']) {
286
288
  pkgJson.types = './dist/index.d.ts'
287
289
 
288
290
  pkgJson.scripts = {
@@ -297,7 +299,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
297
299
  }
298
300
  }
299
301
 
300
- if (features.eslint) {
302
+ if (features['eslint']) {
301
303
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
302
304
  const eslintConfig: any = {
303
305
  root: true,
@@ -308,7 +310,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
308
310
  },
309
311
  extends: [
310
312
  'eslint:recommended',
311
- features.prettier ? 'plugin:prettier/recommended' : undefined,
313
+ features['prettier'] ? 'plugin:prettier/recommended' : undefined,
312
314
  ].filter(Boolean),
313
315
  parserOptions: {
314
316
  ecmaVersion: 2020,
@@ -317,7 +319,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
317
319
  plugins: [
318
320
  'import',
319
321
  'simple-import-sort',
320
- features.prettier ? 'prettier' : undefined,
322
+ features['prettier'] ? 'prettier' : undefined,
321
323
  ].filter(Boolean),
322
324
  rules: {
323
325
  'no-console': 'error',
@@ -339,7 +341,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
339
341
 
340
342
  pkgJson.scripts = {
341
343
  ...pkgJson.scripts,
342
- lint: features.typescript
344
+ lint: features['typescript']
343
345
  ? 'eslint . --ext .cjs,.js,.ts,.tsx'
344
346
  : 'eslint . --ext .cjs,.js',
345
347
  }
@@ -347,13 +349,13 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
347
349
  pkgJson.devDependencies = {
348
350
  ...pkgJson.devDependencies,
349
351
  'eslint': '*',
350
- 'eslint-config-prettier': features.prettier ? '*' : undefined,
352
+ 'eslint-config-prettier': features['prettier'] ? '*' : undefined,
351
353
  'eslint-plugin-simple-import-sort': '*',
352
354
  'eslint-plugin-import': '*',
353
- 'eslint-plugin-prettier': features.prettier ? '*' : undefined,
355
+ 'eslint-plugin-prettier': features['prettier'] ? '*' : undefined,
354
356
  }
355
357
 
356
- if (features.typescript) {
358
+ if (features['typescript']) {
357
359
  pkgJson.devDependencies = {
358
360
  ...pkgJson.devDependencies,
359
361
  '@typescript-eslint/eslint-plugin': '*',
@@ -369,7 +371,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
369
371
  },
370
372
  extends: [
371
373
  'eslint:recommended',
372
- features.prettier ? 'plugin:prettier/recommended' : undefined,
374
+ features['prettier'] ? 'plugin:prettier/recommended' : undefined,
373
375
  'plugin:@typescript-eslint/eslint-recommended',
374
376
  'plugin:@typescript-eslint/recommended',
375
377
  ].filter(Boolean),
@@ -377,7 +379,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
377
379
  'import',
378
380
  '@typescript-eslint',
379
381
  'simple-import-sort',
380
- features.prettier ? 'prettier' : undefined,
382
+ features['prettier'] ? 'prettier' : undefined,
381
383
  ].filter(Boolean),
382
384
  rules: {
383
385
  '@typescript-eslint/explicit-module-boundary-types': 'error',
@@ -405,7 +407,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
405
407
  })
406
408
  }
407
409
 
408
- if (features.typescript) {
410
+ if (features['typescript']) {
409
411
  files.push({
410
412
  name: 'tsconfig.settings.json',
411
413
  contents: await format(
@@ -490,7 +492,7 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
490
492
  }
491
493
 
492
494
  // source file
493
- if (features.typescript) {
495
+ if (features['typescript']) {
494
496
  files.push({
495
497
  name: 'package.config.ts',
496
498
  contents: await format(