Skip to content

Commit

Permalink
fix(webpack): prod build chokes on upgraded ssh2 binaries hyperledger…
Browse files Browse the repository at this point in the history
…-cacti#1405

This removes all webpack minified builds entirely. This has the
benefits of faster and stabler builds.
What we lose is efficiency of deployments in resource constrained
environments where the bundle size would make a difference but
the idea here is to crawl, walk and then run with having these
minified bundles enabled being the running part of the equation.

Root cause
==========

If you update the yarn lock file to the latest & greatest it breaks the
webpack prod build at the moment with this beauty:

ERROR in ../../node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node 1:0
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type, currently no
loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
 @ ../../node_modules/ssh2/lib/protocol/crypto.js 30:12-60
 @ ../../node_modules/ssh2/lib/client.js 34:29-60
 @ ../../node_modules/ssh2/lib/index.js 27:10-32
 @ ../../node_modules/docker-modem/lib/ssh.js 1:13-35
 @ ../../node_modules/docker-modem/lib/modem.js 6:8-24
 @ ../../node_modules/dockerode/lib/docker.js 2:10-33
 @ ./src/main/typescript/besu/besu-test-ledger.ts 8:36-56
 @ ./src/main/typescript/public-api.ts 20:25-59
 @ ./src/main/typescript/index.ts 13:13-36
To Reproduce

rm yarn.lock && yarn && yarn configure && yarn build

