UNPKG

1.9 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 Case = require("case");
7const base_command_1 = require("../../base-command");
8const decorators_1 = require("../../utils/decorators");
9const helpers_1 = require("../../utils/helpers");
10class PrepareViews extends base_command_1.default {
11 async run() {
12 const { flags } = this.parse(PrepareViews);
13 // Prepare folder structure
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}
27PrepareViews.description = 'Prepare integration views';
28PrepareViews.hidden = true;
29PrepareViews.flags = Object.assign({}, base_command_1.default.flags, { empty: command_1.flags.boolean() });
30PrepareViews.args = [];
31tslib_1.__decorate([
32 decorators_1.skipIfNoViews(),
33 decorators_1.RequireIntegrationFolder()
34], PrepareViews.prototype, "run", null);
35exports.default = PrepareViews;