From f870cb55a3965cfc9237b5a63931ed6c961cb6f7 Mon Sep 17 00:00:00 2001 From: Szymon Szlachtowicz <38212223+Szymx95@users.noreply.github.com> Date: Wed, 1 Sep 2021 15:18:02 +0200 Subject: [PATCH] Improve packages and webpack (#38) --- packages/contracts/package.json | 4 +- packages/core/package.json | 2 +- packages/example/package.json | 5 ++- packages/example/webpack.config.js | 14 +++++- packages/react-components/package.json | 4 +- yarn.lock | 59 ++++++++++++++++++-------- 6 files changed, 63 insertions(+), 25 deletions(-) diff --git a/packages/contracts/package.json b/packages/contracts/package.json index d64ffa0..9346c41 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,8 +1,8 @@ { - "name": "@status-community-dapp/contracts", + "name": "@status-waku-voting/contracts", "version": "0.0.1", "main": "index.js", - "repository": "git@github.com:EthWorks/status-community-dapp.git", + "repository": "git@github.com:EthWorks/status-waku-voting.git", "license": "MIT", "scripts": { "clean": "rm -r ./{build,dist,flatten}", diff --git a/packages/core/package.json b/packages/core/package.json index 9a371b8..98c3ef8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "dist/cjs/src/index.js", "module": "dist/esm/src/index.js", "types": "dist/esm/src/index.d.ts", - "version": "1.0.0", + "version": "0.1.0", "license": "MIT", "scripts": { "build": "yarn run build:esm && yarn run build:cjs", diff --git a/packages/example/package.json b/packages/example/package.json index 36c9adc..341219c 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -1,6 +1,6 @@ { "name": "@status-waku-voting/example", - "version": "1.0.0", + "version": "0.1.0", "main": "index.js", "license": "MIT", "scripts": { @@ -13,7 +13,7 @@ "lint:prettier": "yarn prettier './{src,test}/**/*.{ts,tsx}'" }, "dependencies": { - "@status-waku-voting/react-components": "link:../react-components", + "@status-waku-voting/react-components": "^0.1.0", "@usedapp/core": "^0.4.6", "assert": "^2.0.0", "buffer": "^6.0.3", @@ -38,6 +38,7 @@ "@typescript-eslint/eslint-plugin": "^4.29.0", "@typescript-eslint/parser": "^4.29.0", "chai": "^4.3.4", + "esbuild-loader": "^2.15.1", "eslint": "^7.32.0", "eslint-plugin-hooks": "^0.2.0", "eslint-plugin-react": "^7.24.0", diff --git a/packages/example/webpack.config.js b/packages/example/webpack.config.js index 22624ea..cc8a6a8 100644 --- a/packages/example/webpack.config.js +++ b/packages/example/webpack.config.js @@ -2,6 +2,7 @@ const path = require('path') const HtmlWebpackPlugin = require('html-webpack-plugin') const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin') const webpack = require('webpack') +const { ESBuildMinifyPlugin } = require('esbuild-loader') module.exports = (env) => { let environment = 'development' @@ -30,8 +31,12 @@ module.exports = (env) => { rules: [ { test: /\.tsx?$/, - use: 'ts-loader', + loader: 'esbuild-loader', exclude: /node_modules/, + options: { + loader: 'tsx', + target: 'es2018', + }, }, { enforce: 'pre', @@ -45,6 +50,13 @@ module.exports = (env) => { }, ], }, + optimization: { + minimizer: [ + new ESBuildMinifyPlugin({ + target: 'es2018', + }), + ], + }, plugins: [ new ForkTsCheckerWebpackPlugin(), new HtmlWebpackPlugin({ diff --git a/packages/react-components/package.json b/packages/react-components/package.json index 108fb96..0b41431 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -3,7 +3,7 @@ "main": "dist/cjs/src/index.js", "module": "dist/esm/src/index.js", "types": "dist/esm/src/index.d.ts", - "version": "1.0.0", + "version": "0.1.0", "license": "MIT", "scripts": { "clean": "rimraf dist/", @@ -21,7 +21,7 @@ "lint:prettier": "yarn prettier './{src,test}/**/*.{ts,tsx}'" }, "dependencies": { - "@status-waku-voting/core": "link:../core", + "@status-waku-voting/core": "^0.1.0", "ethers": "^5.4.4", "react": "^17.0.2", "react-components": "^0.5.1" diff --git a/yarn.lock b/yarn.lock index 9342a10..a37061a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1044,22 +1044,6 @@ "@stablelib/random" "^1.0.1" "@stablelib/wipe" "^1.0.1" -"@status-waku-voting/core@link:packages/core": - version "1.0.0" - dependencies: - eth-sig-util "^3.0.1" - ethers "^5.4.4" - js-waku "^0.11.0" - protons "^2.0.1" - -"@status-waku-voting/react-components@link:packages/react-components": - version "1.0.0" - dependencies: - "@status-waku-voting/core" "link:packages/core" - ethers "^5.4.4" - react "^17.0.2" - react-components "^0.5.1" - "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -4373,6 +4357,24 @@ es6-symbol@^3.1.1, es6-symbol@~3.1.3: d "^1.0.1" ext "^1.1.2" +esbuild-loader@^2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-2.15.1.tgz#5a3940f5d20317f1a35720efa33e933f97c923e9" + integrity sha512-JRBL6uTeWplMbylNBt9gxLKMjD8wKnqGq786QV/cm/nPBSNA9/kC7/vNwCXTDPfYqHoWsjyfH7ub9ekN0kdAYQ== + dependencies: + esbuild "^0.12.21" + joycon "^3.0.1" + json5 "^2.2.0" + loader-utils "^2.0.0" + tapable "^2.2.0" + type-fest "^1.4.0" + webpack-sources "^2.2.0" + +esbuild@^0.12.21: + version "0.12.24" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.24.tgz#21966fad25a80f368ed308101e88102bce0dc68f" + integrity sha512-C0ibY+HsXzYB6L/pLWEiWjMpghKsIc58Q5yumARwBQsHl9DXPakW+5NI/Y9w4YXiz0PEP6XTGTT/OV4Nnsmb4A== + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -7082,6 +7084,11 @@ jest-worker@^27.0.6: merge-stream "^2.0.0" supports-color "^8.0.0" +joycon@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf" + integrity sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA== + js-sha3@0.5.7, js-sha3@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" @@ -7283,7 +7290,7 @@ json5@^0.5.1: resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= -json5@^2.1.2: +json5@^2.1.2, json5@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== @@ -10639,6 +10646,11 @@ solidity-comments-extractor@^0.0.7: resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz#99d8f1361438f84019795d928b931f4e5c39ca19" integrity sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw== +source-list-map@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" + integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== + source-map-js@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e" @@ -11457,6 +11469,11 @@ type-fest@^0.20.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== +type-fest@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" + integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== + type-is@~1.6.17, type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -12193,6 +12210,14 @@ webpack-merge@^5.7.3: clone-deep "^4.0.1" wildcard "^2.0.0" +webpack-sources@^2.2.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.1.tgz#570de0af163949fe272233c2cefe1b56f74511fd" + integrity sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA== + dependencies: + source-list-map "^2.0.1" + source-map "^0.6.1" + webpack-sources@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.0.tgz#b16973bcf844ebcdb3afde32eda1c04d0b90f89d"