@equinor/fusion-framework-cli
Version:
--- title: Fusion Framework CLI ---
35 lines • 1.99 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { Spinner } from './spinner.js';
import { formatPath, chalk } from './format.js';
import { createAppConfig } from '../../lib/app-config.js';
export const loadAppConfig = (env, pkg, options) => __awaiter(void 0, void 0, void 0, function* () {
const spinner = Spinner.Current;
try {
spinner.start('create application configuration');
spinner.info(`generating config with ${chalk.red.dim(env.command)} command in ${chalk.green.dim(env.mode)} mode`);
const baseAppConfig = {};
const appConfig = yield createAppConfig(env, baseAppConfig, { file: options === null || options === void 0 ? void 0 : options.file });
spinner.succeed();
if (appConfig.path) {
spinner.info(`generating config from ${formatPath(appConfig.path, { relative: true })}`);
}
else {
spinner.info(chalk.dim('no local application config applied, using built-in'));
}
return appConfig;
}
catch (err) {
spinner.fail(`failed to resolve application config ${(options === null || options === void 0 ? void 0 : options.file) ? formatPath(options === null || options === void 0 ? void 0 : options.file) : ''}`);
throw err;
}
});
export default loadAppConfig;
//# sourceMappingURL=load-app-config.js.map