Update webpack dependencies

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-06-16 13:04:12 +01:00
parent c172a70a95
commit e1fb8683f4
4 changed files with 1273 additions and 411 deletions

1637
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,14 +11,14 @@
"start": "./entry.sh", "start": "./entry.sh",
"build": "npm run release && webpack", "build": "npm run release && webpack",
"build:debug": "npm run release && npm run packagejson:copy", "build:debug": "npm run release && npm run packagejson:copy",
"lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ && tsc --noEmit && tsc --noEmit --project tsconfig.js.json", "lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ webpack.config.js && tsc --noEmit && tsc --noEmit --project tsconfig.js.json",
"test": "npm run test-nolint", "test": "npm run test-nolint",
"posttest": "npm run lint", "posttest": "npm run lint",
"test-nolint": "npm run test:build && TEST=1 mocha", "test-nolint": "npm run test:build && TEST=1 mocha",
"test:build": "npm run test-build && npm run testitems:copy && npm run packagejson:copy", "test:build": "npm run test-build && npm run testitems:copy && npm run packagejson:copy",
"test:fast": "TEST=1 mocha --opts test/fast-mocha.opts", "test:fast": "TEST=1 mocha --opts test/fast-mocha.opts",
"test:debug": "npm run test:build && TEST=1 mocha --inspect-brk", "test:debug": "npm run test:build && TEST=1 mocha --inspect-brk",
"prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/", "prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js",
"test-build": "tsc --project tsconfig.json", "test-build": "tsc --project tsconfig.json",
"release": "tsc --project tsconfig.release.json && cp -r build/src/* build && rm -rf build/src", "release": "tsc --project tsconfig.release.json && cp -r build/src/* build && rm -rf build/src",
"packagejson:copy": "cp package.json build/", "packagejson:copy": "cp package.json build/",
@ -41,6 +41,7 @@
"@types/chai": "^4.2.11", "@types/chai": "^4.2.11",
"@types/chai-as-promised": "^7.1.2", "@types/chai-as-promised": "^7.1.2",
"@types/common-tags": "^1.8.0", "@types/common-tags": "^1.8.0",
"@types/copy-webpack-plugin": "^6.0.0",
"@types/dbus": "^1.0.0", "@types/dbus": "^1.0.0",
"@types/dockerode": "^2.5.28", "@types/dockerode": "^2.5.28",
"@types/event-stream": "^3.3.34", "@types/event-stream": "^3.3.34",
@ -61,7 +62,9 @@
"@types/sinon": "^7.5.2", "@types/sinon": "^7.5.2",
"@types/sinon-chai": "^3.2.4", "@types/sinon-chai": "^3.2.4",
"@types/supertest": "^2.0.9", "@types/supertest": "^2.0.9",
"@types/terser-webpack-plugin": "^3.0.0",
"@types/tmp": "^0.1.0", "@types/tmp": "^0.1.0",
"@types/webpack": "^4.41.17",
"@types/yargs": "^15.0.5", "@types/yargs": "^15.0.5",
"balena-register-device": "^6.1.6", "balena-register-device": "^6.1.6",
"blinking": "~0.0.3", "blinking": "~0.0.3",
@ -71,7 +74,7 @@
"chai-events": "0.0.1", "chai-events": "0.0.1",
"chokidar": "^3.3.1", "chokidar": "^3.3.1",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"copy-webpack-plugin": "^5.1.1", "copy-webpack-plugin": "^6.0.2",
"deep-object-diff": "^1.1.0", "deep-object-diff": "^1.1.0",
"docker-delta": "^2.2.9", "docker-delta": "^2.2.9",
"docker-progress": "^3.0.5", "docker-progress": "^3.0.5",
@ -79,7 +82,7 @@
"duration-js": "^4.0.0", "duration-js": "^4.0.0",
"event-stream": "3.3.4", "event-stream": "3.3.4",
"express": "^4.17.1", "express": "^4.17.1",
"fork-ts-checker-webpack-plugin": "^4.1.3", "fork-ts-checker-webpack-plugin": "^5.0.1",
"fp-ts": "^2.5.3", "fp-ts": "^2.5.3",
"husky": "^4.2.5", "husky": "^4.2.5",
"io-ts": "^2.1.2", "io-ts": "^2.1.2",
@ -112,12 +115,12 @@
"strict-event-emitter-types": "^2.0.0", "strict-event-emitter-types": "^2.0.0",
"supertest": "^4.0.2", "supertest": "^4.0.2",
"tar-stream": "^2.1.2", "tar-stream": "^2.1.2",
"terser-webpack-plugin": "^2.3.6", "terser-webpack-plugin": "^3.0.5",
"tmp": "^0.1.0", "tmp": "^0.1.0",
"ts-loader": "^6.2.2", "ts-loader": "^7.0.5",
"ts-node": "^8.10.1", "ts-node": "^8.10.2",
"typed-error": "^2.0.0", "typed-error": "^2.0.0",
"typescript": "^3.9.2", "typescript": "^3.9.5",
"webpack": "^4.43.0", "webpack": "^4.43.0",
"webpack-cli": "^3.3.11", "webpack-cli": "^3.3.11",
"winston": "^3.2.1", "winston": "^3.2.1",

