@@ -88,21 +88,11 @@ async function status ({ repoPath, migrations }) {
88
88
return `${ statusString } \nCurrent repo version: ${ version } \nLatest migration version: ${ lastMigrationVersion } `
89
89
}
90
90
91
- async function getAuthor ( ) {
92
- try {
93
- const name = ( await exec ( 'git config --get user.name' ) ) . stdout
94
- const email = ( await exec ( 'git config --get user.email' ) ) . stdout
95
- return `${ name . replace ( '\n' , '' ) } <${ email . replace ( '\n' , '' ) } >`
96
- } catch ( e ) {
97
- return ''
98
- }
99
- }
100
-
101
91
async function add ( { empty } ) {
102
92
const newMigrationVersion = migrator . getLatestMigrationVersion ( ) + 1
103
93
const newMigrationFolder = path . join ( __dirname , '..' , 'migrations' , 'migration-' + newMigrationVersion )
104
94
105
- const migrationsImport = migrations . map ( ( migration ) => migration . empty ? ` Object.assign({version: ${ migration . version } }, emptyMigration),` : ` require('./migration-${ migration . version } '),` )
95
+ const migrationsImport = migrations . map ( ( migration ) => migration . empty ? ` Object.assign({version: ${ parseInt ( migration . version ) } }, emptyMigration),` : ` require('./migration-${ parseInt ( migration . version ) } '),` )
106
96
if ( empty ) {
107
97
migrationsImport . push ( ` Object.assign({version: ${ newMigrationVersion } }, emptyMigration),` )
108
98
} else {
@@ -116,11 +106,6 @@ async function add ({ empty }) {
116
106
117
107
await mkdir ( newMigrationFolder )
118
108
119
- const packageJsonContent = templates . packageJson
120
- . replace ( / { { version} } / gi, newMigrationVersion )
121
- . replace ( / { { author} } / gi, await getAuthor ( ) )
122
- await writeFile ( path . join ( newMigrationFolder , 'package.json' ) , packageJsonContent )
123
-
124
109
const indexJsContent = templates . indexJs
125
110
. replace ( / { { version} } / gi, newMigrationVersion )
126
111
await writeFile ( path . join ( newMigrationFolder , 'index.js' ) , indexJsContent )
0 commit comments