-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): add non-studio app template and non-studio dev options
- Loading branch information
1 parent
53b8009
commit 56cee8b
Showing
13 changed files
with
210 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/@sanity/cli/src/actions/init-project/determineStudioTemplate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const nonStudioTemplates = ['core-app'] | ||
|
||
/** | ||
* Determine if a given template is a studio template. | ||
* This function may need to be more robust once we | ||
* introduce remote templates, for example. | ||
* | ||
* @param templateName - Name of the template | ||
* @returns boolean indicating if the template is a studio template | ||
*/ | ||
export function determineStudioTemplate(templateName: string): boolean { | ||
return !nonStudioTemplates.includes(templateName) | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/@sanity/cli/src/actions/init-project/templates/coreApp.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {type ProjectTemplate} from '../initProject' | ||
|
||
const coreAppTemplate: ProjectTemplate = { | ||
dependencies: { | ||
'@sanity/sdk': '^0.0.0-alpha', | ||
'@sanity/sdk-react': '^0.0.0-alpha', | ||
}, | ||
devDependencies: { | ||
'vite': '^6', | ||
'@vitejs/plugin-react': '^4.3.4', | ||
}, | ||
} | ||
|
||
export default coreAppTemplate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {SanityApp} from '@sanity/sdk-react/components' | ||
|
||
export function App() { | ||
|
||
const sanityConfig = { | ||
/* | ||
* CORE apps can access several different projects! | ||
* Add the below configuration if you want to connect to a specific project. | ||
*/ | ||
// projectId: 'my-project-id', | ||
// dataset: 'my-dataset', | ||
auth: { | ||
authScope: 'org' | ||
} | ||
} | ||
return ( | ||
<SanityApp sanityConfig={sanityConfig}> | ||
Hello world! | ||
</SanityApp> | ||
) | ||
} | ||
|
||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import App from './App.tsx' | ||
|
||
createRoot(document.getElementById('root')!).render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.