View File

@ -4,5 +4,5 @@
"noImplicitAny": false, "noImplicitAny": false,
"checkJs": true "checkJs": true
}, },
"include": ["src/**/*", "test/**/*", "typings/**/*.d.ts", "build-utils/**/*"] "include": ["src/**/*", "test/**/*", "typings/**/*.d.ts", "build-utils/**/*", "webpack.config.js"]
} }

View File

@ -23,9 +23,9 @@ var externalModules = [
/mssql\/.*/, /mssql\/.*/,
]; ];
var requiredModules = []; let requiredModules = [];
var maybeOptionalModules = []; let maybeOptionalModules = [];
lookForOptionalDeps = function(sourceDir) { const lookForOptionalDeps = function (sourceDir) {
// We iterate over the node modules and mark all optional dependencies as external // We iterate over the node modules and mark all optional dependencies as external
var dirs = fs.readdirSync(sourceDir); var dirs = fs.readdirSync(sourceDir);
for (let dir of dirs) { for (let dir of dirs) {
@ -36,7 +36,7 @@ lookForOptionalDeps = function(sourceDir) {
} }
try { try {
packageJson = JSON.parse( packageJson = JSON.parse(
fs.readFileSync(path.join(sourceDir, dir, '/package.json')), fs.readFileSync(path.join(sourceDir, dir, '/package.json'), 'utf8'),
); );
} catch (e) { } catch (e) {
continue; continue;
@ -67,7 +67,7 @@ externalModules.push(
console.log('Using the following dependencies as external:', externalModules); console.log('Using the following dependencies as external:', externalModules);
module.exports = function(env) { module.exports = function (env) {
return { return {
mode: env == null || !env.noOptimize ? 'production' : 'development', mode: env == null || !env.noOptimize ? 'production' : 'development',
devtool: 'none', devtool: 'none',
@ -125,7 +125,7 @@ module.exports = function(env) {
}, },
], ],
}, },
externals: (context, request, callback) => { externals: (_context, request, callback) => {
for (let m of externalModules) { for (let m of externalModules) {
if ( if (
(typeof m === 'string' && m === request) || (typeof m === 'string' && m === request) ||
@ -142,12 +142,14 @@ module.exports = function(env) {
new ForkTsCheckerWebpackPlugin({ new ForkTsCheckerWebpackPlugin({
async: false, async: false,
}), }),
new CopyWebpackPlugin([ new CopyWebpackPlugin({
{ patterns: [
from: './build/migrations', {
to: 'migrations', from: './build/migrations',
}, to: 'migrations',
]), },
],
}),
new webpack.ContextReplacementPlugin( new webpack.ContextReplacementPlugin(
/\.\/migrations/, /\.\/migrations/,
path.resolve(__dirname, 'build/migrations'), path.resolve(__dirname, 'build/migrations'),