Merge pull request #1382 from balena-io/update-webpack-deps

Update webpack dependencies
This commit is contained in:
bulldozer-balena[bot] 2020-06-16 13:54:10 +00:00 committed by GitHub
commit dfde956da6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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",
"build": "npm run release && webpack",
"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",
"posttest": "npm run lint",
"test-nolint": "npm run test:build && TEST=1 mocha",
"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: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",
"release": "tsc --project tsconfig.release.json && cp -r build/src/* build && rm -rf build/src",
"packagejson:copy": "cp package.json build/",
@ -41,6 +41,7 @@
"@types/chai": "^4.2.11",
"@types/chai-as-promised": "^7.1.2",
"@types/common-tags": "^1.8.0",
"@types/copy-webpack-plugin": "^6.0.0",
"@types/dbus": "^1.0.0",
"@types/dockerode": "^2.5.28",
"@types/event-stream": "^3.3.34",
@ -61,7 +62,9 @@
"@types/sinon": "^7.5.2",
"@types/sinon-chai": "^3.2.4",
"@types/supertest": "^2.0.9",
"@types/terser-webpack-plugin": "^3.0.0",
"@types/tmp": "^0.1.0",
"@types/webpack": "^4.41.17",
"@types/yargs": "^15.0.5",
"balena-register-device": "^6.1.6",
"blinking": "~0.0.3",
@ -71,7 +74,7 @@
"chai-events": "0.0.1",
"chokidar": "^3.3.1",
"common-tags": "^1.8.0",
"copy-webpack-plugin": "^5.1.1",
"copy-webpack-plugin": "^6.0.2",
"deep-object-diff": "^1.1.0",
"docker-delta": "^2.2.9",
"docker-progress": "^3.0.5",
@ -79,7 +82,7 @@
"duration-js": "^4.0.0",
"event-stream": "3.3.4",
"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",
"husky": "^4.2.5",
"io-ts": "^2.1.2",
@ -112,12 +115,12 @@
"strict-event-emitter-types": "^2.0.0",
"supertest": "^4.0.2",
"tar-stream": "^2.1.2",
"terser-webpack-plugin": "^2.3.6",
"terser-webpack-plugin": "^3.0.5",
"tmp": "^0.1.0",
"ts-loader": "^6.2.2",
"ts-node": "^8.10.1",
"ts-loader": "^7.0.5",
"ts-node": "^8.10.2",
"typed-error": "^2.0.0",
"typescript": "^3.9.2",
"typescript": "^3.9.5",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"winston": "^3.2.1",

View File

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