fix env var loading
This commit is contained in:
parent
ad84138469
commit
7974ad58ff
5 changed files with 15 additions and 7 deletions
8
app/package-lock.json
generated
8
app/package-lock.json
generated
|
@ -29,7 +29,7 @@
|
||||||
"@electron-forge/plugin-webpack": "^6.2.1",
|
"@electron-forge/plugin-webpack": "^6.2.1",
|
||||||
"@electron-forge/publisher-github": "^6.2.1",
|
"@electron-forge/publisher-github": "^6.2.1",
|
||||||
"@types/chmodr": "^1.0.0",
|
"@types/chmodr": "^1.0.0",
|
||||||
"@types/node": "^20.3.1",
|
"@types/node": "^20.4.0",
|
||||||
"@types/react": "^18.2.14",
|
"@types/react": "^18.2.14",
|
||||||
"@types/react-dom": "^18.2.6",
|
"@types/react-dom": "^18.2.6",
|
||||||
"@types/uuid": "^9.0.2",
|
"@types/uuid": "^9.0.2",
|
||||||
|
@ -2712,9 +2712,9 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.3.1",
|
"version": "20.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.0.tgz",
|
||||||
"integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg=="
|
"integrity": "sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/parse-json": {
|
"node_modules/@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
"@electron-forge/plugin-webpack": "^6.2.1",
|
"@electron-forge/plugin-webpack": "^6.2.1",
|
||||||
"@electron-forge/publisher-github": "^6.2.1",
|
"@electron-forge/publisher-github": "^6.2.1",
|
||||||
"@types/chmodr": "^1.0.0",
|
"@types/chmodr": "^1.0.0",
|
||||||
"@types/node": "^20.3.1",
|
"@types/node": "^20.4.0",
|
||||||
"@types/react": "^18.2.14",
|
"@types/react": "^18.2.14",
|
||||||
"@types/react-dom": "^18.2.6",
|
"@types/react-dom": "^18.2.6",
|
||||||
"@types/uuid": "^9.0.2",
|
"@types/uuid": "^9.0.2",
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
import { Analytics } from '@segment/analytics-node'
|
import { Analytics } from '@segment/analytics-node'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import Store from 'electron-store'
|
||||||
|
|
||||||
const Store = require('electron-store')
|
|
||||||
const store = new Store()
|
const store = new Store()
|
||||||
|
|
||||||
|
console.log(process.env)
|
||||||
|
|
||||||
export const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '<empty>' })
|
export const analytics = new Analytics({ writeKey: process.env.TELEMETRY_WRITE_KEY || '<empty>' })
|
||||||
|
|
||||||
export function id(): string {
|
export function id(): string {
|
||||||
const id = store.get('id')
|
const id = store.get('id') as string
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
return id
|
return id
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import type { Configuration } from 'webpack'
|
import type { Configuration } from 'webpack'
|
||||||
|
|
||||||
import { rules } from './webpack.rules'
|
import { rules } from './webpack.rules'
|
||||||
|
import { plugins } from './webpack.plugins'
|
||||||
|
|
||||||
export const mainConfig: Configuration = {
|
export const mainConfig: Configuration = {
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +13,7 @@ export const mainConfig: Configuration = {
|
||||||
module: {
|
module: {
|
||||||
rules,
|
rules,
|
||||||
},
|
},
|
||||||
|
plugins,
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'],
|
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'],
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type IForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
|
import type IForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
|
||||||
|
import { DefinePlugin } from 'webpack'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const ForkTsCheckerWebpackPlugin: typeof IForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
|
const ForkTsCheckerWebpackPlugin: typeof IForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
|
||||||
|
@ -7,4 +8,7 @@ export const plugins = [
|
||||||
new ForkTsCheckerWebpackPlugin({
|
new ForkTsCheckerWebpackPlugin({
|
||||||
logger: 'webpack-infrastructure',
|
logger: 'webpack-infrastructure',
|
||||||
}),
|
}),
|
||||||
|
new DefinePlugin({
|
||||||
|
'process.env.TELEMETRY_WRITE_KEY': JSON.stringify(process.env.TELEMETRY_WRITE_KEY),
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue