create-sanity 5.2.0 → 5.2.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/index.js +14 -3
- package/package.json +4 -3
package/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {spawn} from 'node:child_process'
|
|
3
|
+
import {readFile} from 'node:fs/promises'
|
|
3
4
|
import {join} from 'node:path'
|
|
5
|
+
import {fileURLToPath} from 'node:url'
|
|
4
6
|
|
|
5
7
|
import {moduleResolve} from 'import-meta-resolve'
|
|
6
8
|
|
|
@@ -8,9 +10,18 @@ const args = process.argv.slice(2)
|
|
|
8
10
|
|
|
9
11
|
let cliBin
|
|
10
12
|
try {
|
|
11
|
-
const cliPkgDir = await moduleResolve('@sanity/cli/package.json', import.meta.url)
|
|
12
|
-
const cliDir = join(cliPkgDir
|
|
13
|
-
|
|
13
|
+
const cliPkgDir = fileURLToPath(await moduleResolve('@sanity/cli/package.json', import.meta.url))
|
|
14
|
+
const cliDir = join(cliPkgDir, '..')
|
|
15
|
+
|
|
16
|
+
// Read the package.json file and extract the bin path
|
|
17
|
+
const pJson = await readFile(cliPkgDir, 'utf8')
|
|
18
|
+
const pkgJson = JSON.parse(pJson)
|
|
19
|
+
const binPath = pkgJson.bin?.['sanity']
|
|
20
|
+
if (!binPath) {
|
|
21
|
+
throw new Error('Failed to resolve `@sanity/cli` package')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
cliBin = join(cliDir, binPath)
|
|
14
25
|
} catch (err) {
|
|
15
26
|
throw new Error('Failed to resolve `@sanity/cli` package', {cause: err})
|
|
16
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sanity",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "Initialize a new Sanity project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
"import-meta-resolve": "^4.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"publint": "^0.3.16"
|
|
34
|
+
"publint": "^0.3.16",
|
|
35
|
+
"vitest": "^4.0.17"
|
|
35
36
|
},
|
|
36
37
|
"engines": {
|
|
37
38
|
"node": ">=20"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"publint": "publint",
|
|
41
|
-
"test": "
|
|
42
|
+
"test": "vitest"
|
|
42
43
|
}
|
|
43
44
|
}
|