@featurevisor/core 0.51.2 → 0.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +19 -0
  3. package/coverage/clover.xml +2 -2
  4. package/coverage/lcov-report/index.html +1 -1
  5. package/coverage/lcov-report/lib/builder/allocator.js.html +1 -1
  6. package/coverage/lcov-report/lib/builder/index.html +1 -1
  7. package/coverage/lcov-report/lib/builder/traffic.js.html +1 -1
  8. package/coverage/lcov-report/src/builder/allocator.ts.html +1 -1
  9. package/coverage/lcov-report/src/builder/index.html +1 -1
  10. package/coverage/lcov-report/src/builder/traffic.ts.html +1 -1
  11. package/lib/linter/conditionSchema.js +27 -5
  12. package/lib/linter/conditionSchema.js.map +1 -1
  13. package/lib/site/exportSite.d.ts +2 -0
  14. package/lib/site/exportSite.js +34 -0
  15. package/lib/site/exportSite.js.map +1 -0
  16. package/lib/site/generateHistory.d.ts +3 -0
  17. package/lib/site/generateHistory.js +76 -0
  18. package/lib/site/generateHistory.js.map +1 -0
  19. package/lib/site/generateSiteSearchIndex.d.ts +4 -0
  20. package/lib/site/generateSiteSearchIndex.js +141 -0
  21. package/lib/site/generateSiteSearchIndex.js.map +1 -0
  22. package/lib/site/getLastModifiedFromHistory.d.ts +2 -0
  23. package/lib/site/getLastModifiedFromHistory.js +19 -0
  24. package/lib/site/getLastModifiedFromHistory.js.map +1 -0
  25. package/lib/site/getOwnerAndRepoFromUrl.d.ts +4 -0
  26. package/lib/site/getOwnerAndRepoFromUrl.js +21 -0
  27. package/lib/site/getOwnerAndRepoFromUrl.js.map +1 -0
  28. package/lib/site/getRelativePaths.d.ts +6 -0
  29. package/lib/site/getRelativePaths.js +16 -0
  30. package/lib/site/getRelativePaths.js.map +1 -0
  31. package/lib/site/getRepoDetails.d.ts +8 -0
  32. package/lib/site/getRepoDetails.js +49 -0
  33. package/lib/site/getRepoDetails.js.map +1 -0
  34. package/lib/site/index.d.ts +2 -0
  35. package/lib/site/index.js +19 -0
  36. package/lib/site/index.js.map +1 -0
  37. package/lib/site/serveSite.d.ts +2 -0
  38. package/lib/site/serveSite.js +55 -0
  39. package/lib/site/serveSite.js.map +1 -0
  40. package/package.json +7 -7
  41. package/src/linter/conditionSchema.ts +39 -10
  42. package/src/site/exportSite.ts +53 -0
  43. package/src/site/generateHistory.ts +101 -0
  44. package/src/site/generateSiteSearchIndex.ts +203 -0
  45. package/src/site/getLastModifiedFromHistory.ts +21 -0
  46. package/src/site/getOwnerAndRepoFromUrl.ts +17 -0
  47. package/src/site/getRelativePaths.ts +24 -0
  48. package/src/site/getRepoDetails.ts +62 -0
  49. package/src/site/index.ts +2 -0
  50. package/src/site/serveSite.ts +60 -0
  51. package/lib/site.d.ts +0 -16
  52. package/lib/site.js +0 -368
  53. package/lib/site.js.map +0 -1
  54. package/src/site.ts +0 -515
