@@ -4,6 +4,7 @@ import styles from "./questions/styles.json"
44import features from "./questions/features.json"
55import languages from "./questions/languages.json"
66import { initStarter , getPackageManager , gitSetup } from "./init-starter"
7+ import { writeFiles , IFile } from "./write-files"
78import { installPlugins } from "./install-plugins"
89import colors from "ansi-colors"
910import path from "path"
@@ -27,7 +28,6 @@ export const DEFAULT_STARTERS: Record<keyof typeof languages, string> = {
2728 js : `https://github.com/gatsbyjs/gatsby-starter-minimal.git` ,
2829 ts : `https://github.com/gatsbyjs/gatsby-starter-minimal-ts.git` ,
2930}
30-
3131interface IAnswers {
3232 name : string
3333 project : string
@@ -58,6 +58,14 @@ interface IPluginEntry {
5858 * Keys must match plugin names or name:key combinations from the plugins array
5959 */
6060 options ?: PluginConfigMap
61+ /**
62+ * If the item is not a valid Gatsby plugin, set this to `false`
63+ */
64+ isGatsbyPlugin ?: boolean
65+ /**
66+ * Additional files that should be written to the filesystem
67+ */
68+ files ?: Array < IFile >
6169}
6270
6371export type PluginMap = Record < string , IPluginEntry >
@@ -203,8 +211,12 @@ ${center(colors.blueBright.bold.underline(`Welcome to Gatsby!`))}
203211 ) } for styling your site`
204212 )
205213 const extraPlugins = styles [ answers . styling ] . plugins || [ ]
206-
207- plugins . push ( answers . styling , ...extraPlugins )
214+ // If the key is not a valid Gatsby plugin, don't add it to the plugins array
215+ if ( styles [ answers . styling ] ?. isGatsbyPlugin === false ) {
216+ plugins . push ( ...extraPlugins )
217+ } else {
218+ plugins . push ( answers . styling , ...extraPlugins )
219+ }
208220 packages . push (
209221 answers . styling ,
210222 ...( styles [ answers . styling ] . dependencies || [ ] ) ,
@@ -305,6 +317,12 @@ ${colors.bold(`Thanks! Here's what we'll now do:`)}
305317 reporter . info ( `${ maybeUseEmoji ( `🔌 ` ) } Setting-up plugins...` )
306318 await installPlugins ( plugins , pluginConfig , fullPath , [ ] )
307319 }
320+
321+ if ( answers . styling && styles [ answers . styling ] ?. files ) {
322+ reporter . info ( `${ maybeUseEmoji ( `🎨 ` ) } Adding necessary styling files...` )
323+ await writeFiles ( answers . project , styles [ answers . styling ] . files )
324+ }
325+
308326 await setSiteMetadata ( fullPath , `title` , siteName )
309327
310328 await gitSetup ( answers . project )
0 commit comments