packages/okam-build/lib/build/run-build.js
function runBuild(buildConf, buildManager) {
    let timer = new Timer();
    timer.start();

    let {appType, logger, root: rootDir, configPath} = buildConf;

    logger.info('build start...');
    logger.info('build app type:', colors.cyan(appType));
    logger.info(
        'load process files from',
        colors.cyan(getRelativePath(rootDir))
    );

    if (configPath) {
        logger.info(
            'build by config',
            colors.cyan(getRelativePath(configPath))
        );
    }
    else if (buildConf.useDefaultConfig) {
        logger.info('build using default inner config');
    }

    // load build files
    let result = buildManager.loadFiles();
    if (!(result instanceof Promise)) {
        result = Promise.resolve();
    }

    return result.then(() => {
        logger.info('load process files done, file count:',
            colors.cyan(buildManager.getProcessFileCount()) + ', load time:',
            colors.gray(timer.tick())
        );
        logger.info('build for', colors.cyan(buildManager.getBuildEnv()), 'env');

        return buildProject(timer, buildConf, buildManager);
    });
}
function runBuild(buildConf, buildManager) {
    let timer = new Timer();
    timer.start();

    let {appType, logger, root: rootDir, configPath} = buildConf;

    logger.info('build start...');
    logger.info('build app type:', colors.cyan(appType));
    logger.info(
        'load process files from',
        colors.cyan(getRelativePath(rootDir))
    );

    if (configPath) {
        logger.info(
            'build by config',
            colors.cyan(getRelativePath(configPath))
        );
    }
    else if (buildConf.useDefaultConfig) {
        logger.info('build using default inner config');
    }

    // load build files
    let result = buildManager.loadFiles();
    if (!(result instanceof Promise)) {
        result = Promise.resolve();
    }

    return result.then(() => {
        logger.info('load process files done, file count:',
            colors.cyan(buildManager.getProcessFileCount()) + ', load time:',
            colors.gray(timer.tick())
        );
        logger.info('build for', colors.cyan(buildManager.getBuildEnv()), 'env');

        return buildProject(timer, buildConf, buildManager);
    });
}
开始构建

@param {Object} buildConf     构建配置
@param {Object} buildManager  类BuildManager的实例
@return {Promise}