@@ -0,0 +1,21 @@
1
+ import { HistoryEntry, LastModified } from "@featurevisor/types";
2
+
3
+ export function getLastModifiedFromHistory(
4
+ fullHistory: HistoryEntry[],
5
+ type,
6
+ key,
7
+ ): LastModified | undefined {
8
+ const lastModified = fullHistory.find((entry) => {
9
+ return entry.entities.find((entity) => {
10
+ return entity.type === type && entity.key === key;
11
+ });
12
+ });
13
+
14
+ if (lastModified) {
15
+ return {
16
+ commit: lastModified.commit,
17
+ timestamp: lastModified.timestamp,
18
+ author: lastModified.author,
19
+ };
20
+ }
21
+ }
@@ -0,0 +1,17 @@
1
+ export function getOwnerAndRepoFromUrl(url: string): { owner: string; repo: string } {
2
+ let owner;
3
+ let repo;
4
+
5
+ if (url.startsWith("https://")) {
6
+ const parts = url.split("/");
7
+ repo = (parts.pop() as string).replace(".git", "");
8
+ owner = parts.pop();
9
+ } else if (url.startsWith("git@")) {
10
+ const urlParts = url.split(":");
11
+ const parts = urlParts[1].split("/");
12
+ repo = (parts.pop() as string).replace(".git", "");
13
+ owner = parts.pop();
14
+ }
15
+
16
+ return { owner, repo };
17
+ }
@@ -0,0 +1,24 @@
1
+ import * as path from "path";
2
+
3
+ import { ProjectConfig } from "../config";
4
+
5
+ export function getRelativePaths(rootDirectoryPath, projectConfig: ProjectConfig) {
6
+ const relativeFeaturesPath = path.relative(
7
+ rootDirectoryPath,
8
+ projectConfig.featuresDirectoryPath,
9
+ );
10
+ const relativeSegmentsPath = path.relative(
11
+ rootDirectoryPath,
12
+ projectConfig.segmentsDirectoryPath,
13
+ );
14
+ const relativeAttributesPath = path.relative(
15
+ rootDirectoryPath,
16
+ projectConfig.attributesDirectoryPath,
17
+ );
18
+
19
+ return {
20
+ relativeFeaturesPath,
21
+ relativeSegmentsPath,
22
+ relativeAttributesPath,
23
+ };
24
+ }
@@ -0,0 +1,62 @@
1
+ import { execSync } from "child_process";
2
+
3
+ import { getOwnerAndRepoFromUrl } from "./getOwnerAndRepoFromUrl";
4
+
5
+ export interface RepoDetails {
6
+ branch: string;
7
+ remoteUrl: string;
8
+ blobUrl: string;
9
+ commitUrl: string;
10
+ topLevelPath: string;
11
+ }
12
+
13
+ export function getRepoDetails(): RepoDetails | undefined {
14
+ try {
15
+ const topLevelPathOutput = execSync(`git rev-parse --show-toplevel`);
16
+ const topLevelPath = topLevelPathOutput.toString().trim();
17
+
18
+ const remoteUrlOutput = execSync(`git remote get-url origin`);
19
+ const remoteUrl = remoteUrlOutput.toString().trim();
20
+
21
+ const branchOutput = execSync(`git rev-parse --abbrev-ref HEAD`);
22
+ const branch = branchOutput.toString().trim();
23
+
24
+ if (!remoteUrl || !branch) {
25
+ return;
26
+ }
27
+
28
+ const { owner, repo } = getOwnerAndRepoFromUrl(remoteUrl);
29
+
30
+ if (!owner || !repo) {
31
+ return;
32
+ }
33
+
34
+ let blobUrl;
35
+ let commitUrl;
36
+
37
+ if (remoteUrl.indexOf("github.com") > -1) {
38
+ blobUrl = `https://github.com/${owner}/${repo}/blob/${branch}/{{blobPath}}`;
39
+ commitUrl = `https://github.com/${owner}/${repo}/commit/{{hash}}`;
40
+ } else if (remoteUrl.indexOf("bitbucket.org") > -1) {
41
+ blobUrl = `https://bitbucket.org/${owner}/${repo}/src/${branch}/{{blobPath}}`;
42
+ commitUrl = `https://bitbucket.org/${owner}/${repo}/commits/{{hash}}`;
43
+ }
44
+
45
+ if (!blobUrl || !commitUrl) {
46
+ return;
47
+ }
48
+
49
+ return {
50
+ branch,
51
+ remoteUrl,
52
+ blobUrl,
53
+ commitUrl,
54
+ topLevelPath,
55
+ };
56
+ } catch (e) {
57
+ console.error(e);
58
+ return;
59
+ }
60
+
61
+ return;
62
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./exportSite";
2
+ export * from "./serveSite";
@@ -0,0 +1,60 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import * as http from "http";
4
+
5
+ import { ProjectConfig } from "../config";
6
+
7
+ export function serveSite(
8
+ rootDirectoryPath: string,
9
+ projectConfig: ProjectConfig,
10
+ options: any = {},
11
+ ) {
12
+ const port = options.p || 3000;
13
+
14
+ http
15
+ .createServer(function (request, response) {
16
+ const requestedUrl = request.url;
17
+ const filePath =
18
+ requestedUrl === "/"
19
+ ? path.join(projectConfig.siteExportDirectoryPath, "index.html")
20
+ : path.join(projectConfig.siteExportDirectoryPath, requestedUrl as string);
21
+
22
+ console.log("requesting: " + filePath + "");
23
+
24
+ const extname = path.extname(filePath);
25
+ let contentType = "text/html";
26
+ switch (extname) {
27
+ case ".js":
28
+ contentType = "text/javascript";
29
+ break;
30
+ case ".css":
31
+ contentType = "text/css";
32
+ break;
33
+ case ".json":
34
+ contentType = "application/json";
35
+ break;
36
+ case ".png":
37
+ contentType = "image/png";
38
+ break;
39
+ }
40
+
41
+ fs.readFile(filePath, function (error, content) {
42
+ if (error) {
43
+ if (error.code == "ENOENT") {
44
+ response.writeHead(404, { "Content-Type": "text/html" });
45
+ response.end("404 Not Found", "utf-8");
46
+ } else {
47
+ response.writeHead(500);
48
+ response.end("Error 500: " + error.code);
49
+ response.end();
50
+ }
51
+ } else {
52
+ response.writeHead(200, { "Content-Type": contentType });
53
+ response.end(content, "utf-8");
54
+ }
55
+ });
56
+ })
57
+ .listen(port);
58
+
59
+ console.log(`Server running at http://127.0.0.1:${port}/`);
60
+ }
package/lib/site.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { HistoryEntry, LastModified, SearchIndex } from "@featurevisor/types";
2
- import { ProjectConfig } from "./config";
3
- export declare function generateHistory(rootDirectoryPath: any, projectConfig: ProjectConfig): HistoryEntry[];
4
- export declare function getLastModifiedFromHistory(fullHistory: HistoryEntry[], type: any, key: any): LastModified | undefined;
5
- interface RepoDetails {
6
- branch: string;
7
- remoteUrl: string;
8
- blobUrl: string;
9
- commitUrl: string;
10
- topLevelPath: string;
11
- }
12
- export declare function getDetailsFromRepo(): RepoDetails | undefined;
13
- export declare function generateSiteSearchIndex(rootDirectoryPath: string, projectConfig: ProjectConfig, fullHistory: HistoryEntry[], repoDetails: RepoDetails | undefined): SearchIndex;
14
- export declare function exportSite(rootDirectoryPath: string, projectConfig: ProjectConfig): boolean;
15
- export declare function serveSite(rootDirectoryPath: string, projectConfig: ProjectConfig, options?: any): void;
16
- export {};
package/lib/site.js DELETED
@@ -1,368 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.serveSite = exports.exportSite = exports.generateSiteSearchIndex = exports.getDetailsFromRepo = exports.getLastModifiedFromHistory = exports.generateHistory = void 0;
15
- var fs = require("fs");
16
- var path = require("path");
17
- var http = require("http");
18
- var child_process_1 = require("child_process");
19
- var mkdirp = require("mkdirp");
20
- var datasource_1 = require("./datasource");
21
- var utils_1 = require("./utils");
22
- function getRelativePaths(rootDirectoryPath, projectConfig) {
23
- var relativeFeaturesPath = path.relative(rootDirectoryPath, projectConfig.featuresDirectoryPath);
24
- var relativeSegmentsPath = path.relative(rootDirectoryPath, projectConfig.segmentsDirectoryPath);
25
- var relativeAttributesPath = path.relative(rootDirectoryPath, projectConfig.attributesDirectoryPath);
26
- return {
27
- relativeFeaturesPath: relativeFeaturesPath,
28
- relativeSegmentsPath: relativeSegmentsPath,
29
- relativeAttributesPath: relativeAttributesPath,
30
- };
31
- }
32
- function generateHistory(rootDirectoryPath, projectConfig) {
33
- try {
34
- // raw history
35
- var rawHistoryFilePath = path.join(projectConfig.siteExportDirectoryPath, "history-raw.txt");
36
- var _a = getRelativePaths(rootDirectoryPath, projectConfig), relativeFeaturesPath = _a.relativeFeaturesPath, relativeSegmentsPath_1 = _a.relativeSegmentsPath, relativeAttributesPath_1 = _a.relativeAttributesPath;
37
- var separator_1 = "|";
38
- var cmd = "git log --name-only --pretty=format:\"%h".concat(separator_1, "%an").concat(separator_1, "%aI\" --no-merges --relative -- ").concat(relativeFeaturesPath, " ").concat(relativeSegmentsPath_1, " ").concat(relativeAttributesPath_1, " > ").concat(rawHistoryFilePath);
39
- (0, child_process_1.execSync)(cmd);
40
- console.log("History (raw) generated at: ".concat(rawHistoryFilePath));
41
- // structured history
42
- var rawHistory = fs.readFileSync(rawHistoryFilePath, "utf8");
43
- var fullHistory_1 = [];
44
- var entry_1 = {
45
- commit: "",
46
- author: "",
47
- timestamp: "",
48
- entities: [],
49
- };
50
- rawHistory.split("\n").forEach(function (line, index) {
51
- if (index === 0 && line.length === 0) {
52
- // no history found
53
- return;
54
- }
55
- if (index > 0 && line.length === 0) {
56
- // commit finished
57
- fullHistory_1.push(entry_1);
58
- return;
59
- }
60
- if (line.indexOf(separator_1) > -1) {
61
- // commit line
62
- var parts = line.split("|");
63
- entry_1 = {
64
- commit: parts[0],
65
- author: parts[1],
66
- timestamp: parts[2],
67
- entities: [],
68
- };
69
- }
70
- else {
71
- // file line
72
- var lineSplit = line.split(path.sep);
73
- var fileName = lineSplit.pop();
74
- var relativeDir = lineSplit.join(path.sep);
75
- var key = fileName.replace("." + projectConfig.parser, "");
76
- var type = "feature";
77
- if (relativeDir === relativeSegmentsPath_1) {
78
- type = "segment";
79
- }
80
- else if (relativeDir === relativeAttributesPath_1) {
81
- type = "attribute";
82
- }
83
- entry_1.entities.push({
84
- type: type,
85
- key: key,
86
- });
87
- }
88
- });
89
- var fullHistoryFilePath = path.join(projectConfig.siteExportDirectoryPath, "history-full.json");
90
- fs.writeFileSync(fullHistoryFilePath, JSON.stringify(fullHistory_1));
91
- console.log("History (full) generated at: ".concat(fullHistoryFilePath));
92
- return fullHistory_1;
93
- }
94
- catch (error) {
95
- console.error("Error when generating history from git: ".concat(error.status, "\n").concat(error.stderr.toString()));
96
- return [];
97
- }
98
- }
99
- exports.generateHistory = generateHistory;
100
- function getLastModifiedFromHistory(fullHistory, type, key) {
101
- var lastModified = fullHistory.find(function (entry) {
102
- return entry.entities.find(function (entity) {
103
- return entity.type === type && entity.key === key;
104
- });
105
- });
106
- if (lastModified) {
107
- return {
108
- commit: lastModified.commit,
109
- timestamp: lastModified.timestamp,
110
- author: lastModified.author,
111
- };
112
- }
113
- }
114
- exports.getLastModifiedFromHistory = getLastModifiedFromHistory;
115
- function getOwnerAndRepoFromUrl(url) {
116
- var owner;
117
- var repo;
118
- if (url.startsWith("https://")) {
119
- var parts = url.split("/");
120
- repo = parts.pop().replace(".git", "");
121
- owner = parts.pop();
122
- }
123
- else if (url.startsWith("git@")) {
124
- var urlParts = url.split(":");
125
- var parts = urlParts[1].split("/");
126
- repo = parts.pop().replace(".git", "");
127
- owner = parts.pop();
128
- }
129
- return { owner: owner, repo: repo };
130
- }
131
- function getDetailsFromRepo() {
132
- try {
133
- var topLevelPathOutput = (0, child_process_1.execSync)("git rev-parse --show-toplevel");
134
- var topLevelPath = topLevelPathOutput.toString().trim();
135
- var remoteUrlOutput = (0, child_process_1.execSync)("git remote get-url origin");
136
- var remoteUrl = remoteUrlOutput.toString().trim();
137
- var branchOutput = (0, child_process_1.execSync)("git rev-parse --abbrev-ref HEAD");
138
- var branch = branchOutput.toString().trim();
139
- if (!remoteUrl || !branch) {
140
- return;
141
- }
142
- var _a = getOwnerAndRepoFromUrl(remoteUrl), owner = _a.owner, repo = _a.repo;
143
- if (!owner || !repo) {
144
- return;
145
- }
146
- var blobUrl = void 0;
147
- var commitUrl = void 0;
148
- if (remoteUrl.indexOf("github.com") > -1) {
149
- blobUrl = "https://github.com/".concat(owner, "/").concat(repo, "/blob/").concat(branch, "/{{blobPath}}");
150
- commitUrl = "https://github.com/".concat(owner, "/").concat(repo, "/commit/{{hash}}");
151
- }
152
- else if (remoteUrl.indexOf("bitbucket.org") > -1) {
153
- blobUrl = "https://bitbucket.org/".concat(owner, "/").concat(repo, "/src/").concat(branch, "/{{blobPath}}");
154
- commitUrl = "https://bitbucket.org/".concat(owner, "/").concat(repo, "/commits/{{hash}}");
155
- }
156
- if (!blobUrl || !commitUrl) {
157
- return;
158
- }
159
- return {
160
- branch: branch,
161
- remoteUrl: remoteUrl,
162
- blobUrl: blobUrl,
163
- commitUrl: commitUrl,
164
- topLevelPath: topLevelPath,
165
- };
166
- }
167
- catch (e) {
168
- console.error(e);
169
- return;
170
- }
171
- return;
172
- }
173
- exports.getDetailsFromRepo = getDetailsFromRepo;
174
- function generateSiteSearchIndex(rootDirectoryPath, projectConfig, fullHistory, repoDetails) {
175
- var result = {
176
- links: undefined,
177
- entities: {
178
- attributes: [],
179
- segments: [],
180
- features: [],
181
- },
182
- };
183
- var datasource = new datasource_1.Datasource(projectConfig);
184
- /**
185
- * Links
186
- */
187
- if (repoDetails) {
188
- var _a = getRelativePaths(rootDirectoryPath, projectConfig), relativeAttributesPath = _a.relativeAttributesPath, relativeSegmentsPath = _a.relativeSegmentsPath, relativeFeaturesPath = _a.relativeFeaturesPath;
189
- var prefix = "";
190
- if (repoDetails.topLevelPath !== rootDirectoryPath) {
191
- prefix = rootDirectoryPath.replace(repoDetails.topLevelPath + "/", "") + "/";
192
- }
193
- result.links = {
194
- attribute: repoDetails.blobUrl.replace("{{blobPath}}", prefix + relativeAttributesPath + "/{{key}}." + datasource.getExtension()),
195
- segment: repoDetails.blobUrl.replace("{{blobPath}}", prefix + relativeSegmentsPath + "/{{key}}." + datasource.getExtension()),
196
- feature: repoDetails.blobUrl.replace("{{blobPath}}", prefix + relativeFeaturesPath + "/{{key}}." + datasource.getExtension()),
197
- commit: repoDetails.commitUrl,
198
- };
199
- }
200
- /**
201
- * Entities
202
- */
203
- // usage
204
- var attributesUsedInFeatures = {};
205
- var attributesUsedInSegments = {};
206
- var segmentsUsedInFeatures = {};
207
- // features
208
- var featureFiles = datasource.listFeatures();
209
- featureFiles.forEach(function (entityName) {
210
- var parsed = datasource.readFeature(entityName);
211
- if (Array.isArray(parsed.variations)) {
212
- parsed.variations.forEach(function (variation) {
213
- if (!variation.variables) {
214
- return;
215
- }
216
- variation.variables.forEach(function (v) {
217
- if (v.overrides) {
218
- v.overrides.forEach(function (o) {
219
- if (o.conditions) {
220
- (0, utils_1.extractAttributeKeysFromConditions)(o.conditions).forEach(function (attributeKey) {
221
- if (!attributesUsedInFeatures[attributeKey]) {
222
- attributesUsedInFeatures[attributeKey] = new Set();
223
- }
224
- attributesUsedInFeatures[attributeKey].add(entityName);
225
- });
226
- }
227
- if (o.segments && o.segments !== "*") {
228
- (0, utils_1.extractSegmentKeysFromGroupSegments)(o.segments).forEach(function (segmentKey) {
229
- if (!segmentsUsedInFeatures[segmentKey]) {
230
- segmentsUsedInFeatures[segmentKey] = new Set();
231
- }
232
- segmentsUsedInFeatures[segmentKey].add(entityName);
233
- });
234
- }
235
- });
236
- }
237
- });
238
- });
239
- }
240
- Object.keys(parsed.environments).forEach(function (environmentKey) {
241
- var env = parsed.environments[environmentKey];
242
- env.rules.forEach(function (rule) {
243
- if (rule.segments && rule.segments !== "*") {
244
- (0, utils_1.extractSegmentKeysFromGroupSegments)(rule.segments).forEach(function (segmentKey) {
245
- if (!segmentsUsedInFeatures[segmentKey]) {
246
- segmentsUsedInFeatures[segmentKey] = new Set();
247
- }
248
- segmentsUsedInFeatures[segmentKey].add(entityName);
249
- });
250
- }
251
- });
252
- if (env.force) {
253
- env.force.forEach(function (force) {
254
- if (force.segments && force.segments !== "*") {
255
- (0, utils_1.extractSegmentKeysFromGroupSegments)(force.segments).forEach(function (segmentKey) {
256
- if (!segmentsUsedInFeatures[segmentKey]) {
257
- segmentsUsedInFeatures[segmentKey] = new Set();
258
- }
259
- segmentsUsedInFeatures[segmentKey].add(entityName);
260
- });
261
- }
262
- if (force.conditions) {
263
- (0, utils_1.extractAttributeKeysFromConditions)(force.conditions).forEach(function (attributeKey) {
264
- if (!attributesUsedInFeatures[attributeKey]) {
265
- attributesUsedInFeatures[attributeKey] = new Set();
266
- }
267
- attributesUsedInFeatures[attributeKey].add(entityName);
268
- });
269
- }
270
- });
271
- }
272
- });
273
- result.entities.features.push(__assign(__assign({}, parsed), { key: entityName, lastModified: getLastModifiedFromHistory(fullHistory, "feature", entityName) }));
274
- });
275
- // segments
276
- var segmentFiles = datasource.listSegments();
277
- segmentFiles.forEach(function (entityName) {
278
- var parsed = datasource.readSegment(entityName);
279
- (0, utils_1.extractAttributeKeysFromConditions)(parsed.conditions).forEach(function (attributeKey) {
280
- if (!attributesUsedInSegments[attributeKey]) {
281
- attributesUsedInSegments[attributeKey] = new Set();
282
- }
283
- attributesUsedInSegments[attributeKey].add(entityName);
284
- });
285
- result.entities.segments.push(__assign(__assign({}, parsed), { key: entityName, lastModified: getLastModifiedFromHistory(fullHistory, "segment", entityName), usedInFeatures: Array.from(segmentsUsedInFeatures[entityName] || []) }));
286
- });
287
- // attributes
288
- var attributeFiles = datasource.listAttributes();
289
- attributeFiles.forEach(function (entityName) {
290
- var parsed = datasource.readAttribute(entityName);
291
- result.entities.attributes.push(__assign(__assign({}, parsed), { key: entityName, lastModified: getLastModifiedFromHistory(fullHistory, "attribute", entityName), usedInFeatures: Array.from(attributesUsedInFeatures[entityName] || []), usedInSegments: Array.from(attributesUsedInSegments[entityName] || []) }));
292
- });
293
- return result;
294
- }
295
- exports.generateSiteSearchIndex = generateSiteSearchIndex;
296
- function exportSite(rootDirectoryPath, projectConfig) {
297
- var hasError = false;
298
- mkdirp.sync(projectConfig.siteExportDirectoryPath);
299
- var sitePackagePath = path.dirname(require.resolve("@featurevisor/site/package.json"));
300
- // copy site dist
301
- var siteDistPath = path.join(sitePackagePath, "dist");
302
- fs.cpSync(siteDistPath, projectConfig.siteExportDirectoryPath, { recursive: true });
303
- var sitePublicPath = path.join(sitePackagePath, "public");
304
- fs.cpSync(sitePublicPath, projectConfig.siteExportDirectoryPath, { recursive: true });
305
- console.log("Site dist copied to:", projectConfig.siteExportDirectoryPath);
306
- // generate history
307
- var fullHistory = generateHistory(rootDirectoryPath, projectConfig);
308
- // site search index
309
- var repoDetails = getDetailsFromRepo();
310
- var searchIndex = generateSiteSearchIndex(rootDirectoryPath, projectConfig, fullHistory, repoDetails);
311
- var searchIndexFilePath = path.join(projectConfig.siteExportDirectoryPath, "search-index.json");
312
- fs.writeFileSync(searchIndexFilePath, JSON.stringify(searchIndex));
313
- console.log("Site search index written at: ".concat(searchIndexFilePath));
314
- // copy datafiles
315
- fs.cpSync(projectConfig.outputDirectoryPath, path.join(projectConfig.siteExportDirectoryPath, "datafiles"), { recursive: true });
316
- // @TODO: replace placeoholders in index.html
317
- return hasError;
318
- }
319
- exports.exportSite = exportSite;
320
- function serveSite(rootDirectoryPath, projectConfig, options) {
321
- if (options === void 0) { options = {}; }
322
- var port = options.p || 3000;
323
- http
324
- .createServer(function (request, response) {
325
- var requestedUrl = request.url;
326
- var filePath = requestedUrl === "/"
327
- ? path.join(projectConfig.siteExportDirectoryPath, "index.html")
328
- : path.join(projectConfig.siteExportDirectoryPath, requestedUrl);
329
- console.log("requesting: " + filePath + "");
330
- var extname = path.extname(filePath);
331
- var contentType = "text/html";
332
- switch (extname) {
333
- case ".js":
334
- contentType = "text/javascript";
335
- break;
336
- case ".css":
337
- contentType = "text/css";
338
- break;
339
- case ".json":
340
- contentType = "application/json";
341
- break;
342
- case ".png":
343
- contentType = "image/png";
344
- break;
345
- }
346
- fs.readFile(filePath, function (error, content) {
347
- if (error) {
348
- if (error.code == "ENOENT") {
349
- response.writeHead(404, { "Content-Type": "text/html" });
350
- response.end("404 Not Found", "utf-8");
351
- }
352
- else {
353
- response.writeHead(500);
354
- response.end("Error 500: " + error.code);
355
- response.end();
356
- }
357
- }
358
- else {
359
- response.writeHead(200, { "Content-Type": contentType });
360
- response.end(content, "utf-8");
361
- }
362
- });
363
- })
364
- .listen(port);
365
- console.log("Server running at http://127.0.0.1:".concat(port, "/"));
366
- }
367
- exports.serveSite = serveSite;
368
- //# sourceMappingURL=site.js.map
package/lib/site.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"site.js","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uBAAyB;AACzB,2BAA6B;AAC7B,2BAA6B;AAC7B,+CAAyC;AAEzC,+BAAiC;AAajC,2CAA0C;AAC1C,iCAAkG;AAElG,SAAS,gBAAgB,CAAC,iBAAiB,EAAE,aAA4B;IACvE,IAAM,oBAAoB,GAAG,IAAI,CAAC,QAAQ,CACxC,iBAAiB,EACjB,aAAa,CAAC,qBAAqB,CACpC,CAAC;IACF,IAAM,oBAAoB,GAAG,IAAI,CAAC,QAAQ,CACxC,iBAAiB,EACjB,aAAa,CAAC,qBAAqB,CACpC,CAAC;IACF,IAAM,sBAAsB,GAAG,IAAI,CAAC,QAAQ,CAC1C,iBAAiB,EACjB,aAAa,CAAC,uBAAuB,CACtC,CAAC;IAEF,OAAO;QACL,oBAAoB,sBAAA;QACpB,oBAAoB,sBAAA;QACpB,sBAAsB,wBAAA;KACvB,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAAC,iBAAiB,EAAE,aAA4B;IAC7E,IAA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