@eventcatalog/core 2.21.1 → 2.21.3
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.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/catalog-to-astro-content-directory.js +2 -2
- package/dist/{chunk-KC3LZQXV.js → chunk-LF6C2UBE.js} +1 -1
- package/dist/{chunk-4CHHTLUN.js → chunk-N4Q2I3OP.js} +1 -1
- package/dist/chunk-XMDPVKIJ.js +48 -0
- package/dist/{chunk-6UDSGYH7.js → chunk-Y3RLX2GF.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +109 -11
- package/dist/eventcatalog.js +73 -19
- package/dist/features.cjs +82 -0
- package/dist/features.d.cts +3 -0
- package/dist/features.d.ts +3 -0
- package/dist/features.js +6 -0
- package/dist/watcher.js +2 -2
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +25 -1
- package/package.json +2 -1
- package/dist/{chunk-WF34R5UT.js → chunk-CXKIF3EI.js} +3 -3
- package/dist/{chunk-FSKZU5FH.js → chunk-OW2FQPYP.js} +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-N4Q2I3OP.js";
|
|
4
|
+
import "../chunk-Y3RLX2GF.js";
|
|
5
|
+
import "../chunk-LF6C2UBE.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/features.ts
|
|
2
|
+
import boxen from "boxen";
|
|
3
|
+
var isBackstagePluginEnabled = async (licenseKey) => {
|
|
4
|
+
const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || null;
|
|
5
|
+
if (!LICENSE_KEY) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
|
|
9
|
+
method: "POST",
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${LICENSE_KEY}`,
|
|
12
|
+
"Content-Type": "application/json"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
if (response.status !== 200) {
|
|
16
|
+
console.log(
|
|
17
|
+
"\nTried to verify your backstage license but it is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
|
|
18
|
+
);
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (response.status === 200) {
|
|
22
|
+
const data = await response.json();
|
|
23
|
+
if ("@eventcatalog/backstage-plugin-eventcatalog" !== data.plugin) {
|
|
24
|
+
console.log(
|
|
25
|
+
"\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
|
|
26
|
+
);
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
let message = "Backstage integration is enabled for EventCatalog";
|
|
30
|
+
if (data.is_trial) {
|
|
31
|
+
message += "\nYou are using a trial license for backstage integration.";
|
|
32
|
+
}
|
|
33
|
+
console.log(
|
|
34
|
+
boxen(message, {
|
|
35
|
+
padding: 1,
|
|
36
|
+
margin: 1,
|
|
37
|
+
borderColor: "green",
|
|
38
|
+
title: "@eventcatalog/backstage-plugin-eventcatalog",
|
|
39
|
+
titleAlignment: "center"
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
isBackstagePluginEnabled
|
|
48
|
+
};
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
|
|
|
161
161
|
var import_os = __toESM(require("os"), 1);
|
|
162
162
|
|
|
163
163
|
// package.json
|
|
164
|
-
var version = "2.21.
|
|
164
|
+
var version = "2.21.3";
|
|
165
165
|
|
|
166
166
|
// src/constants.ts
|
|
167
167
|
var VERSION = version;
|
|
@@ -513,6 +513,71 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
|
513
513
|
};
|
|
514
514
|
|
|
515
515
|
// src/eventcatalog.ts
|
|
516
|
+
var import_semver = __toESM(require("semver"), 1);
|
|
517
|
+
var import_boxen2 = __toESM(require("boxen"), 1);
|
|
518
|
+
|
|
519
|
+
// src/features.ts
|
|
520
|
+
var import_boxen = __toESM(require("boxen"), 1);
|
|
521
|
+
var isBackstagePluginEnabled = async (licenseKey) => {
|
|
522
|
+
const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || null;
|
|
523
|
+
if (!LICENSE_KEY) {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
|
|
527
|
+
method: "POST",
|
|
528
|
+
headers: {
|
|
529
|
+
Authorization: `Bearer ${LICENSE_KEY}`,
|
|
530
|
+
"Content-Type": "application/json"
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
if (response.status !== 200) {
|
|
534
|
+
console.log(
|
|
535
|
+
"\nTried to verify your backstage license but it is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
|
|
536
|
+
);
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
if (response.status === 200) {
|
|
540
|
+
const data = await response.json();
|
|
541
|
+
if ("@eventcatalog/backstage-plugin-eventcatalog" !== data.plugin) {
|
|
542
|
+
console.log(
|
|
543
|
+
"\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
|
|
544
|
+
);
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
let message = "Backstage integration is enabled for EventCatalog";
|
|
548
|
+
if (data.is_trial) {
|
|
549
|
+
message += "\nYou are using a trial license for backstage integration.";
|
|
550
|
+
}
|
|
551
|
+
console.log(
|
|
552
|
+
(0, import_boxen.default)(message, {
|
|
553
|
+
padding: 1,
|
|
554
|
+
margin: 1,
|
|
555
|
+
borderColor: "green",
|
|
556
|
+
title: "@eventcatalog/backstage-plugin-eventcatalog",
|
|
557
|
+
titleAlignment: "center"
|
|
558
|
+
})
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
return true;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
// src/eventcatalog.ts
|
|
565
|
+
var boxenOptions = {
|
|
566
|
+
padding: 1,
|
|
567
|
+
margin: 1,
|
|
568
|
+
align: "center",
|
|
569
|
+
borderColor: "yellow",
|
|
570
|
+
borderStyle: {
|
|
571
|
+
topLeft: " ",
|
|
572
|
+
topRight: " ",
|
|
573
|
+
bottomLeft: " ",
|
|
574
|
+
bottomRight: " ",
|
|
575
|
+
right: " ",
|
|
576
|
+
top: "-",
|
|
577
|
+
bottom: "-",
|
|
578
|
+
left: " "
|
|
579
|
+
}
|
|
580
|
+
};
|
|
516
581
|
var currentDir = import_node_path7.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
517
582
|
var program = new import_commander.Command().version(VERSION);
|
|
518
583
|
var dir = import_node_path7.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
@@ -539,8 +604,30 @@ var copyCore = () => {
|
|
|
539
604
|
var clearCore = () => {
|
|
540
605
|
if (import_fs2.default.existsSync(core)) import_fs2.default.rmSync(core, { recursive: true });
|
|
541
606
|
};
|
|
607
|
+
var checkForUpdate = () => {
|
|
608
|
+
try {
|
|
609
|
+
const packageJson = JSON.parse(import_fs2.default.readFileSync(import_node_path7.default.join(dir, "package.json"), "utf-8"));
|
|
610
|
+
const userEventCatalogVersion = packageJson.dependencies["@eventcatalog/core"];
|
|
611
|
+
const corePackageJson = JSON.parse(import_fs2.default.readFileSync(import_node_path7.default.join(core, "package.json"), "utf-8"));
|
|
612
|
+
const coreVersion = corePackageJson.version;
|
|
613
|
+
const userVersion = userEventCatalogVersion.replace(/[\^~]/, "");
|
|
614
|
+
if (import_semver.default.lt(userVersion, coreVersion)) {
|
|
615
|
+
const docusaurusUpdateMessage = (0, import_boxen2.default)(
|
|
616
|
+
`Update available for EventCatalog
|
|
617
|
+
@eventcatalog/core ${userVersion} \u2192 ${coreVersion}
|
|
618
|
+
|
|
619
|
+
Run \`npm i @eventcatalog/core@${coreVersion}\` to update your EventCatalog
|
|
620
|
+
`,
|
|
621
|
+
boxenOptions
|
|
622
|
+
);
|
|
623
|
+
console.log(docusaurusUpdateMessage);
|
|
624
|
+
}
|
|
625
|
+
} catch (error) {
|
|
626
|
+
}
|
|
627
|
+
};
|
|
542
628
|
program.command("dev").description("Run development server of EventCatalog").option("-d, --debug", "Output EventCatalog application information into your terminal").option("--force-recreate", "Recreate the eventcatalog-core directory", false).action(async (options, command) => {
|
|
543
629
|
console.log("Setting up EventCatalog....");
|
|
630
|
+
checkForUpdate();
|
|
544
631
|
if (options.debug) {
|
|
545
632
|
console.log("Debug mode enabled");
|
|
546
633
|
console.log("PROJECT_DIR", dir);
|
|
@@ -551,6 +638,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
551
638
|
console.log("EventCatalog is starting at http://localhost:3000/docs");
|
|
552
639
|
await resolve_catalog_dependencies_default(dir, core);
|
|
553
640
|
await catalogToAstro(dir, core);
|
|
641
|
+
const canEmbedPages = await isBackstagePluginEnabled();
|
|
554
642
|
let watchUnsub;
|
|
555
643
|
try {
|
|
556
644
|
watchUnsub = await watch(dir, core);
|
|
@@ -561,7 +649,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
561
649
|
cwd: core,
|
|
562
650
|
env: {
|
|
563
651
|
PROJECT_DIR: dir,
|
|
564
|
-
CATALOG_DIR: core
|
|
652
|
+
CATALOG_DIR: core,
|
|
653
|
+
ENABLE_EMBED: canEmbedPages
|
|
565
654
|
}
|
|
566
655
|
}
|
|
567
656
|
]);
|
|
@@ -574,20 +663,29 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
574
663
|
});
|
|
575
664
|
program.command("build").description("Run build of EventCatalog").action(async (options, command) => {
|
|
576
665
|
console.log("Building EventCatalog...");
|
|
666
|
+
checkForUpdate();
|
|
577
667
|
copyCore();
|
|
578
668
|
await log_build_default(dir);
|
|
579
669
|
await resolve_catalog_dependencies_default(dir, core);
|
|
580
670
|
await catalogToAstro(dir, core);
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
671
|
+
const canEmbedPages = await isBackstagePluginEnabled();
|
|
672
|
+
(0, import_node_child_process.execSync)(
|
|
673
|
+
`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} npx astro build ${command.args.join(" ").trim()}`,
|
|
674
|
+
{
|
|
675
|
+
cwd: core,
|
|
676
|
+
stdio: "inherit"
|
|
677
|
+
}
|
|
678
|
+
);
|
|
585
679
|
});
|
|
586
|
-
var previewCatalog = ({ command }) => {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
680
|
+
var previewCatalog = async ({ command }) => {
|
|
681
|
+
const canEmbedPages = await isBackstagePluginEnabled();
|
|
682
|
+
(0, import_node_child_process.execSync)(
|
|
683
|
+
`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} npx astro preview ${command.args.join(" ").trim()}`,
|
|
684
|
+
{
|
|
685
|
+
cwd: core,
|
|
686
|
+
stdio: "inherit"
|
|
687
|
+
}
|
|
688
|
+
);
|
|
591
689
|
};
|
|
592
690
|
program.command("preview").description("Serves the contents of your eventcatalog build directory").action((options, command) => {
|
|
593
691
|
console.log("Starting preview of your build...");
|
package/dist/eventcatalog.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolve_catalog_dependencies_default
|
|
3
|
+
} from "./chunk-BLDONK5J.js";
|
|
1
4
|
import {
|
|
2
5
|
watch
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OW2FQPYP.js";
|
|
4
7
|
import {
|
|
5
8
|
log_build_default
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-N4Q2I3OP.js";
|
|
10
|
+
import "./chunk-Y3RLX2GF.js";
|
|
8
11
|
import {
|
|
9
12
|
catalogToAstro
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CXKIF3EI.js";
|
|
11
14
|
import {
|
|
12
15
|
VERSION
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LF6C2UBE.js";
|
|
17
|
+
import {
|
|
18
|
+
isBackstagePluginEnabled
|
|
19
|
+
} from "./chunk-XMDPVKIJ.js";
|
|
14
20
|
import {
|
|
15
21
|
generate
|
|
16
22
|
} from "./chunk-YEQVKHST.js";
|
|
17
|
-
import "./chunk-7JDTB3U5.js";
|
|
18
|
-
import {
|
|
19
|
-
resolve_catalog_dependencies_default
|
|
20
|
-
} from "./chunk-BLDONK5J.js";
|
|
21
23
|
import "./chunk-E7TXTI7G.js";
|
|
24
|
+
import "./chunk-7JDTB3U5.js";
|
|
22
25
|
|
|
23
26
|
// src/eventcatalog.ts
|
|
24
27
|
import { Command } from "commander";
|
|
@@ -28,6 +31,24 @@ import fs from "fs";
|
|
|
28
31
|
import path from "node:path";
|
|
29
32
|
import { fileURLToPath } from "node:url";
|
|
30
33
|
import concurrently from "concurrently";
|
|
34
|
+
import semver from "semver";
|
|
35
|
+
import boxen from "boxen";
|
|
36
|
+
var boxenOptions = {
|
|
37
|
+
padding: 1,
|
|
38
|
+
margin: 1,
|
|
39
|
+
align: "center",
|
|
40
|
+
borderColor: "yellow",
|
|
41
|
+
borderStyle: {
|
|
42
|
+
topLeft: " ",
|
|
43
|
+
topRight: " ",
|
|
44
|
+
bottomLeft: " ",
|
|
45
|
+
bottomRight: " ",
|
|
46
|
+
right: " ",
|
|
47
|
+
top: "-",
|
|
48
|
+
bottom: "-",
|
|
49
|
+
left: " "
|
|
50
|
+
}
|
|
51
|
+
};
|
|
31
52
|
var currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
32
53
|
var program = new Command().version(VERSION);
|
|
33
54
|
var dir = path.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
@@ -54,8 +75,30 @@ var copyCore = () => {
|
|
|
54
75
|
var clearCore = () => {
|
|
55
76
|
if (fs.existsSync(core)) fs.rmSync(core, { recursive: true });
|
|
56
77
|
};
|
|
78
|
+
var checkForUpdate = () => {
|
|
79
|
+
try {
|
|
80
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf-8"));
|
|
81
|
+
const userEventCatalogVersion = packageJson.dependencies["@eventcatalog/core"];
|
|
82
|
+
const corePackageJson = JSON.parse(fs.readFileSync(path.join(core, "package.json"), "utf-8"));
|
|
83
|
+
const coreVersion = corePackageJson.version;
|
|
84
|
+
const userVersion = userEventCatalogVersion.replace(/[\^~]/, "");
|
|
85
|
+
if (semver.lt(userVersion, coreVersion)) {
|
|
86
|
+
const docusaurusUpdateMessage = boxen(
|
|
87
|
+
`Update available for EventCatalog
|
|
88
|
+
@eventcatalog/core ${userVersion} \u2192 ${coreVersion}
|
|
89
|
+
|
|
90
|
+
Run \`npm i @eventcatalog/core@${coreVersion}\` to update your EventCatalog
|
|
91
|
+
`,
|
|
92
|
+
boxenOptions
|
|
93
|
+
);
|
|
94
|
+
console.log(docusaurusUpdateMessage);
|
|
95
|
+
}
|
|
96
|
+
} catch (error) {
|
|
97
|
+
}
|
|
98
|
+
};
|
|
57
99
|
program.command("dev").description("Run development server of EventCatalog").option("-d, --debug", "Output EventCatalog application information into your terminal").option("--force-recreate", "Recreate the eventcatalog-core directory", false).action(async (options, command) => {
|
|
58
100
|
console.log("Setting up EventCatalog....");
|
|
101
|
+
checkForUpdate();
|
|
59
102
|
if (options.debug) {
|
|
60
103
|
console.log("Debug mode enabled");
|
|
61
104
|
console.log("PROJECT_DIR", dir);
|
|
@@ -66,6 +109,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
66
109
|
console.log("EventCatalog is starting at http://localhost:3000/docs");
|
|
67
110
|
await resolve_catalog_dependencies_default(dir, core);
|
|
68
111
|
await catalogToAstro(dir, core);
|
|
112
|
+
const canEmbedPages = await isBackstagePluginEnabled();
|
|
69
113
|
let watchUnsub;
|
|
70
114
|
try {
|
|
71
115
|
watchUnsub = await watch(dir, core);
|
|
@@ -76,7 +120,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
76
120
|
cwd: core,
|
|
77
121
|
env: {
|
|
78
122
|
PROJECT_DIR: dir,
|
|
79
|
-
CATALOG_DIR: core
|
|
123
|
+
CATALOG_DIR: core,
|
|
124
|
+
ENABLE_EMBED: canEmbedPages
|
|
80
125
|
}
|
|
81
126
|
}
|
|
82
127
|
]);
|
|
@@ -89,20 +134,29 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
89
134
|
});
|
|
90
135
|
program.command("build").description("Run build of EventCatalog").action(async (options, command) => {
|
|
91
136
|
console.log("Building EventCatalog...");
|
|
137
|
+
checkForUpdate();
|
|
92
138
|
copyCore();
|
|
93
139
|
await log_build_default(dir);
|
|
94
140
|
await resolve_catalog_dependencies_default(dir, core);
|
|
95
141
|
await catalogToAstro(dir, core);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
142
|
+
const canEmbedPages = await isBackstagePluginEnabled();
|
|
143
|
+
execSync(
|
|
144
|
+
`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} npx astro build ${command.args.join(" ").trim()}`,
|
|
145
|
+
{
|
|
146
|
+
cwd: core,
|
|
147
|
+
stdio: "inherit"
|
|
148
|
+
}
|
|
149
|
+
);
|
|
100
150
|
});
|
|
101
|
-
var previewCatalog = ({ command }) => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
151
|
+
var previewCatalog = async ({ command }) => {
|
|
152
|
+
const canEmbedPages = await isBackstagePluginEnabled();
|
|
153
|
+
execSync(
|
|
154
|
+
`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} npx astro preview ${command.args.join(" ").trim()}`,
|
|
155
|
+
{
|
|
156
|
+
cwd: core,
|
|
157
|
+
stdio: "inherit"
|
|
158
|
+
}
|
|
159
|
+
);
|
|
106
160
|
};
|
|
107
161
|
program.command("preview").description("Serves the contents of your eventcatalog build directory").action((options, command) => {
|
|
108
162
|
console.log("Starting preview of your build...");
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/features.ts
|
|
31
|
+
var features_exports = {};
|
|
32
|
+
__export(features_exports, {
|
|
33
|
+
isBackstagePluginEnabled: () => isBackstagePluginEnabled
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(features_exports);
|
|
36
|
+
var import_boxen = __toESM(require("boxen"), 1);
|
|
37
|
+
var isBackstagePluginEnabled = async (licenseKey) => {
|
|
38
|
+
const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || null;
|
|
39
|
+
if (!LICENSE_KEY) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Bearer ${LICENSE_KEY}`,
|
|
46
|
+
"Content-Type": "application/json"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (response.status !== 200) {
|
|
50
|
+
console.log(
|
|
51
|
+
"\nTried to verify your backstage license but it is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
|
|
52
|
+
);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (response.status === 200) {
|
|
56
|
+
const data = await response.json();
|
|
57
|
+
if ("@eventcatalog/backstage-plugin-eventcatalog" !== data.plugin) {
|
|
58
|
+
console.log(
|
|
59
|
+
"\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
|
|
60
|
+
);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
let message = "Backstage integration is enabled for EventCatalog";
|
|
64
|
+
if (data.is_trial) {
|
|
65
|
+
message += "\nYou are using a trial license for backstage integration.";
|
|
66
|
+
}
|
|
67
|
+
console.log(
|
|
68
|
+
(0, import_boxen.default)(message, {
|
|
69
|
+
padding: 1,
|
|
70
|
+
margin: 1,
|
|
71
|
+
borderColor: "green",
|
|
72
|
+
title: "@eventcatalog/backstage-plugin-eventcatalog",
|
|
73
|
+
titleAlignment: "center"
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
};
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
isBackstagePluginEnabled
|
|
82
|
+
});
|
package/dist/features.js
ADDED
package/dist/watcher.js
CHANGED
|
@@ -142,6 +142,8 @@ const currentNavigationItem = navigationItems.find((item) => item.current);
|
|
|
142
142
|
const { title, description, sidebar: showSideBarOverride } = Astro.props;
|
|
143
143
|
|
|
144
144
|
const showSideBarOnLoad = currentNavigationItem?.sidebar;
|
|
145
|
+
|
|
146
|
+
const canPageBeEmbedded = process.env.ENABLE_EMBED === 'true';
|
|
145
147
|
---
|
|
146
148
|
|
|
147
149
|
<!doctype html>
|
|
@@ -209,10 +211,26 @@ const showSideBarOnLoad = currentNavigationItem?.sidebar;
|
|
|
209
211
|
>
|
|
210
212
|
<slot />
|
|
211
213
|
</main>
|
|
214
|
+
|
|
215
|
+
<!-- Creae a overlay that tells people to purchase backstage plugin if they want to embed the page -->
|
|
216
|
+
<div class="absolute inset-0 bg-black items-center justify-center z-50 hidden" id="embed-overlay">
|
|
217
|
+
<div class="text-white text-center space-y-4">
|
|
218
|
+
<div>
|
|
219
|
+
<h1 class="text-2xl font-bold">EventCatalog Backstage Integration</h1>
|
|
220
|
+
<p class="text-md text-red-500">Missing license key for backstage integration.</p>
|
|
221
|
+
</div>
|
|
222
|
+
<div>
|
|
223
|
+
<p class="text-sm text-gray-500">Please configure the backstage plugin to embed this page into Backstage.</p>
|
|
224
|
+
<a href="https://www.eventcatalog.dev/integrations/backstage" class="text-blue-500 text-xs"
|
|
225
|
+
>Configure backstage plugin →</a
|
|
226
|
+
>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
212
230
|
</div>
|
|
213
231
|
</body>
|
|
214
232
|
</html>
|
|
215
|
-
<script define:vars={{ navigationItems, currentNavigationItem, showSideBarOnLoad }}>
|
|
233
|
+
<script define:vars={{ navigationItems, currentNavigationItem, showSideBarOnLoad, canPageBeEmbedded }}>
|
|
216
234
|
// Listen for Astro transititions
|
|
217
235
|
document.addEventListener('astro:page-load', () => {
|
|
218
236
|
document.dispatchEvent(new CustomEvent('contentLoaded'));
|
|
@@ -230,6 +248,12 @@ const showSideBarOnLoad = currentNavigationItem?.sidebar;
|
|
|
230
248
|
const embeded = params.embed === 'true' ? true : false;
|
|
231
249
|
const content = document.getElementById('content');
|
|
232
250
|
|
|
251
|
+
if (embeded && !canPageBeEmbedded) {
|
|
252
|
+
const overlay = document.getElementById('embed-overlay');
|
|
253
|
+
overlay.style.display = 'flex';
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
233
257
|
if (embeded) {
|
|
234
258
|
const elementsToHide = [
|
|
235
259
|
'eventcatalog-vertical-nav',
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/event-catalog/eventcatalog.git"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"version": "2.21.
|
|
9
|
+
"version": "2.21.3",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"astro-pagefind": "^1.6.0",
|
|
43
43
|
"astro-seo": "^0.8.4",
|
|
44
44
|
"axios": "^1.7.7",
|
|
45
|
+
"boxen": "^8.0.1",
|
|
45
46
|
"commander": "^12.1.0",
|
|
46
47
|
"concurrently": "^8.2.2",
|
|
47
48
|
"cross-env": "^7.0.3",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
mapCatalogToAstro
|
|
3
|
-
} from "./chunk-7JDTB3U5.js";
|
|
4
1
|
import {
|
|
5
2
|
addPropertyToFrontMatter,
|
|
6
3
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
7
4
|
} from "./chunk-E7TXTI7G.js";
|
|
5
|
+
import {
|
|
6
|
+
mapCatalogToAstro
|
|
7
|
+
} from "./chunk-7JDTB3U5.js";
|
|
8
8
|
|
|
9
9
|
// src/catalog-to-astro-content-directory.js
|
|
10
10
|
import { glob } from "glob";
|