import * as fs from 'fs-extra' ; import * as path from 'path' ; import { chdir } from 'process' ; import { exec } from './util' ; const targetDir = path . join ( 'build' , 'clean' ) ; async function prepareRelease ( ) { const originalDir = __dirname ; await fs . remove ( targetDir ) ; await fs . mkdirp ( targetDir ) ; await exec ( 'git' , [ 'clone' , '.git' , targetDir ] ) ; chdir ( targetDir ) ; chdir ( 'app' ) ; await exec ( 'yarn' ) ; chdir ( '..' ) ; await exec ( 'yarn' ) ; await exec ( 'yarn' , [ 'build' ] ) ; await fs . remove ( 'node_modules' ) ; await exec ( 'yarn' , [ 'install' , '--production' ] ) ; await fs . remove ( path . join ( 'app' , 'node_modules' ) ) ; chdir ( originalDir ) ; } prepareRelease ( ) ;