Skip to content

Commit

Permalink
🔧 upgrade to webpack 4 (#3252)
Browse files Browse the repository at this point in the history
* upgrade to webpack 4

* migrate webpack config

* add cssnano, though it doesn't seem to work

* fix cssnano in docs-app

* small config refactors

* upgrade karma deps

* migrate karma webpack usage.

use webpack alias for enzyme adapter instead of template string

* upgrade sinon

* skip borked table tests that rely on now-impossible sinon spy behavior.

sinonjs/sinon#1711

* fix lint

* Use cjs modules for karma testing

* Forgot to enable cjs for table
  • Loading branch information
giladgray authored Jan 9, 2019
1 parent 9987b6b commit 5175bd8
Show file tree
Hide file tree
Showing 29 changed files with 2,280 additions and 2,053 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@types/react": "^16.4.14",
"@types/react-dom": "^16.0.7",
"@types/react-transition-group": "^2.0.6",
"@types/sinon": "^4.1.2",
"@types/sinon": "^7.0.3",
"@types/webpack": "^3.8.8",
"chai": "^4.1.2",
"circle-github-bot": "^2.0.1",
Expand All @@ -53,7 +53,7 @@
"http-server": "^0.11.1",
"lerna": "^2.7.1",
"npm-run-all": "^4.1.2",
"sinon": "^4.1.4",
"sinon": "^7.2.2",
"stylelint-config-palantir": "^3.0.2",
"stylelint-scss": "^2.5.0",
"typescript": "~2.8.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
"@blueprintjs/node-build-scripts": "*",
"@blueprintjs/test-commons": "^0.8.0",
"enzyme": "^3.3.0",
"karma": "^1.7.1",
"karma": "^3.1.4",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"sass-inline-svg": "^1.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../../config/tsconfig.base",
"extends": "../src/tsconfig",
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"noEmit": true,
"lib": [
"dom",
Expand Down
4 changes: 1 addition & 3 deletions packages/core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const path = require("path");

module.exports = Object.assign({}, baseConfig, {
entry: {
core: [
"./src/index.ts"
],
core: "./src/index.ts",
},

externals: COMMON_EXTERNALS,
Expand Down
4 changes: 2 additions & 2 deletions packages/datetime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
"@blueprintjs/node-build-scripts": "*",
"@blueprintjs/test-commons": "^0.8.0",
"enzyme": "^3.3.0",
"karma": "^1.7.1",
"karma": "^3.1.4",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/datetime/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../../config/tsconfig.base",
"extends": "../src/tsconfig",
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"noEmit": true
}
}
4 changes: 2 additions & 2 deletions packages/docs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"@blueprintjs/webpack-build-scripts": "*",
"@types/chroma-js": "^1.3.3",
"npm-run-all": "^4.1.2",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/icons/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../../config/tsconfig.base",
"extends": "../src/tsconfig",
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"noEmit": true
}
}
10 changes: 2 additions & 8 deletions packages/karma-build-scripts/createKarmaConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = function createKarmaConfig(
},
port: KARMA_SERVER_PORT,
preprocessors: {
[path.join(dirname, "test/**/*.ts")]: "sourcemap",
[path.join(dirname, "test/**/*.ts")]: ["sourcemap"],
[path.join(dirname, "test/index.ts")]: ["webpack", "sourcemap"],
},
// define where to save final remapped coverage reports
Expand All @@ -80,13 +80,7 @@ module.exports = function createKarmaConfig(
},
reporters: ["mocha"],
singleRun: true,
webpack: Object.assign({}, webpackBuildScripts.karmaConfig, {
entry: {
testIndex: [
path.resolve(dirname, "test/index.ts"),
],
},
}),
webpack: webpackBuildScripts.karmaConfig,
webpackMiddleware: {
noInfo: true,
stats: {
Expand Down
6 changes: 3 additions & 3 deletions packages/karma-build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"dependencies": {
"@blueprintjs/webpack-build-scripts": "*",
"istanbul-instrumenter-loader": "^3.0.0",
"karma": "^1.7.1",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1",
Expand All @@ -17,7 +17,7 @@
"karma-mocha-reporter": "^2.2.5",
"karma-remap-coverage": "^0.1.5",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.5",
"karma-webpack": "^4.0.0-rc.5",
"mocha": "^4.1.0"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/labs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
"@blueprintjs/node-build-scripts": "*",
"@blueprintjs/test-commons": "^0.8.0",
"enzyme": "^3.3.0",
"karma": "^1.7.1",
"karma": "^3.1.4",
"npm-run-all": "^4.1.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
5 changes: 3 additions & 2 deletions packages/labs/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../../config/tsconfig.base",
"extends": "../src/tsconfig",
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"noEmit": true
}
}
}
8 changes: 4 additions & 4 deletions packages/landing-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
},
"devDependencies": {
"@blueprintjs/webpack-build-scripts": "*",
"copy-webpack-plugin": "^4.2.0",
"copy-webpack-plugin": "^4.6.0",
"npm-run-all": "^4.1.2",
"raw-loader": "^0.5.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"raw-loader": "^1.0.0",
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
"@blueprintjs/karma-build-scripts": "*",
"@blueprintjs/node-build-scripts": "*",
"enzyme": "^3.3.0",
"karma": "^1.7.1",
"karma": "^3.1.4",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/select/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../../config/tsconfig.base",
"extends": "../src/tsconfig",
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"noEmit": true,
"strict": true
}
Expand Down
4 changes: 2 additions & 2 deletions packages/table-dev-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@blueprintjs/webpack-build-scripts": "*",
"npm-run-all": "^4.1.2",
"stylelint": "~8.4.0",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@
"@blueprintjs/node-build-scripts": "*",
"@blueprintjs/test-commons": "^0.8.0",
"enzyme": "^3.3.0",
"karma": "^1.7.1",
"karma": "^3.1.4",
"lodash": "^4.17.4",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.11.1"
"webpack": "^4.27.1",
"webpack-dev-server": "^3.1.0"
},
"repository": {
"type": "git",
Expand Down
9 changes: 5 additions & 4 deletions packages/table/test/selectableTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import { expect } from "chai";
import * as React from "react";
import * as sinon from "sinon";
import React from "react";
import sinon from "sinon";

import { IFocusedCellCoordinates } from "../src/common/cell";
import * as FocusedCellUtils from "../src/common/internal/focusedCellUtils";
Expand Down Expand Up @@ -363,8 +363,8 @@ describe("DragSelectable", () => {
});

afterEach(() => {
(FocusedCellUtils.expandFocusedRegion as any).restore();
(Regions.expandRegion as any).restore();
(FocusedCellUtils.expandFocusedRegion as sinon.SinonSpy).restore();
(Regions.expandRegion as sinon.SinonSpy).restore();
});

it("expands selection from focused cell (if provided)", () => {
Expand All @@ -375,6 +375,7 @@ describe("DragSelectable", () => {
const item = getItem(component);

item.mouse("mousedown", { shiftKey: true });

expect(expandFocusedSpy.calledOnce, "calls FCU.expandFocusedRegion on mousedown").to.be.true;
expect(onSelection.calledOnce, "calls onSelection on mousedown").to.be.true;

Expand Down
2 changes: 1 addition & 1 deletion packages/table/test/tableBodyTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe("TableBody", () => {
runTestSuite(simulateAction);
});

// triggering onContextMenu via ctrl+click doesn't work in Phantom :/
// triggering onContextMenu via ctrl+click doesn't work in HeadlessChrome
describe.skip("on ctrl+click", () => {
// ctrl+click should also triggers the context menu and should behave in the exact same way
const simulateAction = (tableBody: ReactWrapper<any, any>) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/table/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "../../../config/tsconfig.base",
"extends": "../src/tsconfig",
"compilerOptions": {
"lib": ["dom", "es5", "es6"],
"declaration": false,
"module": "commonjs",
"noEmit": true
}
}
}
3 changes: 2 additions & 1 deletion packages/test-commons/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ require("./polyfill");

const Enzyme = require("enzyme");
// test against React 15 with REACT=15 env variable.
const Adapter = require(`enzyme-adapter-react-${process.env.REACT || 16}`);
// this module is swapped out using webpack aliases in webpack.config.karma.js
const Adapter = require("enzyme-adapter-react-16");

Enzyme.configure({ adapter: new Adapter() });

Expand Down
4 changes: 2 additions & 2 deletions packages/timezone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
"@blueprintjs/test-commons": "^0.8.0",
"@types/moment-timezone": "^0.5.0",
"enzyme": "^3.3.0",
"karma": "^1.7.1",
"karma": "^3.1.4",
"npm-run-all": "^4.1.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"typescript": "~2.8.3",
"webpack": "^3.10.0"
"webpack-cli": "^3.1.2"
},
"repository": {
"type": "git",
Expand Down
5 changes: 3 additions & 2 deletions packages/timezone/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../../config/tsconfig.base",
"extends": "../src/tsconfig",
"compilerOptions": {
"declaration": false,
"module": "commonjs",
"noEmit": true
}
}
}
30 changes: 15 additions & 15 deletions packages/webpack-build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
},
"dependencies": {
"autoprefixer": "^7.1.2",
"awesome-typescript-loader": "^3.4.1",
"circular-dependency-plugin": "^4.3.0",
"css-loader": "^0.28.8",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.6",
"node-sass": "^4.7.2",
"awesome-typescript-loader": "^5.2.1",
"circular-dependency-plugin": "^5.0.2",
"css-loader": "^2.0.1",
"cssnano": "^4.1.4",
"file-loader": "^2.0.0",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0",
"postcss-discard-comments": "^2.0.4",
"postcss-loader": "^2.0.10",
"sass-loader": "^6.0.6",
"source-map-loader": "^0.2.3",
"style-loader": "^0.19.1",
"uglifyjs-webpack-plugin": "^1.1.6",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.2",
"webpack-dev-server": "^2.11.1",
"webpack-notifier": "^1.5.0"
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"source-map-loader": "^0.2.4",
"style-loader": "^0.23.1",
"webpack": "^4.27.1",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-dev-server": "^3.1.0",
"webpack-notifier": "^1.7.0"
},
"repository": {
"type": "git",
Expand Down
Loading

1 comment on commit 5175bd8

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 upgrade to webpack 4 (#3252)

Previews: documentation | landing | table

Please sign in to comment.