@sanity/cli 3.58.0 → 3.59.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/lib/cli.js CHANGED
@@ -5,7 +5,6 @@ require("node:os");
5
5
  require("node:path");
6
6
  require("chalk");
7
7
  require("./_chunks-cjs/loadEnv.js");
8
- require("node-machine-id");
9
8
  var cli = require("./_chunks-cjs/cli.js");
10
9
  require("./_chunks-cjs/getCliConfig.js");
11
10
  exports.runCli = cli.runCli;
package/lib/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"cli.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
package/lib/index.d.mts CHANGED
@@ -431,7 +431,6 @@ export declare type SinglePrompt =
431
431
  })
432
432
 
433
433
  export declare interface TelemetryUserProperties {
434
- deviceId: string
435
434
  runtime: string
436
435
  runtimeVersion: string
437
436
  cliVersion: string
package/lib/index.d.ts CHANGED
@@ -431,7 +431,6 @@ export declare type SinglePrompt =
431
431
  })
432
432
 
433
433
  export declare interface TelemetryUserProperties {
434
- deviceId: string
435
434
  runtime: string
436
435
  runtimeVersion: string
437
436
  cliVersion: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "3.58.0",
3
+ "version": "3.59.0",
4
4
  "description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
5
5
  "keywords": [
6
6
  "sanity",
@@ -57,10 +57,10 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@babel/traverse": "^7.23.5",
60
- "@sanity/client": "^6.21.3",
61
- "@sanity/codegen": "3.58.0",
60
+ "@sanity/client": "^6.22.0",
61
+ "@sanity/codegen": "3.59.0",
62
62
  "@sanity/telemetry": "^0.7.7",
63
- "@sanity/util": "3.58.0",
63
+ "@sanity/util": "3.59.0",
64
64
  "chalk": "^4.1.2",
65
65
  "debug": "^4.3.4",
66
66
  "decompress": "^4.2.0",
@@ -68,7 +68,6 @@
68
68
  "esbuild-register": "^3.5.0",
69
69
  "get-it": "^8.6.5",
70
70
  "groq-js": "^1.13.0",
71
- "node-machine-id": "^1.1.12",
72
71
  "pkg-dir": "^5.0.0",
73
72
  "prettier": "^3.3.0",
74
73
  "semver": "^7.3.5",
@@ -77,12 +76,13 @@
77
76
  },
78
77
  "devDependencies": {
79
78
  "@jest/globals": "^29.7.0",
80
- "@repo/package.config": "3.58.0",
79
+ "@repo/package.config": "3.59.0",
80
+ "@repo/test-config": "3.59.0",
81
81
  "@rexxars/gitconfiglocal": "^3.0.1",
82
82
  "@rollup/plugin-node-resolve": "^15.2.3",
83
83
  "@sanity/eslint-config-studio": "^4.0.0",
84
84
  "@sanity/generate-help-url": "^3.0.0",
85
- "@sanity/types": "3.58.0",
85
+ "@sanity/types": "3.59.0",
86
86
  "@types/babel__traverse": "^7.20.5",
87
87
  "@types/configstore": "^5.0.1",
88
88
  "@types/cpx": "^1.5.2",
@@ -135,5 +135,5 @@
135
135
  "engines": {
136
136
  "node": ">=18"
137
137
  },
138
- "gitHead": "63e101bd68bfcb4e04be616c99da64e99cb11354"
138
+ "gitHead": "30c046b2eb514875bfe900f56ea564b385eaca1d"
139
139
  }
@@ -594,26 +594,31 @@ export default async function initSanity(
594
594
 
595
595
  trace.log({step: 'importTemplateDataset', selectedOption: shouldImport ? 'yes' : 'no'})
596
596
 
597
- // Bootstrap Sanity, creating required project files, manifests etc
598
- await bootstrapTemplate(templateOptions, context)
599
-
600
- // update that files were initialized locally; do not halt flow for request
601
- apiClient({api: {projectId: projectId}})
602
- .request<SanityProject>({uri: `/projects/${projectId}`})
603
- .then((project: SanityProject) => {
604
- if (!project?.metadata?.cliInitializedAt) {
605
- return apiClient({api: {projectId}}).request({
606
- method: 'PATCH',
607
- uri: `/projects/${projectId}`,
608
- body: {metadata: {cliInitializedAt: new Date().toISOString()}},
609
- })
610
- }
611
- return Promise.resolve()
612
- })
613
- .catch(() => {
614
- // Non-critical update
615
- debug('Failed to update cliInitializedAt metadata')
616
- })
597
+ const [_, bootstrapPromise] = await Promise.allSettled([
598
+ // record template files attempted to be created locally
599
+ apiClient({api: {projectId: projectId}})
600
+ .request<SanityProject>({uri: `/projects/${projectId}`})
601
+ .then((project: SanityProject) => {
602
+ if (!project?.metadata?.cliInitializedAt) {
603
+ return apiClient({api: {projectId}}).request({
604
+ method: 'PATCH',
605
+ uri: `/projects/${projectId}`,
606
+ body: {metadata: {cliInitializedAt: new Date().toISOString()}},
607
+ })
608
+ }
609
+ return Promise.resolve()
610
+ })
611
+ .catch(() => {
612
+ // Non-critical update
613
+ debug('Failed to update cliInitializedAt metadata')
614
+ }),
615
+ // Bootstrap Sanity, creating required project files, manifests etc
616
+ bootstrapTemplate(templateOptions, context),
617
+ ])
618
+
619
+ if (bootstrapPromise.status === 'rejected' && bootstrapPromise.reason instanceof Error) {
620
+ throw bootstrapPromise.reason
621
+ }
617
622
 
618
623
  let pkgManager: PackageManager
619
624
 
package/src/cli.ts CHANGED
@@ -5,7 +5,6 @@ import path from 'node:path'
5
5
 
6
6
  import chalk from 'chalk'
7
7
  import dotenv from 'dotenv'
8
- import {machineId} from 'node-machine-id'
9
8
  import resolveFrom from 'resolve-from'
10
9
 
11
10
  import {CliCommand} from './__telemetry__/cli.telemetry'
@@ -85,7 +84,6 @@ export async function runCli(cliRoot: string, {cliVersion}: {cliVersion: string}
85
84
  )
86
85
 
87
86
  telemetry.updateUserProperties({
88
- deviceId: await machineId(),
89
87
  runtimeVersion: process.version,
90
88
  runtime: detectRuntime(),
91
89
  cliVersion: pkg.version,
@@ -37,9 +37,9 @@ const listProjectsCommand: CliCommandDefinition = {
37
37
 
38
38
  const projects = await client.projects.list()
39
39
  const ordered = sortBy(
40
- projects.map(({displayName, id, members = [], studioHost = '', createdAt}) => {
41
- const studio = studioHost ? `https://${studioHost}.sanity.studio` : 'Not deployed'
42
- return [id, members.length, displayName, studio, createdAt].map(String)
40
+ projects.map(({displayName, id, members = [], createdAt}) => {
41
+ const manage = `https://www.sanity.io/manage/project/${id}`
42
+ return [id, members.length, displayName, manage, createdAt].map(String)
43
43
  }),
44
44
  [headings.indexOf(flags.sort)],
45
45
  )
package/src/types.ts CHANGED
@@ -94,7 +94,6 @@ export interface CliBaseCommandContext {
94
94
  }
95
95
 
96
96
  export interface TelemetryUserProperties {
97
- deviceId: string
98
97
  runtime: string
99
98
  runtimeVersion: string
100
99
  cliVersion: string