create-sanity 6.0.0-alpha.2 → 6.0.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.
Files changed (2) hide show
  1. package/index.js +15 -6
  2. package/package.json +12 -12
package/index.js CHANGED
@@ -1,16 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  import {spawn} from 'node:child_process'
3
- import {join} from 'node:path'
4
-
5
- import {moduleResolve} from 'import-meta-resolve'
3
+ import {readFile} from 'node:fs/promises'
4
+ import {dirname, resolve} from 'node:path'
5
+ import {fileURLToPath} from 'node:url'
6
6
 
7
7
  const args = process.argv.slice(2)
8
8
 
9
9
  let cliBin
10
10
  try {
11
- const cliPkgDir = await moduleResolve('@sanity/cli/package.json', import.meta.url)
12
- const cliDir = join(cliPkgDir.pathname, '..')
13
- cliBin = join(cliDir, 'bin', 'run.js')
11
+ const cliPkgDir = fileURLToPath(import.meta.resolve('@sanity/cli/package.json'))
12
+ const cliDir = dirname(cliPkgDir)
13
+
14
+ // Read the package.json file and extract the bin path
15
+ const pJson = await readFile(cliPkgDir, 'utf8')
16
+ const pkgJson = JSON.parse(pJson)
17
+ const binPath = pkgJson.bin?.['sanity']
18
+ if (!binPath) {
19
+ throw new Error('Failed to resolve `@sanity/cli` package')
20
+ }
21
+
22
+ cliBin = resolve(cliDir, binPath)
14
23
  } catch (err) {
15
24
  throw new Error('Failed to resolve `@sanity/cli` package', {cause: err})
16
25
  }
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
1
  {
2
2
  "name": "create-sanity",
3
- "version": "6.0.0-alpha.2",
3
+ "version": "6.0.1",
4
4
  "description": "Initialize a new Sanity project",
5
5
  "keywords": [
6
- "sanity",
7
6
  "cms",
7
+ "content",
8
+ "create-sanity",
8
9
  "headless",
9
10
  "realtime",
10
- "content",
11
- "create-sanity"
11
+ "sanity"
12
12
  ],
13
13
  "homepage": "https://www.sanity.io/",
14
14
  "bugs": {
15
15
  "url": "https://github.com/sanity-io/cli/issues"
16
16
  },
17
+ "license": "MIT",
18
+ "author": "Sanity.io <hello@sanity.io>",
17
19
  "repository": {
18
20
  "type": "git",
19
21
  "url": "git+https://github.com/sanity-io/cli.git",
20
22
  "directory": "packages/create-sanity"
21
23
  },
22
- "license": "MIT",
23
- "author": "Sanity.io <hello@sanity.io>",
24
- "type": "module",
25
24
  "bin": "./index.js",
26
25
  "files": [
27
26
  "index.js"
28
27
  ],
28
+ "type": "module",
29
29
  "dependencies": {
30
- "import-meta-resolve": "^4.1.0",
31
- "@sanity/cli": "6.0.0-alpha.6"
30
+ "@sanity/cli": "7.0.1"
32
31
  },
33
32
  "devDependencies": {
34
- "publint": "^0.3.16"
33
+ "publint": "^0.3.21",
34
+ "vitest": "^4.1.8"
35
35
  },
36
36
  "engines": {
37
- "node": ">=20"
37
+ "node": ">=20.19.1 <22 || >=22.12"
38
38
  },
39
39
  "scripts": {
40
40
  "publint": "publint",
41
- "test": "node test.js"
41
+ "test": "vitest"
42
42
  }
43
43
  }