From d1bd1bf0a09f5389f3f272039271b864150022f9 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Wed, 15 Dec 2021 12:54:13 +0800 Subject: [PATCH 1/2] add new apps/ directory for deployable apps updated ts config to modern flags --- .github/CODEOWNERS | 18 ++++---- .idea/dictionaries/fuxing.xml | 1 + .idea/jellyfish.iml | 6 +-- README.md | 23 +--------- {website => apps/website}/.gitignore | 0 {website => apps/website}/README.md | 8 ++-- {website => apps/website}/babel.config.js | 0 .../website}/docusaurus.config.js | 8 ++-- {website => apps/website}/package.json | 4 +- {website => apps/website}/src/css/theme.css | 0 {website => apps/website}/src/pages/index.tsx | 0 .../website}/src/pages/styles.module.css | 0 .../website}/static/img/favicon.ico | Bin {website => apps/website}/static/img/logo.svg | 0 {website => apps/website}/tsconfig.json | 0 jest.config.js | 9 ++-- lerna.json | 5 +- netlify.toml | 2 +- package-lock.json | 43 ++++++++++++------ package.json | 9 ++-- packages/jellyfish-api-jsonrpc/package.json | 3 -- tsconfig.base.json | 13 ++++-- tsconfig.build.json | 2 +- tsconfig.json | 6 +-- 24 files changed, 79 insertions(+), 81 deletions(-) rename {website => apps/website}/.gitignore (100%) rename {website => apps/website}/README.md (69%) rename {website => apps/website}/babel.config.js (100%) rename {website => apps/website}/docusaurus.config.js (96%) rename {website => apps/website}/package.json (92%) rename {website => apps/website}/src/css/theme.css (100%) rename {website => apps/website}/src/pages/index.tsx (100%) rename {website => apps/website}/src/pages/styles.module.css (100%) rename {website => apps/website}/static/img/favicon.ico (100%) rename {website => apps/website}/static/img/logo.svg (100%) rename {website => apps/website}/tsconfig.json (100%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 133f98c9b..385b8922d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,29 +1,27 @@ # Define individuals that are responsible for code in this repository. # More details are here: https://help.github.com/articles/about-codeowners/ -/.github/ @fuxingloh @monstrobishi -/.husky/ @fuxingloh @monstrobishi - -/examples/ @fuxingloh +/.github/ @fuxingloh +/.husky/ @fuxingloh /packages/jellyfish-address/ @fuxingloh @ivan-zynesis -/packages/jellyfish-api-core/ @fuxingloh @canonbrother @jingyi2811 @ivan-zynesis @surangap @Jouzo +/packages/jellyfish-api-core/ @fuxingloh @canonbrother @jingyi2811 @ivan-zynesis @surangap /packages/jellyfish-api-jsonrpc/ @fuxingloh @thedoublejay -/packages/jellyfish-block/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @Jouzo @jingyi2811 +/packages/jellyfish-block/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @jingyi2811 -/packages/jellyfish-buffer/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @Jouzo @jingyi2811 +/packages/jellyfish-buffer/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @jingyi2811 /packages/jellyfish-crypto/ @fuxingloh @ivan-zynesis @surangap /packages/jellyfish-json/ @fuxingloh @canonbrother /packages/jellyfish-network/ @fuxingloh @ivan-zynesis -/packages/jellyfish-testing/ @fuxingloh @canonbrother @jingyi2811 @surangap @Jouzo +/packages/jellyfish-testing/ @fuxingloh @canonbrother @jingyi2811 @surangap -/packages/jellyfish-transaction/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @Jouzo @jingyi2811 -/packages/jellyfish-transaction-builder/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @Jouzo @jingyi2811 +/packages/jellyfish-transaction/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @jingyi2811 +/packages/jellyfish-transaction-builder/ @fuxingloh @ivan-zynesis @canonbrother @monstrobishi @surangap @jingyi2811 /packages/jellyfish-transaction-signature/ @fuxingloh @ivan-zynesis @surangap /packages/jellyfish-wallet/ @fuxingloh @ivan-zynesis @monstrobishi @surangap diff --git a/.idea/dictionaries/fuxing.xml b/.idea/dictionaries/fuxing.xml index a514d2e32..efc7cf47b 100644 --- a/.idea/dictionaries/fuxing.xml +++ b/.idea/dictionaries/fuxing.xml @@ -159,6 +159,7 @@ mintedblocks minttokens modifiedfee + monstrobishi multisig nblocks networkhashps diff --git a/.idea/jellyfish.iml b/.idea/jellyfish.iml index 17f208a21..ddf4e5765 100644 --- a/.idea/jellyfish.iml +++ b/.idea/jellyfish.iml @@ -4,13 +4,13 @@ - - + + - + \ No newline at end of file diff --git a/README.md b/README.md index c1e6fba5d..cb790f7ad 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ DeFiChain Jellyfish SDK. A collection of TypeScript + JavaScript tools and libra
Watch this space! -We are consolidating all jellyfish ecosystem projects ocean, whale, playground, and salmon into this repository. +We are consolidating all jellyfish ecosystem projects ocean, whale and playground into this repository. - For better synergy of DeFiChain open source development across all concerns. - Consistent versioning for all ecosystem releases with a single source of truth. @@ -28,27 +28,6 @@ We are consolidating all jellyfish ecosystem projects ocean, whale, playground, DeFi Jellyfish follows a monorepo methodology, all maintained packages are in the same repo and published with the same version tag. -| Package | Description | -|----------------------------------------------|------------------------------------------------------------------------------------------------------------------------| -| `@defichain/jellyfish-address` | Provide address builder, parser, validator utility library for DeFi Blockchain. | -| `@defichain/jellyfish-api-core` | A protocol agnostic DeFi Blockchain client interfaces, with a "foreign function interface" design. | -| `@defichain/jellyfish-api-jsonrpc` | Implements the [JSON-RPC 1.0](https://www.jsonrpc.org/specification_v1) specification for api-core. | -| `@defichain/jellyfish-block` | Stateless raw block composer for the DeFi Blockchain. | -| `@defichain/jellyfish-buffer` | Buffer composer for jellyfish. | -| `@defichain/jellyfish-crypto` | Cryptography operations for jellyfish, includes a simple 'secp256k1' EllipticPair. | -| `@defichain/jellyfish-json` | Allows parsing of JSON with 'lossless', 'bignumber' and 'number' numeric precision. | -| `@defichain/jellyfish-network` | Contains DeFi Blockchain various network configuration for mainnet, testnet and regtest. | -| `@defichain/jellyfish-testing` | Provides many abstractions for various commonly used setup pattern for DeFi Blockchain. | -| `@defichain/jellyfish-transaction` | Dead simple modern stateless raw transaction composer for the DeFi Blockchain. | -| `@defichain/jellyfish-transaction-builder` | Provides a high-high level abstraction for constructing transaction ready to be broadcast for DeFi Blockchain. | -| `@defichain/jellyfish-transaction-signature` | Stateless utility library to perform transaction signing. | -| `@defichain/jellyfish-wallet` | Jellyfish wallet is a managed wallet, where account can get discovered from an HD seed. | -| `@defichain/jellyfish-wallet-classic` | WalletClassic implements a simple, single elliptic pair wallet. | -| `@defichain/jellyfish-wallet-encrypted` | Library to encrypt MnemonicHdNode as EncryptedMnemonicHdNode. Able to perform as MnemonicHdNode with passphrase known. | -| `@defichain/jellyfish-wallet-mnemonic` | MnemonicHdNode implements the WalletHdNode from jellyfish-wallet; a CoinType-agnostic HD Wallet for noncustodial DeFi. | -| `@defichain/testcontainers` | Provides a lightweight, throw away instances for DeFiD node provisioned automatically in a Docker container. | -| ~~@defichain/testing~~ | (deprecated) ~~Provides rich test fixture setup functions for effective and effortless testing.~~ | - ## Developing & Contributing Thanks for contributing, appreciate all the help we can get. Feel free to make a pull-request, we will guide you along diff --git a/website/.gitignore b/apps/website/.gitignore similarity index 100% rename from website/.gitignore rename to apps/website/.gitignore diff --git a/website/README.md b/apps/website/README.md similarity index 69% rename from website/README.md rename to apps/website/README.md index 69a00a16c..6edeacd47 100644 --- a/website/README.md +++ b/apps/website/README.md @@ -1,7 +1,5 @@ -# jellyfish/website - -`/website/*` contains the documentation for jellyfish; built using [Docusaurus 2](https://v2.docusaurus.io/), a modern -static website generator. +`/apps/website/*` contains the documentation for jellyfish; built using [Docusaurus 2](https://v2.docusaurus.io/), a +modern static website generator. ## Writing documentations @@ -15,5 +13,5 @@ having to restart the server. ```console npm i -npm run start +npm run start --workspace=apps/website ``` diff --git a/website/babel.config.js b/apps/website/babel.config.js similarity index 100% rename from website/babel.config.js rename to apps/website/babel.config.js diff --git a/website/docusaurus.config.js b/apps/website/docusaurus.config.js similarity index 96% rename from website/docusaurus.config.js rename to apps/website/docusaurus.config.js index 0213f581a..a1672ed30 100644 --- a/website/docusaurus.config.js +++ b/apps/website/docusaurus.config.js @@ -128,7 +128,7 @@ module.exports = { '@docusaurus/preset-classic', { docs: { - path: '../docs/ecosystem', + path: '../../docs/ecosystem', routeBasePath: 'ecosystem', editUrl: 'https://github.com/DeFiCh/jellyfish/tree/main/website', sidebarCollapsed: false, @@ -144,7 +144,7 @@ module.exports = { '@docusaurus/plugin-content-docs', { id: 'node', - path: '../docs/node', + path: '../../docs/node', routeBasePath: 'node', editUrl: 'https://github.com/DeFiCh/jellyfish/tree/main/website', sidebarCollapsed: false, @@ -154,7 +154,7 @@ module.exports = { '@docusaurus/plugin-content-docs', { id: 'ocean', - path: '../docs/ocean', + path: '../../docs/ocean', routeBasePath: 'ocean', editUrl: 'https://github.com/DeFiCh/jellyfish/tree/main/website', sidebarCollapsed: false, @@ -164,7 +164,7 @@ module.exports = { '@docusaurus/plugin-content-docs', { id: 'testing', - path: '../docs/testing', + path: '../../docs/testing', routeBasePath: 'testing', editUrl: 'https://github.com/DeFiCh/jellyfish/tree/main/website', sidebarCollapsed: false, diff --git a/website/package.json b/apps/website/package.json similarity index 92% rename from website/package.json rename to apps/website/package.json index daf8086ef..ef5c76d56 100644 --- a/website/package.json +++ b/apps/website/package.json @@ -22,11 +22,11 @@ }, "devDependencies": { "@docusaurus/module-type-aliases": "^2.0.0-beta.13", - "@docusaurus/types": "^2.0.0-beta.9", + "@docusaurus/types": "^2.0.0-beta.13", "@tsconfig/docusaurus": "^1.0.4", "@types/react": "^17.0.37", "@types/react-helmet": "^6.1.4", - "@types/react-router-dom": "^5.3.1" + "@types/react-router-dom": "^5.3.2" }, "browserslist": { "production": [ diff --git a/website/src/css/theme.css b/apps/website/src/css/theme.css similarity index 100% rename from website/src/css/theme.css rename to apps/website/src/css/theme.css diff --git a/website/src/pages/index.tsx b/apps/website/src/pages/index.tsx similarity index 100% rename from website/src/pages/index.tsx rename to apps/website/src/pages/index.tsx diff --git a/website/src/pages/styles.module.css b/apps/website/src/pages/styles.module.css similarity index 100% rename from website/src/pages/styles.module.css rename to apps/website/src/pages/styles.module.css diff --git a/website/static/img/favicon.ico b/apps/website/static/img/favicon.ico similarity index 100% rename from website/static/img/favicon.ico rename to apps/website/static/img/favicon.ico diff --git a/website/static/img/logo.svg b/apps/website/static/img/logo.svg similarity index 100% rename from website/static/img/logo.svg rename to apps/website/static/img/logo.svg diff --git a/website/tsconfig.json b/apps/website/tsconfig.json similarity index 100% rename from website/tsconfig.json rename to apps/website/tsconfig.json diff --git a/jest.config.js b/jest.config.js index 0b09ac365..e68ef854c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,17 +3,16 @@ module.exports = { testRegex: '((\\.|/)(e2e|test|spec))\\.[jt]sx?$', testSequencer: require.resolve('./jest.sequencer'), moduleNameMapper: { - '@defichain/jellyfish-(.*)': '/packages/jellyfish-$1/src', - '@defichain/testcontainers': '/packages/testcontainers/src', - '@defichain/testing': '/packages/testing/src' + '@defichain/.*': '/packages/$1/src' }, verbose: true, clearMocks: true, testTimeout: 180000, coveragePathIgnorePatterns: [ '/node_modules/', - '.*/__tests__/.*', '/examples/', - '/website/' + '/apps/website/', + '.*/__tests__/.*', + '.*/testing/.*' ] } diff --git a/lerna.json b/lerna.json index cd4706c6b..136090289 100644 --- a/lerna.json +++ b/lerna.json @@ -1,7 +1,8 @@ { "version": "0.0.0", "packages": [ - "packages/*", - "./" + "./", + "apps/*", + "packages/*" ] } diff --git a/netlify.toml b/netlify.toml index 90308e369..f55daa28f 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,5 +1,5 @@ [build] -publish = "website/build/" +publish = "apps/website/build/" command = "npm run website:build" [[headers]] diff --git a/package-lock.json b/package-lock.json index 364af22f9..64a33f974 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,8 @@ "license": "MIT", "workspaces": [ "./", - "./packages/*", - "./website" + "./apps/*", + "./packages/*" ], "devDependencies": { "@types/jest": "^27.0.3", @@ -22,6 +22,7 @@ "jest": "^27.4.4", "lerna": "^4.0.0", "lint-staged": "^12.1.2", + "nock": "^13.1.3", "shuffle-seed": "^1.1.6", "ts-jest": "^27.1.1", "typescript": "4.2.4", @@ -31,6 +32,25 @@ "node": ">=14.x" } }, + "apps/website": { + "version": "0.0.0", + "dependencies": { + "@docusaurus/core": "2.0.0-beta.13", + "@docusaurus/preset-classic": "2.0.0-beta.13", + "@mdx-js/react": "^1.6.22", + "clsx": "^1.1.1", + "react": "^17.0.2", + "react-dom": "^17.0.2" + }, + "devDependencies": { + "@docusaurus/module-type-aliases": "^2.0.0-beta.13", + "@docusaurus/types": "^2.0.0-beta.9", + "@tsconfig/docusaurus": "^1.0.4", + "@types/react": "^17.0.37", + "@types/react-helmet": "^6.1.4", + "@types/react-router-dom": "^5.3.1" + } + }, "node_modules/@algolia/autocomplete-core": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.5.0.tgz", @@ -20500,7 +20520,7 @@ "license": "MIT" }, "node_modules/website": { - "resolved": "website", + "resolved": "apps/website", "link": true }, "node_modules/websocket-driver": { @@ -20968,9 +20988,6 @@ "abort-controller": "^3.0.0", "cross-fetch": "^3.1.4" }, - "devDependencies": { - "nock": "^13.2.1" - }, "peerDependencies": { "defichain": "^0.0.0" } @@ -21190,6 +21207,7 @@ }, "website": { "version": "0.0.0", + "extraneous": true, "dependencies": { "@docusaurus/core": "2.0.0-beta.13", "@docusaurus/preset-classic": "2.0.0-beta.13", @@ -22347,8 +22365,7 @@ "requires": { "@defichain/jellyfish-api-core": "^0.0.0", "abort-controller": "^3.0.0", - "cross-fetch": "^3.1.4", - "nock": "^13.2.1" + "cross-fetch": "^3.1.4" } }, "@defichain/jellyfish-block": { @@ -27012,11 +27029,12 @@ "jest": "^27.4.4", "lerna": "^4.0.0", "lint-staged": "^12.1.2", + "nock": "^13.1.3", "shuffle-seed": "^1.1.6", "ts-jest": "^27.1.1", "typescript": "4.2.4", "wait-for-expect": "^3.0.2", - "website": "file:website" + "website": "file:apps/website" }, "dependencies": { "@algolia/autocomplete-core": { @@ -28157,8 +28175,7 @@ "requires": { "@defichain/jellyfish-api-core": "^0.0.0", "abort-controller": "^3.0.0", - "cross-fetch": "^3.1.4", - "nock": "^13.2.1" + "cross-fetch": "^3.1.4" } }, "@defichain/jellyfish-block": { @@ -40788,7 +40805,7 @@ } }, "website": { - "version": "file:website", + "version": "file:apps/website", "requires": { "@docusaurus/core": "2.0.0-beta.13", "@docusaurus/module-type-aliases": "^2.0.0-beta.13", @@ -49077,7 +49094,7 @@ } }, "website": { - "version": "file:website", + "version": "file:apps/website", "requires": { "@docusaurus/core": "2.0.0-beta.13", "@docusaurus/module-type-aliases": "^2.0.0-beta.13", diff --git a/package.json b/package.json index 6aac2185b..d2c30319e 100644 --- a/package.json +++ b/package.json @@ -9,16 +9,16 @@ "files": [], "workspaces": [ "./", - "./packages/*", - "./website" + "./apps/*", + "./packages/*" ], "engines": { "node": ">=14.x" }, "scripts": { - "clean": "rm -rf ./packages/**/dist && rm -rf ./packages/**/tsconfig.build.tsbuildinfo", + "clean": "rm -rf ./packages/**/dist && rm -rf ./apps/**/dist && rm -rf ./packages/**/tsconfig.build.tsbuildinfo", "prepare": "husky install", - "website:build": "npm run build --workspace=website", + "website:build": "npm run build --workspace=apps/website", "build": "lerna run --scope '@defichain/*' build", "version:set": "lerna version $1 --yes --no-push --no-git-tag-version --exact", "publish:latest": "lerna exec -- npm publish --tag latest --access public", @@ -37,6 +37,7 @@ "lerna": "^4.0.0", "lint-staged": "^12.1.2", "shuffle-seed": "^1.1.6", + "nock": "^13.1.3", "ts-jest": "^27.1.1", "typescript": "4.2.4", "wait-for-expect": "^3.0.2" diff --git a/packages/jellyfish-api-jsonrpc/package.json b/packages/jellyfish-api-jsonrpc/package.json index 1975dc501..b0bdf2683 100644 --- a/packages/jellyfish-api-jsonrpc/package.json +++ b/packages/jellyfish-api-jsonrpc/package.json @@ -28,8 +28,5 @@ }, "peerDependencies": { "defichain": "^0.0.0" - }, - "devDependencies": { - "nock": "^13.2.1" } } diff --git a/tsconfig.base.json b/tsconfig.base.json index d2b6fc407..4c14cafd8 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,10 +1,17 @@ { "compilerOptions": { - "lib": ["es2020"], - "target": "es6", + "lib": [ + "es2020" + ], + "target": "esnext", "module": "commonjs", "moduleResolution": "node", "strict": true, - "esModuleInterop": true + "esModuleInterop": true, + "experimentalDecorators": true, + "incremental": true, + "allowSyntheticDefaultImports": true, + "emitDecoratorMetadata": true, + "resolveJsonModule": true } } diff --git a/tsconfig.build.json b/tsconfig.build.json index 25acc8946..d4b74b2b8 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -4,6 +4,6 @@ "composite": true, "declaration": true, "declarationMap": true, - "sourceMap": true, + "sourceMap": true } } diff --git a/tsconfig.json b/tsconfig.json index b783fa269..e768dae55 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "baseUrl": "./", "paths": { - "@defichain/jellyfish-*": ["packages/jellyfish-*/src"], - "@defichain/testcontainers": ["packages/testcontainers/src"], - "@defichain/testing": ["packages/testing/src"], + "@defichain/*": [ + "packages/*/src" + ] } } } From 240e4f4b3ce93c2c3a70717715f11929b9d70b95 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Wed, 15 Dec 2021 13:07:28 +0800 Subject: [PATCH 2/2] fix regex capture --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index e68ef854c..d7946eff3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,7 +3,7 @@ module.exports = { testRegex: '((\\.|/)(e2e|test|spec))\\.[jt]sx?$', testSequencer: require.resolve('./jest.sequencer'), moduleNameMapper: { - '@defichain/.*': '/packages/$1/src' + '@defichain/(.*)': '/packages/$1/src' }, verbose: true, clearMocks: true,