mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
adding fredy version
This commit is contained in:
@@ -3,10 +3,12 @@ import { getJobs } from '../storage/jobStorage.js';
|
|||||||
import {getUniqueId} from './uniqueId.js';
|
import {getUniqueId} from './uniqueId.js';
|
||||||
import {config, inDevMode} from '../../utils.js';
|
import {config, inDevMode} from '../../utils.js';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import {readFileSync} from 'fs';
|
||||||
|
import {packageUp} from 'package-up';
|
||||||
|
|
||||||
const mixpanelTracker = Mixpanel.init('718670ef1c58c0208256c1e408a3d75e');
|
const mixpanelTracker = Mixpanel.init('718670ef1c58c0208256c1e408a3d75e');
|
||||||
|
|
||||||
const distinct_id = getUniqueId() || 'N/A';
|
const distinct_id = getUniqueId() || 'N/A';
|
||||||
|
const version = await getPackageVersion();
|
||||||
|
|
||||||
export const track = function () {
|
export const track = function () {
|
||||||
//only send tracking information if the user allowed to do so.
|
//only send tracking information if the user allowed to do so.
|
||||||
@@ -71,5 +73,18 @@ function enrichTrackingObject(trackingObject) {
|
|||||||
nodeVersion,
|
nodeVersion,
|
||||||
language,
|
language,
|
||||||
distinct_id,
|
distinct_id,
|
||||||
|
fredy_version: version
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getPackageVersion() {
|
||||||
|
try {
|
||||||
|
const packagePath = await packageUp();
|
||||||
|
const packageJson = readFileSync(packagePath, 'utf8');
|
||||||
|
const json = JSON.parse(packageJson);
|
||||||
|
return json.version;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error reading version from package.json', error);
|
||||||
|
}
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
"nanoid": "5.0.9",
|
"nanoid": "5.0.9",
|
||||||
"node-fetch": "3.3.2",
|
"node-fetch": "3.3.2",
|
||||||
"node-mailjet": "6.0.6",
|
"node-mailjet": "6.0.6",
|
||||||
|
"package-up": "^5.0.0",
|
||||||
"puppeteer": "^23.10.4",
|
"puppeteer": "^23.10.4",
|
||||||
"puppeteer-extra": "^3.3.6",
|
"puppeteer-extra": "^3.3.6",
|
||||||
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
||||||
|
|||||||
12
yarn.lock
12
yarn.lock
@@ -3545,6 +3545,11 @@ filter-obj@^5.1.0:
|
|||||||
resolved "https://registry.npmjs.org/filter-obj/-/filter-obj-5.1.0.tgz"
|
resolved "https://registry.npmjs.org/filter-obj/-/filter-obj-5.1.0.tgz"
|
||||||
integrity sha512-qWeTREPoT7I0bifpPUXtxkZJ1XJzxWtfoWWkdVGqa+eCr3SHW/Ocp89o8vLvbUuQnadybJpjOKu4V+RwO6sGng==
|
integrity sha512-qWeTREPoT7I0bifpPUXtxkZJ1XJzxWtfoWWkdVGqa+eCr3SHW/Ocp89o8vLvbUuQnadybJpjOKu4V+RwO6sGng==
|
||||||
|
|
||||||
|
find-up-simple@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/find-up-simple/-/find-up-simple-1.0.0.tgz#21d035fde9fdbd56c8f4d2f63f32fd93a1cfc368"
|
||||||
|
integrity sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==
|
||||||
|
|
||||||
find-up@^5.0.0:
|
find-up@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz"
|
resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz"
|
||||||
@@ -5958,6 +5963,13 @@ pac-resolver@^7.0.1:
|
|||||||
degenerator "^5.0.0"
|
degenerator "^5.0.0"
|
||||||
netmask "^2.0.2"
|
netmask "^2.0.2"
|
||||||
|
|
||||||
|
package-up@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/package-up/-/package-up-5.0.0.tgz#3facda2aa9248c0b68b3dddfa4c58d22aa3faea2"
|
||||||
|
integrity sha512-MQEgDUvXCa3sGvqHg3pzHO8e9gqTCMPVrWUko3vPQGntwegmFo52mZb2abIVTjFnUcW0BcPz0D93jV5Cas1DWA==
|
||||||
|
dependencies:
|
||||||
|
find-up-simple "^1.0.0"
|
||||||
|
|
||||||
parent-module@^1.0.0:
|
parent-module@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz"
|
resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz"
|
||||||
|
|||||||
Reference in New Issue
Block a user