mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
more configuration tweaks
This commit is contained in:
parent
ec7b8661d9
commit
8f4db5bd53
12
package.json
12
package.json
@ -5,13 +5,13 @@
|
||||
"version": "3.5.0-beta.1",
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
"dev": "yarn compile:dll && concurrently yarn:dev:* && yarn dev-run",
|
||||
"dev-run": "electron .",
|
||||
"dev": "yarn compile:dll && concurrently yarn:dev:*",
|
||||
"dev-run": "electron --inspect .",
|
||||
"dev:main": "DEBUG=true webpack --watch --config webpack.main.ts",
|
||||
"dev:renderer": "DEBUG=true webpack --watch --config webpack.renderer.ts",
|
||||
"compile": "concurrently 'yarn download-bins' 'yarn i18n:compile' 'yarn compile:dll' && concurrently yarn:compile:*",
|
||||
"compile:main": "webpack -p --progress --config webpack.main.ts",
|
||||
"compile:renderer": "webpack -p --progress --config webpack.renderer.ts",
|
||||
"compile": "NODE_ENV=production concurrently 'yarn download-bins' 'yarn i18n:compile' 'yarn compile:dll' && concurrently yarn:compile:*",
|
||||
"compile:main": "NODE_ENV=production webpack -p --progress --config webpack.main.ts",
|
||||
"compile:renderer": "NODE_ENV=production webpack -p --progress --config webpack.renderer.ts",
|
||||
"compile:dll": "webpack --config webpack.dll.ts",
|
||||
"build:linux": "yarn compile && electron-builder --linux --dir -c.productName=LensDev",
|
||||
"build:mac": "yarn compile && electron-builder --mac --dir -c.productName=LensDev",
|
||||
@ -21,7 +21,7 @@
|
||||
"dist": "yarn compile && electron-builder -p onTag",
|
||||
"dist:win": "yarn compile && electron-builder -p onTag --x64 --ia32",
|
||||
"dist:dir": "yarn dist --dir -c.compression=store -c.mac.identity=null",
|
||||
"postinstall": "patch-package && concurrently 'electron-builder install-app-deps' 'yarn compile:dll'",
|
||||
"postinstall": "patch-package && concurrently 'electron-builder install-app-deps'",
|
||||
"i18n:extract": "lingui extract",
|
||||
"i18n:compile": "lingui compile",
|
||||
"download-bins": "concurrently yarn:download:*",
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { isMac, isWindows } from "./vars";
|
||||
|
||||
if (isMac) {
|
||||
// require("mac-ca"); // fixme: crashes
|
||||
console.warn("//FIXME: MAC-CA IMPORT ERROR!");
|
||||
// require("mac-ca");
|
||||
}
|
||||
if (isWindows) {
|
||||
require("win-ca").inject("+") // see: https://github.com/ukoloff/win-ca#caveats
|
||||
|
||||
@ -8,10 +8,11 @@ export const isDevelopment = !isProduction;
|
||||
export const buildVersion = process.env.BUILD_VERSION;
|
||||
|
||||
// Paths
|
||||
export const staticDir = path.resolve(__dirname, "../../static");
|
||||
export const outDir = path.resolve(__dirname, "../../dist");
|
||||
export const mainDir = path.resolve(__dirname, "../main");
|
||||
export const rendererDir = path.resolve(__dirname, "../renderer");
|
||||
export const contextDir = process.cwd();
|
||||
export const staticDir = path.join(contextDir, "static");
|
||||
export const outDir = path.join(contextDir, "dist");
|
||||
export const mainDir = path.join(contextDir, "src/main");
|
||||
export const rendererDir = path.join(contextDir, "src/renderer");
|
||||
|
||||
// Apis
|
||||
export const staticProto = "static://"
|
||||
|
||||
@ -4,19 +4,20 @@ import "../common/system-ca"
|
||||
import { app, BrowserWindow } from "electron"
|
||||
|
||||
console.log('MAIN', process.resourcesPath)
|
||||
console.log('userData', app.getPath("userData"))
|
||||
|
||||
app.whenReady().then(function start() {
|
||||
console.log('APP READY')
|
||||
|
||||
var window = new BrowserWindow({
|
||||
width: 600,
|
||||
height: 500,
|
||||
app.whenReady().then(async function start() {
|
||||
var mainWindow = new BrowserWindow({
|
||||
width: 1024,
|
||||
height: 768,
|
||||
show: false,
|
||||
webPreferences: {
|
||||
devTools: true,
|
||||
nodeIntegration: true,
|
||||
}
|
||||
});
|
||||
|
||||
window.loadFile("index.html");
|
||||
window.show();
|
||||
await mainWindow.loadFile("dist/index.html");
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Lens - The Kubernetes IDE</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
<!--<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />-->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import path from "path";
|
||||
import webpack from "webpack";
|
||||
import webpack, { LibraryTarget } from "webpack";
|
||||
import { isDevelopment, outDir } from "./src/common/vars";
|
||||
|
||||
export const fileName = "dll"
|
||||
export const manifestPath = path.resolve(outDir, `${fileName}.manifest.json`);
|
||||
export const library = "dll"
|
||||
export const libraryTarget: LibraryTarget = "commonjs2"
|
||||
export const manifestPath = path.resolve(outDir, `${library}.manifest.json`);
|
||||
|
||||
export const externalPackages = [
|
||||
export const packages = [
|
||||
"react", "react-dom",
|
||||
"ace-builds", "xterm",
|
||||
"moment",
|
||||
@ -13,18 +14,19 @@ export const externalPackages = [
|
||||
|
||||
export default function (): webpack.Configuration {
|
||||
return {
|
||||
context: path.dirname(manifestPath),
|
||||
mode: isDevelopment ? "development" : "production",
|
||||
cache: isDevelopment,
|
||||
entry: {
|
||||
[fileName]: externalPackages
|
||||
[library]: packages,
|
||||
},
|
||||
output: {
|
||||
library: fileName,
|
||||
libraryTarget: "commonjs2"
|
||||
library,
|
||||
libraryTarget,
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DllPlugin({
|
||||
name: fileName,
|
||||
name: library,
|
||||
path: manifestPath,
|
||||
})
|
||||
],
|
||||
|
||||
@ -4,7 +4,7 @@ import HtmlWebpackPlugin from "html-webpack-plugin";
|
||||
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||
import TerserWebpackPlugin from "terser-webpack-plugin";
|
||||
import { isDevelopment, isProduction, outDir, rendererDir } from "./src/common/vars";
|
||||
import { externalPackages, manifestPath } from "./webpack.dll";
|
||||
import { libraryTarget, manifestPath } from "./webpack.dll";
|
||||
|
||||
export default function (): webpack.Configuration {
|
||||
const htmlTemplate = path.resolve(rendererDir, "index.html");
|
||||
@ -14,8 +14,7 @@ export default function (): webpack.Configuration {
|
||||
return {
|
||||
target: "electron-renderer",
|
||||
mode: isProduction ? "production" : "development",
|
||||
devtool: isProduction ? "source-map" : "cheap-module-eval-source-map",
|
||||
externals: externalPackages,
|
||||
devtool: isProduction ? "source-map" : "eval-source-map",
|
||||
cache: isDevelopment,
|
||||
entry: {
|
||||
renderer: path.resolve(rendererDir, "index.tsx"),
|
||||
@ -111,14 +110,11 @@ export default function (): webpack.Configuration {
|
||||
},
|
||||
|
||||
plugins: [
|
||||
...(isDevelopment ? [
|
||||
new webpack.HotModuleReplacementPlugin()
|
||||
] : []),
|
||||
|
||||
// provide access to external libraries, e.g. react, moment, etc.
|
||||
// todo: check if this actually works in mode=production files
|
||||
new webpack.DllReferencePlugin({
|
||||
context: __dirname,
|
||||
manifest: require(manifestPath),
|
||||
context: process.cwd(),
|
||||
manifest: manifestPath,
|
||||
sourceType: libraryTarget,
|
||||
}),
|
||||
|
||||
new HtmlWebpackPlugin({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user