Przeglądaj źródła

feat(core): Export VENDURE_VERSION constant

Relates to #1471
Michael Bromley 2 lat temu
rodzic
commit
b2a910a21b
2 zmienionych plików z 18 dodań i 0 usunięć
  1. 1 0
      packages/core/src/index.ts
  2. 17 0
      packages/core/src/version.ts

+ 1 - 0
packages/core/src/index.ts

@@ -1,4 +1,5 @@
 export { bootstrap, bootstrapWorker } from './bootstrap';
+export { VENDURE_VERSION } from './version';
 export { generateMigration, revertLastMigration, runMigrations } from './migrate';
 export * from './api/index';
 export * from './cache/index';

+ 17 - 0
packages/core/src/version.ts

@@ -0,0 +1,17 @@
+/* eslint-disable @typescript-eslint/no-var-requires */
+/**
+ * @description
+ * A constant which holds the current version of the Vendure core. You can use
+ * this when your code needs to know the version of Vendure which is running.
+ *
+ * @example
+ * ```TypeScript
+ * import { VENDURE_VERSION } from '\@vendure/core';
+ *
+ * console.log('Vendure version:', VENDURE_VERSION);
+ * ```
+ *
+ * @docsCategory common
+ * @since 2.0.0
+ */
+export const VENDURE_VERSION: string = require('../package.json').version;