import { TFlow } from './ifaces' ; import { clear , createSymlinks , createTempAssets , exit , npmAuditFix , patchLockfile , printRuntimeDigest , resolveBins , syncLockfile , verify , yarnImport , yarnInstall , yarnLockToPkgLock , } from './stages' ; export const convert = { main : [ [ 'Resolve bins' , resolveBins ] , [ 'Runtime digest' , printRuntimeDigest ] , [ 'Verifying package structure...' , verify ] , [ 'Preparing temp assets...' , clear , createTempAssets , createSymlinks ] , [ 'Generating package-lock.json from yarn.lock...' , yarnLockToPkgLock ] , [ 'Applying npm audit fix...' , npmAuditFix ] , [ 'Updating yarn.lock from package-lock.json...' , yarnImport , syncLockfile , clear , ] , [ 'Installing deps update...' , yarnInstall ] , [ 'Done' ] , ] , fallback : [ [ 'Failure!' , clear , exit ] ] , } ; export const patch = { main : [ [ 'Resolve bins' , resolveBins ] , [ 'Runtime digest' , printRuntimeDigest ] , [ 'Verifying package structure...' , verify ] , [ 'Preparing temp assets...' , clear , createTempAssets , createSymlinks ] , [ 'Patching yarn.lock with audit data...' , patchLockfile , syncLockfile , clear , ] , [ 'Installing deps update...' , yarnInstall ] , [ 'Done' ] , ] , fallback : [ [ 'Failure!' , clear , exit ] ] , } ; export const getFlow = ( flow = 'patch' ) : TFlow => { if ( flow === 'convert' ) { return convert ; } if ( flow === 'patch' ) { return patch ; } throw new Error ( `Unsupported flow: ${ flow }` ) ; } ;