File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,9 +162,13 @@ var initInquirer = require('../lib/initialize');
162162if ( argv . init ) {
163163 initInquirer ( argv . _ ) ;
164164} else if ( argv . migrate ) {
165- const dummyConfigLoc = require . resolve ( path . join ( process . cwd ( ) , 'example/webpack.config.js' ) ) ;
166- const outputConfigLoc = path . join ( process . cwd ( ) , 'example/neo-webpack.config.js' ) ;
167- require ( '../lib/migrate.js' ) ( dummyConfigLoc , outputConfigLoc ) ;
165+ const filePaths = argv . _ ;
166+ if ( ! filePaths . length ) {
167+ throw new Error ( 'Please specify a path to your webpack config' ) ;
168+ }
169+ const inputConfigPath = path . resolve ( process . cwd ( ) , filePaths [ 0 ] ) ;
170+
171+ require ( '../lib/migrate.js' ) ( inputConfigPath , inputConfigPath ) ;
168172} else {
169173 processOptions ( yargs , argv ) ;
170174}
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ const chalk = require('chalk');
44const transform = require ( './transformations' ) . transform ;
55const inquirer = require ( 'inquirer' ) ;
66
7- module . exports = ( currentConfigLoc , outputConfigLoc ) => {
8- let currentConfig = fs . readFileSync ( currentConfigLoc , 'utf8' ) ;
7+ module . exports = ( currentConfigPath , outputConfigPath ) => {
8+ let currentConfig = fs . readFileSync ( currentConfigPath , 'utf8' ) ;
99 const outputConfig = transform ( currentConfig ) ;
1010 const diffOutput = diff . diffLines ( currentConfig , outputConfig ) ;
1111 diffOutput . map ( diffLine => {
@@ -27,8 +27,8 @@ module.exports = (currentConfigLoc, outputConfigLoc) => {
2727 . then ( answers => {
2828 if ( answers [ 'confirmMigration' ] ) {
2929 // TODO validate the config
30- fs . writeFileSync ( outputConfigLoc , outputConfig , 'utf8' ) ;
31- process . stdout . write ( chalk . green ( `Congratulations! Your new webpack v2 config file is at ${ outputConfigLoc } ` ) ) ;
30+ fs . writeFileSync ( outputConfigPath , outputConfig , 'utf8' ) ;
31+ process . stdout . write ( chalk . green ( `Congratulations! Your new webpack v2 config file is at ${ outputConfigPath } ` ) ) ;
3232 } else {
3333 process . stdout . write ( chalk . yellow ( 'Migration aborted' ) ) ;
3434 }
You can’t perform that action at this time.
0 commit comments