From 9e4b725873efd87d6560e0599ca0a822950b49bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kosi=C5=84ski?= Date: Tue, 3 Sep 2019 23:55:30 +0200 Subject: [PATCH] Better typescript setup for monorepo (#17) * feat(mnonorepo): project paths * feat: build:static. project refrences * fix: include for utils-general. ts update * fix: references. main in package.json. compiler flags * fix: types path in utils-general * Fix part of packages * Update imports * Faster incremental UI builds * Publish only required files * merge fix * fix: include schemas dir * Update tests * Remove test that is deleted on master as well --- package.json | 6 +- packages/asset-registry/package.json | 11 +- packages/asset-registry/scripts/build.js | 83 +++++---- .../src/wrappedContracts/AssetConsumingDB.ts | 2 +- .../AssetConsumingRegistryLogic.ts | 2 +- .../wrappedContracts/AssetContractLookup.ts | 2 +- .../src/wrappedContracts/AssetProducingDB.ts | 2 +- .../AssetProducingRegistryLogic.ts | 2 +- .../src/wrappedContracts/GeneralFunctions.ts | 2 +- packages/asset-registry/tsconfig.build.json | 20 +++ packages/asset-registry/tsconfig.json | 6 +- packages/market-matcher/.npmignore | 1 - packages/market-matcher/package.json | 18 +- .../src/controller/BlockchainConnection.ts | 3 +- .../controller/BlockchainModeController.ts | 2 +- .../controller/SimulationModeController.ts | 2 +- packages/market-matcher/src/exports.ts | 98 ----------- packages/market-matcher/src/index.ts | 86 ++++++++- packages/market-matcher/src/main.ts | 30 ++++ .../src/matcher/SimpleMatcher.ts | 2 +- .../src/schema-defs/MatcherConf.ts | 4 +- .../src/test/StrategyBasedMatcherTest.ts | 2 +- packages/market-matcher/tsconfig.build.json | 30 ++++ packages/market-matcher/tsconfig.json | 7 +- packages/market/package.json | 11 +- packages/market/src/test/MarketFacade.ts | 2 +- .../src/wrappedContracts/AgreementLogic.ts | 2 +- .../src/wrappedContracts/GeneralFunctions.ts | 2 +- .../wrappedContracts/MarketContractLookup.ts | 2 +- .../market/src/wrappedContracts/MarketDB.ts | 9 +- .../src/wrappedContracts/MarketLogic.ts | 2 +- packages/market/tsconfig.build.json | 23 +++ packages/market/tsconfig.json | 6 +- packages/origin-ui/package.json | 5 +- packages/origin-ui/tsconfig.build.json | 31 ++++ packages/origin-ui/tsconfig.json | 11 +- packages/origin-ui/webpack/base.config.js | 75 ++++---- packages/origin/package.json | 10 +- .../src/wrappedContracts/CertificateDB.ts | 2 +- .../src/wrappedContracts/CertificateLogic.ts | 2 +- .../CertificateSpecificContract.ts | 2 +- .../EnergyCertificateBundleDB.ts | 2 +- .../EnergyCertificateBundleLogic.ts | 2 +- .../origin/src/wrappedContracts/EnergyDB.ts | 2 +- .../src/wrappedContracts/GeneralFunctions.ts | 2 +- .../wrappedContracts/OriginContractLookup.ts | 2 +- .../TradableEntityContract.ts | 2 +- packages/origin/tsconfig.build.json | 23 +++ packages/origin/tsconfig.json | 6 +- packages/solar-simulator/.npmignore | 1 - packages/solar-simulator/package.json | 3 +- packages/solar-simulator/tsconfig.build.json | 18 ++ packages/solar-simulator/tsconfig.json | 9 +- packages/user-registry/package.json | 7 +- .../src/wrappedContracts/GeneralFunctions.ts | 2 +- .../src/wrappedContracts/RoleManagement.ts | 2 +- .../wrappedContracts/UserContractLookup.ts | 2 +- .../src/wrappedContracts/UserDB.ts | 2 +- .../src/wrappedContracts/UserLogic.ts | 2 +- packages/user-registry/tsconfig.build.json | 14 ++ packages/user-registry/tsconfig.json | 10 +- packages/utils-demo/.npmignore | 0 packages/utils-demo/package.json | 9 +- packages/utils-demo/tsconfig.build.json | 28 +++ packages/utils-demo/tsconfig.json | 6 +- packages/utils-general/package.json | 14 +- packages/utils-general/scripts/build.js | 61 ++++--- packages/utils-general/tsconfig.build.json | 11 ++ packages/utils-general/tsconfig.json | 6 +- packages/utils-testbackend/package.json | 7 +- .../utils-testbackend/tsconfig.build.json | 10 ++ packages/utils-testbackend/tsconfig.json | 6 +- tsconfig.build.json | 18 ++ tsconfig.json | 25 +-- yarn.lock | 166 ++++++++++++------ 75 files changed, 686 insertions(+), 414 deletions(-) create mode 100644 packages/asset-registry/tsconfig.build.json delete mode 100644 packages/market-matcher/.npmignore delete mode 100644 packages/market-matcher/src/exports.ts create mode 100644 packages/market-matcher/src/main.ts create mode 100644 packages/market-matcher/tsconfig.build.json create mode 100644 packages/market/tsconfig.build.json create mode 100644 packages/origin-ui/tsconfig.build.json create mode 100644 packages/origin/tsconfig.build.json delete mode 100644 packages/solar-simulator/.npmignore create mode 100644 packages/solar-simulator/tsconfig.build.json create mode 100644 packages/user-registry/tsconfig.build.json delete mode 100644 packages/utils-demo/.npmignore create mode 100644 packages/utils-demo/tsconfig.build.json create mode 100644 packages/utils-general/tsconfig.build.json create mode 100644 packages/utils-testbackend/tsconfig.build.json create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index 55f486c215..e3da6051ae 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,10 @@ }, "scripts": { "build": "lerna run build", + "build:ui": "lerna run build --scope @energyweb/origin-ui --stream", "lint": "lerna run lint --parallel --stream", + "clean": "lerna run clean --parallel", + "build:static": "lerna run build:static --parallel", "lint:simulator": "lerna run lint --scope @energyweb/solar-simulator --stream", "lint-fix:simulator": "lerna run lint-fix --scope @energyweb/solar-simulator --stream", "prettier:simulator": "lerna run prettier --scope @energyweb/solar-simulator --stream", @@ -33,7 +36,8 @@ "test": "yarn test:ui && yarn test:contracts && yarn test:matcher", "test:ui": "lerna run test --scope @energyweb/origin-ui --stream", "test:contracts": "lerna run --scope @energyweb/asset-registry --stream test-contracts && lerna run --scope @energyweb/origin --stream test-contracts && lerna run --scope @energyweb/user-registry --stream test-contracts && lerna run --scope @energyweb/market --stream test-contracts", - "test:matcher": "lerna run test --scope @energyweb/market-matcher --stream" + "test:matcher": "lerna run test --scope @energyweb/market-matcher --stream", + "test:user-registry": "lerna run test --scope @energyweb/user-registry --stream" }, "workspaces": [ "packages/*" diff --git a/packages/asset-registry/package.json b/packages/asset-registry/package.json index 494da473b1..7c817eadf3 100644 --- a/packages/asset-registry/package.json +++ b/packages/asset-registry/package.json @@ -15,7 +15,10 @@ "main": "dist/js/src/index.js", "files": [ "contracts", - "dist" + "dist/js/build", + "dist/js/src", + "dist/js/schemas", + "dist/schemas" ], "directories": { "test": "test" @@ -27,7 +30,7 @@ "build-schema:ProducingAssetPropertiesOffChain": "typescript-json-schema --ignoreErrors --required src/blockchain-facade/ProducingAsset.ts IOffChainProperties > schemas/ProducingAssetPropertiesOffChain.schema.json", "prebuild-schemas": "rm -rf dist/schemas && mkdir -p dist/schemas && rm -rf schemas && mkdir schemas", "build-schemas": "npm run build-schema:AssetPropertiesOffChain && npm run build-schema:ProducingAssetPropertiesOffChain && cp -R schemas dist/schemas", - "build-ts": "npm run build-schemas && rm -rf dist/js && tsc", + "build-ts": "npm run build-schemas && rm -rf dist/js && tsc -b tsconfig.build.json --verbose --pretty", "compile": "truffle compile", "compile-contracts": "node build/ts/utils/deployment/compile", "deploy-contracts": "truffle migrate", @@ -38,7 +41,9 @@ "start-test-backend": "node ../../node_modules/@energyweb/utils-testbackend/dist/js/src/index.js", "test": "npm run build-schemas && npm run build && mocha dist/js/src/test/ --timeout 60000", "prettier": "prettier --write --config-precedence file-override './src/**/*'", - "test-contracts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn test\"" + "test-contracts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn test\"", + "clean": "rm -rf build dist", + "build:static": "yarn compile && yarn build-schemas" }, "types": "dist/js/src/index.d.ts", "dependencies": { diff --git a/packages/asset-registry/scripts/build.js b/packages/asset-registry/scripts/build.js index 10003d5f0a..85221a7ebd 100755 --- a/packages/asset-registry/scripts/build.js +++ b/packages/asset-registry/scripts/build.js @@ -6,67 +6,66 @@ const path = require('path'); const fs = require('fs-extra'); function relativePath(pathToAdd) { - return path.join(__dirname, pathToAdd); + return path.join(__dirname, pathToAdd); } function getRootDirectory() { - const PATHS_TO_TEST = [ - relativePath('../') - ]; + const PATHS_TO_TEST = [relativePath('../')]; - for (const path of PATHS_TO_TEST) { - if (fs.existsSync(path)) { - return path; + for (const path of PATHS_TO_TEST) { + if (fs.existsSync(path)) { + return path; + } } - } - throw `Can't find contracts directory`; + throw `Can't find contracts directory`; } const ROOT_DIRECTORY = getRootDirectory(); async function executeCommand(command, directory) { - const options = {}; - - if (directory) { - options.cwd = directory; - } - - try { - const { stdout, stderr } = await exec(command, options); - - console.log(stdout); - console.error(stderr); - } catch (error) { - if (error && error.stdout) { - console.error(error.stdout); - } else { - console.error(error); + const options = {}; + + if (directory) { + options.cwd = directory; + } + + try { + const { stdout, stderr } = await exec(command, options); + + console.log(stdout); + console.error(stderr); + } catch (error) { + if (error && error.stdout) { + console.error(error.stdout); + } else { + console.error(error); + } + process.exit(1); } - } } async function run() { - console.log('EW-ASSET-REGISTRY-LIB: Building...'); + console.log('EW-ASSET-REGISTRY-LIB: Building...'); - await executeCommand('yarn compile', ROOT_DIRECTORY) - await executeCommand('yarn build-ts', ROOT_DIRECTORY) + await executeCommand('yarn compile', ROOT_DIRECTORY); + await executeCommand('yarn build-ts', ROOT_DIRECTORY); - if (!(await fs.pathExists(`${ROOT_DIRECTORY}/dist/js/src`))) { - await fs.move(`${ROOT_DIRECTORY}/dist/js`, `${ROOT_DIRECTORY}/dist/js-temp`); - await fs.ensureDir(`${ROOT_DIRECTORY}/dist/js`); - await fs.move(`${ROOT_DIRECTORY}/dist/js-temp`, `${ROOT_DIRECTORY}/dist/js/src`); - } + if (!(await fs.pathExists(`${ROOT_DIRECTORY}/dist/js/src`))) { + await fs.move(`${ROOT_DIRECTORY}/dist/js`, `${ROOT_DIRECTORY}/dist/js-temp`); + await fs.ensureDir(`${ROOT_DIRECTORY}/dist/js`); + await fs.move(`${ROOT_DIRECTORY}/dist/js-temp`, `${ROOT_DIRECTORY}/dist/js/src`); + } - if (!(await fs.pathExists(`${ROOT_DIRECTORY}/dist/js/schemas`))) { - await fs.move(`${ROOT_DIRECTORY}/schemas`, `${ROOT_DIRECTORY}/dist/js/schemas`); - } + if (!(await fs.pathExists(`${ROOT_DIRECTORY}/dist/js/schemas`))) { + await fs.move(`${ROOT_DIRECTORY}/schemas`, `${ROOT_DIRECTORY}/dist/js/schemas`); + } - if (!(await fs.pathExists(`${ROOT_DIRECTORY}/dist/js/build`))) { - await fs.move(`${ROOT_DIRECTORY}/build`, `${ROOT_DIRECTORY}/dist/js/build`); - } + if (!(await fs.pathExists(`${ROOT_DIRECTORY}/dist/js/build`))) { + await fs.move(`${ROOT_DIRECTORY}/build`, `${ROOT_DIRECTORY}/dist/js/build`); + } - console.log('EW-ASSET-REGISTRY-LIB: Done.'); + console.log('EW-ASSET-REGISTRY-LIB: Done.'); } -run(); \ No newline at end of file +run(); diff --git a/packages/asset-registry/src/wrappedContracts/AssetConsumingDB.ts b/packages/asset-registry/src/wrappedContracts/AssetConsumingDB.ts index 462e5e9ef0..5c11b52e16 100644 --- a/packages/asset-registry/src/wrappedContracts/AssetConsumingDB.ts +++ b/packages/asset-registry/src/wrappedContracts/AssetConsumingDB.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import AssetConsumingDBJSON from '../../build/contracts/AssetConsumingDB.json'; export class AssetConsumingDB extends GeneralFunctions { diff --git a/packages/asset-registry/src/wrappedContracts/AssetConsumingRegistryLogic.ts b/packages/asset-registry/src/wrappedContracts/AssetConsumingRegistryLogic.ts index b40f0a1bd6..2cf5a71335 100644 --- a/packages/asset-registry/src/wrappedContracts/AssetConsumingRegistryLogic.ts +++ b/packages/asset-registry/src/wrappedContracts/AssetConsumingRegistryLogic.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import AssetConsumingRegistryLogicJSON from '../../build/contracts/AssetConsumingRegistryLogic.json'; import moment from 'moment'; diff --git a/packages/asset-registry/src/wrappedContracts/AssetContractLookup.ts b/packages/asset-registry/src/wrappedContracts/AssetContractLookup.ts index c169d7056c..bf8352f439 100644 --- a/packages/asset-registry/src/wrappedContracts/AssetContractLookup.ts +++ b/packages/asset-registry/src/wrappedContracts/AssetContractLookup.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import AssetContractLookupJSON from '../../build/contracts/AssetContractLookup.json'; export class AssetContractLookup extends GeneralFunctions { diff --git a/packages/asset-registry/src/wrappedContracts/AssetProducingDB.ts b/packages/asset-registry/src/wrappedContracts/AssetProducingDB.ts index f76f11172f..4b51cae69f 100644 --- a/packages/asset-registry/src/wrappedContracts/AssetProducingDB.ts +++ b/packages/asset-registry/src/wrappedContracts/AssetProducingDB.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import AssetProducingDBJSON from '../../build/contracts/AssetProducingDB.json'; export class AssetProducingDB extends GeneralFunctions { diff --git a/packages/asset-registry/src/wrappedContracts/AssetProducingRegistryLogic.ts b/packages/asset-registry/src/wrappedContracts/AssetProducingRegistryLogic.ts index 67d6e6cd96..89253a4cf0 100644 --- a/packages/asset-registry/src/wrappedContracts/AssetProducingRegistryLogic.ts +++ b/packages/asset-registry/src/wrappedContracts/AssetProducingRegistryLogic.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import AssetProducingRegistryLogicJSON from '../../build/contracts/AssetProducingRegistryLogic.json'; import moment from 'moment'; diff --git a/packages/asset-registry/src/wrappedContracts/GeneralFunctions.ts b/packages/asset-registry/src/wrappedContracts/GeneralFunctions.ts index 850b23f571..524fa4ee67 100644 --- a/packages/asset-registry/src/wrappedContracts/GeneralFunctions.ts +++ b/packages/asset-registry/src/wrappedContracts/GeneralFunctions.ts @@ -1,4 +1,4 @@ -import Web3 = require('web3'); +import Web3 from 'web3'; import { Tx } from 'web3/eth/types'; import { TransactionReceipt, Logs } from 'web3/types'; diff --git a/packages/asset-registry/tsconfig.build.json b/packages/asset-registry/tsconfig.build.json new file mode 100644 index 0000000000..0054fc9cd0 --- /dev/null +++ b/packages/asset-registry/tsconfig.build.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "rootDir": "./", + "outDir": "./dist/js" + }, + "include": ["./src/**/*", "./schemas/*.json", "./build/**/*.json"], + "references": [ + { + "path": "../user-registry/tsconfig.build.json" + }, + { + "path": "../utils-general/tsconfig.build.json" + }, + { + "path": "../utils-testbackend/tsconfig.build.json" + } + ] +} diff --git a/packages/asset-registry/tsconfig.json b/packages/asset-registry/tsconfig.json index dbbce11c9a..594c52763a 100644 --- a/packages/asset-registry/tsconfig.json +++ b/packages/asset-registry/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js" - }, - "include": ["./src/**/*"] -} + } +} \ No newline at end of file diff --git a/packages/market-matcher/.npmignore b/packages/market-matcher/.npmignore deleted file mode 100644 index e8310385c5..0000000000 --- a/packages/market-matcher/.npmignore +++ /dev/null @@ -1 +0,0 @@ -src \ No newline at end of file diff --git a/packages/market-matcher/package.json b/packages/market-matcher/package.json index 91d949efc4..48a9ec64ff 100644 --- a/packages/market-matcher/package.json +++ b/packages/market-matcher/package.json @@ -12,11 +12,11 @@ "url": "https://github.com/energywebfoundation/ewf-monorepo/issues" }, "version": "1.1.0", - "main": "dist/js/src/exports.js", + "main": "dist/js/src/index.js", "scripts": { "build": "scripts/build.js", - "build-ts": "rm -rf dist && tsc", - "debug": "node --inspect-brk dist/js/src/index.js", + "build-ts": "rm -rf dist && tsc -b tsconfig.build.json --verbose --pretty", + "debug": "node --inspect-brk dist/js/src/main.js", "generate-conf-schema": "typescript-json-schema --required --ignoreErrors tsconfig.json IMatcherConf > schemas/conf.schema.json", "generate-rule-schema": "typescript-json-schema --required --ignoreErrors tsconfig.json IRuleConf > schemas/rule.schema.json", "generate-schemas": "rm -rf schemas/ && mkdir schemas/ && npm run generate-sim-flow-schema && npm run generate-rule-schema && npm run generate-conf-schema", @@ -24,12 +24,14 @@ "lint": "tslint 'src/**/*{.ts,.tsx}'", "lint-fix": "tslint --fix 'src/**/*{.ts,.tsx}'", "prepare": "scripts/build.js", - "start": "npm run build && node dist/js/src/index.js", + "start": "npm run build && node dist/js/src/main.js", "start-ganache": "ganache-cli -m 'chalk park staff buzz chair purchase wise oak receive avoid avoid home' -l 8000000 -e 1000000 -a 20", "start-test-backend": "node ../../node_modules/@energyweb/utils-testbackend/dist/js/src/index.js", "prettier": "prettier --write --config-precedence file-override './src/**/*'", "test": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn build && mocha --exit dist/js/src/test/\"", - "test-ts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn generate-schemas && mocha --exit -r ts-node/register src/test/*.ts\"" + "test-ts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn generate-schemas && mocha --exit -r ts-node/register src/test/*.ts\"", + "clean": "rm -rf build dist", + "build:static": "yarn generate-schemas" }, "types": "dist/js/src/exports.d.ts", "dependencies": { @@ -64,5 +66,9 @@ "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" - } + }, + "files": [ + "dist/js/src", + "dist/js/schemas" + ] } diff --git a/packages/market-matcher/src/controller/BlockchainConnection.ts b/packages/market-matcher/src/controller/BlockchainConnection.ts index 12b4ebe572..8982b34e0b 100644 --- a/packages/market-matcher/src/controller/BlockchainConnection.ts +++ b/packages/market-matcher/src/controller/BlockchainConnection.ts @@ -25,7 +25,6 @@ import { createBlockchainProperties as issuerCreateBlockchainProperties } from '@energyweb/origin'; import { Configuration, ContractEventHandler, EventHandlerManager } from '@energyweb/utils-general'; -import { EthAccount } from '@energyweb/utils-general/dist/js/blockchain-facade/Configuration'; import Web3 from 'web3'; import { logger } from '../Logger'; @@ -67,7 +66,7 @@ export const initMatchingManager = async (controller: Controller, conf: Configur export const createBlockchainConf = async ( blockchainSectionConfFile: IBlockchainDataSource, - matcherAccount: EthAccount + matcherAccount: Configuration.EthAccount ): Promise => { const web3 = new Web3(blockchainSectionConfFile.web3Url); const marketConf = await marketCreateBlockchainProperties( diff --git a/packages/market-matcher/src/controller/BlockchainModeController.ts b/packages/market-matcher/src/controller/BlockchainModeController.ts index f46fa4131b..57b7e2c2d3 100644 --- a/packages/market-matcher/src/controller/BlockchainModeController.ts +++ b/packages/market-matcher/src/controller/BlockchainModeController.ts @@ -18,7 +18,7 @@ import { Agreement, Demand, Supply } from '@energyweb/market'; import { Certificate } from '@energyweb/origin'; import { Configuration, TimeFrame } from '@energyweb/utils-general'; -import { METHOD_NOT_IMPLEMENTED } from '../exports'; +import { METHOD_NOT_IMPLEMENTED } from '..'; import { logger } from '../Logger'; import * as SimulationFlowDef from '../schema-defs/simulation-flow'; import { initEventHandling, initMatchingManager } from './BlockchainConnection'; diff --git a/packages/market-matcher/src/controller/SimulationModeController.ts b/packages/market-matcher/src/controller/SimulationModeController.ts index 5af08a11c8..23ad790ff4 100644 --- a/packages/market-matcher/src/controller/SimulationModeController.ts +++ b/packages/market-matcher/src/controller/SimulationModeController.ts @@ -20,8 +20,8 @@ import { TimeFrame } from '@energyweb/utils-general'; import * as fs from 'fs'; import * as LogSymbols from 'log-symbols'; +import { METHOD_NOT_IMPLEMENTED } from '..'; import * as SimulationDescriptionSchema from '../../schemas/simulation-description.schema.json'; -import { METHOD_NOT_IMPLEMENTED } from '../exports'; import { logger } from '../Logger'; import { ISimulationDataSource } from '../schema-defs/MatcherConf'; import * as SimulationFlowDef from '../schema-defs/simulation-flow/'; diff --git a/packages/market-matcher/src/exports.ts b/packages/market-matcher/src/exports.ts deleted file mode 100644 index dcfabc90b1..0000000000 --- a/packages/market-matcher/src/exports.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2018 Energy Web Foundation -// This file is part of the Origin Application brought to you by the Energy Web Foundation, -// a global non-profit organization focused on accelerating blockchain technology across the energy sector, -// incorporated in Zug, Switzerland. -// -// The Origin Application is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// This is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY and without an implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details, at . -// -// @authors: slock.it GmbH, Heiko Burkhardt, heiko.burkhardt@slock.it -import * as fs from 'fs'; - -import * as ConfSchema from '../schemas/conf.schema.json'; -import * as RuleSchema from '../schemas/rule.schema.json'; -import { createBlockchainConf } from './controller/BlockchainConnection'; -import { BlockchainModeController } from './controller/BlockchainModeController'; -import { Controller } from './controller/Controller'; -import { SimulationModeController } from './controller/SimulationModeController'; -import { logger } from './Logger'; -import { ConfigurableReferenceMatcher } from './matcher/ConfigurableReferenceMatcher'; -import { Matcher } from './matcher/Matcher'; -import * as MatcherLogic from './matcher/MatcherLogic'; -import { SimpleMatcher } from './matcher/SimpleMatcher'; -import { StrategyBasedMatcher } from './matcher/StrategyBasedMatcher'; -import * as SchemaDefs from './schema-defs/MatcherConf'; -import { LowestPriceStrategy } from './strategy/LowestPriceStrategy'; - -const METHOD_NOT_IMPLEMENTED = 'Method not implemented.'; - -const buildMatcher = ( - matcherSpecification: - | SchemaDefs.IBlockchainMatcherSpecification - | SchemaDefs.ISimulationMatcherSpecification -): Matcher => { - switch (matcherSpecification.type) { - case SchemaDefs.MatcherType.ConfigurableReference: - const matcherConfig = JSON.parse( - fs.readFileSync(matcherSpecification.matcherConfigFile, 'utf-8') - ); - Controller.validateJson(matcherConfig, RuleSchema, 'Rule file'); - - return new ConfigurableReferenceMatcher(matcherConfig); - - case SchemaDefs.MatcherType.Simple: - return new SimpleMatcher(); - - case SchemaDefs.MatcherType.Strategy: - return new StrategyBasedMatcher(new LowestPriceStrategy()); - - default: - throw new Error('Unknown matcher type.'); - } -}; - -const buildController = async ( - dataSource: SchemaDefs.IBlockchainDataSource | SchemaDefs.ISimulationDataSource -): Promise => { - logger.verbose('Data source type is ' + dataSource.type); - switch (dataSource.type) { - case SchemaDefs.BlockchainDataSourceType.Blockchain: - return new BlockchainModeController( - await createBlockchainConf(dataSource, dataSource.matcherAccount), - dataSource.matcherAccount.address - ); - - case SchemaDefs.SimulationDataSourceType.Simulation: - return new SimulationModeController(dataSource); - - default: - throw new Error('Unknown data source type.'); - } -}; - -const startMatcher = async (conf: SchemaDefs.IMatcherConf) => { - logger.info('Matcher application started.'); - - if (conf) { - try { - Controller.validateJson(conf, ConfSchema, 'Config file'); - const matcher = buildMatcher(conf.matcherSpecification); - const controller = await buildController(conf.dataSource); - matcher.setController(controller); - controller.setMatcher(matcher); - controller.start(); - } catch (e) { - logger.error(e.message); - } - } else { - throw new Error('No config specified'); - } -}; - -export { MatcherLogic, METHOD_NOT_IMPLEMENTED, startMatcher }; diff --git a/packages/market-matcher/src/index.ts b/packages/market-matcher/src/index.ts index ef2b2c974e..dcfabc90b1 100644 --- a/packages/market-matcher/src/index.ts +++ b/packages/market-matcher/src/index.ts @@ -12,19 +12,87 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details, at . // -// @authors: slock.it GmbH; Heiko Burkhardt, heiko.burkhardt@slock.it; Martin Kuechler, martin.kuchler@slock.it +// @authors: slock.it GmbH, Heiko Burkhardt, heiko.burkhardt@slock.it import * as fs from 'fs'; -import { startMatcher } from './exports'; +import * as ConfSchema from '../schemas/conf.schema.json'; +import * as RuleSchema from '../schemas/rule.schema.json'; +import { createBlockchainConf } from './controller/BlockchainConnection'; +import { BlockchainModeController } from './controller/BlockchainModeController'; +import { Controller } from './controller/Controller'; +import { SimulationModeController } from './controller/SimulationModeController'; +import { logger } from './Logger'; +import { ConfigurableReferenceMatcher } from './matcher/ConfigurableReferenceMatcher'; +import { Matcher } from './matcher/Matcher'; +import * as MatcherLogic from './matcher/MatcherLogic'; +import { SimpleMatcher } from './matcher/SimpleMatcher'; +import { StrategyBasedMatcher } from './matcher/StrategyBasedMatcher'; import * as SchemaDefs from './schema-defs/MatcherConf'; +import { LowestPriceStrategy } from './strategy/LowestPriceStrategy'; -const main = async () => { - if (process.argv[2]) { - const conf: SchemaDefs.IMatcherConf = JSON.parse( - fs.readFileSync(process.argv[2], 'utf8').toString() - ); - await startMatcher(conf); +const METHOD_NOT_IMPLEMENTED = 'Method not implemented.'; + +const buildMatcher = ( + matcherSpecification: + | SchemaDefs.IBlockchainMatcherSpecification + | SchemaDefs.ISimulationMatcherSpecification +): Matcher => { + switch (matcherSpecification.type) { + case SchemaDefs.MatcherType.ConfigurableReference: + const matcherConfig = JSON.parse( + fs.readFileSync(matcherSpecification.matcherConfigFile, 'utf-8') + ); + Controller.validateJson(matcherConfig, RuleSchema, 'Rule file'); + + return new ConfigurableReferenceMatcher(matcherConfig); + + case SchemaDefs.MatcherType.Simple: + return new SimpleMatcher(); + + case SchemaDefs.MatcherType.Strategy: + return new StrategyBasedMatcher(new LowestPriceStrategy()); + + default: + throw new Error('Unknown matcher type.'); + } +}; + +const buildController = async ( + dataSource: SchemaDefs.IBlockchainDataSource | SchemaDefs.ISimulationDataSource +): Promise => { + logger.verbose('Data source type is ' + dataSource.type); + switch (dataSource.type) { + case SchemaDefs.BlockchainDataSourceType.Blockchain: + return new BlockchainModeController( + await createBlockchainConf(dataSource, dataSource.matcherAccount), + dataSource.matcherAccount.address + ); + + case SchemaDefs.SimulationDataSourceType.Simulation: + return new SimulationModeController(dataSource); + + default: + throw new Error('Unknown data source type.'); + } +}; + +const startMatcher = async (conf: SchemaDefs.IMatcherConf) => { + logger.info('Matcher application started.'); + + if (conf) { + try { + Controller.validateJson(conf, ConfSchema, 'Config file'); + const matcher = buildMatcher(conf.matcherSpecification); + const controller = await buildController(conf.dataSource); + matcher.setController(controller); + controller.setMatcher(matcher); + controller.start(); + } catch (e) { + logger.error(e.message); + } + } else { + throw new Error('No config specified'); } }; -main(); +export { MatcherLogic, METHOD_NOT_IMPLEMENTED, startMatcher }; diff --git a/packages/market-matcher/src/main.ts b/packages/market-matcher/src/main.ts new file mode 100644 index 0000000000..c087930d42 --- /dev/null +++ b/packages/market-matcher/src/main.ts @@ -0,0 +1,30 @@ +// Copyright 2018 Energy Web Foundation +// This file is part of the Origin Application brought to you by the Energy Web Foundation, +// a global non-profit organization focused on accelerating blockchain technology across the energy sector, +// incorporated in Zug, Switzerland. +// +// The Origin Application is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// This is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY and without an implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details, at . +// +// @authors: slock.it GmbH; Heiko Burkhardt, heiko.burkhardt@slock.it; Martin Kuechler, martin.kuchler@slock.it +import * as fs from 'fs'; + +import { startMatcher } from './'; +import * as SchemaDefs from './schema-defs/MatcherConf'; + +const main = async () => { + if (process.argv[2]) { + const conf: SchemaDefs.IMatcherConf = JSON.parse( + fs.readFileSync(process.argv[2], 'utf8').toString() + ); + await startMatcher(conf); + } +}; + +main(); diff --git a/packages/market-matcher/src/matcher/SimpleMatcher.ts b/packages/market-matcher/src/matcher/SimpleMatcher.ts index f5b164d014..fe271008ce 100644 --- a/packages/market-matcher/src/matcher/SimpleMatcher.ts +++ b/packages/market-matcher/src/matcher/SimpleMatcher.ts @@ -17,7 +17,7 @@ import { Agreement, Demand } from '@energyweb/market'; import { Certificate } from '@energyweb/origin'; import { Controller } from '../controller/Controller'; -import { METHOD_NOT_IMPLEMENTED } from '../exports'; +import { METHOD_NOT_IMPLEMENTED } from '..'; import { Matcher } from './Matcher'; export class SimpleMatcher extends Matcher { diff --git a/packages/market-matcher/src/schema-defs/MatcherConf.ts b/packages/market-matcher/src/schema-defs/MatcherConf.ts index f4d3633a06..1f8d6ac5de 100644 --- a/packages/market-matcher/src/schema-defs/MatcherConf.ts +++ b/packages/market-matcher/src/schema-defs/MatcherConf.ts @@ -1,4 +1,4 @@ -import { EthAccount } from '@energyweb/utils-general/dist/js/blockchain-facade/Configuration'; +import { Configuration } from '@energyweb/utils-general'; export enum BlockchainDataSourceType { Blockchain = 'BLOCKCHAIN' @@ -20,7 +20,7 @@ export interface IBlockchainDataSource { offChainDataSourceUrl: string; marketContractLookupAddress: string; originContractLookupAddress: string; - matcherAccount: EthAccount; + matcherAccount: Configuration.EthAccount; } export interface ISimulationDataSource { diff --git a/packages/market-matcher/src/test/StrategyBasedMatcherTest.ts b/packages/market-matcher/src/test/StrategyBasedMatcherTest.ts index 9e36dbbe6a..cf74689af5 100644 --- a/packages/market-matcher/src/test/StrategyBasedMatcherTest.ts +++ b/packages/market-matcher/src/test/StrategyBasedMatcherTest.ts @@ -31,7 +31,7 @@ import { import { assert } from 'chai'; import Web3 from 'web3'; -import { startMatcher } from '../exports'; +import { startMatcher } from '..'; import { logger } from '../Logger'; import * as SchemaDefs from '../schema-defs/MatcherConf'; diff --git a/packages/market-matcher/tsconfig.build.json b/packages/market-matcher/tsconfig.build.json new file mode 100644 index 0000000000..397ff8e575 --- /dev/null +++ b/packages/market-matcher/tsconfig.build.json @@ -0,0 +1,30 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "rootDir": "./", + "outDir": "./dist/js", + "types": ["mocha"] + }, + "include": ["./src/**/*", "./src/test/*", "./schemas/**/*.json"], + "references": [ + { + "path": "../user-registry/tsconfig.build.json" + }, + { + "path": "../utils-general/tsconfig.build.json" + }, + { + "path": "../asset-registry/tsconfig.build.json" + }, + { + "path": "../market/tsconfig.build.json" + }, + { + "path": "../origin/tsconfig.build.json" + }, + { + "path": "../utils-testbackend/tsconfig.build.json" + } + ] +} diff --git a/packages/market-matcher/tsconfig.json b/packages/market-matcher/tsconfig.json index 839c8b9678..594c52763a 100644 --- a/packages/market-matcher/tsconfig.json +++ b/packages/market-matcher/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js", - "types": ["mocha"] - }, - "include": ["./src/**/*", "./src/test/*"] -} + } +} \ No newline at end of file diff --git a/packages/market/package.json b/packages/market/package.json index 7bff9e3f27..4b9cf8ea1d 100644 --- a/packages/market/package.json +++ b/packages/market/package.json @@ -13,7 +13,10 @@ "main": "dist/js/src/index.js", "files": [ "contracts", - "dist" + "dist/js/build", + "dist/js/src", + "dist/js/schemas", + "dist/schemas" ], "directories": { "test": "test" @@ -26,7 +29,7 @@ "build-schema:SupplyPropertiesOffChain": "typescript-json-schema --ignoreErrors --required src/blockchain-facade/Supply.ts ISupplyOffchainProperties > schemas/SupplyOffchainProperties.schema.json", "prebuild-schemas": "rm -rf dist/schemas && mkdir -p dist/schemas && rm -rf schemas && mkdir schemas", "build-schemas": "npm run build-schema:AgreementPropertiesOffChain && npm run build-schema:MatcherPropertiesOffChain && npm run build-schema:DemandPropertiesOffChain && npm run build-schema:SupplyPropertiesOffChain && cp -R schemas dist/schemas", - "build-ts": "npm run build-schemas && rm -rf dist/js && tsc", + "build-ts": "npm run build-schemas && rm -rf dist/js && tsc -b tsconfig.build.json --verbose --pretty", "compile": "truffle compile", "deploy-contracts": "truffle migrate", "flatten-contracts": "truffle-flattener contracts/**/* contracts/MarketContractLookup.sol > build/flattenedContracts.sol && node scripts/removeExperimentalDuplicates.js build/flattenedContracts.sol", @@ -38,7 +41,9 @@ "test": "npm run build && mocha dist/js/src/test/ --timeout 60000", "test-ts": "mocha -r ts-node/register src/test/*.ts --timeout 60000", "prettier": "prettier --write --config-precedence file-override './src/**/*'", - "test-contracts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn test\"" + "test-contracts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn test\"", + "clean": "rm -rf build dist", + "build:static": "yarn compile && yarn build-schemas" }, "types": "dist/js/src/index.d.ts", "dependencies": { diff --git a/packages/market/src/test/MarketFacade.ts b/packages/market/src/test/MarketFacade.ts index fed19e00d2..47b6e74017 100644 --- a/packages/market/src/test/MarketFacade.ts +++ b/packages/market/src/test/MarketFacade.ts @@ -30,7 +30,7 @@ import { import * as GeneralLib from '@energyweb/utils-general'; import { assert } from 'chai'; import * as fs from 'fs'; -import Web3 = require('web3'); +import Web3 from 'web3'; import * as Market from '..'; import { MarketLogic } from '..'; diff --git a/packages/market/src/wrappedContracts/AgreementLogic.ts b/packages/market/src/wrappedContracts/AgreementLogic.ts index 9ca796d677..e74d3758d0 100644 --- a/packages/market/src/wrappedContracts/AgreementLogic.ts +++ b/packages/market/src/wrappedContracts/AgreementLogic.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import AgreementLogicJSON from '../../build/contracts/AgreementLogic.json'; export class AgreementLogic extends GeneralFunctions { diff --git a/packages/market/src/wrappedContracts/GeneralFunctions.ts b/packages/market/src/wrappedContracts/GeneralFunctions.ts index 850b23f571..524fa4ee67 100644 --- a/packages/market/src/wrappedContracts/GeneralFunctions.ts +++ b/packages/market/src/wrappedContracts/GeneralFunctions.ts @@ -1,4 +1,4 @@ -import Web3 = require('web3'); +import Web3 from 'web3'; import { Tx } from 'web3/eth/types'; import { TransactionReceipt, Logs } from 'web3/types'; diff --git a/packages/market/src/wrappedContracts/MarketContractLookup.ts b/packages/market/src/wrappedContracts/MarketContractLookup.ts index 68bf003275..236f94ebbe 100644 --- a/packages/market/src/wrappedContracts/MarketContractLookup.ts +++ b/packages/market/src/wrappedContracts/MarketContractLookup.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import MarketContractLookupJSON from '../../build/contracts/MarketContractLookup.json'; export class MarketContractLookup extends GeneralFunctions { diff --git a/packages/market/src/wrappedContracts/MarketDB.ts b/packages/market/src/wrappedContracts/MarketDB.ts index 8c0d1c13f5..d13fa6094b 100644 --- a/packages/market/src/wrappedContracts/MarketDB.ts +++ b/packages/market/src/wrappedContracts/MarketDB.ts @@ -1,10 +1,5 @@ -import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import * as fs from 'fs'; -import * as path from 'path'; -import Web3 = require('web3'); -import { Tx, BlockType } from 'web3/eth/types'; -import { TransactionReceipt, Logs } from 'web3/types'; -import { JsonRPCResponse } from 'web3/providers'; +import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; +import Web3 from 'web3'; import MarketDBJSON from '../../build/contracts/MarketDB.json'; export class MarketDB extends GeneralFunctions { diff --git a/packages/market/src/wrappedContracts/MarketLogic.ts b/packages/market/src/wrappedContracts/MarketLogic.ts index 7a43c3c1db..0bdcac0f9c 100644 --- a/packages/market/src/wrappedContracts/MarketLogic.ts +++ b/packages/market/src/wrappedContracts/MarketLogic.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import MarketLogicJSON from '../../build/contracts/MarketLogic.json'; import { DemandStatus } from '../blockchain-facade/Demand'; diff --git a/packages/market/tsconfig.build.json b/packages/market/tsconfig.build.json new file mode 100644 index 0000000000..dcbbd96644 --- /dev/null +++ b/packages/market/tsconfig.build.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "rootDir": "./", + "outDir": "./dist/js" + }, + "include": ["./src/**/**/*", "./build/**/*.json", "./schemas/**/*.json"], + "references": [ + { + "path": "../user-registry/tsconfig.build.json" + }, + { + "path": "../utils-general/tsconfig.build.json" + }, + { + "path": "../asset-registry/tsconfig.build.json" + }, + { + "path": "../utils-testbackend/tsconfig.build.json" + } + ] +} diff --git a/packages/market/tsconfig.json b/packages/market/tsconfig.json index 89086c4341..594c52763a 100644 --- a/packages/market/tsconfig.json +++ b/packages/market/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js" - }, - "include": ["./src/**/**/*"] -} + } +} \ No newline at end of file diff --git a/packages/origin-ui/package.json b/packages/origin-ui/package.json index dfdc06bc80..42d966fe0d 100644 --- a/packages/origin-ui/package.json +++ b/packages/origin-ui/package.json @@ -51,10 +51,10 @@ "redux": "4.0.4", "redux-saga": "1.0.5", "toastr": "2.1.4", - "ts-loader": "5.4.5", + "ts-loader": "6.0.4", "url-loader": "1.1.2", "web3": "1.0.0-beta.37", - "webpack": "4.30.0", + "webpack": "4.39.3", "winston": "3.2.1" }, "devDependencies": { @@ -72,6 +72,7 @@ "dotenv-webpack": "1.7.0", "enzyme": "3.10.0", "enzyme-adapter-react-16": "1.14.0", + "fork-ts-checker-webpack-plugin": "1.5.0", "ganache-cli": "6.6.0", "html-webpack-plugin": "3.2.0", "jest": "24.8.0", diff --git a/packages/origin-ui/tsconfig.build.json b/packages/origin-ui/tsconfig.build.json new file mode 100644 index 0000000000..10d75da0c7 --- /dev/null +++ b/packages/origin-ui/tsconfig.build.json @@ -0,0 +1,31 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "outDir": "./dist/", + "module": "es2015", + "moduleResolution": "node", + "declaration": false + }, + "include": ["./src/**/*"], + "exclude": ["./src/__tests__/**/*"], + "references": [ + { + "path": "../user-registry/tsconfig.build.json" + }, + { + "path": "../utils-general/tsconfig.build.json" + }, + { + "path": "../asset-registry/tsconfig.build.json" + }, + { + "path": "../market/tsconfig.build.json" + }, + { + "path": "../origin/tsconfig.build.json" + }, + { + "path": "../utils-testbackend/tsconfig.build.json" + } + ] +} diff --git a/packages/origin-ui/tsconfig.json b/packages/origin-ui/tsconfig.json index 2f67208bec..594c52763a 100644 --- a/packages/origin-ui/tsconfig.json +++ b/packages/origin-ui/tsconfig.json @@ -1,12 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/", - "declaration": false, - "moduleResolution": "node", - "module": "es2015", - "target": "es2018" - }, - "include": ["./src/**/*"], - "exclude": ["./src/__tests__/**/*"] -} + } +} \ No newline at end of file diff --git a/packages/origin-ui/webpack/base.config.js b/packages/origin-ui/webpack/base.config.js index 8b9bff5943..b7696f55cf 100644 --- a/packages/origin-ui/webpack/base.config.js +++ b/packages/origin-ui/webpack/base.config.js @@ -1,17 +1,17 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); -const path = require('path'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); module.exports = { - entry: "./src/index.tsx", + entry: './src/index.tsx', output: { - filename: "bundle.js", - path: __dirname + "/../dist" + filename: 'bundle.js', + path: __dirname + '/../dist' }, resolve: { // Add '.ts' and '.tsx' as resolvable extensions. - extensions: [".ts", ".tsx", ".js", ".json"] + extensions: ['.ts', '.tsx', '.js', '.json'] }, devServer: { @@ -24,50 +24,59 @@ module.exports = { new ExtractTextPlugin({ filename: 'styles.css', allChunks: true - }), - new HtmlWebpackPlugin({ - title: 'Origin', - favicon: 'favicon.ico', - template: './src/index.ejs', - meta: { - viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no' - } - }) + }), + new HtmlWebpackPlugin({ + title: 'Origin', + favicon: 'favicon.ico', + template: './src/index.ejs', + meta: { + viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no' + } + }), + new ForkTsCheckerWebpackPlugin() ], module: { - rules: [ { test: /\.(scss|css)$/, - use: [{ - loader: "style-loader" // creates style nodes from JS strings - }, { - loader: "css-loader" // translates CSS into CommonJS - }, { - loader: "sass-loader" // compiles Sass to CSS - }] + use: [ + { + loader: 'style-loader' // creates style nodes from JS strings + }, + { + loader: 'css-loader' // translates CSS into CommonJS + }, + { + loader: 'sass-loader' // compiles Sass to CSS + } + ] }, { test: /\.(png|jpg|gif|svg)$/, use: [ - { - loader: 'url-loader', - options: { - limit: 8192 + { + loader: 'url-loader', + options: { + limit: 8192 + } } - } ] + }, + { + test: /\.tsx?$/, + loader: 'ts-loader', + options: { + configFile: '../tsconfig.build.json', + transpileOnly: true + } }, - // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'. - { test: /\.tsx?$/, loader: "ts-loader" }, // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'. - { enforce: "pre", test: /\.js\.map$/, loader: "source-map-loader" } + { enforce: 'pre', test: /\.js\.map$/, loader: 'source-map-loader' } ] - }, node: { fs: 'empty' - } -}; \ No newline at end of file + } +}; diff --git a/packages/origin/package.json b/packages/origin/package.json index 2092ed0e66..2db0cd5b26 100644 --- a/packages/origin/package.json +++ b/packages/origin/package.json @@ -15,15 +15,16 @@ "main": "dist/js/src/index.js", "files": [ "contracts", - "dist" + "dist/js/build", + "dist/js/src" ], "directories": { "test": "test" }, "scripts": { "build": "./scripts/build.js", - "build-ts": "rm -rf dist/js && tsc", - "clean": "rm -rf node_modules dist build db.json", + "build-ts": "rm -rf dist/js && tsc -b tsconfig.build.json --verbose --pretty", + "clean": "rm -rf dist build db.json", "compile": "truffle compile", "deploy-contracts": "truffle migrate", "flatten-contracts": "truffle-flattener contracts/Origin/* > build/flattenedContracts.sol && node scripts/removeExperimentalDuplicates.js build/flattenedContracts.sol", @@ -34,7 +35,8 @@ "start-test-backend": "rm -rf db.json && node ../../node_modules/@energyweb/utils-testbackend/dist/js/src/index.js", "test": "npm run build && mocha dist/js/src/test/ --timeout 60000", "prettier": "prettier --write --config-precedence file-override './src/**/*'", - "test-contracts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn test\"" + "test-contracts": "concurrently --success first --kill-others -n eth,backend,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn test\"", + "build:static": "yarn compile" }, "types": "dist/js/src/index.d.ts", "dependencies": { diff --git a/packages/origin/src/wrappedContracts/CertificateDB.ts b/packages/origin/src/wrappedContracts/CertificateDB.ts index 027310a877..c4dee276d9 100644 --- a/packages/origin/src/wrappedContracts/CertificateDB.ts +++ b/packages/origin/src/wrappedContracts/CertificateDB.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import CertificateDBJSON from '../../build/contracts/CertificateDB.json'; export class CertificateDB extends GeneralFunctions { diff --git a/packages/origin/src/wrappedContracts/CertificateLogic.ts b/packages/origin/src/wrappedContracts/CertificateLogic.ts index dda7908ed9..04cc0940dc 100644 --- a/packages/origin/src/wrappedContracts/CertificateLogic.ts +++ b/packages/origin/src/wrappedContracts/CertificateLogic.ts @@ -1,5 +1,5 @@ import { SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import CertificateLogicJSON from '../../build/contracts/CertificateLogic.json'; import { CertificateSpecificContract } from './CertificateSpecificContract'; diff --git a/packages/origin/src/wrappedContracts/CertificateSpecificContract.ts b/packages/origin/src/wrappedContracts/CertificateSpecificContract.ts index 48c62afc36..f8a5bca56d 100644 --- a/packages/origin/src/wrappedContracts/CertificateSpecificContract.ts +++ b/packages/origin/src/wrappedContracts/CertificateSpecificContract.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import CertificateSpecificContractJSON from '../../build/contracts/CertificateSpecificContract.json'; export class CertificateSpecificContract extends GeneralFunctions { diff --git a/packages/origin/src/wrappedContracts/EnergyCertificateBundleDB.ts b/packages/origin/src/wrappedContracts/EnergyCertificateBundleDB.ts index f9f75f0b7e..c6400f484b 100644 --- a/packages/origin/src/wrappedContracts/EnergyCertificateBundleDB.ts +++ b/packages/origin/src/wrappedContracts/EnergyCertificateBundleDB.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import EnergyCertificateBundleDBJSON from '../../build/contracts/EnergyCertificateBundleDB.json'; export class EnergyCertificateBundleDB extends GeneralFunctions { diff --git a/packages/origin/src/wrappedContracts/EnergyCertificateBundleLogic.ts b/packages/origin/src/wrappedContracts/EnergyCertificateBundleLogic.ts index 37ea2afabf..05fc8e5018 100644 --- a/packages/origin/src/wrappedContracts/EnergyCertificateBundleLogic.ts +++ b/packages/origin/src/wrappedContracts/EnergyCertificateBundleLogic.ts @@ -1,5 +1,5 @@ import { SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import EnergyCertificateBundleLogicJSON from '../../build/contracts/EnergyCertificateBundleLogic.json'; import { CertificateSpecificContract } from './CertificateSpecificContract'; diff --git a/packages/origin/src/wrappedContracts/EnergyDB.ts b/packages/origin/src/wrappedContracts/EnergyDB.ts index c707e2de66..26c7315cf7 100644 --- a/packages/origin/src/wrappedContracts/EnergyDB.ts +++ b/packages/origin/src/wrappedContracts/EnergyDB.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import EnergyDBJSON from '../../build/contracts/EnergyDB.json'; export class EnergyDB extends GeneralFunctions { diff --git a/packages/origin/src/wrappedContracts/GeneralFunctions.ts b/packages/origin/src/wrappedContracts/GeneralFunctions.ts index 850b23f571..524fa4ee67 100644 --- a/packages/origin/src/wrappedContracts/GeneralFunctions.ts +++ b/packages/origin/src/wrappedContracts/GeneralFunctions.ts @@ -1,4 +1,4 @@ -import Web3 = require('web3'); +import Web3 from 'web3'; import { Tx } from 'web3/eth/types'; import { TransactionReceipt, Logs } from 'web3/types'; diff --git a/packages/origin/src/wrappedContracts/OriginContractLookup.ts b/packages/origin/src/wrappedContracts/OriginContractLookup.ts index 6f730736a4..391a3ec5f6 100644 --- a/packages/origin/src/wrappedContracts/OriginContractLookup.ts +++ b/packages/origin/src/wrappedContracts/OriginContractLookup.ts @@ -1,7 +1,7 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; import * as fs from 'fs'; import * as path from 'path'; -import Web3 = require('web3'); +import Web3 from 'web3'; import { Tx, BlockType } from 'web3/eth/types'; import { TransactionReceipt, Logs } from 'web3/types'; import { JsonRPCResponse } from 'web3/providers'; diff --git a/packages/origin/src/wrappedContracts/TradableEntityContract.ts b/packages/origin/src/wrappedContracts/TradableEntityContract.ts index 82a6f4cd49..7350017a39 100644 --- a/packages/origin/src/wrappedContracts/TradableEntityContract.ts +++ b/packages/origin/src/wrappedContracts/TradableEntityContract.ts @@ -1,5 +1,5 @@ import { GeneralFunctions } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import TradableEntityContractJSON from '../../build/contracts/TradableEntityContract.json'; export class TradableEntityContract extends GeneralFunctions { diff --git a/packages/origin/tsconfig.build.json b/packages/origin/tsconfig.build.json new file mode 100644 index 0000000000..e879296a7a --- /dev/null +++ b/packages/origin/tsconfig.build.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "rootDir": "./", + "outDir": "./dist/js" + }, + "include": ["./src/**/*", "./dist/ts/**/*", "./build/**/*.json"], + "references": [ + { + "path": "../user-registry/tsconfig.build.json" + }, + { + "path": "../utils-general/tsconfig.build.json" + }, + { + "path": "../asset-registry/tsconfig.build.json" + }, + { + "path": "../utils-testbackend/tsconfig.build.json" + } + ] +} diff --git a/packages/origin/tsconfig.json b/packages/origin/tsconfig.json index d5df38baf9..594c52763a 100644 --- a/packages/origin/tsconfig.json +++ b/packages/origin/tsconfig.json @@ -1,7 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js" - }, - "include": ["./src/**/*", "./dist/ts/**/*"] -} + } +} \ No newline at end of file diff --git a/packages/solar-simulator/.npmignore b/packages/solar-simulator/.npmignore deleted file mode 100644 index e8310385c5..0000000000 --- a/packages/solar-simulator/.npmignore +++ /dev/null @@ -1 +0,0 @@ -src \ No newline at end of file diff --git a/packages/solar-simulator/package.json b/packages/solar-simulator/package.json index a06f17d398..f42e90d9c8 100644 --- a/packages/solar-simulator/package.json +++ b/packages/solar-simulator/package.json @@ -9,7 +9,8 @@ "fund-assets-smart-meters": "ts-node src/fundAssets.ts", "prettier": "prettier --write --config-precedence file-override './src/**/*'", "lint": "tslint 'src/**/*{.ts,.tsx}'", - "lint-fix": "tslint --fix 'src/**/*{.ts,.tsx}'" + "lint-fix": "tslint --fix 'src/**/*{.ts,.tsx}'", + "clean": "rm -rf dist" }, "author": "", "license": "GPLv3", diff --git a/packages/solar-simulator/tsconfig.build.json b/packages/solar-simulator/tsconfig.build.json new file mode 100644 index 0000000000..0e745c5c53 --- /dev/null +++ b/packages/solar-simulator/tsconfig.build.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "rootDir": "./", + "outDir": "./dist/js", + "types": ["node"] + }, + "include": ["./src/**/*"], + "references": [ + { + "path": "../utils-general/tsconfig.build.json" + }, + { + "path": "../asset-registry/tsconfig.build.json" + } + ] +} diff --git a/packages/solar-simulator/tsconfig.json b/packages/solar-simulator/tsconfig.json index 8932c1e7d3..594c52763a 100644 --- a/packages/solar-simulator/tsconfig.json +++ b/packages/solar-simulator/tsconfig.json @@ -1,12 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js", - "types": [ - "node" - ] - }, - "include": [ - "./src/**/*" - ] + } } \ No newline at end of file diff --git a/packages/user-registry/package.json b/packages/user-registry/package.json index 47c914c6b1..55bcb7a92c 100644 --- a/packages/user-registry/package.json +++ b/packages/user-registry/package.json @@ -15,7 +15,8 @@ "main": "dist/js/src/index.js", "files": [ "contracts", - "dist" + "dist/js/build", + "dist/js/src" ], "directories": { "test": "test" @@ -24,8 +25,9 @@ "clean": "rm -rf build schemas db.json dist", "build": "./scripts/build.js", "build-and-deploy": "npm run build-ts && npm run deploy-contracts", + "prebuild-ts": "rm -rf dist/js", + "build-ts": "rm -rf dist/js && tsc -b tsconfig.build.json --verbose --pretty", "prebuild": "rm -rf dist/js", - "build-ts": "rm -rf dist/js && tsc", "compile": "truffle compile", "deploy-contracts": "truffle migrate", "lint": "solium -d contracts && tslint 'src/**/*{.ts,.tsx}'", @@ -35,6 +37,7 @@ "start-test-backend": "node ../../node_modules/@energyweb/utils-testbackend/dist/js/src/index.js", "test": "npm run build && mocha dist/js/src/test/ --timeout 60000", "prettier": "prettier --write --config-precedence file-override './src/**/*'", + "build:static": "yarn compile", "test-contracts": "concurrently --success first --kill-others -n eth,test \"yarn start-ganache\" \"yarn start-test-backend\" \"yarn test\"", "prebuild-schemas": "rm -rf dist/schemas && mkdir -p dist/schemas && rm -rf schemas && mkdir schemas", "build-schemas": "npm run prebuild-schemas && npm run build-schema:UserPropertiesOffChain && cp -R schemas dist/schemas", diff --git a/packages/user-registry/src/wrappedContracts/GeneralFunctions.ts b/packages/user-registry/src/wrappedContracts/GeneralFunctions.ts index ae77d0bf9c..aa0751261d 100644 --- a/packages/user-registry/src/wrappedContracts/GeneralFunctions.ts +++ b/packages/user-registry/src/wrappedContracts/GeneralFunctions.ts @@ -1,4 +1,4 @@ -import Web3 = require('web3'); +import Web3 from 'web3'; import { Tx } from 'web3/eth/types'; import { TransactionReceipt, Logs } from 'web3/types'; diff --git a/packages/user-registry/src/wrappedContracts/RoleManagement.ts b/packages/user-registry/src/wrappedContracts/RoleManagement.ts index 0249970acf..c7fbb83512 100644 --- a/packages/user-registry/src/wrappedContracts/RoleManagement.ts +++ b/packages/user-registry/src/wrappedContracts/RoleManagement.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import RoleManagementJSON from '../../build/contracts/RoleManagement.json'; export enum Role { diff --git a/packages/user-registry/src/wrappedContracts/UserContractLookup.ts b/packages/user-registry/src/wrappedContracts/UserContractLookup.ts index 6cc2960fb7..03a177cf8a 100644 --- a/packages/user-registry/src/wrappedContracts/UserContractLookup.ts +++ b/packages/user-registry/src/wrappedContracts/UserContractLookup.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog, getClientVersion } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import UserContractLookupJSON from '../../build/contracts/UserContractLookup.json'; export class UserContractLookup extends GeneralFunctions { diff --git a/packages/user-registry/src/wrappedContracts/UserDB.ts b/packages/user-registry/src/wrappedContracts/UserDB.ts index 8e7057a60c..c2bafad0df 100644 --- a/packages/user-registry/src/wrappedContracts/UserDB.ts +++ b/packages/user-registry/src/wrappedContracts/UserDB.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import UserDBJSON from '../../build/contracts/UserDB.json'; export class UserDB extends GeneralFunctions { diff --git a/packages/user-registry/src/wrappedContracts/UserLogic.ts b/packages/user-registry/src/wrappedContracts/UserLogic.ts index 7ad34584de..35fa32fc91 100644 --- a/packages/user-registry/src/wrappedContracts/UserLogic.ts +++ b/packages/user-registry/src/wrappedContracts/UserLogic.ts @@ -1,5 +1,5 @@ import { GeneralFunctions, SpecialTx, SearchLog } from './GeneralFunctions'; -import Web3 = require('web3'); +import Web3 from 'web3'; import UserLogicJSON from '../../build/contracts/UserLogic.json'; export class UserLogic extends GeneralFunctions { diff --git a/packages/user-registry/tsconfig.build.json b/packages/user-registry/tsconfig.build.json new file mode 100644 index 0000000000..a29b38d509 --- /dev/null +++ b/packages/user-registry/tsconfig.build.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "rootDir": "./", + "outDir": "./dist/js" + }, + "include": ["./src/**/*", "./build/**/*.json", "./schemas/*.json"], + "references": [ + { + "path": "../utils-general/tsconfig.build.json" + } + ] +} diff --git a/packages/user-registry/tsconfig.json b/packages/user-registry/tsconfig.json index 117e8a32a9..594c52763a 100644 --- a/packages/user-registry/tsconfig.json +++ b/packages/user-registry/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js", - }, - "include": [ - "./src/**/*", - "./dist/ts/**/*", - "./build/**/*" - ] -} + } +} \ No newline at end of file diff --git a/packages/utils-demo/.npmignore b/packages/utils-demo/.npmignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/utils-demo/package.json b/packages/utils-demo/package.json index 4ae60d0a03..997f9e7d6b 100644 --- a/packages/utils-demo/package.json +++ b/packages/utils-demo/package.json @@ -10,15 +10,16 @@ "scripts": { "prebuild-ts": "rm -rf build/ts", "build": "npm run build-ts", - "build-ts": "rm -rf dist/js && tsc", + "build-ts": "rm -rf dist/js && tsc -b tsconfig.build.json --verbose --pretty", "deploy-empty": "npm run build-ts && node dist/js/deployEmpty", "lint": "./node_modules/.bin/tslint --fix 'src/**/*{.ts,.tsx}'", - "start": "npm run build-ts && node dist/js/test", + "start": "npm run build-ts && node dist/js/src/test", "start-all": "npx concurrently -n eth,backend,deploy \"npm run start-ganache\" \"npm run start-test-backend\" \"npm run start\"", "start-ganache": "ganache-cli -m 'chalk park staff buzz chair purchase wise oak receive avoid avoid home' -l 8000000 -e 1000000 -a 40 -h 0.0.0.0", "start-test-backend": "node ../../node_modules/@energyweb/utils-testbackend/dist/js/src/index.js", - "test": "npm run build-ts && node dist/js/test", - "prettier": "prettier --write --config-precedence file-override './src/**/*'" + "test": "npm run build-ts && node dist/js/src/test", + "prettier": "prettier --write --config-precedence file-override './src/**/*'", + "clean": "rm -rf dist" }, "types": "dist/js/index.d.ts", "dependencies": { diff --git a/packages/utils-demo/tsconfig.build.json b/packages/utils-demo/tsconfig.build.json new file mode 100644 index 0000000000..0c0d2370fc --- /dev/null +++ b/packages/utils-demo/tsconfig.build.json @@ -0,0 +1,28 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist/js" + }, + "include": ["src/**/*"], + "references": [ + { + "path": "../user-registry/tsconfig.build.json" + }, + { + "path": "../utils-general/tsconfig.build.json" + }, + { + "path": "../asset-registry/tsconfig.build.json" + }, + { + "path": "../market/tsconfig.build.json" + }, + { + "path": "../origin/tsconfig.build.json" + }, + { + "path": "../utils-testbackend/tsconfig.build.json" + } + ] +} diff --git a/packages/utils-demo/tsconfig.json b/packages/utils-demo/tsconfig.json index 09f20a6d54..594c52763a 100644 --- a/packages/utils-demo/tsconfig.json +++ b/packages/utils-demo/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js", - }, - "include": [ - "src/**/*" - ] + } } \ No newline at end of file diff --git a/packages/utils-general/package.json b/packages/utils-general/package.json index e2caa3b892..f9e7ca4de5 100644 --- a/packages/utils-general/package.json +++ b/packages/utils-general/package.json @@ -2,7 +2,6 @@ "name": "@energyweb/utils-general", "description": "", "license": "GPL-3.0", - "author": "slock.it GmbH; Martin Kuechler, martin.kuechler@slock.it; Heiko Burkhardt, heiko.burkhardt@slock.it", "homepage": "https://github.com/energywebfoundation/ewf-monorepo/packages/utils-general#readme", "repository": { "type": "git", @@ -12,26 +11,29 @@ "url": "https://github.com/energywebfoundation/ewf-monorepo/issues" }, "version": "1.1.0", - "main": "dist/js/index.js", + "main": "dist/js/src/index.js", "files": [ "contracts", - "dist" + "dist/js/build", + "dist/js/src" ], "directories": { "test": "test" }, "scripts": { "build": "scripts/build.js", - "build-ts": "rm -rf dist/js && tsc", + "build-ts": "rm -rf dist/js && tsc -b tsconfig.build.json --verbose --pretty", "compile": "truffle compile", "deploy-contracts": "truffle migrate", "lint": "solium -d contracts && tslint 'src/**/*{.ts,.tsx}'", "lint-fix": "solium -d contracts --fix && tslint --fix 'src/**/*{.ts,.tsx}'", "prepare": "scripts/build.js", "start-ganache": "ganache-cli -m 'chalk park staff buzz chair purchase wise oak receive avoid avoid home' -g 0 -l 80000000 -e 1000000 -a 20", - "prettier": "prettier --write --config-precedence file-override './src/**/*'" + "prettier": "prettier --write --config-precedence file-override './src/**/*'", + "clean": "rm -rf build dist", + "build:static": "yarn compile" }, - "types": "dist/js/index.d.ts", + "types": "dist/js/src/index.d.ts", "dependencies": { "axios": "0.19.0", "ew-utils-general-precise-proofs": "0.3.0", diff --git a/packages/utils-general/scripts/build.js b/packages/utils-general/scripts/build.js index 89329907b9..e004a3ef93 100755 --- a/packages/utils-general/scripts/build.js +++ b/packages/utils-general/scripts/build.js @@ -6,53 +6,52 @@ const path = require('path'); const fs = require('fs-extra'); function relativePath(pathToAdd) { - return path.join(__dirname, pathToAdd); + return path.join(__dirname, pathToAdd); } function getRootDirectory() { - const PATHS_TO_TEST = [ - relativePath('../') - ]; + const PATHS_TO_TEST = [relativePath('../')]; - for (const path of PATHS_TO_TEST) { - if (fs.existsSync(path)) { - return path; + for (const path of PATHS_TO_TEST) { + if (fs.existsSync(path)) { + return path; + } } - } - throw `Can't find contracts directory`; + throw `Can't find contracts directory`; } const ROOT_DIRECTORY = getRootDirectory(); async function executeCommand(command, directory) { - const options = {}; - - if (directory) { - options.cwd = directory; - } - - try { - const { stdout, stderr } = await exec(command, options); - - console.log(stdout); - console.error(stderr); - } catch (error) { - if (error && error.stdout) { - console.error(error.stdout); - } else { - console.error(error); + const options = {}; + + if (directory) { + options.cwd = directory; + } + + try { + const { stdout, stderr } = await exec(command, options); + + console.log(stdout); + console.error(stderr); + } catch (error) { + if (error && error.stdout) { + console.error(error.stdout); + } else { + console.error(error); + } + process.exit(1); } - } } async function run() { - console.log('EW-UTILS-GENERAL-LIB: Building...'); + console.log('EW-UTILS-GENERAL-LIB: Building...'); - await executeCommand('yarn compile', ROOT_DIRECTORY) - await executeCommand('yarn build-ts', ROOT_DIRECTORY) + await executeCommand('yarn compile', ROOT_DIRECTORY); + await executeCommand('yarn build-ts', ROOT_DIRECTORY); - console.log('EW-UTILS-GENERAL-LIB: Done.'); + console.log('EW-UTILS-GENERAL-LIB: Done.'); } -run(); \ No newline at end of file +run(); diff --git a/packages/utils-general/tsconfig.build.json b/packages/utils-general/tsconfig.build.json new file mode 100644 index 0000000000..11abdaae2e --- /dev/null +++ b/packages/utils-general/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "rootDir": "./", + "outDir": "./dist/js", + }, + "include": [ + "src/**/*", "build/**/*.json" + ] +} \ No newline at end of file diff --git a/packages/utils-general/tsconfig.json b/packages/utils-general/tsconfig.json index 09f20a6d54..594c52763a 100644 --- a/packages/utils-general/tsconfig.json +++ b/packages/utils-general/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist/js", - }, - "include": [ - "src/**/*" - ] + } } \ No newline at end of file diff --git a/packages/utils-testbackend/package.json b/packages/utils-testbackend/package.json index b00562acaf..2fccf2c845 100644 --- a/packages/utils-testbackend/package.json +++ b/packages/utils-testbackend/package.json @@ -2,14 +2,15 @@ "name": "@energyweb/utils-testbackend", "version": "1.1.0", "description": "", - "main": "dist/js/index.js", + "main": "dist/js/src/index.js", "scripts": { "start": "node dist/js/src/index.js", - "build": "rm -rf dist/js && tsc", + "build": "rm -rf dist/js && tsc -b tsconfig.build.json --verbose --pretty", "lint": "tslint --fix 'src/**/*{.ts,.tsx}'", "prettier": "prettier --write --config-precedence file-override './src/**/*'", "prepare": "yarn build", - "test": "rm -rf db.json && npm run build && mocha dist/js/test/ --timeout 60000" + "test": "rm -rf db.json && npm run build && mocha dist/js/test/ --timeout 60000", + "clean": "rm -rf dist" }, "repository": { "type": "git", diff --git a/packages/utils-testbackend/tsconfig.build.json b/packages/utils-testbackend/tsconfig.build.json new file mode 100644 index 0000000000..f2a4575619 --- /dev/null +++ b/packages/utils-testbackend/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.build.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist/js", + }, + "include": [ + "src/**/*" + ] +} \ No newline at end of file diff --git a/packages/utils-testbackend/tsconfig.json b/packages/utils-testbackend/tsconfig.json index 792fca2a6f..53ddd69e3f 100644 --- a/packages/utils-testbackend/tsconfig.json +++ b/packages/utils-testbackend/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "rootDir": "./", - "outDir": "./dist/js" - }, - "include": ["./test/*", "./src/**/*", "./env.json"] + + } } diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000000..34ef45a40c --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "sourceMap": true, + "noImplicitAny": false, + "declaration": true, + "module": "CommonJS", + "target": "es2018", + "jsx": "react", + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "lib": [ + "es2018", + "dom" + ], + "skipLibCheck": true + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 34ef45a40c..a7fe6b6906 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,9 @@ { - "compilerOptions": { - "sourceMap": true, - "noImplicitAny": false, - "declaration": true, - "module": "CommonJS", - "target": "es2018", - "jsx": "react", - "allowSyntheticDefaultImports": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "lib": [ - "es2018", - "dom" - ], - "skipLibCheck": true - } -} \ No newline at end of file + "extends": "./tsconfig.build.json", + "compilerOptions": { + "baseUrl": "./packages", + "paths": { + "@energyweb/*": ["*/src"] + } + } +} diff --git a/yarn.lock b/yarn.lock index cc2fe44b09..d778f1f5da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1798,11 +1798,6 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" -acorn-dynamic-import@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" - integrity sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw== - acorn-globals@^4.1.0: version "4.3.3" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.3.tgz#a86f75b69680b8780d30edd21eee4e0ea170c05e" @@ -1821,7 +1816,7 @@ acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.1, acorn@^6.0.5: +acorn@^6.0.1, acorn@^6.2.1: version "6.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== @@ -1878,7 +1873,7 @@ ajv-errors@^1.0.0: resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== -ajv-keywords@^3.1.0: +ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: version "3.4.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== @@ -1893,7 +1888,7 @@ ajv@^5.2.2: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" -ajv@^6.1.0, ajv@^6.5.5: +ajv@^6.1.0, ajv@^6.10.2, ajv@^6.5.5: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== @@ -2257,7 +2252,7 @@ axios@0.19.0: follow-redirects "1.5.10" is-buffer "^2.0.2" -babel-code-frame@^6.26.0: +babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= @@ -2539,6 +2534,13 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" @@ -3019,7 +3021,7 @@ chokidar@^1.6.0: optionalDependencies: fsevents "^1.0.0" -chokidar@^2.0.2, chokidar@^2.1.5: +chokidar@^2.0.2, chokidar@^2.0.4, chokidar@^2.1.5: version "2.1.8" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" integrity sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg== @@ -3043,7 +3045,7 @@ chownr@^1.1.1, chownr@^1.1.2: resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6" integrity sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A== -chrome-trace-event@^1.0.0: +chrome-trace-event@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4" integrity sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ== @@ -4733,7 +4735,7 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -eslint-scope@^4.0.0: +eslint-scope@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== @@ -5347,6 +5349,13 @@ fill-range@^4.0.0: repeat-string "^1.6.1" to-regex-range "^2.1.0" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + finalhandler@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105" @@ -5502,6 +5511,20 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +fork-ts-checker-webpack-plugin@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.5.0.tgz#ce1d77190b44d81a761b10b6284a373795e41f0c" + integrity sha512-zEhg7Hz+KhZlBhILYpXy+Beu96gwvkROWJiTXOCyOOMMrdBIRPvsBpBqgTI4jfJGrJXcqGwJR8zsBGDmzY0jsA== + dependencies: + babel-code-frame "^6.22.0" + chalk "^2.4.1" + chokidar "^2.0.4" + micromatch "^3.1.10" + minimatch "^3.0.4" + semver "^5.6.0" + tapable "^1.0.0" + worker-rpc "^0.1.0" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -6940,6 +6963,11 @@ is-number@^4.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-obj@^1.0.0, is-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" @@ -8127,7 +8155,7 @@ load-json-file@^5.3.0: strip-bom "^3.0.0" type-fest "^0.3.0" -loader-runner@^2.3.0: +loader-runner@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== @@ -8142,7 +8170,7 @@ loader-utils@^0.2.16: json5 "^0.5.0" object-assign "^4.0.1" -loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0: +loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA== @@ -8524,7 +8552,7 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" -memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: +memory-fs@^0.4.0, memory-fs@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= @@ -8588,6 +8616,11 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= +microevent.ts@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/microevent.ts/-/microevent.ts-0.1.1.tgz#70b09b83f43df5172d0205a63025bce0f7357fa0" + integrity sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g== + micromatch@^2.1.5: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" @@ -8626,6 +8659,14 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -8786,7 +8827,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: +mkdirp@*, mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -8996,7 +9037,7 @@ negotiator@0.6.2: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== -neo-async@^2.5.0, neo-async@^2.6.0: +neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== @@ -9098,7 +9139,7 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= -node-libs-browser@^2.0.0: +node-libs-browser@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425" integrity sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q== @@ -10042,6 +10083,11 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= +picomatch@^2.0.5: + version "2.0.7" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.0.7.tgz#514169d8c7cd0bdbeecc8a2609e34a7163de69f6" + integrity sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -11653,7 +11699,7 @@ semver-utils@^1.1.4: resolved "https://registry.yarnpkg.com/semver-utils/-/semver-utils-1.1.4.tgz#cf0405e669a57488913909fc1c3f29bf2a4871e2" integrity sha512-EjnoLE5OGmDAVV/8YDoN5KiajNadjzIp9BAHOhYeQHt7j0UWxjmgsx4YD48wp4Ue1Qogq38F1GNUJNqF1kKKxA== -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.0.1, semver@^5.0.3, semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.0.3, semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -12556,7 +12602,7 @@ synchronous-promise@^2.0.6: resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.9.tgz#b83db98e9e7ae826bf9c8261fd8ac859126c780a" integrity sha512-LO95GIW16x69LuND1nuuwM4pjgFGupg7pZ/4lU86AmchPKrhk0o2tpMU2unXRrqo81iAFe1YJ0nAGEVwsrZAgg== -tapable@^1.0.0, tapable@^1.1.0: +tapable@^1.0.0, tapable@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== @@ -12631,7 +12677,7 @@ term-size@^1.2.0: dependencies: execa "^0.7.0" -terser-webpack-plugin@^1.1.0: +terser-webpack-plugin@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4" integrity sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg== @@ -12793,6 +12839,13 @@ to-regex-range@^2.1.0: is-number "^3.0.0" repeat-string "^1.6.1" +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" @@ -12926,16 +12979,16 @@ ts-jest@24.0.2: semver "^5.5" yargs-parser "10.x" -ts-loader@5.4.5: - version "5.4.5" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-5.4.5.tgz#a0c1f034b017a9344cef0961bfd97cc192492b8b" - integrity sha512-XYsjfnRQCBum9AMRZpk2rTYSVpdZBpZK+kDh0TeT3kxmQNBDVIeUjdPjY5RZry4eIAb8XHc4gYSUiUWPYvzSRw== +ts-loader@6.0.4: + version "6.0.4" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.0.4.tgz#bc331ad91a887a60632d94c9f79448666f2c4b63" + integrity sha512-p2zJYe7OtwR+49kv4gs7v4dMrfYD1IPpOtqiSPCbe8oR+4zEBtdHwzM7A7M91F+suReqgzZrlClk4LRSSp882g== dependencies: chalk "^2.3.0" enhanced-resolve "^4.0.0" loader-utils "^1.0.2" - micromatch "^3.1.4" - semver "^5.0.1" + micromatch "^4.0.0" + semver "^6.0.0" ts-mockito@2.4.2: version "2.4.2" @@ -13110,11 +13163,16 @@ typescript-tuple@^2.1.0: dependencies: typescript-compare "^0.0.2" -typescript@^3.0.1, typescript@^3.5.1, typescript@^3.5.3: +typescript@^3.0.1, typescript@^3.5.1: version "3.5.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== +typescript@^3.5.3: + version "3.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" + integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw== + uglify-js@3.4.x: version "3.4.10" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f" @@ -13479,7 +13537,7 @@ warning@^4.0.1: dependencies: loose-envify "^1.0.0" -watchpack@^1.5.0: +watchpack@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" integrity sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA== @@ -13814,7 +13872,7 @@ webpack-merge@4.2.1: dependencies: lodash "^4.17.5" -webpack-sources@^1.1.0, webpack-sources@^1.3.0, webpack-sources@^1.4.0: +webpack-sources@^1.1.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ== @@ -13822,35 +13880,34 @@ webpack-sources@^1.1.0, webpack-sources@^1.3.0, webpack-sources@^1.4.0: source-list-map "^2.0.0" source-map "~0.6.1" -webpack@4.30.0: - version "4.30.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.30.0.tgz#aca76ef75630a22c49fcc235b39b4c57591d33a9" - integrity sha512-4hgvO2YbAFUhyTdlR4FNyt2+YaYBYHavyzjCMbZzgglo02rlKi/pcsEzwCuCpsn1ryzIl1cq/u8ArIKu8JBYMg== +webpack@4.39.3: + version "4.39.3" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.39.3.tgz#a02179d1032156b713b6ec2da7e0df9d037def50" + integrity sha512-BXSI9M211JyCVc3JxHWDpze85CvjC842EvpRsVTc/d15YJGlox7GIDd38kJgWrb3ZluyvIjgenbLDMBQPDcxYQ== dependencies: "@webassemblyjs/ast" "1.8.5" "@webassemblyjs/helper-module-context" "1.8.5" "@webassemblyjs/wasm-edit" "1.8.5" "@webassemblyjs/wasm-parser" "1.8.5" - acorn "^6.0.5" - acorn-dynamic-import "^4.0.0" - ajv "^6.1.0" - ajv-keywords "^3.1.0" - chrome-trace-event "^1.0.0" + acorn "^6.2.1" + ajv "^6.10.2" + ajv-keywords "^3.4.1" + chrome-trace-event "^1.0.2" enhanced-resolve "^4.1.0" - eslint-scope "^4.0.0" + eslint-scope "^4.0.3" json-parse-better-errors "^1.0.2" - loader-runner "^2.3.0" - loader-utils "^1.1.0" - memory-fs "~0.4.1" - micromatch "^3.1.8" - mkdirp "~0.5.0" - neo-async "^2.5.0" - node-libs-browser "^2.0.0" + loader-runner "^2.4.0" + loader-utils "^1.2.3" + memory-fs "^0.4.1" + micromatch "^3.1.10" + mkdirp "^0.5.1" + neo-async "^2.6.1" + node-libs-browser "^2.2.1" schema-utils "^1.0.0" - tapable "^1.1.0" - terser-webpack-plugin "^1.1.0" - watchpack "^1.5.0" - webpack-sources "^1.3.0" + tapable "^1.1.3" + terser-webpack-plugin "^1.4.1" + watchpack "^1.6.0" + webpack-sources "^1.4.1" websocket-driver@>=0.5.1: version "0.7.3" @@ -13998,6 +14055,13 @@ worker-farm@^1.7.0: dependencies: errno "~0.1.7" +worker-rpc@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/worker-rpc/-/worker-rpc-0.1.1.tgz#cb565bd6d7071a8f16660686051e969ad32f54d5" + integrity sha512-P1WjMrUB3qgJNI9jfmpZ/htmBEjFh//6l/5y8SD9hg1Ef5zTTVVoRjTrTEzPrNBQvmhMxkoTsjOXN10GWU7aCg== + dependencies: + microevent.ts "~0.1.1" + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"