mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Switch to using npm over yarn Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove reference to `yarn` from documentation Signed-off-by: Sebastian Malton <sebastian@malton.name> * Enable NPM workspaces Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Introduce script for installing all dependencies Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove usage of lerna bootstrap for no longer being used Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix build by not bundling libraries for application in node environment (main) as Electron does that Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Tweak evil static import paths in build of application Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Consolidate npmrc configs to root since required by workspaces Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make application build not fail for not detecting electron version Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Update package-lock Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make sure native dependencies are rebuilt for electron Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove unused binary for causing trouble when installing dependencies Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Update package-lock Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Disable caching in CI for Windows Installing Electron in Windows seems to be broken in this regards. Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> --------- Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Sebastian Malton <sebastian@malton.name> Co-authored-by: Sebastian Malton <sebastian@malton.name>
88 lines
2.3 KiB
TypeScript
Executable File
88 lines
2.3 KiB
TypeScript
Executable File
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
|
|
import path from "path";
|
|
import type webpack from "webpack";
|
|
import nodeExternals from "webpack-node-externals";
|
|
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
|
import { iconsAndImagesWebpackRules } from "./renderer";
|
|
import { DefinePlugin } from "webpack";
|
|
import { buildDir, isDevelopment } from "./vars";
|
|
import { platform } from "process";
|
|
|
|
const webpackLensMain = (): webpack.Configuration => {
|
|
return {
|
|
name: "lens-app-main",
|
|
context: __dirname,
|
|
target: "electron-main",
|
|
mode: isDevelopment ? "development" : "production",
|
|
devtool: isDevelopment ? "cheap-module-source-map" : "source-map",
|
|
cache: isDevelopment ? { type: "filesystem" } : false,
|
|
entry: {
|
|
main: path.resolve(__dirname, "..", "src", "main", "library.ts"),
|
|
},
|
|
output: {
|
|
library: {
|
|
type: "commonjs2",
|
|
},
|
|
path: path.resolve(buildDir, "library"),
|
|
},
|
|
optimization: {
|
|
minimize: false,
|
|
},
|
|
resolve: {
|
|
extensions: [".json", ".js", ".ts"],
|
|
},
|
|
externals: [
|
|
nodeExternals({ modulesFromFile: true }),
|
|
],
|
|
module: {
|
|
parser: {
|
|
javascript: {
|
|
commonjsMagicComments: true,
|
|
},
|
|
},
|
|
rules: [
|
|
{
|
|
test: /\.node$/,
|
|
use: "node-loader",
|
|
},
|
|
{
|
|
test: /\.ts$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: "ts-loader",
|
|
options: {
|
|
transpileOnly: true,
|
|
compilerOptions: {
|
|
sourceMap: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
...iconsAndImagesWebpackRules(),
|
|
],
|
|
},
|
|
plugins: [
|
|
new DefinePlugin({
|
|
CONTEXT_MATCHER_FOR_NON_FEATURES: `/\\.injectable(\\.${platform})?\\.tsx?$/`,
|
|
CONTEXT_MATCHER_FOR_FEATURES: `/\\/(main|common)\\/.+\\.injectable(\\.${platform})?\\.tsx?$/`,
|
|
}),
|
|
new ForkTsCheckerPlugin({
|
|
typescript: {
|
|
mode: "write-dts",
|
|
configOverwrite: {
|
|
compilerOptions: {
|
|
declaration: true,
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
};
|
|
};
|
|
|
|
export default webpackLensMain;
|