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