UNPKG

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