@sanity/pkg-utils 7.1.0 → 7.2.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": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -68,8 +68,8 @@
68
68
  "prettier": "@sanity/prettier-config",
69
69
  "dependencies": {
70
70
  "@babel/core": "^7.26.10",
71
- "@babel/preset-typescript": "^7.26.0",
72
- "@babel/types": "^7.26.10",
71
+ "@babel/preset-typescript": "^7.27.0",
72
+ "@babel/types": "^7.27.0",
73
73
  "@microsoft/api-extractor": "7.52.1",
74
74
  "@microsoft/tsdoc-config": "0.17.1",
75
75
  "@optimize-lodash/rollup-plugin": "5.0.2",
@@ -94,14 +94,13 @@
94
94
  "jsonc-parser": "^3.3.1",
95
95
  "mkdirp": "^3.0.1",
96
96
  "outdent": "^0.8.0",
97
- "parse-git-config": "^3.0.0",
98
97
  "pkg-up": "^3.1.0",
99
98
  "prettier": "^3.5.3",
100
99
  "pretty-bytes": "^5.6.0",
101
100
  "prompts": "^2.4.2",
102
101
  "recast": "0.23.11",
103
102
  "rimraf": "^4.4.1",
104
- "rollup": "^4.35.0",
103
+ "rollup": "^4.37.0",
105
104
  "rollup-plugin-esbuild": "^6.2.1",
106
105
  "rxjs": "^7.8.2",
107
106
  "treeify": "^1.1.0",
@@ -118,7 +117,6 @@
118
117
  "@types/find-config": "^1.0.4",
119
118
  "@types/git-url-parse": "^9.0.3",
120
119
  "@types/node": "^20.8.7",
121
- "@types/parse-git-config": "^3.0.4",
122
120
  "@types/prompts": "^2.4.9",
123
121
  "@types/rimraf": "^3.0.2",
124
122
  "@types/semver": "^7.5.8",
@@ -143,12 +141,12 @@
143
141
  "semver": "^7.6.0",
144
142
  "ts-node": "^10.9.2",
145
143
  "typescript": "5.8.2",
146
- "vitest": "^3.0.8",
147
- "@sanity/pkg-utils": "7.1.0"
144
+ "vitest": "^3.0.9",
145
+ "@sanity/pkg-utils": "7.2.0"
148
146
  },
149
147
  "peerDependencies": {
150
148
  "babel-plugin-react-compiler": "*",
151
- "typescript": "5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x"
149
+ "typescript": "5.8.x"
152
150
  },
153
151
  "peerDependenciesMeta": {
154
152
  "babel-plugin-react-compiler": {
@@ -1,10 +1,10 @@
1
+ import {execSync} from 'node:child_process'
1
2
  import {resolve} from 'node:path'
2
3
 
3
4
  import prettierConfig from '@sanity/prettier-config'
4
5
  import getLatestVersion from 'get-latest-version'
5
6
  import gitUrlParse from 'git-url-parse'
6
7
  import {outdent} from 'outdent'
7
- import parseGitConfig from 'parse-git-config'
8
8
  import prettier, {type Config as PrettierConfig} from 'prettier'
9
9
 
10
10
  import {
@@ -18,7 +18,7 @@ import {
18
18
  const RE_NAME = /^(?:@(?:[a-z0-9-*~][a-z0-9-*._~]*)\/)?[a-z0-9-~][a-z0-9-._~]*$/i
19
19
 
20
20
  export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) => {
21
- const gitConfig = await parseGitConfig({cwd, type: 'global'})
21
+ const gitConfig = getGitUserConfig(cwd)
22
22
 
23
23
  return {
24
24
  options: [
@@ -86,13 +86,13 @@ export const defaultTemplate: PkgTemplate = async ({cwd, logger, packagePath}) =
86
86
  name: 'authorName',
87
87
  type: 'string',
88
88
  description: 'package author name',
89
- initial: gitConfig?.['user']?.name,
89
+ initial: gitConfig.user,
90
90
  }),
91
91
  defineTemplateOption({
92
92
  name: 'authorEmail',
93
93
  type: 'string',
94
94
  description: 'package author email',
95
- initial: gitConfig?.['user']?.email,
95
+ initial: gitConfig.email,
96
96
  }),
97
97
  defineTemplateOption({
98
98
  name: 'license',
@@ -534,3 +534,17 @@ async function resolveLatestDeps(deps: Record<string, string | undefined>) {
534
534
 
535
535
  return latestDeps
536
536
  }
537
+
538
+ function getGitUserConfig(cwd: string): {user?: string; email?: string} {
539
+ let user: string | undefined
540
+ let email: string | undefined
541
+
542
+ try {
543
+ user = execSync('git config user.name', {encoding: 'utf8', cwd}).trim() || undefined
544
+ email = execSync('git config user.email', {encoding: 'utf8', cwd}).trim() || undefined
545
+ } catch {
546
+ /* ignore */
547
+ }
548
+
549
+ return {user, email}
550
+ }
@@ -15,6 +15,7 @@
15
15
  "allowSyntheticDefaultImports": true,
16
16
  "esModuleInterop": true,
17
17
  "forceConsistentCasingInFileNames": true,
18
- "skipLibCheck": true
18
+ "skipLibCheck": true,
19
+ "erasableSyntaxOnly": true
19
20
  }
20
21
  }