Merge from develop

This commit is contained in:
Gervwyk 2020-11-03 14:44:30 +02:00
commit 1ab2562e39
101 changed files with 489 additions and 2050 deletions

1354
.pnp.js generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -28,7 +28,6 @@
"scripts": {
"build": "babel src --copy-files --out-dir dist",
"clean": "rm -rf dist",
"dev": "webpack serve",
"npm-publish": "npm publish --access public",
"prepare": "yarn build",
"prepublishOnly": "yarn build",
@ -61,7 +60,7 @@
"enzyme-to-json": "3.6.1",
"html-webpack-plugin": "4.5.0",
"identity-obj-proxy": "3.0.0",
"jest": "26.6.1",
"jest": "26.6.2",
"js-yaml": "3.14.0",
"path-browserify": "1.0.1",
"process": "0.11.10",

View File

@ -31,8 +31,8 @@
"npm-publish": "npm publish --access public",
"prepare": "yarn build",
"prepublishOnly": "yarn build",
"serve": "serve dist -p 3002",
"start": "webpack serve --config webpack.dev.js",
"start": "webpack serve --config webpack.demo.js",
"start:dev": "webpack serve --config webpack.dev.js",
"test": "jest --coverage --config jest.config.js --no-cache",
"version:prerelease": "yarn version prerelease",
"version:patch": "yarn version patch -d",
@ -59,11 +59,10 @@
"enzyme": "3.11.0",
"html-webpack-plugin": "4.5.0",
"identity-obj-proxy": "3.0.0",
"jest": "26.6.1",
"jest": "26.6.2",
"js-yaml": "3.14.0",
"react-markdown": "4.3.1",
"react-syntax-highlighter": "15.2.1",
"serve": "11.3.2",
"react-syntax-highlighter": "15.3.0",
"style-loader": "2.0.0",
"webpack": "5.3.2",
"webpack-cli": "4.1.0",

View File

@ -3,7 +3,7 @@ const { ModuleFederationPlugin } = require('webpack').container;
const path = require('path');
const fs = require('fs');
const package = require('./package.json');
const packageJson = require('./package.json');
const sanitizeName = (name) => {
return name
@ -70,21 +70,21 @@ module.exports = {
},
plugins: [
new ModuleFederationPlugin({
name: sanitizeName(package.name),
library: { type: 'var', name: sanitizeName(package.name) },
name: sanitizeName(packageJson.name),
library: { type: 'var', name: sanitizeName(packageJson.name) },
filename: 'remoteEntry.js',
exposes: blockModules(),
shared: {
...package.dependencies,
...packageJson.dependencies,
react: {
singleton: true, // only a single version of the shared module is allowed
requiredVersion: '~17.0.0',
version: package.dependencies.react,
version: packageJson.dependencies.react,
},
'react-dom': {
singleton: true, // only a single version of the shared module is allowed
requiredVersion: '~17.0.0',
version: package.dependencies['react-dom'],
version: packageJson.dependencies['react-dom'],
},
},
}),

View File

@ -0,0 +1,49 @@
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const packageJson = require('./package.json');
const sanitizeName = (name) => {
return name
.replace('@', '_at_')
.replace('/', '_slash_')
.replace('-', '_dash_')
.replace(/^[a-zA-Z0-9_]/g, '_');
};
const addRemoteEntryUrl = (content, absoluteFrom) => {
const scope = sanitizeName(packageJson.name);
const meta = JSON.parse(content);
meta.moduleFederation = {
module: path.basename(absoluteFrom, '.json'),
scope,
version: packageJson.version,
remoteEntryUrl: 'http://localhost:3002/remoteEntry.js',
};
return JSON.stringify(meta);
};
module.exports = merge(common, {
entry: './demo/index',
mode: 'development',
devtool: 'eval-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: 3002,
},
plugins: [
new CopyPlugin({
patterns: [
{
from: 'src/blocks/**/*.json',
transformPath: (targetPath) => {
return path.join('meta', path.basename(targetPath));
},
transform: addRemoteEntryUrl,
},
],
}),
],
});

View File

@ -3,7 +3,7 @@ const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const package = require('./package.json');
const packageJson = require('./package.json');
const sanitizeName = (name) => {
return name
@ -14,19 +14,19 @@ const sanitizeName = (name) => {
};
const addRemoteEntryUrl = (content, absoluteFrom) => {
const scope = sanitizeName(package.name);
const scope = sanitizeName(packageJson.name);
const meta = JSON.parse(content);
meta.moduleFederation = {
module: path.basename(absoluteFrom, '.json'),
scope,
version: package.version,
version: packageJson.version,
remoteEntryUrl: 'http://localhost:3002/remoteEntry.js',
};
return JSON.stringify(meta);
};
module.exports = merge(common, {
entry: './demo/index',
entry: './src/index.js',
mode: 'development',
devtool: 'eval-source-map',
devServer: {

View File

@ -3,7 +3,7 @@ const path = require('path');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const package = require('./package.json');
const packageJson = require('./package.json');
const sanitizeName = (name) => {
return name
@ -14,15 +14,15 @@ const sanitizeName = (name) => {
};
const addRemoteEntryUrl = (content, absoluteFrom) => {
const scope = sanitizeName(package.name);
const scope = sanitizeName(packageJson.name);
const meta = JSON.parse(content);
// if no moduleFederation info is provided, default to unpkg
if (!meta.moduleFederation) {
meta.moduleFederation = {
module: path.basename(absoluteFrom, '.json'),
scope,
version: package.version,
remoteEntryUrl: `https://unpkg.com/${package.name}@${package.version}/dist/remoteEntry.js`,
version: packageJson.version,
remoteEntryUrl: `https://unpkg.com/${packageJson.name}@${packageJson.version}/dist/remoteEntry.js`,
};
}
return JSON.stringify(meta);

View File

@ -56,7 +56,7 @@
"babel-jest": "26.6.2",
"babel-loader": "8.1.0",
"clean-webpack-plugin": "3.0.0",
"jest": "26.6.1",
"jest": "26.6.2",
"webpack": "5.3.2",
"webpack-cli": "4.1.0"
}

View File

@ -73,7 +73,7 @@
"clean-webpack-plugin": "3.0.0",
"css-loader": "5.0.0",
"html-webpack-plugin": "4.5.0",
"jest": "26.6.1",
"jest": "26.6.2",
"style-loader": "2.0.0",
"webpack": "5.3.2",
"webpack-cli": "4.0.0"

View File

@ -45,6 +45,6 @@
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"babel-jest": "26.6.2",
"jest": "26.6.1"
"jest": "26.6.2"
}
}

View File

@ -49,6 +49,6 @@
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"babel-jest": "26.6.2",
"jest": "26.6.1"
"jest": "26.6.2"
}
}

View File

@ -44,6 +44,6 @@
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"babel-jest": "26.6.2",
"jest": "26.6.1"
"jest": "26.6.2"
}
}

View File

@ -52,7 +52,7 @@
"babel-jest": "26.6.2",
"babel-loader": "8.1.0",
"clean-webpack-plugin": "3.0.0",
"jest": "26.6.1",
"jest": "26.6.2",
"webpack": "5.3.2",
"webpack-cli": "4.1.0"
}

