@sanity/pkg-utils 7.0.4 → 7.1.1

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.0.4",
3
+ "version": "7.1.1",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -67,17 +67,17 @@
67
67
  "browserslist": "extends @sanity/browserslist-config",
68
68
  "prettier": "@sanity/prettier-config",
69
69
  "dependencies": {
70
- "@babel/core": "^7.26.7",
70
+ "@babel/core": "^7.26.10",
71
71
  "@babel/preset-typescript": "^7.26.0",
72
- "@babel/types": "^7.26.7",
73
- "@microsoft/api-extractor": "7.49.2",
72
+ "@babel/types": "^7.26.10",
73
+ "@microsoft/api-extractor": "7.52.1",
74
74
  "@microsoft/tsdoc-config": "0.17.1",
75
- "@optimize-lodash/rollup-plugin": "5.0.1",
75
+ "@optimize-lodash/rollup-plugin": "5.0.2",
76
76
  "@rollup/plugin-alias": "^5.1.1",
77
77
  "@rollup/plugin-babel": "^6.0.4",
78
- "@rollup/plugin-commonjs": "^28.0.2",
78
+ "@rollup/plugin-commonjs": "^28.0.3",
79
79
  "@rollup/plugin-json": "^6.1.0",
80
- "@rollup/plugin-node-resolve": "^16.0.0",
80
+ "@rollup/plugin-node-resolve": "^16.0.1",
81
81
  "@rollup/plugin-replace": "^6.0.2",
82
82
  "@rollup/plugin-terser": "^0.4.4",
83
83
  "@sanity/browserslist-config": "^1.0.5",
@@ -85,53 +85,51 @@
85
85
  "cac": "^6.7.14",
86
86
  "chalk": "^4.1.2",
87
87
  "chokidar": "^4.0.3",
88
- "esbuild": "^0.24.2",
88
+ "esbuild": "^0.25.1",
89
89
  "esbuild-register": "^3.6.0",
90
90
  "find-config": "^1.0.0",
91
91
  "get-latest-version": "^5.1.0",
92
- "git-url-parse": "^16.0.0",
92
+ "git-url-parse": "^16.0.1",
93
93
  "globby": "^11.1.0",
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
- "prettier": "^3.4.2",
98
+ "prettier": "^3.5.3",
100
99
  "pretty-bytes": "^5.6.0",
101
100
  "prompts": "^2.4.2",
102
- "recast": "0.23.9",
101
+ "recast": "0.23.11",
103
102
  "rimraf": "^4.4.1",
104
- "rollup": "^4.32.1",
105
- "rollup-plugin-esbuild": "^6.1.1",
106
- "rxjs": "^7.8.1",
103
+ "rollup": "^4.36.0",
104
+ "rollup-plugin-esbuild": "^6.2.1",
105
+ "rxjs": "^7.8.2",
107
106
  "treeify": "^1.1.0",
108
- "uuid": "^11.0.5",
109
- "zod": "3.24.1",
107
+ "uuid": "^11.1.0",
108
+ "zod": "3.24.2",
110
109
  "zod-validation-error": "3.4.0"
111
110
  },
112
111
  "devDependencies": {
113
- "@commitlint/cli": "^19.6.1",
114
- "@commitlint/config-conventional": "^19.6.0",
112
+ "@commitlint/cli": "^19.8.0",
113
+ "@commitlint/config-conventional": "^19.8.0",
115
114
  "@sanity/prettier-config": "^1.0.3",
116
115
  "@types/babel__core": "^7.20.5",
117
116
  "@types/cpx": "^1.5.5",
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",
125
123
  "@types/treeify": "^1.0.3",
126
124
  "@types/uuid": "^10.0.0",
127
- "@typescript-eslint/eslint-plugin": "^8.22.0",
128
- "@typescript-eslint/parser": "^8.22.0",
125
+ "@typescript-eslint/eslint-plugin": "^8.26.1",
126
+ "@typescript-eslint/parser": "^8.26.1",
129
127
  "browserslist-to-esbuild": "2.1.1",
130
128
  "commitizen": "^4.3.1",
131
129
  "cpx": "^1.5.0",
132
130
  "cz-conventional-changelog": "^3.3.0",
133
131
  "eslint": "^8.57.1",
134
- "eslint-config-prettier": "^10.0.1",
132
+ "eslint-config-prettier": "^10.1.1",
135
133
  "eslint-plugin-import": "^2.31.0",
136
134
  "eslint-plugin-prettier": "^5.2.3",
137
135
  "eslint-plugin-simple-import-sort": "^12.1.1",
@@ -142,13 +140,13 @@
142
140
  "rollup-plugin-visualizer": "^5.13.1",
143
141
  "semver": "^7.6.0",
144
142
  "ts-node": "^10.9.2",
145
- "typescript": "5.7.3",
146
- "vitest": "^3.0.4",
147
- "@sanity/pkg-utils": "7.0.4"
143
+ "typescript": "5.8.2",
144
+ "vitest": "^3.0.8",
145
+ "@sanity/pkg-utils": "7.1.1"
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"
149
+ "typescript": "5.4.x || 5.5.x || 5.6.x || 5.7.x || 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
+ }