@equinor/fusion-framework-cli
Version:
--- title: Fusion Framework CLI ---
40 lines • 2.32 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 { createManifest, createManifestFromPackage } from '../../lib/app-manifest.js';
export const loadAppManifest = (env, pkg, options) => __awaiter(void 0, void 0, void 0, function* () {
const spinner = Spinner.Clone();
try {
spinner.start('create application manifest');
const baseManifest = yield createManifestFromPackage(pkg);
spinner.info('created application manifest from package.json');
// TODO - this need to come from the config
if (env.command !== 'serve') {
baseManifest.build.entryPoint =
pkg.packageJson.type === 'module' ? 'app-bundle.js' : 'app-bundle.mjs';
}
spinner.info(`generating manifest with ${chalk.red.dim(env.command)} command in ${chalk.green.dim(env.mode)} mode`);
const manifest = yield createManifest(env, baseManifest, { file: options === null || options === void 0 ? void 0 : options.file });
if (manifest.path) {
spinner.succeed(`Created manifest from ${formatPath(manifest.path, { relative: true })}`);
}
else {
spinner.succeed(chalk.dim('no local manifest config applied, using default generated'));
}
return manifest;
}
catch (err) {
spinner.fail(`failed to resolve manifest ${(options === null || options === void 0 ? void 0 : options.file) ? formatPath(options === null || options === void 0 ? void 0 : options.file) : ''}`);
throw err;
}
});
export default loadAppManifest;
//# sourceMappingURL=load-manifest.js.map