From 468e76c8ccca91e848046fc24c3a3d99c4dd5f84 Mon Sep 17 00:00:00 2001 From: shur Date: Tue, 26 Mar 2024 12:28:16 -0400 Subject: [PATCH] feat: indicate in metadata that the quickstart option was used in project creation (#6065) * feat: indicate in metadata that the quickstart option was used in project creation * add quickstart template directory * feat: use quickstart template * Update packages/@sanity/cli/templates/quickstart/README.md Co-authored-by: Jon Eide Johnsen * Update packages/@sanity/cli/templates/quickstart/README.md Co-authored-by: Jon Eide Johnsen * update selectProjectTemplate comment --------- Co-authored-by: RostiMelk Co-authored-by: Jon Eide Johnsen --- .../@sanity/cli/src/actions/init-project/initProject.ts | 3 +-- .../cli/src/actions/init-project/templates/index.ts | 2 ++ .../cli/src/actions/init-project/templates/quickstart.ts | 5 +++++ packages/@sanity/cli/templates/quickstart/README.md | 9 +++++++++ .../cli/templates/quickstart/schemaTypes/index.js | 1 + .../@sanity/cli/templates/quickstart/static/.gitkeep | 1 + 6 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 packages/@sanity/cli/src/actions/init-project/templates/quickstart.ts create mode 100644 packages/@sanity/cli/templates/quickstart/README.md create mode 100644 packages/@sanity/cli/templates/quickstart/schemaTypes/index.js create mode 100644 packages/@sanity/cli/templates/quickstart/static/.gitkeep diff --git a/packages/@sanity/cli/src/actions/init-project/initProject.ts b/packages/@sanity/cli/src/actions/init-project/initProject.ts index 0b4c0bbf3d4..9f7cf7265ee 100644 --- a/packages/@sanity/cli/src/actions/init-project/initProject.ts +++ b/packages/@sanity/cli/src/actions/init-project/initProject.ts @@ -964,9 +964,8 @@ export default async function initSanity( function selectProjectTemplate() { // Make sure the --quickstart and --template are not used together - // Force template to clean if --quickstart is used if (flags.quickstart) { - return 'clean' + return 'quickstart' } const defaultTemplate = unattended || flags.template ? flags.template || 'clean' : null diff --git a/packages/@sanity/cli/src/actions/init-project/templates/index.ts b/packages/@sanity/cli/src/actions/init-project/templates/index.ts index d65954c8a58..00f90fae358 100644 --- a/packages/@sanity/cli/src/actions/init-project/templates/index.ts +++ b/packages/@sanity/cli/src/actions/init-project/templates/index.ts @@ -3,6 +3,7 @@ import blog from './blog' import clean from './clean' import getStartedTemplate from './getStarted' import moviedb from './moviedb' +import quickstart from './quickstart' import shopify from './shopify' import shopifyOnline from './shopifyOnline' @@ -13,6 +14,7 @@ const templates: Record = { moviedb, shopify, 'shopify-online-storefront': shopifyOnline, + quickstart, // empty project that dynamically imports its own schema } export default templates diff --git a/packages/@sanity/cli/src/actions/init-project/templates/quickstart.ts b/packages/@sanity/cli/src/actions/init-project/templates/quickstart.ts new file mode 100644 index 00000000000..02238d659e5 --- /dev/null +++ b/packages/@sanity/cli/src/actions/init-project/templates/quickstart.ts @@ -0,0 +1,5 @@ +import {type ProjectTemplate} from '../initProject' + +const quickStartTemplate: ProjectTemplate = {} + +export default quickStartTemplate diff --git a/packages/@sanity/cli/templates/quickstart/README.md b/packages/@sanity/cli/templates/quickstart/README.md new file mode 100644 index 00000000000..63986616a35 --- /dev/null +++ b/packages/@sanity/cli/templates/quickstart/README.md @@ -0,0 +1,9 @@ +# Sanity Studio + +Congratulations, you have now installed Sanity Studio, an open source real-time content editing environment connected to the Sanity Content Lake backend. + +Now you can do the following things: + +- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme) +- [Join the community Slack](https://slack.sanity.io/?utm_source=readme) +- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme) diff --git a/packages/@sanity/cli/templates/quickstart/schemaTypes/index.js b/packages/@sanity/cli/templates/quickstart/schemaTypes/index.js new file mode 100644 index 00000000000..ba4681d69ff --- /dev/null +++ b/packages/@sanity/cli/templates/quickstart/schemaTypes/index.js @@ -0,0 +1 @@ +export const schemaTypes = [] diff --git a/packages/@sanity/cli/templates/quickstart/static/.gitkeep b/packages/@sanity/cli/templates/quickstart/static/.gitkeep new file mode 100644 index 00000000000..37178a72a54 --- /dev/null +++ b/packages/@sanity/cli/templates/quickstart/static/.gitkeep @@ -0,0 +1 @@ +Files placed here will be served by the Sanity server under the `/static`-prefix