@cellaware/utils 3.3.25 → 3.3.27
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/version.d.ts +4 -0
- package/dist/version.js +12 -0
- package/package.json +1 -1
package/dist/version.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts `version` from `package.json`.
|
|
4
|
+
*/
|
|
5
|
+
export function getVersion() {
|
|
6
|
+
const path = 'package.json';
|
|
7
|
+
if (!fs.existsSync(path)) {
|
|
8
|
+
throw new Error(`VERSION: '${path}' not found`);
|
|
9
|
+
}
|
|
10
|
+
const content = JSON.parse(fs.readFileSync(path, 'utf8'));
|
|
11
|
+
return content.version;
|
|
12
|
+
}
|