File tree Expand file tree Collapse file tree 4 files changed +13
-0
lines changed Expand file tree Collapse file tree 4 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 11const semver = require ( 'semver' )
2+ const throwError = require ( './utils/throw-error' )
23
34
45module . exports = {
@@ -10,5 +11,13 @@ module.exports = {
1011 'Semantic Versioning: https://semver.org' ,
1112 ] . join ( '\n' ) )
1213 }
14+ } ,
15+ engine : config => {
16+ if ( ! semver . satisfies ( config . mili . version , config . template . engines ) ) {
17+ throwError ( [
18+ `The mili version template need is ${ config . template . engines } ` ,
19+ `But mili version used is ${ config . mili . version } `
20+ ] . join ( '\n' ) )
21+ }
1322 }
1423}
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ module.exports = async (options = {}) => {
4545 templateVersion : version ,
4646 } )
4747
48+ checkParams . engine ( config )
49+
4850 if ( config . template . status !== 'loaded' ) {
4951 throwError ( [
5052 'The template configuration file could not be loaded' ,
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ module.exports = async (options) => {
8383 config = await config . reload ( {
8484 templateVersion : version ,
8585 } )
86+ checkParams . engine ( config )
8687
8788 await prompt ( config )
8889 config . template . files = config . template . files . filter ( file => file . upgrade !== 'keep' )
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ module.exports = async (options = {}) => {
3232 config = await config . reload ( {
3333 templateVersion : version ,
3434 } )
35+ checkParams . engine ( config )
3536
3637 await prompt ( config )
3738 config . template . files = config . template . files . filter ( file => file . upgrade !== 'keep' )
You can’t perform that action at this time.
0 commit comments