File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const { join } = require('path')
44const paths = require ( './paths' )
55const { promisify } = require ( 'util' )
66const throwError = require ( './throwError' )
7+ const semver = require ( 'semver' )
78
89
910const access = promisify ( fs . access )
@@ -21,7 +22,11 @@ module.exports = async (repository, version) => {
2122 }
2223
2324 const gitT = git ( templatePath )
24- const tags = await gitT . tags ( )
25+ let tags = await gitT . tags ( )
26+ tags = tags . all
27+ . filter ( semver . valid )
28+ . sort ( semver . compare )
29+ . reverse ( )
2530
2631 const branchSummary = await gitT . branch ( )
2732 const currentBranch = branchSummary . current
@@ -38,8 +43,9 @@ module.exports = async (repository, version) => {
3843 }
3944
4045 gitT . checkout ( version )
41- } else if ( tags . latest ) {
42- await gitT . checkout ( tags . latest )
46+ } else if ( tags . length ) {
47+ console . log ( tags )
48+ await gitT . checkout ( tags [ 0 ] )
4349 }
4450
4551 return { templatePath, currentBranch }
You can’t perform that action at this time.
0 commit comments