Generate example for codecov issue

This commit is contained in:
dannyrb 2019-07-19 14:54:34 -04:00
parent d64cdc429e
commit 37f60ba0af
6 changed files with 101 additions and 11 deletions

View File

@ -0,0 +1,90 @@
const path = require("path");
const ExtractCssChunks = require("extract-css-chunks-webpack-plugin");
const SRC_DIR = path.join(__dirname, "../src");
const PUBLIC_DIR = path.join(__dirname, "../public");
const DIST_DIR = path.join(__dirname, "../dist");
module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
return {
entry: {
app: `${SRC_DIR}/index.js`
},
context: SRC_DIR,
module: {
rules: [
{
test: /\.jsx?$/,
exclude: [/node_modules/, /packages\\extension/],
loader: "babel-loader",
options: {
// Find babel.config.js in monorepo root
// https://babeljs.io/docs/en/options#rootmode
rootMode: "upward",
presets: [
[
"@babel/preset-env",
{
// Do not transform ES6 modules to another format.
// Webpack will take care of that.
modules: false
}
]
]
}
},
{
test: /\.css$/,
use: [
"style-loader",
ExtractCssChunks.loader,
{ loader: "css-loader", options: { importLoaders: 1 } },
{
loader: "postcss-loader",
options: {
config: {
path: "./postcss.config.js"
}
}
}
]
},
/**
* This allows us to include web workers in our bundle, and VTK.js
* web workers in our bundle. While this increases bundle size, it
* cuts down on the number of includes we need for `script tag` usage.
*/
{
test: /\.worker\.js$/,
include: /vtk\.js[\/\\]Sources/,
use: [
{
loader: "worker-loader",
options: { inline: true, fallback: false }
}
]
},
/**
* This is exclusively used by `vtk.js` to bundle glsl files.
*/
{
test: /\.glsl$/i,
include: /vtk\.js[\/\\]Sources/,
loader: "shader-loader"
}
]
},
resolve: {
// Which directories to search when resolving modules
modules: [
path.resolve(__dirname, "../node_modules"),
path.resolve(__dirname, "../../../node_modules"),
SRC_DIR
],
// Attempt to resolve these extensions in order.
extensions: [".js", ".jsx", ".json", "*"],
// symlinked resources are resolved to their real path, not their symlinked location
symlinks: true
}
};
};

View File

@ -19,10 +19,11 @@
### Global
| Commands | | |
| -------------- | --- | ----------------------------------------------------- |
| `test:unit` | | Jest multi-project test runner; overall coverage |
| `test:unit:ci` | | Runs tests in parallel. Reports coverage per project. |
| Commands | | |
| --------------- | --- | ----------------------------------------------------- |
| `build:package` | | Builds commonjs bundles for all projects |
| `test:unit` | | Jest multi-project test runner; overall coverage |
| `test:unit:ci` | | Runs tests in parallel. Reports coverage per project. |
### Local

View File

@ -13,12 +13,12 @@
"scripts": {
"cm": "npx git-cz",
"start": "lerna run lerna:start --parallel",
"build": "lerna run lerna:build --parallel",
"build:package": "lerna run build:package --parallel",
"test:ci": "",
"test:unit": "jest --collectCoverage",
"test:unit:ci": "lerna run test:unit:ci --parallel",
"test:e2e": "",
"test:e2e:ci": "lerna run lerna:test:e2e --parallel && codecov",
"test:e2e:ci": "lerna run lerna:test:e2e --parallel",
"new-version": "lerna version --conventional-commits --yes",
"build:pwa:ci": ""
},

View File

@ -16,7 +16,7 @@
},
"scripts": {
"test:unit": "jest --watch",
"test:unit:ci": "jest --ci --runInBand --collectCoverage",
"test:unit:ci": "jest --ci --runInBand --collectCoverage && codecov --flags=core",
"build": "rollup -c",
"lerna:build": "webpack --config config/webpack.prod.js -w -d",
"dev": "jest --watch",

View File

@ -16,7 +16,7 @@
],
"scripts": {
"test:unit": "jest --watch",
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests",
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests && codecov --flags=ui",
"dev": "docz dev",
"lerna:build": "webpack --config config/webpack.prod.js -w -d",
"build": "rollup -c",

View File

@ -14,12 +14,11 @@
"proxy": "http://localhost:8042",
"scripts": {
"lerna:start": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack.dev.js --mode development -w -d",
"build:package": "webpack --config config/webpack.prod.js",
"test:unit": "jest --watch",
"test:unit:ci": "jest --ci --runInBand --collectCoverage",
"test:unit:ci": "jest --ci --runInBand --collectCoverage && codecov --flags=viewer",
"dev": "yarn run preBuild && react-scripts start",
"dev:debug": "react-scripts start",
"build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
"build:package:ci": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
"build:web": "yarn run preBuild && react-scripts --max_old_space_size=4096 build",
"build:demo:ci": "yarn run preBuild && cross-env PUBLIC_URL=/ REACT_APP_CONFIG=config/demo.js react-scripts --max_old_space_size=4096 build",
"test:e2e:ci": "start-server-and-test start http://localhost:5000 cy:run:ci",