move app build to a separate package

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen committed 2023-01-09 16:42:04 +02:00
1 parent bc87eb4f22
commit 11b763e48f
19 files changed
+934 -154

No files matched your search

+291
View File
@@ -0,0 +1,291 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
const packageJson = require("./package.json");
module.exports = {
ignorePatterns: [
"**/node_modules/**/*",
"**/dist/**/*",
"**/static/**/*",
"**/site/**/*",
"build/webpack/**/*",
],
settings: {
react: {
version: packageJson.devDependencies.react || "detect",
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.json",
},
},
},
overrides: [
{
files: [
"**/*.js",
"**/*.mjs",
],
extends: [
"eslint:recommended",
],
env: {
node: true,
es2022: true,
},
parserOptions: {
sourceType: "module",
},
plugins: [
"header",
"unused-imports",
"react-hooks",
],
rules: {
"no-constant-condition": ["error", { "checkLoops": false }],
"header/header": [2, "../../license-header"],
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": "error",
"indent": ["error", 2, {
"SwitchCase": 1,
}],
"no-unused-vars": "off",
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always",
}],
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn", {
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": true,
},
],
"quotes": ["error", "double", {
"avoidEscape": true,
"allowTemplateLiterals": true,
}],
"object-curly-spacing": ["error", "always", {
"objectsInObjects": false,
"arraysInObjects": true,
}],
"linebreak-style": ["error", "unix"],
"eol-last": ["error", "always"],
"semi": ["error", "always"],
"object-shorthand": "error",
"prefer-template": "error",
"template-curly-spacing": "error",
"no-unused-expressions": "error",
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" },
{ "blankLine": "always", "prev": "*", "next": "block-like" },
{ "blankLine": "always", "prev": "*", "next": "function" },
{ "blankLine": "always", "prev": "*", "next": "class" },
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
],
"no-template-curly-in-string": "error",
},
},
{
files: [
"**/*.ts",
"**/*.tsx",
],
parser: "@typescript-eslint/parser",
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
plugins: [
"header",
"unused-imports",
"react-hooks",
],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
rules: {
"no-constant-condition": ["error", {
"checkLoops": false,
}],
"header/header": [2, "../../license-header"],
"react/prop-types": "off",
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": ["error"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-restricted-imports": ["error", {
"paths": [
{
"name": ".",
"message": "No importing from local index.ts(x?) file. A common way to make circular dependencies.",
},
],
}],
"@typescript-eslint/member-delimiter-style": ["error", {
"multiline": {
"delimiter": "semi",
"requireLast": true,
},
"singleline": {
"delimiter": "semi",
"requireLast": false,
},
}],
"react/jsx-max-props-per-line": ["error", {
"maximum": {
"single": 2,
"multi": 1,
},
}],
"react/jsx-first-prop-new-line": ["error", "multiline"],
"react/jsx-one-expression-per-line": ["error", {
"allow": "single-child",
}],
"react/jsx-indent": ["error", 2],
"react/jsx-indent-props": ["error", 2],
"react/jsx-closing-tag-location": "error",
"react/jsx-wrap-multilines": ["error", {
"declaration": "parens-new-line",
"assignment": "parens-new-line",
"return": "parens-new-line",
"arrow": "parens-new-line",
"condition": "parens-new-line",
"logical": "parens-new-line",
"prop": "parens-new-line",
}],
"react/display-name": "off",
"space-before-function-paren": "off",
"@typescript-eslint/space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always",
}],
"@typescript-eslint/naming-convention": ["error",
{
"selector": "interface",
"format": ["PascalCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid",
"custom": {
"regex": "^Props$",
"match": false,
},
},
{
"selector": "typeAlias",
"format": ["PascalCase"],
"leadingUnderscore": "forbid",
"trailingUnderscore": "forbid",
"custom": {
"regex": "^(Props|State)$",
"match": false,
},
},
],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"unused-imports/no-unused-imports-ts": process.env.PROD === "true" ? "error" : "warn",
"unused-imports/no-unused-vars-ts": [
"warn", {
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": true,
},
],
"comman-dangle": "off",
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
"comma-spacing": "off",
"@typescript-eslint/comma-spacing": "error",
"indent": ["error", 2, {
"SwitchCase": 1,
}],
"quotes": ["error", "double", {
"avoidEscape": true,
"allowTemplateLiterals": true,
}],
"object-curly-spacing": "off",
"@typescript-eslint/object-curly-spacing": ["error", "always", {
"objectsInObjects": false,
"arraysInObjects": true,
}],
"semi": "off",
"@typescript-eslint/semi": ["error"],
"linebreak-style": ["error", "unix"],
"eol-last": ["error", "always"],
"object-shorthand": "error",
"prefer-template": "error",
"template-curly-spacing": "error",
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "error",
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" },
{ "blankLine": "always", "prev": "*", "next": "block-like" },
{ "blankLine": "always", "prev": "*", "next": "function" },
{ "blankLine": "always", "prev": "*", "next": "class" },
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "off",
"no-template-curly-in-string": "error",
"@typescript-eslint/consistent-type-imports": "error",
},
},
{
files: [
"src/{common,main,renderer}/**/*.ts",
"src/{common,main,renderer}/**/*.tsx",
],
rules: {
"no-restricted-imports": ["error", {
"paths": [
{
"name": ".",
"message": "No importing from local index.ts(x?) file. A common way to make circular dependencies.",
},
{
"name": "..",
"message": "No importing from parent index.ts(x?) file. A common way to make circular dependencies.",
},
],
"patterns": [
{
"group": [
"**/extensions/renderer-api/**/*",
"**/extensions/main-api/**/*",
"**/extensions/common-api/**/*",
],
message: "No importing from the extension api definitions in application code",
},
],
}],
},
},
],
};
+18
View File
@@ -0,0 +1,18 @@
{
"module": {
"type": "commonjs"
},
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": true,
"dynamicImport": false
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"target": "es2019"
}
}
+3
View File
@@ -0,0 +1,3 @@
disturl "https://electronjs.org/headers"
target "19.0.4"
runtime "electron"
+6
View File
@@ -0,0 +1,6 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
export default ""; // mostly path to bundled file or data-url (webpack)
+5 -124
View File
@@ -1,7 +1,6 @@
{
"name": "@k8slens/open-lens",
"productName": "OpenLens",
"description": "OpenLens - Open Source IDE for Kubernetes",
"description": "Lens Desktop Core",
"homepage": "https://github.com/lensapp/lens",
"version": "6.4.0-alpha.0",
"repository": {
@@ -37,7 +36,6 @@
"build/*.plist",
"build/installer.nsh",
"build/notarize.js",
"src/**/*",
"static/build/library/**/*",
"templates/**/*",
"types/*",
@@ -47,37 +45,19 @@
"license": "MIT",
"author": "OpenLens Authors <info@k8slens.dev>",
"scripts": {
"build": "yarn run compile-library",
"dev": "concurrently -i -k \"yarn run dev-run -C\" yarn:dev:*",
"dev-build": "concurrently yarn:compile:*",
"debug-build": "concurrently yarn:compile:main yarn:compile:extension-types",
"dev-run": "nodemon --watch ./static/build/main.js --exec \"electron --remote-debugging-port=9223 --inspect .\"",
"dev:main": "yarn run compile:main --watch --progress",
"dev:renderer": "yarn run ts-node webpack/dev-server.ts",
"build": "yarn run compile:library",
"clean": "rm -rf dist/ static/build binaries/",
"compile-library": "env NODE_ENV=production yarn run webpack --config webpack/library-bundle.ts",
"compile": "env NODE_ENV=production concurrently yarn:compile:*",
"compile:main": "yarn run webpack --config webpack/main.ts",
"compile:renderer": "yarn run webpack --config webpack/renderer.ts",
"compile:extension-types": "yarn run webpack --config webpack/extensions.ts",
"compile:library": "env NODE_ENV=production yarn run webpack --config webpack/library-bundle.ts",
"compile:node-fetch": "yarn run webpack --config ./webpack/node-fetch.ts",
"prepare": "yarn run compile:node-fetch",
"npm:fix-extensions-package-version": "yarn run ts-node build/set_extensions_npm_version.ts",
"build:linux": "yarn run compile && electron-builder --linux --dir",
"build:mac": "yarn run compile && electron-builder --mac --dir",
"build:win": "yarn run compile && electron-builder --win --dir",
"integration": "jest --runInBand --detectOpenHandles --forceExit integration",
"test:unit": "func() { jest ${1} --watch --testPathIgnorePatterns integration; }; func",
"test:integration": "func() { jest ${1:-xyz} --watch --runInBand --detectOpenHandles --forceExit --modulePaths=[\"<rootDir>/integration/\"]; }; func",
"dist": "yarn run compile && electron-builder --publish onTag",
"dist:dir": "yarn run dist --dir -c.compression=store -c.mac.identity=null",
"download:binaries": "yarn run ts-node build/download_binaries.ts",
"build:tray-icons": "yarn run ts-node build/generate-tray-icons.ts",
"build:theme-vars": "yarn run ts-node build/build_theme_vars.ts",
"lint": "PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .",
"lint:fix": "yarn run lint --fix",
"mkdocs-serve-local": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest",
"verify-docs": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict",
"version-checkout": "cat package.json | jq '.version' -r | xargs printf \"release/v%s\" | xargs git checkout -b",
"version-commit": "cat package.json | jq '.version' -r | xargs printf \"release v%s\" | git commit --no-edit -s -F -",
"version": "yarn run version-checkout && git add package.json && yarn run version-commit",
@@ -124,105 +104,7 @@
],
"runtime": "@side/jest-runtime"
},
"build": {
"generateUpdatesFilesForAllChannels": true,
"files": [
"static/**/*"
],
"afterSign": "build/notarize.js",
"extraResources": [
{
"from": "templates/",
"to": "./templates/",
"filter": "**/*.yaml"
},
"LICENSE"
],
"linux": {
"executableName": "open-lens",
"category": "Network",
"artifactName": "${productName}-${version}.${arch}.${ext}",
"target": [
"deb",
"rpm",
"AppImage"
],
"extraResources": [
{
"from": "binaries/client/linux/${arch}/kubectl",
"to": "./${arch}/kubectl"
},
{
"from": "binaries/client/linux/${arch}/lens-k8s-proxy",
"to": "./${arch}/lens-k8s-proxy"
},
{
"from": "binaries/client/linux/${arch}/helm",
"to": "./${arch}/helm"
}
]
},
"rpm": {
"fpm": [
"--rpm-rpmbuild-define=%define _build_id_links none"
]
},
"mac": {
"executableName": "OpenLens",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist",
"extraResources": [
{
"from": "binaries/client/darwin/${arch}/kubectl",
"to": "./${arch}/kubectl"
},
{
"from": "binaries/client/darwin/${arch}/lens-k8s-proxy",
"to": "./${arch}/lens-k8s-proxy"
},
{
"from": "binaries/client/darwin/${arch}/helm",
"to": "./${arch}/helm"
}
]
},
"win": {
"executableName": "OpenLens.exe",
"target": [
"nsis"
],
"extraResources": [
{
"from": "binaries/client/windows/${arch}/kubectl.exe",
"to": "./${arch}/kubectl.exe"
},
{
"from": "binaries/client/windows/${arch}/lens-k8s-proxy.exe",
"to": "./${arch}/lens-k8s-proxy.exe"
},
{
"from": "binaries/client/windows/${arch}/helm.exe",
"to": "./${arch}/helm.exe"
}
]
},
"nsis": {
"include": "build/installer.nsh",
"oneClick": false,
"allowElevation": true,
"createStartMenuShortcut": true,
"allowToChangeInstallationDirectory": true
},
"protocols": {
"name": "Lens Protocol Handler",
"schemes": [
"lens"
],
"role": "Viewer"
}
},
"build": {},
"resolutions": {
"@astronautlabs/jsonpath/underscore": "^1.12.1"
},
@@ -326,6 +208,7 @@
"@types/dompurify": "^2.4.0",
"@types/electron-devtools-installer": "^2.2.1",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^8.0.0",
"@types/glob-to-regexp": "^0.4.1",
"@types/gunzip-maybe": "^1.4.0",
"@types/hapi__call": "^9.0.0",
@@ -382,8 +265,6 @@
"deepdash": "^5.3.9",
"dompurify": "^2.4.1",
"electron": "^19.1.9",
"electron-builder": "^23.6.0",
"electron-notarize": "^0.3.0",
"esbuild": "^0.16.13",
"esbuild-loader": "^2.20.0",
"eslint": "^8.30.0",
@@ -7,7 +7,7 @@ import { getInjectionToken } from "@ogre-tools/injectable";
import type packageJson from "../../../package.json";
export type ApplicationInformation = Pick<typeof packageJson, "version" | "config" | "productName" | "copyright" | "description" | "name"> & {
build: Partial<typeof packageJson["build"]> & { publish?: unknown[] };
build: { [key:string]: any } & { publish?: unknown[] };
};
const applicationInformationToken = getInjectionToken<ApplicationInformation>({