mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Switch to using messaging and startable stoppable from NPM package (#7368)
* Add custom jest resolver to fix requiring "uuid" module Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Update dependencies Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Introduce test utils for rendering and running with thrown mobx reactions Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Extract startable-stoppable to NPM package Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Extract messaging to NPM package Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using startable-stoppable from NPM package Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using messaging from the Feature Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove old implementation of messaging Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make setupping app paths happen earlier in renderer Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix typo Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add kludge to make testing-library work properly from test-utils package Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix code style Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add lint:fix -root script Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix unrelated failing unit tests Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Turn of no-floating-promises from typescript linting for being broken Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make linting not happen for dist -directories Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make linting failures appear as failure Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Stop running prettier twice It already gets ran as eslint-plugin. Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make CI run unit tests for all packages by consolidating name of NPM script Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add missing unit tests for coverage Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Skip coverage for test utils Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove check for coverage in packages which are not ready for it Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Stop collecting coverage from index.ts files them being indirections to the implementation Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Implement sending message to channel in main Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add missing feature dependencies Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add dummy implementations for requesting in main from renderer Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Re-enable communicating from main to cluster frames Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Ignore trivial files from coverage Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Update package-lock Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Extract message-bridge to separate NPM package to prevent dev dependencies being in the production bundle Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Extract computed channel to own NPM package for clear dependencies Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Consolidate electron related stuff to a directory Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add missing publish configurations Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Ignore test implementation from coverage being not interesting Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> --------- Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
df49ff9b96
commit
0f1f030a06
261 files changed
+4447
-1795
No files matched your search
@@ -8,13 +8,7 @@ const shouldDoTheFix = argv.includes('--fix');
|
||||
try {
|
||||
execSync(`eslint ${shouldDoTheFix ? "--fix " : " "}--ext ts,tsx --max-warnings=0 .`);
|
||||
} catch (error) {
|
||||
console.log(error.stdout.toString());
|
||||
}
|
||||
console.error(error.stdout.toString());
|
||||
|
||||
try {
|
||||
const result = execSync(`prettier ${shouldDoTheFix ? "--write" : "--check"} "**/*.{js,ts,tsx}"`);
|
||||
|
||||
console.log(result.toString());
|
||||
} catch (error) {
|
||||
console.log(error.stdout.toString());
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ module.exports = {
|
||||
"xss",
|
||||
"no-unsanitized"
|
||||
],
|
||||
ignorePatterns: ["dist/*"],
|
||||
rules: {
|
||||
"react/react-in-jsx-scope": 0,
|
||||
"security/detect-object-injection": "off",
|
||||
@@ -125,7 +126,7 @@ module.exports = {
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"@typescript-eslint/no-floating-promises": "off",
|
||||
"@typescript-eslint/interface-name-prefix": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
module.exports = (path, options) => {
|
||||
// Call the defaultResolver, so we leverage its cache, error handling, etc.
|
||||
return options.defaultResolver(path, {
|
||||
...options,
|
||||
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
|
||||
packageFilter: pkg => {
|
||||
// This is a workaround for https://github.com/uuidjs/uuid/pull/616
|
||||
//
|
||||
// jest-environment-jsdom 28+ tries to use browser exports instead of default exports,
|
||||
// but uuid only offers an ESM browser export and not a CommonJS one. Jest does not yet
|
||||
// support ESM modules natively, so this causes a Jest error related to trying to parse
|
||||
// "export" syntax.
|
||||
//
|
||||
// This workaround prevents Jest from considering uuid's module-based exports at all;
|
||||
// it falls back to uuid's CommonJS+node "main" property.
|
||||
//
|
||||
// Once we're able to migrate our Jest config to ESM and a browser crypto
|
||||
// implementation is available for the browser+ESM version of uuid to use (eg, via
|
||||
// https://github.com/jsdom/jsdom/pull/3352 or a similar polyfill), this can go away.
|
||||
switch (pkg.name) {
|
||||
case "uuid":
|
||||
delete pkg["exports"];
|
||||
delete pkg["module"];
|
||||
break;
|
||||
}
|
||||
|
||||
return pkg;
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -1,5 +1,9 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = (rootDir) => {
|
||||
const shared = {
|
||||
"resolver": path.join(__dirname, "jest-28-resolver.js"),
|
||||
|
||||
transform: {
|
||||
"^.+\\.(t|j)sx?$": ["@swc/jest", { cwd: rootDir }],
|
||||
},
|
||||
@@ -15,6 +19,8 @@ module.exports = (rootDir) => {
|
||||
collectCoverageFrom: [
|
||||
"<rootDir>/src/**/*.{ts,tsx}",
|
||||
"!<rootDir>/src/**/*.no-coverage.ts",
|
||||
"!<rootDir>/src/**/test-utils/**/*.{ts,tsx}",
|
||||
"!<rootDir>/src/**/index.{ts,tsx}",
|
||||
],
|
||||
|
||||
moduleNameMapper: {
|
||||
|
||||
Reference in new issue
Block a user