mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Chore/prettier (#1707)
* chore: add prettier * chore: format code * chore: remove eslint ts integration * chore: update webpack.config
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2019,
|
||||
"sourceType": "module",
|
||||
"project": "tsconfig.eslint.json",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@ const ModuleDependencyWarning = require('webpack/lib/ModuleDependencyWarning');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
|
||||
const WorkboxPlugin = require('workbox-webpack-plugin');
|
||||
|
||||
const excludedFromVendor = require('./excludedFromVendor.js');
|
||||
const { getServiceWorkerSource } = require('./webpack.product.utils.js');
|
||||
// const ESLintPlugin = require('eslint-webpack-plugin');
|
||||
|
||||
class IgnoreNotFoundExportPlugin {
|
||||
@@ -63,10 +61,7 @@ module.exports = (env, argv) => {
|
||||
modules = false;
|
||||
}
|
||||
|
||||
const postCssPlugins = [
|
||||
require('postcss-preset-env')({ stage: 0 }),
|
||||
require('@reshadow/postcss')({ scopeBehaviour: moduleScope }),
|
||||
];
|
||||
const postCssPlugins = [require('postcss-preset-env')({ stage: 0 }), require('@reshadow/postcss')({ scopeBehaviour: moduleScope })];
|
||||
|
||||
return [
|
||||
...getBaseStyleLoaders(),
|
||||
@@ -107,27 +102,6 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
};
|
||||
|
||||
var workboxPlugin = [];
|
||||
if (devMode) {
|
||||
// TODO: workbox not working in dev mode
|
||||
|
||||
// workboxPlugin = new WorkboxPlugin.InjectManifest({
|
||||
// swSrc: getServiceWorkerSource(),
|
||||
// swDest: 'service-worker.js',
|
||||
// });
|
||||
// Object.defineProperty(workboxPlugin, 'alreadyCalled', {
|
||||
// get() {
|
||||
// return false;
|
||||
// },
|
||||
// set() {},
|
||||
// });
|
||||
} else {
|
||||
workboxPlugin = [new WorkboxPlugin.InjectManifest({
|
||||
swSrc: getServiceWorkerSource(),
|
||||
swDest: 'service-worker.js',
|
||||
})];
|
||||
}
|
||||
|
||||
return {
|
||||
// target: !devMode ? "web" : "browserslist",
|
||||
optimization: {
|
||||
@@ -206,15 +180,11 @@ module.exports = (env, argv) => {
|
||||
fallback: {
|
||||
// path: require.resolve('path-browserify'),
|
||||
},
|
||||
plugins: [
|
||||
PnpWebpackPlugin,
|
||||
],
|
||||
plugins: [PnpWebpackPlugin],
|
||||
},
|
||||
resolveLoader: {
|
||||
modules: nodeModules,
|
||||
plugins: [
|
||||
PnpWebpackPlugin.moduleLoader(module),
|
||||
],
|
||||
plugins: [PnpWebpackPlugin.moduleLoader(module)],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
@@ -226,10 +196,7 @@ module.exports = (env, argv) => {
|
||||
{
|
||||
test: /\.(ts|js)x?$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
'thread-loader',
|
||||
babelLoader,
|
||||
],
|
||||
use: ['thread-loader', babelLoader],
|
||||
},
|
||||
{
|
||||
test: /\.(css|s[ac]ss)$/,
|
||||
@@ -240,11 +207,7 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
{
|
||||
include: /node_modules/,
|
||||
use: [
|
||||
...getBaseStyleLoaders(),
|
||||
'css-loader',
|
||||
'sass-loader',
|
||||
],
|
||||
use: [...getBaseStyleLoaders(), 'css-loader', 'sass-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.(theme|pure)\.(css|s[ac]ss)$/,
|
||||
@@ -291,7 +254,6 @@ module.exports = (env, argv) => {
|
||||
}
|
||||
},
|
||||
}),
|
||||
...workboxPlugin,
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
const { resolve } = require('path');
|
||||
var PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');
|
||||
const PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');
|
||||
const { merge } = require('webpack-merge');
|
||||
|
||||
const commonConfig = require('./webpack.config.js');
|
||||
|
||||
var main = resolve('src/index.ts');
|
||||
var outputDir = resolve('lib');
|
||||
var package = require(resolve('package.json'));
|
||||
const main = resolve('src/index.ts');
|
||||
const outputDir = resolve('lib');
|
||||
const package = require(resolve('package.json'));
|
||||
|
||||
module.exports = (env, argv) => merge(commonConfig(env, argv), {
|
||||
entry: main,
|
||||
entry: {
|
||||
[package.name.replace('@cloudbeaver/', '')]: main,
|
||||
},
|
||||
output: {
|
||||
filename: 'index.[contenthash].js',
|
||||
filename: '[name].js',
|
||||
chunkFilename: '[name].[contenthash].bundle.js',
|
||||
library: package.name,
|
||||
libraryTarget: 'commonjs',
|
||||
|
||||
@@ -3,6 +3,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
const WorkboxPlugin = require('workbox-webpack-plugin');
|
||||
const { merge } = require('webpack-merge');
|
||||
|
||||
const commonConfig = require('./webpack.config.js');
|
||||
@@ -15,58 +16,85 @@ const sso = require.resolve('@cloudbeaver/plugin-sso/src/index.ts');
|
||||
const ssoHtmlTemplate = require.resolve('@cloudbeaver/plugin-sso/src/index.html.ejs');
|
||||
const outputDir = resolve('lib');
|
||||
const package = require(resolve('package.json'));
|
||||
const { getServiceWorkerSource } = require('./webpack.product.utils.js');
|
||||
|
||||
const timestampVersion = withTimestamp(package.version);
|
||||
|
||||
module.exports = (env, argv) => merge(commonConfig(env, argv), {
|
||||
entry: {
|
||||
main,
|
||||
sso,
|
||||
},
|
||||
output: {
|
||||
filename: 'index.[contenthash].js',
|
||||
chunkFilename: '[name].[contenthash].bundle.js',
|
||||
library: package.name,
|
||||
libraryTarget: 'umd',
|
||||
path: outputDir,
|
||||
pathinfo: false,
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
module.exports = (env, argv) => {
|
||||
const devMode = argv.mode !== 'production';
|
||||
|
||||
minimizer: [new TerserPlugin({
|
||||
extractComments: /Copyright \(C\)/i,
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true,
|
||||
},
|
||||
})],
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: getAssets(package, ''),
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
_VERSION_: JSON.stringify(timestampVersion),
|
||||
_DEV_: false,
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: resolve('src/index.html.ejs'),
|
||||
inject: 'body',
|
||||
chunks: ['main'],
|
||||
version: timestampVersion,
|
||||
title: package.product?.name,
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'sso.html',
|
||||
template: ssoHtmlTemplate,
|
||||
inject: 'body',
|
||||
chunks: ['sso'],
|
||||
version: timestampVersion,
|
||||
title: package.product?.name,
|
||||
}),
|
||||
new HtmlInjectWebpackPlugin({
|
||||
body: [{ attributes: { hidden: true }, tagName: 'object', innerHTML: '{STATIC_CONTENT}', voidTag: false }],
|
||||
}),
|
||||
],
|
||||
});
|
||||
var workboxPlugin = [];
|
||||
if (devMode) {
|
||||
// TODO: workbox not working in dev mode
|
||||
|
||||
// workboxPlugin = new WorkboxPlugin.InjectManifest({
|
||||
// swSrc: getServiceWorkerSource(),
|
||||
// swDest: 'service-worker.js',
|
||||
// });
|
||||
// Object.defineProperty(workboxPlugin, 'alreadyCalled', {
|
||||
// get() {
|
||||
// return false;
|
||||
// },
|
||||
// set() {},
|
||||
// });
|
||||
} else {
|
||||
workboxPlugin = [new WorkboxPlugin.InjectManifest({
|
||||
swSrc: getServiceWorkerSource(),
|
||||
swDest: 'service-worker.js',
|
||||
})];
|
||||
}
|
||||
|
||||
return merge(commonConfig(env, argv), {
|
||||
entry: {
|
||||
main,
|
||||
sso,
|
||||
},
|
||||
output: {
|
||||
filename: 'index.[contenthash].js',
|
||||
chunkFilename: '[name].[contenthash].bundle.js',
|
||||
library: package.name,
|
||||
libraryTarget: 'umd',
|
||||
path: outputDir,
|
||||
pathinfo: false,
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
|
||||
minimizer: [new TerserPlugin({
|
||||
extractComments: /Copyright \(C\)/i,
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true,
|
||||
},
|
||||
})],
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: getAssets(package, ''),
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
_VERSION_: JSON.stringify(timestampVersion),
|
||||
_DEV_: false,
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: resolve('src/index.html.ejs'),
|
||||
inject: 'body',
|
||||
chunks: ['main'],
|
||||
version: timestampVersion,
|
||||
title: package.product?.name,
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'sso.html',
|
||||
template: ssoHtmlTemplate,
|
||||
inject: 'body',
|
||||
chunks: ['sso'],
|
||||
version: timestampVersion,
|
||||
title: package.product?.name,
|
||||
}),
|
||||
new HtmlInjectWebpackPlugin({
|
||||
body: [{ attributes: { hidden: true }, tagName: 'object', innerHTML: '{STATIC_CONTENT}', voidTag: false }],
|
||||
}),
|
||||
...workboxPlugin,
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,3 +19,6 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
"module": "lib/index.js",
|
||||
"main": "lib/core-di.js",
|
||||
"module": "lib/core-di.js",
|
||||
"types": "src/index.ts",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf --glob lib/*",
|
||||
"build": "webpack --config ../../configs/webpack.plugin.config.js",
|
||||
"build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js",
|
||||
"postbuild": "tsc",
|
||||
"lint": "eslint ./src/ --ext .ts,.tsx",
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix",
|
||||
@@ -17,11 +17,11 @@
|
||||
"validate-dependencies": "core-cli-validate-dependencies"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cloudbeaver/core-executor": "~0.1.0",
|
||||
"@cloudbeaver/core-utils": "~0.1.0",
|
||||
"inversify": "~6.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@cloudbeaver/core-executor": "~0.1.0",
|
||||
"@cloudbeaver/core-utils": "~0.1.0",
|
||||
"react": "~18.x.x"
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"composite": true
|
||||
"declarationMap": true,
|
||||
"composite": true,
|
||||
"declaration": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["**/node_modules", "**/.*/"],
|
||||
"references": [{ "path": "../*" }]
|
||||
"references": [{ "path": "../core-executor" }, { "path": "../core-utils" }]
|
||||
}
|
||||
|
||||
@@ -19,3 +19,6 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
@@ -4,21 +4,20 @@
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
"module": "lib/index.js",
|
||||
"main": "lib/core-executor.js",
|
||||
"module": "lib/core-executor.js",
|
||||
"types": "src/index.ts",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf --glob lib/*",
|
||||
"build": "webpack --config ../../configs/webpack.plugin.config.js",
|
||||
"build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js",
|
||||
"postbuild": "tsc",
|
||||
"lint": "eslint ./src/ --ext .ts,.tsx",
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix",
|
||||
"validate-dependencies": "core-cli-validate-dependencies"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cloudbeaver/core-utils": "~0.1.0"
|
||||
},
|
||||
"dependencies": { },
|
||||
"peerDependencies": {
|
||||
"@cloudbeaver/core-utils": "~0.1.0",
|
||||
"mobx": "~6.x.x"
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"composite": true
|
||||
"declarationMap": true,
|
||||
"composite": true,
|
||||
"declaration": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["**/node_modules", "**/.*/"],
|
||||
"references": [{ "path": "../*" }]
|
||||
"exclude": ["**/node_modules", "**/.*/", "src/**/*.test.ts", "src/**/*.test.tsx"],
|
||||
"references": [{ "path": "../core-utils" }]
|
||||
}
|
||||
|
||||
@@ -19,3 +19,6 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
@@ -4,12 +4,12 @@
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
"module": "lib/index.js",
|
||||
"main": "lib/core-utils.js",
|
||||
"module": "lib/core-utils.js",
|
||||
"types": "src/index.ts",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf --glob lib/*",
|
||||
"build": "webpack --config ../../configs/webpack.plugin.config.js",
|
||||
"build": "core-cli-build --mode=production --config ../core-cli/configs/webpack.plugin.config.js",
|
||||
"postbuild": "tsc",
|
||||
"lint": "eslint ./src/ --ext .ts,.tsx",
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix",
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"composite": true
|
||||
"declarationMap": true,
|
||||
"composite": true,
|
||||
"declaration": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["**/node_modules", "**/.*/"],
|
||||
"references": [{ "path": "../*" }]
|
||||
"exclude": ["**/node_modules", "**/.*/", "src/**/*.test.ts", "src/**/*.test.tsx"],
|
||||
"references": []
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": [
|
||||
".eslintrc.cjs",
|
||||
"packages/*/src",
|
||||
"packages/*/tests",
|
||||
"packages/*/bin",
|
||||
"packages/*/mocks",
|
||||
"packages/*/configs"
|
||||
],
|
||||
}
|
||||
@@ -52,10 +52,5 @@
|
||||
"node",
|
||||
"jest"
|
||||
],
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "./packages/*"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user