View File

@ -46,7 +46,7 @@
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"babel-jest": "26.6.2",
"jest": "26.6.1",
"jest": "26.6.2",
"jest-diff": "26.6.2"
}
}

View File

@ -28,7 +28,6 @@
"scripts": {
"build": "babel src --out-dir dist",
"clean": "rm -rf dist",
"dev": "webpack serve",
"npm-publish": "npm publish --access public",
"prepare": "yarn build",
"prepublishOnly": "yarn build",
@ -60,7 +59,7 @@
"css-loader": "5.0.0",
"html-webpack-plugin": "4.5.0",
"identity-obj-proxy": "3.0.0",
"jest": "26.6.1",
"jest": "26.6.2",
"js-yaml": "3.14.0",
"less": "3.12.2",
"less-loader": "7.0.2",

View File

@ -46,7 +46,7 @@
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"babel-jest": "26.6.2",
"jest": "26.6.1",
"jest": "26.6.2",
"jest-diff": "26.6.2"
}
}

View File

@ -47,6 +47,6 @@
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"babel-jest": "26.6.2",
"jest": "26.6.1"
"jest": "26.6.2"
}
}

View File

@ -49,6 +49,6 @@
"@babel/core": "7.12.3",
"@babel/preset-env": "7.12.1",
"babel-jest": "26.6.2",
"jest": "26.6.1"
"jest": "26.6.2"
}
}

View File

@ -30,8 +30,8 @@
"clean": "rm -rf dist",
"npm-publish": "npm publish --access public",
"prepublishOnly": "yarn build",
"start": "serve dist -p 3001",
"dev": "webpack serve --config webpack.dev.js",
"serve": "serve dist -p 3001",
"start": "webpack serve --config webpack.dev.js",
"version:prerelease": "yarn version prerelease",
"version:patch": "yarn version patch -d",
"version:minor": "yarn version minor -d",

View File

@ -1,8 +0,0 @@
{
"extends": [
"config:base"
],
"baseBranches": [
"develop"
]
}

Some files were not shown because too many files have changed in this diff Show More