import moduleAlias from "module-alias" ; import path from "path" ; try { const json = require ( path . join ( __dirname , "../../package.json" ) ) ; if ( json . name . startsWith ( "@auto-canary" ) ) { moduleAlias . addAliases ( { /** We want to rewrite all the imports for canary (ex: npm plugin requiring core) */ "@auto-it" : ( fromPath , request ) => request . startsWith ( "@auto-it" ) && ! fromPath . endsWith ( "noop.js" ) && ! fromPath . includes ( "@auto-it" ) ? "@auto-canary" : "@auto-it" , } ) ; } } catch ( error ) { } import chalk from "chalk" ; import parseArgs from "../parse-args" ; import { runCli } from "../run" ; const [ command , args ] = parseArgs ( ) ; if ( command && args ) { runCli ( command , args ) . catch ( ( e ) => { console . error ( chalk . redBright ( "Error: " ) , e . message ) ; process . exit ( 1 ) ; } ) ; }