UNPKG

1.92 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const path = require("path");
4class LocationProvider {
5 constructor(config) {
6 this.config = config;
7 this.bearerDir = '';
8 this.integrationRoot = '';
9 this.integrationRc = this.config.integrationConfig.config;
10 if (this.integrationRc) {
11 this.integrationRoot = path.dirname(this.integrationRc);
12 this.bearerDir = path.join(this.integrationRoot, '.bearer');
13 }
14 }
15 integrationRootResourcePath(filename) {
16 return path.join(this.integrationRoot, filename);
17 }
18 // ~/views
19 get srcViewsDir() {
20 return path.join(this.integrationRoot, 'views');
21 }
22 srcViewsDirResource(name) {
23 return path.join(this.srcViewsDir, name);
24 }
25 // ~/functions
26 get srcFunctionsDir() {
27 return path.join(this.integrationRoot, 'functions');
28 }
29 buildViewsResourcePath(resource) {
30 return path.join(this.buildViewsDir, resource);
31 }
32 // ~/.bearer/views
33 get buildViewsDir() {
34 return path.join(this.bearerDir, 'views');
35 }
36 // ~/.bearer/views/src
37 get buildViewsComponentsDir() {
38 return path.join(this.buildViewsDir, 'src');
39 }
40 // ~/.bearer/tmp
41 get buildTmpDir() {
42 return path.join(this.bearerDir, 'tmp');
43 }
44 // ~/.bearer/functions
45 get buildFunctionsDir() {
46 return path.join(this.bearerDir, 'functions');
47 }
48 buildFunctionsResourcePath(resource) {
49 return path.join(this.buildFunctionsDir, resource);
50 }
51 get buildArtifactDir() {
52 return path.join(this.bearerDir, 'artifacts');
53 }
54 buildArtifactResourcePath(resource) {
55 return path.join(this.buildArtifactDir, resource);
56 }
57 get authConfigPath() {
58 return this.integrationRootResourcePath('auth.config.json');
59 }
60}
61exports.default = LocationProvider;