chore: remove old configs

This commit is contained in:
Dmitry Krupenya
2020-05-20 14:59:25 +03:00
parent 9cb91ab252
commit 53948779c5
5 changed files with 0 additions and 318 deletions
-10
View File
@@ -1,10 +0,0 @@
module.exports = {
presets: [
'@babel/preset-react',
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'react-require',
'reshadow/babel',
],
}
-17
View File
@@ -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',
],
}
-81
View File
@@ -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);
-23
View File
@@ -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
],
});
-187
View File
@@ -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,
},
};
};