UNPKG

@nx-plus/vue

Version:
68 lines 3.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const utils_1 = require("../../utils"); const webpack_1 = require("../../webpack"); const path = require("path"); // eslint-disable-next-line @typescript-eslint/no-var-requires const Service = require('@vue/cli-service/lib/Service'); // eslint-disable-next-line @typescript-eslint/no-var-requires const { resolvePkg } = require('@vue/cli-shared-utils/lib/pkg'); function runExecutor(options, context) { return tslib_1.__asyncGenerator(this, arguments, function* runExecutor_1() { try { const projectRoot = yield tslib_1.__await((0, utils_1.getProjectRoot)(context)); const babelConfig = yield tslib_1.__await((0, utils_1.getBabelConfig)(projectRoot)); const inlineOptions = { chainWebpack: (config) => { (0, webpack_1.modifyIndexHtmlPath)(config, options, context); (0, webpack_1.modifyEntryPoint)(config, options, context); (0, webpack_1.modifyTsConfigPaths)(config, options, context); (0, webpack_1.modifyTypescriptAliases)(config, options, context); if (babelConfig) { (0, webpack_1.modifyBabelLoader)(config, babelConfig); } }, publicPath: options.publicPath, filenameHashing: options.filenameHashing, productionSourceMap: options.productionSourceMap, css: options.css, configureWebpack: yield tslib_1.__await((0, utils_1.resolveConfigureWebpack)(projectRoot)), transpileDependencies: options.transpileDependencies, }; (0, utils_1.checkUnsupportedConfig)(context, projectRoot); const service = new Service(projectRoot, { pkg: resolvePkg(context.root), inlineOptions, }); const buildOptions = { mode: options.mode, dest: path.join(context.root, options.dest), modern: false, 'unsafe-inline': true, clean: options.clean, report: options.report, 'report-json': options.reportJson, 'skip-plugins': options.skipPlugins, watch: options.watch, stdin: options.stdin, transpileDependencies: options.transpileDependencies, }; yield tslib_1.__await(service.run('build', buildOptions, ['build'])); yield yield tslib_1.__await({ success: true, }); if (options.watch) { // This Promise intentionally never resolves, leaving the process running // eslint-disable-next-line @typescript-eslint/no-empty-function yield tslib_1.__await(new Promise(() => { })); } } catch (err) { console.error(err); yield yield tslib_1.__await({ success: false }); } }); } exports.default = runExecutor; //# sourceMappingURL=executor.js.map