Skip to content

Commit 6fac3f0

Browse files
authored
Expose iTwin.js Core Version for extensions/embed-api (#3287)
Co-authored-by: Arun George <[email protected]>
1 parent 9ae9bd6 commit 6fac3f0

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

common/api/core-frontend.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5333,6 +5333,9 @@ export interface ITwinIdArg {
53335333
readonly iTwinId?: GuidString;
53345334
}
53355335

5336+
// @public (undocumented)
5337+
export const ITWINJS_CORE_VERSION: string;
5338+
53365339
// @public
53375340
export enum KeyinParseError {
53385341
MismatchedQuotes = 4,

common/api/summary/core-frontend.exports.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ public;isTextInputFormatPropEditorSpec: (item: CustomFormatPropEditorSpec) => it
321321
public;isTextSelectFormatPropEditorSpec: (item: CustomFormatPropEditorSpec) => item is TextSelectFormatPropEditorSpec
322322
alpha;ItemField
323323
beta;ITwinIdArg
324+
public;ITWINJS_CORE_VERSION: string
324325
public;KeyinParseError
325326
internal;KeyinStatus
326327
beta;LengthDescription
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/core-frontend",
5+
"comment": "Expose iTwin.js Core Version for extensions",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/core-frontend"
10+
}

core/frontend/src/IModelApp.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
* @module IModelApp
77
*/
88

9-
const copyrightNotice = 'Copyright © 2017-2022 <a href="https://www.bentley.com" target="_blank" rel="noopener noreferrer">Bentley Systems, Inc.</a>';
9+
/** @public */
10+
// eslint-disable-next-line @typescript-eslint/no-var-requires
11+
export const ITWINJS_CORE_VERSION = require("../../package.json").version as string; // require resolves from the lib/{cjs,esm} dir
12+
const COPYRIGHT_NOTICE = 'Copyright © 2017-2022 <a href="https://www.bentley.com" target="_blank" rel="noopener noreferrer">Bentley Systems, Inc.</a>';
1013

1114
import { TelemetryManager } from "@itwin/core-telemetry";
1215
import { UiAdmin } from "@itwin/appui-abstract";
@@ -688,7 +691,7 @@ export class IModelApp {
688691
return this.makeLogoCard({
689692
iconSrc: `${this.publicPath}images/about-imodeljs.svg`,
690693
heading: `<span style="font-weight:normal">${this.localization.getLocalizedString("iModelJs:Notices.PoweredBy")}</span>&nbsp;iTwin.js`,
691-
notice: `${require("../../package.json").version}<br>${copyrightNotice}`, // eslint-disable-line @typescript-eslint/no-var-requires
694+
notice: `${ITWINJS_CORE_VERSION}<br>${COPYRIGHT_NOTICE}`,
692695
});
693696
}
694697

0 commit comments

Comments
 (0)