1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const tslib_1 = require("tslib");
|
4 | const command_1 = require("@oclif/command");
|
5 | const path = require("path");
|
6 | const Case = require("case");
|
7 | const base_command_1 = require("../../base-command");
|
8 | const decorators_1 = require("../../utils/decorators");
|
9 | const helpers_1 = require("../../utils/helpers");
|
10 | class PrepareViews extends base_command_1.default {
|
11 | async run() {
|
12 | const { flags } = this.parse(PrepareViews);
|
13 |
|
14 | this.debug('Preparing views structure');
|
15 | helpers_1.ensureFolderExists(this.locator.buildViewsDir, flags.empty);
|
16 | helpers_1.ensureFolderExists(this.locator.buildViewsComponentsDir);
|
17 | this.debug('Symlinking node_modules');
|
18 | helpers_1.ensureSymlinked(this.locator.integrationRootResourcePath('node_modules'), this.locator.buildViewsResourcePath('node_modules'));
|
19 | this.debug('Symlinking package.json');
|
20 | helpers_1.ensureSymlinked(this.locator.integrationRootResourcePath('package.json'), this.locator.buildViewsResourcePath('package.json'));
|
21 | this.debug('Copying stencil config');
|
22 | const vars = { componentTagName: Case.kebab(this.bearerConfig.integrationConfig.integrationTitle) };
|
23 | await helpers_1.copyFiles(this, 'start', this.locator.buildViewsDir, vars);
|
24 | helpers_1.ensureSymlinked(this.locator.buildViewsResourcePath('global'), path.join(this.locator.buildViewsComponentsDir, 'global'));
|
25 | }
|
26 | }
|
27 | PrepareViews.description = 'Prepare integration views';
|
28 | PrepareViews.hidden = true;
|
29 | PrepareViews.flags = Object.assign({}, base_command_1.default.flags, { empty: command_1.flags.boolean() });
|
30 | PrepareViews.args = [];
|
31 | tslib_1.__decorate([
|
32 | decorators_1.skipIfNoViews(),
|
33 | decorators_1.RequireIntegrationFolder()
|
34 | ], PrepareViews.prototype, "run", null);
|
35 | exports.default = PrepareViews;
|