@sanity/cli 3.78.1-mcp.17 → 3.78.2-mcp.9
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/_chunks-cjs/cli.js +9 -15
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/_chunks-cjs/loadEnv.js +5 -5
- package/lib/_chunks-cjs/loadEnv.js.map +1 -1
- package/lib/index.d.mts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.esm.js +5 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.mjs +5 -5
- package/lib/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/actions/init-project/templates/coreApp.ts +3 -4
- package/src/cli.ts +4 -14
- package/src/types.ts +0 -1
- package/src/util/resolveRootDir.ts +5 -5
- package/templates/core-app/src/App.css +18 -0
- package/templates/core-app/src/App.tsx +8 -12
- package/templates/core-app/src/ExampleComponent.css +26 -0
- package/templates/core-app/src/ExampleComponent.tsx +15 -4
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sanity/cli",
|
3
|
-
"version": "3.78.
|
3
|
+
"version": "3.78.2-mcp.9+516992b0ed",
|
4
4
|
"description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
|
5
5
|
"keywords": [
|
6
6
|
"sanity",
|
@@ -58,11 +58,11 @@
|
|
58
58
|
"dependencies": {
|
59
59
|
"@babel/traverse": "^7.23.5",
|
60
60
|
"@sanity/client": "^6.28.2",
|
61
|
-
"@sanity/codegen": "3.78.
|
61
|
+
"@sanity/codegen": "3.78.2-mcp.9+516992b0ed",
|
62
62
|
"@sanity/runtime-cli": "^1.1.1",
|
63
63
|
"@sanity/telemetry": "^0.7.7",
|
64
64
|
"@sanity/template-validator": "^2.4.0",
|
65
|
-
"@sanity/util": "3.78.
|
65
|
+
"@sanity/util": "3.78.2-mcp.9+516992b0ed",
|
66
66
|
"chalk": "^4.1.2",
|
67
67
|
"debug": "^4.3.4",
|
68
68
|
"decompress": "^4.2.0",
|
@@ -76,13 +76,13 @@
|
|
76
76
|
"validate-npm-package-name": "^3.0.0"
|
77
77
|
},
|
78
78
|
"devDependencies": {
|
79
|
-
"@repo/package.config": "3.78.
|
80
|
-
"@repo/test-config": "3.78.
|
79
|
+
"@repo/package.config": "3.78.1",
|
80
|
+
"@repo/test-config": "3.78.1",
|
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.78.
|
85
|
+
"@sanity/types": "3.78.2-mcp.9+516992b0ed",
|
86
86
|
"@types/babel__traverse": "^7.20.5",
|
87
87
|
"@types/configstore": "^5.0.1",
|
88
88
|
"@types/cpx": "^1.5.2",
|
@@ -134,5 +134,5 @@
|
|
134
134
|
"engines": {
|
135
135
|
"node": ">=18"
|
136
136
|
},
|
137
|
-
"gitHead": "
|
137
|
+
"gitHead": "516992b0edc9f3fbab9770ec7374d691da11e842"
|
138
138
|
}
|
@@ -21,10 +21,9 @@ const coreAppTemplate: ProjectTemplate = {
|
|
21
21
|
},
|
22
22
|
appLocation: './src/App.tsx',
|
23
23
|
scripts: {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
start: 'sanity app start',
|
24
|
+
dev: 'sanity dev',
|
25
|
+
build: 'sanity build',
|
26
|
+
start: 'sanity start',
|
28
27
|
},
|
29
28
|
}
|
30
29
|
|
package/src/cli.ts
CHANGED
@@ -47,17 +47,16 @@ export async function runCli(cliRoot: string, {cliVersion}: {cliVersion: string}
|
|
47
47
|
|
48
48
|
const args = parseArguments()
|
49
49
|
const isInit = args.groupOrCommand === 'init' && args.argsWithoutOptions[0] !== 'plugin'
|
50
|
-
const isCoreApp = args.groupOrCommand === 'app'
|
51
50
|
const cwd = getCurrentWorkingDirectory()
|
52
51
|
let workDir: string | undefined
|
53
52
|
try {
|
54
|
-
workDir = isInit ? process.cwd() : resolveRootDir(cwd
|
53
|
+
workDir = isInit ? process.cwd() : resolveRootDir(cwd)
|
55
54
|
} catch (err) {
|
56
55
|
console.error(chalk.red(err.message))
|
57
56
|
process.exit(1)
|
58
57
|
}
|
59
58
|
|
60
|
-
loadAndSetEnvFromDotEnvFiles({workDir, cmd: args.groupOrCommand
|
59
|
+
loadAndSetEnvFromDotEnvFiles({workDir, cmd: args.groupOrCommand})
|
61
60
|
maybeFixMissingWindowsEnvVar()
|
62
61
|
|
63
62
|
// Check if there are updates available for the CLI, and notify if there is
|
@@ -100,7 +99,6 @@ export async function runCli(cliRoot: string, {cliVersion}: {cliVersion: string}
|
|
100
99
|
corePath: await getCoreModulePath(workDir, cliConfig),
|
101
100
|
cliConfig,
|
102
101
|
telemetry,
|
103
|
-
isCoreApp,
|
104
102
|
}
|
105
103
|
|
106
104
|
warnOnNonProductionEnvironment()
|
@@ -276,15 +274,7 @@ function warnOnNonProductionEnvironment(): void {
|
|
276
274
|
)
|
277
275
|
}
|
278
276
|
|
279
|
-
function loadAndSetEnvFromDotEnvFiles({
|
280
|
-
workDir,
|
281
|
-
cmd,
|
282
|
-
isCoreApp,
|
283
|
-
}: {
|
284
|
-
workDir: string
|
285
|
-
cmd: string
|
286
|
-
isCoreApp: boolean
|
287
|
-
}) {
|
277
|
+
function loadAndSetEnvFromDotEnvFiles({workDir, cmd}: {workDir: string; cmd: string}) {
|
288
278
|
/* eslint-disable no-process-env */
|
289
279
|
|
290
280
|
// Do a cheap lookup for a sanity.json file. If there is one, assume it is a v2 project,
|
@@ -319,7 +309,7 @@ function loadAndSetEnvFromDotEnvFiles({
|
|
319
309
|
|
320
310
|
debug('Loading environment files using %s mode', mode)
|
321
311
|
|
322
|
-
const studioEnv = loadEnv(mode, workDir,
|
312
|
+
const studioEnv = loadEnv(mode, workDir, ['SANITY_STUDIO_'])
|
323
313
|
process.env = {...process.env, ...studioEnv}
|
324
314
|
/* eslint-disable no-process-env */
|
325
315
|
}
|
package/src/types.ts
CHANGED
@@ -7,9 +7,9 @@ import {debug} from '../debug'
|
|
7
7
|
/**
|
8
8
|
* Resolve project root directory, falling back to cwd if it cannot be found
|
9
9
|
*/
|
10
|
-
export function resolveRootDir(cwd: string
|
10
|
+
export function resolveRootDir(cwd: string): string {
|
11
11
|
try {
|
12
|
-
return resolveProjectRoot(cwd
|
12
|
+
return resolveProjectRoot(cwd) || cwd
|
13
13
|
} catch (err) {
|
14
14
|
throw new Error(`Error occurred trying to resolve project root:\n${err.message}`)
|
15
15
|
}
|
@@ -25,8 +25,8 @@ function hasSanityConfig(basePath: string, configName: string): boolean {
|
|
25
25
|
return buildConfigs.some(Boolean)
|
26
26
|
}
|
27
27
|
|
28
|
-
function resolveProjectRoot(basePath: string, iterations = 0
|
29
|
-
const configName =
|
28
|
+
function resolveProjectRoot(basePath: string, iterations = 0): string | false {
|
29
|
+
const configName = 'sanity.config'
|
30
30
|
if (hasSanityConfig(basePath, configName)) {
|
31
31
|
return basePath
|
32
32
|
}
|
@@ -37,7 +37,7 @@ function resolveProjectRoot(basePath: string, iterations = 0, isCoreApp = false)
|
|
37
37
|
return false
|
38
38
|
}
|
39
39
|
|
40
|
-
return resolveProjectRoot(parentDir, iterations + 1
|
40
|
+
return resolveProjectRoot(parentDir, iterations + 1)
|
41
41
|
}
|
42
42
|
|
43
43
|
function isSanityV2StudioRoot(basePath: string): boolean {
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/* Container styling for the app */
|
2
|
+
.app-container {
|
3
|
+
max-width: 1200px;
|
4
|
+
margin: 0 auto;
|
5
|
+
padding: 2rem;
|
6
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
7
|
+
}
|
8
|
+
|
9
|
+
/* Basic reset */
|
10
|
+
* {
|
11
|
+
box-sizing: border-box;
|
12
|
+
}
|
13
|
+
|
14
|
+
body {
|
15
|
+
margin: 0;
|
16
|
+
padding: 0;
|
17
|
+
background-color: #f9f9f9;
|
18
|
+
}
|
@@ -1,27 +1,23 @@
|
|
1
1
|
import {type SanityConfig} from '@sanity/sdk'
|
2
2
|
import {SanityApp} from '@sanity/sdk-react/components'
|
3
3
|
import {ExampleComponent} from './ExampleComponent'
|
4
|
+
import './App.css'
|
4
5
|
|
5
6
|
export function App() {
|
6
|
-
|
7
7
|
const sanityConfig: SanityConfig = {
|
8
8
|
auth: {
|
9
9
|
authScope: 'global'
|
10
10
|
}
|
11
|
-
/*
|
12
|
-
* Apps can access several different projects!
|
13
|
-
* Add the below configuration if you want to connect to a specific project.
|
14
|
-
*/
|
15
|
-
// projectId: 'my-project-id',
|
16
|
-
// dataset: 'my-dataset',
|
17
11
|
}
|
18
12
|
|
19
13
|
return (
|
20
|
-
<
|
21
|
-
{
|
22
|
-
|
23
|
-
|
14
|
+
<div className="app-container">
|
15
|
+
<SanityApp sanityConfig={sanityConfig}>
|
16
|
+
{/* add your own components here! */}
|
17
|
+
<ExampleComponent />
|
18
|
+
</SanityApp>
|
19
|
+
</div>
|
24
20
|
)
|
25
21
|
}
|
26
22
|
|
27
|
-
export default App
|
23
|
+
export default App
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.example-container {
|
2
|
+
background-color: white;
|
3
|
+
border-radius: 8px;
|
4
|
+
padding: 2rem;
|
5
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
6
|
+
}
|
7
|
+
|
8
|
+
.example-heading {
|
9
|
+
color: #333;
|
10
|
+
margin-top: 0;
|
11
|
+
font-size: 1.8rem;
|
12
|
+
}
|
13
|
+
|
14
|
+
.example-text {
|
15
|
+
color: #666;
|
16
|
+
line-height: 1.6;
|
17
|
+
}
|
18
|
+
|
19
|
+
.code-hint {
|
20
|
+
background-color: #f5f5f5;
|
21
|
+
padding: 1rem;
|
22
|
+
border-radius: 4px;
|
23
|
+
font-family: monospace;
|
24
|
+
margin-top: 1.5rem;
|
25
|
+
border-left: 3px solid #e0e0e0;
|
26
|
+
}
|
@@ -1,11 +1,22 @@
|
|
1
|
+
import './ExampleComponent.css'
|
2
|
+
|
1
3
|
export function ExampleComponent() {
|
2
4
|
return (
|
3
|
-
<div>
|
4
|
-
<h1>Welcome to
|
5
|
-
<p>
|
5
|
+
<div className="example-container">
|
6
|
+
<h1 className="example-heading">Welcome to your Sanity App!</h1>
|
7
|
+
<p className="example-text">
|
6
8
|
This is an example component. You can replace this with your own content
|
7
9
|
by creating a new component and importing it in App.tsx.
|
8
10
|
</p>
|
11
|
+
<div className="code-hint">
|
12
|
+
<p>Quick tip: Create new components in separate files and import them like this in App.tsx / App.jsx:</p>
|
13
|
+
<pre>{`import {YourComponent} from './YourComponent'
|
14
|
+
|
15
|
+
// Then use it in your JSX
|
16
|
+
<SanityApp sanityConfig={sanityConfig}>
|
17
|
+
<YourComponent />
|
18
|
+
</SanityApp>`}</pre>
|
19
|
+
</div>
|
9
20
|
</div>
|
10
21
|
)
|
11
|
-
}
|
22
|
+
}
|