Skip to content

Commit

Permalink
removed unused dependencies (#2060)
Browse files Browse the repository at this point in the history
* removed unused dependencies

* convert to esm module, update dependencies

* update test files to mjs

* changes to modules imports and test:bdd command in package.json

* temporary fix for sequelize migrations

* downgrade comunica

* fix lint errors

* fix multiple issues

* remove logs, add sleep in tests

* fix import issues in unit tests

* add asset type json

* properly import json files

* run sequelize migrations programmatically

* remove unused dependencies

* remove unused dependencies

* udate dev dependencies

* Added removing of expired cache files

* add dependencies document

* update package-lock.json

* update origintrail modules versions

* Updated depnedencies for pokladot api

* Added ganache starting for local network setup

Co-authored-by: micax3000 <[email protected]>
Co-authored-by: Djordje Kovacevic <[email protected]>
  • Loading branch information
3 people authored Sep 5, 2022
1 parent b234ce4 commit 57a7ae8
Show file tree
Hide file tree
Showing 163 changed files with 20,242 additions and 39,099 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
extends: ['airbnb/base', 'prettier'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021,
ecmaVersion: 'latest'
},
rules: {
'linebreak-style': ['error', 'unix'],
Expand All @@ -18,6 +18,7 @@ module.exports = {
'no-console': 'warn',
'no-continue': 1,
'no-underscore-dangle': 0,
'import/extensions': 0,
},
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion Alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN tar xzf ./remote_syslog_linux_amd64.tar.gz && cd remote_syslog && cp ./remot

COPY config/papertrail.yml /etc/log_files.yml

#Install nodemon, git & forever
#Install git & forever
RUN npm install forever -g
RUN apk add git

Expand Down
4 changes: 2 additions & 2 deletions Debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ COPY config/papertrail.yml /etc/log_files.yml



#Install nodemon & forever
#Install forever
RUN npm install forever -g


Expand All @@ -52,5 +52,5 @@ COPY . .
RUN npm install

#Mysql intialization
RUN service mariadb start && mysql -u root -e "CREATE DATABASE operationaldb /*\!40100 DEFAULT CHARACTER SET utf8 */; SET PASSWORD FOR root@localhost = PASSWORD(''); FLUSH PRIVILEGES;" && npx sequelize --config=./config/sequelizeConfig.js db:migrate
RUN service mariadb start && mysql -u root -e "CREATE DATABASE operationaldb /*\!40100 DEFAULT CHARACTER SET utf8 */; SET PASSWORD FOR root@localhost = PASSWORD(''); FLUSH PRIVILEGES;"

4 changes: 2 additions & 2 deletions Ubuntu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COPY config/papertrail.yml /etc/log_files.yml



#Install nodemon
#Install forever
RUN npm install -g forever


Expand All @@ -38,5 +38,5 @@ RUN npm install
#Intialize mysql
RUN usermod -d /var/lib/mysql/ mysql
RUN echo "disable_log_bin" >> /etc/mysql/mysql.conf.d/mysqld.cnf
RUN service mysql start && mysql -u root -e "CREATE DATABASE operationaldb /*\!40100 DEFAULT CHARACTER SET utf8 */; update mysql.user set plugin = 'mysql_native_password' where User='root'/*\!40100 DEFAULT CHARACTER SET utf8 */; flush privileges;" && npx sequelize --config=./config/sequelizeConfig.js db:migrate
RUN service mysql start && mysql -u root -e "CREATE DATABASE operationaldb /*\!40100 DEFAULT CHARACTER SET utf8 */; update mysql.user set plugin = 'mysql_native_password' where User='root'/*\!40100 DEFAULT CHARACTER SET utf8 */; flush privileges;"

74 changes: 37 additions & 37 deletions config/config.json

Large diffs are not rendered by default.

276 changes: 276 additions & 0 deletions dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
# OT-node dependencies

## dev dependencies

##### [@cucumber/cucumber](https://www.npmjs.com/package/@cucumber/cucumber)
- **version**: ^8.5.2
- **description**: used to execute bdd tests

##### [@ethersproject/bytes](https://www.npmjs.com/package/@ethersproject/bytes)
- **version**: ^5.7.0
- **description**: Used for creating substrate and evm accounts mapping signatures in `create-account-mapping-signature.js`

##### [@ethersproject/hash](https://www.npmjs.com/package/@ethersproject/hash)
- **version**: ^5.7.0
- **description**: Used for creating substrate and evm accounts mapping signatures in `create-account-mapping-signature.js`

##### [@ethersproject/wallet](https://www.npmjs.com/package/@ethersproject/wallet)
- **version**: ^5.7.0
- **description**: Used for creating substrate and evm accounts mapping signatures in `create-account-mapping-signature.js`

##### [@polkadot/util](https://www.npmjs.com/package/@polkadot/util)
- **version**: ^10.1.7
- **description**: Used for creating substrate and evm accounts mapping signatures in `create-account-mapping-signature.js`

##### [@polkadot/util-crypto](https://www.npmjs.com/package/@polkadot/util-crypto)
- **version**: ^10.1.7
- **description**: Used for creating substrate and evm accounts mapping signatures in `create-account-mapping-signature.js`

##### [chai](https://www.npmjs.com/package/chai)
- **version**: ^4.3.6
- **description**: assertion library for bdd tests

##### [dkg.js](https://www.npmjs.com/package/dkg.js)
- **version**: ^6.0.0-beta.3.0.3
- **description**: dkg client used in bdd tests

##### [eslint](https://www.npmjs.com/package/eslint)
- **version**: ^8.23.0
- **description**: code linter

##### [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb)
- **version**: ^19.0.4
- **description**: linter plugin

##### [eslint-config-prettier](https://www.npmjs.com/package/eslint-config-prettier)
- **version**: ^8.5.0
- **description**: linter plugin

##### [ganache](https://www.npmjs.com/package/ganache)
- **version**: ^7.4.1
- **description**: ethereum simulator used in bdd tests

##### [husky](https://www.npmjs.com/package/husky)
- **version**: ^8.0.1
- **description**: used to run lint-staged as pre commit

##### [lint-staged](https://www.npmjs.com/package/lint-staged)
- **version**: ^13.0.3
- **description**: code linter for pre commits

##### [mocha](https://www.npmjs.com/package/mocha)
- **version**: ^10.0.0
- **description**: test framework used in unit tests

##### [nyc](https://www.npmjs.com/package/nyc)
- **version**: ^15.1.0
- **description**: command line interface used for running mocha

##### [prettier](https://www.npmjs.com/package/prettier)
- **version**: ^2.7.1
- **description**: code formatter

##### [sinon](https://www.npmjs.com/package/sinon)
- **version**: ^14.0.0
- **description**: used to create sandboxes in unit tests

##### [slugify](https://www.npmjs.com/package/slugify)
- **version**: ^1.6.5
- **description**: used to stringify cucumber test scenarios



## dependencies

##### [@chainsafe/libp2p-noise](https://www.npmjs.com/package/@chainsafe/libp2p-noise)
- **version**: ^8.0.1
- **description**: libp2p connection encription module

##### [@comunica/query-sparql](https://www.npmjs.com/package/@comunica/query-sparql)
- **version**: 2.2.1
- **description**: sparql query engine

##### [@libp2p/bootstrap](https://www.npmjs.com/package/@libp2p/bootstrap)
- **version**: ^2.0.0
- **description**: used to connect to list of boostraps

##### [@libp2p/kad-dht](https://www.npmjs.com/package/@libp2p/kad-dht)
- **version**: ^3.0.4
- **description**: libp2p kademlia dht module

##### [@libp2p/mplex](https://www.npmjs.com/package/@libp2p/mplex)
- **version**: ^5.0.0
- **description**: libp2p stream multiplexer module

##### [@libp2p/peer-id-factory](https://www.npmjs.com/package/@libp2p/peer-id-factory)
- **version**: ^1.0.18
- **description**: used for creation of libp2p network identity

##### [@libp2p/tcp](https://www.npmjs.com/package/@libp2p/tcp)
- **version**: ^3.0.3
- **description**: libp2p TCP module

##### [@polkadot/api](https://www.npmjs.com/package/@polkadot/api)
- **version**: ^9.2.4
- **description**: used to interact with substrate nodes

##### [app-root-path](https://www.npmjs.com/package/app-root-path)
- **version**: ^3.1.0
- **description**: used to determine root path

##### [assertion-tools](https://www.npmjs.com/package/assertion-tools)
- **version**: ^1.0.8
- **description**: various functions used by both dkg.js and ot-node

##### [async](https://www.npmjs.com/package/async)
- **version**: ^3.2.4
- **description**: used in `command-executor.js` to create an async queue to manage commands

##### [async-mutex](https://www.npmjs.com/package/async-mutex)
- **version**: ^0.3.2
- **description**: used to avoid race conditions when updating sql repository

##### [awilix](https://www.npmjs.com/package/awilix)
- **version**: ^7.0.3
- **description**: dependency injection container

##### [axios](https://www.npmjs.com/package/axios)
- **version**: ^0.27.2
- **description**: http client used to make http requests

##### [cors](https://www.npmjs.com/package/cors)
- **version**: ^2.8.5
- **description**: cors express middleware

##### [deep-extend](https://www.npmjs.com/package/deep-extend)
- **version**: ^0.6.0
- **description**: used to merge users config and default config

##### [dkg-evm-module](https://www.npmjs.com/package/dkg-evm-module)
- **version**: ^1.0.1
- **description**: used to import latest ot-node smart contracts abis

##### [dotenv](https://www.npmjs.com/package/dotenv)
- **version**: ^16.0.1
- **description**: used for NODE_ENV variable

##### [express](https://www.npmjs.com/package/express)
- **version**: ^4.18.1
- **description**: used to handle http requests

##### [express-fileupload](https://www.npmjs.com/package/express-fileupload)
- **version**: ^1.4.0
- **description**: express middleware **review required**

##### [express-rate-limit](https://www.npmjs.com/package/express-rate-limit)
- **version**: ^6.5.2
- **description**: used to rate limit rpc requests

##### [fs-extra](https://www.npmjs.com/package/fs-extra)
- **version**: ^10.1.0
- **description**: used for file system methods

##### [graphdb](https://www.npmjs.com/package/graphdb)
- **version**: ^2.0.2
- **description**: used to create graphdb repositories if they don't exist

##### [ip](https://www.npmjs.com/package/ip)
- **version**: ^1.1.8
- **description**: used to compare ip addresses

##### [it-length-prefixed](https://www.npmjs.com/package/it-length-prefixed)
- **version**: ^8.0.2
- **description**: used to encode and decode streamed buffers in libp2p

##### [it-map](https://www.npmjs.com/package/it-map)
- **version**: ^1.0.6
- **description**: used to map values received yielded by libp2p async iterators

##### [it-pipe](https://www.npmjs.com/package/it-pipe)
- **version**: ^2.0.4
- **description**: stream pipeline that supports libp2p duplex streams. Used for streaming messages between nodes

##### [jsonld](https://www.npmjs.com/package/jsonld)
- **version**: ^8.1.0
- **description**: used to canonize n-quads retrieved from db. **Should be moved to assertion-tools dependency**

##### [jsonschema](https://www.npmjs.com/package/jsonschema)
- **version**: ^1.4.1
- **description**: used to validate ot-node rpc requests' bodies

##### [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken)
- **version**: ^8.5.1
- **description**: used to generate, validate and decode JWTs

##### [keccak256](https://www.npmjs.com/package/keccak256)
- **version**: ^1.0.6
- **description**: used to hash n-quads in validation module. **Should be moved to assertion-tools dependency**

##### [libp2p](https://www.npmjs.com/package/libp2p)
- **version**: ^0.38.0
- **description**:

##### [merkletreejs](https://www.npmjs.com/package/merkletreejs)
- **version**: ^0.2.32
- **description**: used to create merkle tree in validation module. **Should be moved to assertion-tools dependency**

##### [ms](https://www.npmjs.com/package/ms)
- **version**: ^2.1.3
- **description**: convert expiration time to milliseconds in `token-generation.js`

##### [mysql2](https://www.npmjs.com/package/mysql2)
- **version**: ^2.3.3
- **description**:

##### [pino](https://www.npmjs.com/package/pino)
- **version**: ^8.4.2
- **description**: ot-node logger implementation

##### [pino-pretty](https://www.npmjs.com/package/pino-pretty)
- **version**: ^9.1.0
- **description**: prettifier for pino logger

##### [rc](https://www.npmjs.com/package/rc)
- **version**: ^1.2.8
- **description**: configuration loader

##### [rolling-rate-limiter](https://www.npmjs.com/package/rolling-rate-limiter)
- **version**: ^0.2.13
- **description**: used to limit network requests

##### [semver](https://www.npmjs.com/package/semver)
- **version**: ^7.3.7
- **description**: used to compare ot-node versions during auto update

##### [sequelize](https://www.npmjs.com/package/sequelize)
- **version**: ^6.21.4
- **description**: used to communicate with sql repository

##### [toobusy-js](https://www.npmjs.com/package/toobusy-js)
- **version**: ^0.5.1
- **description**: used to check nodejs event loop lag

##### [uint8arrays](https://www.npmjs.com/package/uint8arrays)
- **version**: ^3.1.0
- **description**: used to convert from string to buffer and from buffer to string

##### [umzug](https://www.npmjs.com/package/umzug)
- **version**: ^3.2.1
- **description**: sequelize migration tool

##### [unzipper](https://www.npmjs.com/package/unzipper)
- **version**: ^0.10.11
- **description**: unzip file during autoupdate

##### [uuid](https://www.npmjs.com/package/uuid)
- **version**: ^8.3.2
- **description**: uuid generation

##### [web3](https://www.npmjs.com/package/web3)
- **version**: ^1.7.5
- **description**: used to interact with evm smart contracts

##### [workerpool](https://www.npmjs.com/package/workerpool)
- **version**: ^6.2.1
- **description**: offload cpu intensive work

2 changes: 1 addition & 1 deletion docker/docker-compose-alpine-blazegraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
command:
- '/bin/sh'
- '-c'
- '/bin/sleep 25 && npx sequelize --config=./config/sequelizeConfig.js db:migrate && forever index.js'
- '/bin/sleep 25 && forever index.js'


volumes:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-alpine-graphdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
command:
- '/bin/sh'
- '-c'
- '/bin/sleep 25 && npx sequelize --config=./config/sequelizeConfig.js db:migrate && forever index.js'
- '/bin/sleep 25 && forever index.js'


volumes:
Expand Down
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable no-console */
require('dotenv').config();
const fs = require('fs-extra');
const path = require('path');
const appRootPath = require('app-root-path');
const { execSync } = require('child_process');
const semver = require('semver');
const OTNode = require('./ot-node');
import 'dotenv/config';
import fs from 'fs-extra';
import path from 'path';
import appRootPath from 'app-root-path';
import { execSync } from 'child_process';
import semver from 'semver';
import OTNode from './ot-node.js';

process.env.NODE_ENV =
process.env.NODE_ENV && ['development', 'testnet', 'mainnet'].indexOf(process.env.NODE_ENV) >= 0
Expand Down
Loading

0 comments on commit 57a7ae8

Please sign in to comment.