Skip to content

Commit

Permalink
feat(cli): allow templates to flag themselves as typescript-only
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Feb 8, 2023
1 parent c11e7c9 commit 4bccf2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@sanity/cli/src/actions/init-project/initProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface ProjectTemplate {
devDependencies?: Record<string, string>
importPrompt?: string
configTemplate?: string | ((variables: GenerateConfigOptions['variables']) => string)
typescriptOnly?: boolean
}

export interface ProjectOrganization {
Expand Down Expand Up @@ -186,10 +187,11 @@ export default async function initSanity(
}

// Use typescript?
const typescriptOnly = template.typescriptOnly === true
let useTypeScript = true
if (typeof cliFlags.typescript === 'boolean') {
if (!typescriptOnly && typeof cliFlags.typescript === 'boolean') {
useTypeScript = cliFlags.typescript
} else if (!unattended) {
} else if (!typescriptOnly && !unattended) {
useTypeScript = await promptForTypeScript(prompt)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default defineConfig({

const shopifyTemplate: ProjectTemplate = {
configTemplate,
typescriptOnly: true,
dependencies: {
'@sanity/icons': '^2.2.2',
'@sanity/ui': '^1.2.2',
Expand Down

1 comment on commit 4bccf2f

@vercel
Copy link

@vercel vercel bot commented on 4bccf2f Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio-git-next.sanity.build
test-studio.sanity.build

Please sign in to comment.