Fixes hyperledger-cacti#1405

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz authored and RafaelAPB committed Nov 19, 2021
1 parent 6be5a1b commit 7a7defe
Show file tree
Hide file tree
Showing 33 changed files with 95 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@
"start": "CONFIG_FILE=./example-config.json node dist/lib/main/typescript/carbon-accounting-app-cli.js",
"solidity": "hardhat compile",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"solidity": {
Expand Down Expand Up @@ -102,4 +99,4 @@
"http-status-codes": "2.1.4",
"jose": "1.28.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -92,4 +89,4 @@
"@types/ssh2": "0.5.47",
"@types/uuid": "8.3.1"
}
}
}
9 changes: 3 additions & 6 deletions examples/cactus-example-supply-chain-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
],
"scripts": {
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "NODE_OPTIONS=--max_old_space_size=4096 npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "NODE_OPTIONS=--max_old_space_size=4096 webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "NODE_OPTIONS=--max_old_space_size=4096 webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {},
"publishConfig": {
Expand Down Expand Up @@ -91,4 +88,4 @@
"@types/express": "4.17.13",
"@types/uuid": "8.3.1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -93,4 +90,4 @@
"@types/ssh2": "0.5.47",
"@types/uuid": "8.3.1"
}
}
}
9 changes: 3 additions & 6 deletions extensions/cactus-plugin-object-store-ipfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -88,4 +85,4 @@
"ipfs-core-types": "0.6.1",
"multiformats": "9.4.6"
}
}
}
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"watch-tsc": "tsc --build --watch",
"watch": "run-p -r watch-*",
"build": "npm-run-all build:dev build:prod",
"build:prod": "npm-run-all build:prod:backend webpack:prod:web build:prod:frontend",
"build:prod:backend": "npm-run-all webpack:prod:node",
"build:prod": "npm-run-all build:prod:frontend",
"build:prod:frontend": "lerna run build:prod:frontend",
"build:dev": "npm-run-all build:dev:backend webpack:dev:web build:dev:frontend",
"build:dev:backend": "npm-run-all lint clean codegen tsc resources",
Expand All @@ -50,13 +49,9 @@
"test:plugin-ledger-connector-iroha": "tap --ts --jobs=1 --timeout=600 \"packages/cactus-*-iroha/src/test/typescript/{unit,integration}/\"",
"test:plugin-htlc-besu": "tap --jobs=1 --timeout=600 \"packages/*htlc-eth-besu/src/test/typescript/{integration}/\"",
"test:plugin-ledger-connector-corda": "tap --ts --jobs=1 --timeout=600 \"packages/cactus-*-corda/src/test/typescript/{unit,integration}/\"",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack:dev": "lerna run webpack:dev",
"webpack": "npm-run-all lerna run webpack:dev",
"webpack:dev:web": "lerna run webpack:dev:web",
"webpack:dev:node": "lerna run webpack:dev:node",
"webpack:prod": "lerna run webpack:prod",
"webpack:prod:web": "lerna run webpack:prod:web",
"webpack:prod:node": "lerna run webpack:prod:node",
"test:all": "tap --ts --jobs=1 --node-arg=--max-old-space-size=4096 --timeout=3600 --no-check-coverage \"packages/cactus-*/src/test/typescript/{unit,integration,benchmark}/\"",
"test:unit": "tap --ts --node-arg=--max-old-space-size=4096 --timeout=600 --no-check-coverage \"packages/cactus-*/src/test/typescript/unit/\"",
"test:benchmark": "tap --ts --jobs=1 --no-timeout --no-check-coverage \"packages/cactus-*/src/test/typescript/benchmark/\"",
Expand Down
9 changes: 3 additions & 6 deletions packages/cactus-api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
],
"scripts": {
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {},
"publishConfig": {
Expand Down Expand Up @@ -68,4 +65,4 @@
"@hyperledger/cactus-core-api": "0.10.0",
"@hyperledger/cactus-plugin-consortium-manual": "0.10.0"
}
}
}
9 changes: 3 additions & 6 deletions packages/cactus-cmd-api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
"codegen:proto": "run-s proto:openapi proto:protoc-gen-ts",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "echo 'SKIPPING script webpack:prod:node for @hyperledger/cactus-cmd-api-server' the dev bundle will be used as fallback until npm can be processed by the Webpack Terser."
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -128,4 +125,4 @@
"artillery": "1.7.2",
"http-status-codes": "2.1.4"
}
}
}
9 changes: 3 additions & 6 deletions packages/cactus-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
],
"scripts": {
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {},
"publishConfig": {
Expand Down Expand Up @@ -76,4 +73,4 @@
"@types/uuid": "8.3.1",
"uuid": "8.3.2"
}
}
}
9 changes: 3 additions & 6 deletions packages/cactus-core-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -80,4 +77,4 @@
"@hyperledger/cactus-common": "0.10.0",
"axios": "0.21.4"
}
}
}
9 changes: 3 additions & 6 deletions packages/cactus-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
],
"scripts": {
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {},
"publishConfig": {
Expand Down Expand Up @@ -74,4 +71,4 @@
"@types/express": "4.17.13",
"uuid": "8.3.2"
}
}
}
7 changes: 2 additions & 5 deletions packages/cactus-plugin-consortium-manual/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down
7 changes: 2 additions & 5 deletions packages/cactus-plugin-htlc-eth-besu-erc20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down
7 changes: 2 additions & 5 deletions packages/cactus-plugin-htlc-eth-besu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down
9 changes: 3 additions & 6 deletions packages/cactus-plugin-keychain-aws-sm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -87,4 +84,4 @@
"internal-ip": "6.2.0",
"openapi-types": "9.1.0"
}
}
}
9 changes: 3 additions & 6 deletions packages/cactus-plugin-keychain-azure-kv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -89,4 +86,4 @@
"internal-ip": "6.2.0",
"openapi-types": "9.1.0"
}
}
}
9 changes: 3 additions & 6 deletions packages/cactus-plugin-keychain-google-sm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -88,4 +85,4 @@
"internal-ip": "6.2.0",
"openapi-types": "9.1.0"
}
}
}
9 changes: 3 additions & 6 deletions packages/cactus-plugin-keychain-memory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
"codegen:openapi": "npm run generate-sdk",
"codegen": "run-p 'codegen:*'",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js",
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
"webpack:prod": "npm-run-all webpack:prod:node webpack:prod:web",
"webpack:prod:web": "webpack --env=prod --target=web --config ../../webpack.config.js",
"webpack:prod:node": "webpack --env=prod --target=node --config ../../webpack.config.js"
"webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js"
},
"watch": {
"codegen:openapi": {
Expand Down Expand Up @@ -83,4 +80,4 @@
"devDependencies": {
"@types/express": "4.17.13"
}
}
}
Loading

0 comments on commit 7a7defe

Please sign in to comment.