diff --git a/app/package-lock.json b/app/package-lock.json index 24f2882d..7fe529a4 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -29,7 +29,7 @@ "@electron-forge/plugin-webpack": "^6.2.1", "@electron-forge/publisher-github": "^6.2.1", "@types/chmodr": "^1.0.0", - "@types/node": "^20.3.1", + "@types/node": "^20.4.0", "@types/react": "^18.2.14", "@types/react-dom": "^18.2.6", "@types/uuid": "^9.0.2", @@ -2712,9 +2712,9 @@ "optional": true }, "node_modules/@types/node": { - "version": "20.3.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz", - "integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==" + "version": "20.4.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.0.tgz", + "integrity": "sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g==" }, "node_modules/@types/parse-json": { "version": "4.0.0", diff --git a/app/package.json b/app/package.json index 3709e1ad..345004ab 100644 --- a/app/package.json +++ b/app/package.json @@ -31,7 +31,7 @@ "@electron-forge/plugin-webpack": "^6.2.1", "@electron-forge/publisher-github": "^6.2.1", "@types/chmodr": "^1.0.0", - "@types/node": "^20.3.1", + "@types/node": "^20.4.0", "@types/react": "^18.2.14", "@types/react-dom": "^18.2.6", "@types/uuid": "^9.0.2", diff --git a/app/src/telemetry.ts b/app/src/telemetry.ts index a2dc81f0..33101b10 100644 --- a/app/src/telemetry.ts +++ b/app/src/telemetry.ts @@ -1,13 +1,15 @@ import { Analytics } from '@segment/analytics-node' import { v4 as uuidv4 } from 'uuid' +import Store from 'electron-store' -const Store = require('electron-store') const store = new Store() +console.log(process.env) + export const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '' }) export function id(): string { - const id = store.get('id') + const id = store.get('id') as string if (id) { return id diff --git a/app/webpack.main.config.ts b/app/webpack.main.config.ts index b6dac79b..51160862 100644 --- a/app/webpack.main.config.ts +++ b/app/webpack.main.config.ts @@ -1,6 +1,7 @@ import type { Configuration } from 'webpack' import { rules } from './webpack.rules' +import { plugins } from './webpack.plugins' export const mainConfig: Configuration = { /** @@ -12,6 +13,7 @@ export const mainConfig: Configuration = { module: { rules, }, + plugins, resolve: { extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'], }, diff --git a/app/webpack.plugins.ts b/app/webpack.plugins.ts index ca78adc1..3f9ce147 100644 --- a/app/webpack.plugins.ts +++ b/app/webpack.plugins.ts @@ -1,4 +1,5 @@ import type IForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin' +import { DefinePlugin } from 'webpack' // eslint-disable-next-line @typescript-eslint/no-var-requires const ForkTsCheckerWebpackPlugin: typeof IForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin') @@ -7,4 +8,7 @@ export const plugins = [ new ForkTsCheckerWebpackPlugin({ logger: 'webpack-infrastructure', }), + new DefinePlugin({ + 'process.env.TELEMETRY_WRITE_KEY': JSON.stringify(process.env.TELEMETRY_WRITE_KEY), + }), ]