From 53948779c55a1253ca20effc81be5b53eb185e61 Mon Sep 17 00:00:00 2001 From: Dmitry Krupenya Date: Wed, 20 May 2020 14:59:25 +0300 Subject: [PATCH] chore: remove old configs --- webapp/configs/babel-rollup.config.js | 10 -- webapp/configs/babel.config.js | 17 --- webapp/configs/rollup.config.js | 81 ----------- webapp/configs/webpack/build-plugin.js | 23 --- webapp/configs/webpack/common.js | 187 ------------------------- 5 files changed, 318 deletions(-) delete mode 100644 webapp/configs/babel-rollup.config.js delete mode 100644 webapp/configs/babel.config.js delete mode 100644 webapp/configs/rollup.config.js delete mode 100644 webapp/configs/webpack/build-plugin.js delete mode 100644 webapp/configs/webpack/common.js diff --git a/webapp/configs/babel-rollup.config.js b/webapp/configs/babel-rollup.config.js deleted file mode 100644 index 04f99be204..0000000000 --- a/webapp/configs/babel-rollup.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - presets: [ - '@babel/preset-react', - ], - plugins: [ - '@babel/plugin-syntax-dynamic-import', - 'react-require', - 'reshadow/babel', - ], -} diff --git a/webapp/configs/babel.config.js b/webapp/configs/babel.config.js deleted file mode 100644 index aa436143dd..0000000000 --- a/webapp/configs/babel.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - presets: [ - "@babel/preset-env", - "@babel/preset-react", - ['@babel/preset-typescript', { isTSX: true, allExtensions: true }], - ], - plugins: [ - '@babel/plugin-transform-runtime', - '@babel/plugin-syntax-dynamic-import', - 'babel-plugin-transform-typescript-metadata', - '@babel/plugin-proposal-optional-chaining', - ['@babel/plugin-proposal-decorators', { legacy: true }], - ['@babel/plugin-proposal-class-properties', { loose: true }], - 'react-require', - 'reshadow/babel', - ], -} diff --git a/webapp/configs/rollup.config.js b/webapp/configs/rollup.config.js deleted file mode 100644 index cfbfa955e0..0000000000 --- a/webapp/configs/rollup.config.js +++ /dev/null @@ -1,81 +0,0 @@ -import babelPlugin from 'rollup-plugin-babel'; -const path = require('path'); -import postcssPlugin from 'rollup-plugin-postcss'; -import nodeResolve from 'rollup-plugin-node-resolve'; -import commonjs from 'rollup-plugin-commonjs'; -import peerDepsExternal from 'rollup-plugin-peer-deps-external'; -import includePaths from 'rollup-plugin-includepaths'; -import typescriptPlugin from 'rollup-plugin-typescript2'; - -const includePathOptions = { - include: {}, - paths: ['src'], - external: [ - - ], - extensions: ['.ts', '.tsx', '.js'] -}; - -export const defaultBuilderOptions = { - babelConfig: path.join(__dirname, './babel-rollup.config.js'), - typescriptConfig: '', // tbd -} - -export function configBuilder(options = defaultBuilderOptions) { - - return { - input: 'src/index.ts', - output: [ - { - dir: 'dist', - format: 'esm', - }, - ], - external: [ - // externals beyond peer dependencies - ], - plugins: [ - includePaths(includePathOptions), - nodeResolve(), - commonjs({ - sourceMap: false, - }), - typescriptPlugin({ - tsconfig: 'tsconfig.build.json', - useTsconfigDeclarationDir: true, - }), - babelPlugin({ - exclude: 'node_modules/**', - extensions: ['.js', '.ts', '.tsx'], - configFile: options.babelConfig, - }), - postcssPlugin({ - extract: false, - // enable CSS modules for .module.css .module.scss files - autoModules: true, - // modules: { - // generateScopedName: "[local]___[hash:base64:5]" - // }, - inject: true, - use: { - sass: { - includePaths: ['node_modules', '../../node_modules'], - } - }, - // this option is added in dkrupenya/rollup-plugin-postcss#develop - // todo to be converted to custom loader - firstPlugin: require('reshadow/postcss'), - plugins: [ - require('postcss-preset-env')({ stage: 0 }), - require('postcss-discard-comments'), - // todo move 'reshadow/postcss' to custom loader to run it before postcss-loader - // require('reshadow/postcss'), - ] - }), - peerDepsExternal(), - ], - }; - -} - -export default configBuilder(defaultBuilderOptions); diff --git a/webapp/configs/webpack/build-plugin.js b/webapp/configs/webpack/build-plugin.js deleted file mode 100644 index df115404ab..0000000000 --- a/webapp/configs/webpack/build-plugin.js +++ /dev/null @@ -1,23 +0,0 @@ -const merge = require('webpack-merge'); -const {resolve} = require('path'); -var PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin'); - -const commonConfig = require('./common'); - -module.exports = (env, argv) => merge(commonConfig(env, argv), { - mode: argv.mode || 'development', - entry: resolve(__dirname, '../../src/index.ts'), // todo - output: { - filename: 'index.js', - path: resolve(__dirname, '../../dist'), - library: 'basicConnectionPlugin', // todo pass from package.js - libraryTarget: 'umd', - }, - externals: [ - /^@dbeaver\/.+$/ - ], - devtool: 'source-map', - plugins: [ - new PeerDepsExternalsPlugin(), // allow to treat all peerDependencies as externals - ], -}); diff --git a/webapp/configs/webpack/common.js b/webapp/configs/webpack/common.js deleted file mode 100644 index becb4f9072..0000000000 --- a/webapp/configs/webpack/common.js +++ /dev/null @@ -1,187 +0,0 @@ -// shared config (dev and prod) -const webpack = require('webpack'); -const ModuleDependencyWarning = require("webpack/lib/ModuleDependencyWarning"); -const path = require('path'); -const CircularDependencyPlugin = require('circular-dependency-plugin'); -const MiniCssExtractPlugin = require('mini-css-extract-plugin'); - - -// Temporary solution to remove wrong warning messages (it's was fixed https://github.com/microsoft/TypeScript/pull/35200 in typescript 3.8) -class IgnoreNotFoundExportPlugin { - apply(compiler) { - const messageRegExp = /export '.*'( \(reexported as '.*'\))? was not found in/ - function doneHook(stats) { - stats.compilation.warnings = stats.compilation.warnings.filter(function (warn) { - if (warn instanceof ModuleDependencyWarning && messageRegExp.test(warn.message)) { - return false - } - return true; - }) - } - if (compiler.hooks) { - compiler.hooks.done.tap("IgnoreNotFoundExportPlugin", doneHook) - } else { - compiler.plugin("done", doneHook) - } - } -} - -module.exports = (env, argv) => { - - function generateStyleLoaders(options = { hasModule: false }) { - const moduleScope = options.hasModule ? 'local' : 'global'; - const modules = { - mode: moduleScope, - localIdentName: '[local]___[hash:base64:5]', - }; - - const postCssPlugins = [ - require('postcss-preset-env')({ stage: 0 }), - require('@csstools/postcss-sass')({ - includePaths: ['node_modules', path.resolve('../../node_modules')], - }), - require('postcss-discard-comments'), - require('reshadow/postcss')({ scopeBehaviour: moduleScope }) - ]; - - // 'use' clause in webpack rules - return [ - { - loader: MiniCssExtractPlugin.loader, - options: { - hot: argv.mode !== 'production', - }, - }, - { - loader: 'css-loader', - options: { - importLoaders: 1, - modules: modules, - } - }, - { - loader: 'postcss-loader', - options: { - syntax: 'postcss-scss', - plugins: postCssPlugins, - }, - }, - ]; - } - - return { - resolve: { - extensions: ['.ts', '.tsx', '.js', '.jsx'], - }, - module: { - rules: [ - { - test: /\.js$/, - use: [ - { - loader: 'babel-loader', - options: { - configFile: path.join(__dirname, '../babel.config.js') - }, - }, - 'source-map-loader' - ], - exclude: /node_modules/, - }, - { - test: /\.tsx?$/, - use: [ - { - loader: 'babel-loader', - options: { - configFile: path.join(__dirname, '../babel.config.js') - }, - }, - { - loader: 'eslint-loader', - // uncomment to fix after rule changes - // options: { - // fix: true, - // }, - } - ], - }, - { - test: /\.(css|scss|sass)$/, - oneOf: [ - // css-module files ( should have *.module mask ) - { - test: /\.module\.(css|scss|sass)$/, - use: generateStyleLoaders({ hasModule: true }), - }, - { - include: /node_modules/, - use: [ - { - loader: MiniCssExtractPlugin.loader, - options: { - hot: argv.mode !== 'production', - }, - }, - 'css-loader', - ] - }, - { - use: generateStyleLoaders({ hasModule: false }), - } - ] - }, - { - test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i, - loader: 'url-loader', - options: { - limit: 8192, - }, - }, - ], - }, - optimization: { - minimize: false, - namedModules: true, - concatenateModules: false, - }, - plugins: [ - new IgnoreNotFoundExportPlugin(), - new webpack.ProgressPlugin({ - entries: true, - modules: true, - modulesCount: 100, - profile: true, - handler: (percentage, message, ...args) => { - // custom logic - } - }), - new CircularDependencyPlugin({ - // exclude detection of files based on a RegExp - exclude: /a\.js|node_modules/, - // include specific files based on a RegExp - // include: /dir/, - // add errors to webpack instead of warnings - failOnError: false, - // allow import cycles that include an asyncronous import, - // e.g. via import(/* webpackMode: "weak" */ './file.js') - allowAsyncCycles: false, - // set the current working directory for displaying module paths - cwd: process.cwd(), - }), - new MiniCssExtractPlugin({ - // Options similar to the same options in webpackOptions.output - // all options are optional - filename: argv.mode !== 'production' ? '[name].css' : '[name].[hash].css', - chunkFilename: argv.mode !== 'production' ? '[name].css' : '[name].[hash].css', - ignoreOrder: false, // Enable to remove warnings about conflicting order - }), - // new webpack.optimize.LimitChunkCountPlugin({ - // maxChunks: 1, - // }), - ], - performance: { - hints: false, - }, - }; -};