@@ -4,6 +4,7 @@ import styles from "./questions/styles.json"
4
4
import features from "./questions/features.json"
5
5
import languages from "./questions/languages.json"
6
6
import { initStarter , getPackageManager , gitSetup } from "./init-starter"
7
+ import { writeFiles , IFile } from "./write-files"
7
8
import { installPlugins } from "./install-plugins"
8
9
import colors from "ansi-colors"
9
10
import path from "path"
@@ -27,7 +28,6 @@ export const DEFAULT_STARTERS: Record<keyof typeof languages, string> = {
27
28
js : `https://github.com/gatsbyjs/gatsby-starter-minimal.git` ,
28
29
ts : `https://github.com/gatsbyjs/gatsby-starter-minimal-ts.git` ,
29
30
}
30
-
31
31
interface IAnswers {
32
32
name : string
33
33
project : string
@@ -58,6 +58,14 @@ interface IPluginEntry {
58
58
* Keys must match plugin names or name:key combinations from the plugins array
59
59
*/
60
60
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 >
61
69
}
62
70
63
71
export type PluginMap = Record < string , IPluginEntry >
@@ -203,8 +211,12 @@ ${center(colors.blueBright.bold.underline(`Welcome to Gatsby!`))}
203
211
) } for styling your site`
204
212
)
205
213
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
+ }
208
220
packages . push (
209
221
answers . styling ,
210
222
...( styles [ answers . styling ] . dependencies || [ ] ) ,
@@ -305,6 +317,12 @@ ${colors.bold(`Thanks! Here's what we'll now do:`)}
305
317
reporter . info ( `${ maybeUseEmoji ( `🔌 ` ) } Setting-up plugins...` )
306
318
await installPlugins ( plugins , pluginConfig , fullPath , [ ] )
307
319
}
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
+
308
326
await setSiteMetadata ( fullPath , `title` , siteName )
309
327
310
328
await gitSetup ( answers . project )
0 commit comments