File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
packages/gatsby-plugin-theme-ui Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,25 @@ exports.onPreInit = (__, options) => {
4
4
options . themeModulePath = require ( themeModulePath )
5
5
}
6
6
if ( prismPreset ) {
7
- options . prismPreset = require ( `@theme-ui/prism/presets/${ prismPreset } .json` )
7
+ try {
8
+ options . prismPreset = require ( `@theme-ui/prism/presets/${ prismPreset } .json` )
9
+ } catch {
10
+ reporter . error ( `It appears the prism dependency is not installed. Try running \`${ generateInstallInstructions ( ) } @theme-ui/prism\`` )
11
+ }
8
12
}
9
13
}
10
14
15
+ function generateInstallInstructions ( ) {
16
+ const { getConfigStore } = require ( `gatsby-core-utils` )
17
+
18
+ const packageMangerConfigKey = `cli.packageManager`
19
+ const PACKAGE_MANGER = getConfigStore ( ) . get ( packageMangerConfigKey ) || `yarn`
20
+
21
+ const installKeyWord = PACKAGE_MANGER === `yarn` ? "add" : "install"
22
+
23
+ return `${ PACKAGE_MANGER } ${ installKeyWord } `
24
+ }
25
+
11
26
exports . createSchemaCustomization = ( { actions } ) => {
12
27
const { createTypes } = actions
13
28
Original file line number Diff line number Diff line change 7
7
"peerDependencies" : {
8
8
"gatsby" : " ^2.13.1" ,
9
9
"theme-ui" : " ^0.3.0" ,
10
- "@theme-ui/prism" : " 0.3.0"
10
+ "@theme-ui/prism" : " 0.3.0" ,
11
+ "gatsby-core-utils" : " ^1.2.0"
11
12
},
12
13
"keywords" : [
13
14
" gatsby" ,
You can’t perform that action at this time.
0 commit comments