Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-factor build scripts to TypeScript #202

Merged
merged 23 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d7c26fd
Re-factor scripts for building, development, linting, and cleaning to…
smithki Sep 1, 2021
7fa7da1
Remove remnants of old test runner (ava)
smithki Sep 1, 2021
a210f1b
Re-factor scripts for unit testing to TypeScript
smithki Sep 1, 2021
e2ccc67
Small cleanups
smithki Sep 1, 2021
d258eeb
Refactor to merge `ViewController` and `PayloadTransport` classes (#203)
smithki Sep 2, 2021
9a59d3f
Make script code more DRY
smithki Sep 2, 2021
d12760f
Update TypeScript & make scripts more DRY
smithki Sep 2, 2021
94efcb4
Fix typo and add 'printSeparator' script utility
smithki Sep 2, 2021
a2325a2
Fix 'inject-env.ts' script following re-organization of code
smithki Sep 2, 2021
d5e2f35
Remove outdated / unused dependencies from root PackageJSON
smithki Sep 8, 2021
a858d16
Progress towards integrating microbundle
smithki Sep 9, 2021
69d343f
Update build scripts to bundle all packages via microbundle
smithki Sep 10, 2021
50a0a03
Remove unnecessary console statement
smithki Sep 10, 2021
e8c7fde
Run pre-commit hooks against all packages
smithki Sep 10, 2021
2e0e32c
Add more memory for tasks spawned via 'wsrun'
smithki Sep 10, 2021
3e28ee0
Raise the resource class in CI
smithki Sep 10, 2021
66a3346
Try to fix ENOMEM errors in CI by limiting concurrency
smithki Sep 10, 2021
89a4660
Replace 'p-limit' dependency with prior version (new version is ESM-o…
smithki Sep 10, 2021
b529dd4
Better caching in CircleCI
smithki Sep 10, 2021
f80e463
Update test script to work with Yarn 2
smithki Sep 10, 2021
494fe08
Fix tests related to ViewController refactor
smithki Sep 10, 2021
f1066f4
Reduce the CircleCI resource class back to medium
smithki Sep 10, 2021
62b4874
Fix tests related to ViewController refactor
smithki Sep 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor to merge ViewController and PayloadTransport classes (#203)
* (feat): Added 'web3-core' package v1.5.2  to import the new AbstractProvider Type

* (feat): fix #83

* First step to refactoring 'PayloadTransport' into 'ViewController'

* Fix remaining tests

* Update 'peerDependencies' for @magic-sdk/commons

* Fix clean script

Co-authored-by: Adenekan Wonderful <[email protected]>
  • Loading branch information
smithki and adenekan41 committed Sep 2, 2021
commit d258eeb59fd11bcf91320d02c8f1cf9911fb200e
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/node_modules
**/coverage
**/dist
**/.eslintrc.js
**/jest.config.ts
Expand Down
42 changes: 24 additions & 18 deletions .eslintrc → .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
{
"root": true,
module.exports = {
root: true,

"extends": ["@ikscodes/eslint-config"],
extends: ["@ikscodes/eslint-config"],

"rules": {
"import/extensions": 0,
rules: {
// ESLint rules
"no-alert": 0,
"@typescript-eslint/await-thenable": 0,
"no-underscore-dangle": 0,
"no-useless-constructor": 0,
"@typescript-eslint/no-useless-constructor": 0,
"@typescript-eslint/no-empty-function": 0,
"class-methods-use-this": 0,

// Import rules
"import/extensions": 0,
"import/no-extraneous-dependencies": 0,

// TypeScript rules
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/no-unsafe-call": 0,
"@typescript-eslint/await-thenable": 0,
"@typescript-eslint/no-unsafe-return": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-floating-promises": 0,
"@typescript-eslint/no-unsafe-assignment": 0,
"@typescript-eslint/no-useless-constructor": 0,
"@typescript-eslint/no-unsafe-member-access": 0,
"@typescript-eslint/no-floating-promises": 0,
"@typescript-eslint/no-unsafe-call": 0,
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/restrict-template-expressions": 0,
"class-methods-use-this": 0,
"import/no-extraneous-dependencies": 0
},

"settings": {
settings: {
"import/resolver": {
"typescript": {
"directory": ["**/tsconfig.json"]
}
}
}
"directory": ["**/tsconfig.json"],
},
},
},
}
1 change: 1 addition & 0 deletions packages/@magic-sdk/commons/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/node_modules
/coverage
/dist
/.eslintrc.js
/jest.config.ts
2 changes: 1 addition & 1 deletion packages/@magic-sdk/commons/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['../../../.eslintrc'],
extends: ['../../../.eslintrc.js'],
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions packages/@magic-sdk/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"module": "dist/es/index.js",
"types": "dist/es/index.d.ts",
"peerDependencies": {
"@magic-sdk/provider": "^4.3.0",
"@magic-sdk/types": "^3.1.1",
"@magic-sdk/provider": ">=4.3.0",
"@magic-sdk/types": ">=3.1.1",
"tslib": "^2.0.3"
},
"gitHead": "1ef062ea699d48d5e9a9375a93b7c147632b05ca"
Expand Down
1 change: 1 addition & 0 deletions packages/@magic-sdk/provider/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/node_modules
/coverage
/dist
/.eslintrc.js
/jest.config.ts
2 changes: 1 addition & 1 deletion packages/@magic-sdk/provider/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['../../../.eslintrc'],
extends: ['../../../.eslintrc.js'],
parserOptions: {
project: ['./tsconfig.json', './test/tsconfig.json'],
tsconfigRootDir: __dirname,
Expand Down
8 changes: 4 additions & 4 deletions packages/@magic-sdk/provider/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ There are numerous code paths that [`./modules`](./modules) can follow to intera
// `magic.auth` and `magic.user` methods follow this pattern.
magic.user.getMetadata();

BaseModule.request -> PayloadTransport.post -> Window.postMessage -> iframe
BaseModule.request -> ViewController.post -> Window.postMessage -> iframe
```

### Case #2: Web3 `>=1.0.0-beta.38` using `send`
Expand All @@ -26,7 +26,7 @@ This represents the most current behavior of Web3:
```ts
web3.eth.sendTransaction(...);

RPCProviderModule.send -> BaseModule.request -> PayloadTransport.post -> Window.postMessage -> iframe
RPCProviderModule.send -> BaseModule.request -> ViewController.post -> Window.postMessage -> iframe
```

### Case #3: Web3 `<=1.0.0-beta.37` using `send`
Expand All @@ -36,7 +36,7 @@ This is an edge case affecting a small subset of Web3 pre-`1.x` beta versions:
```ts
web3.eth.sendTransaction(...);

RPCProviderModule.send -> RPCProviderModule.sendAsync -> PayloadTransport.post -> Window.postMessage -> iframe
RPCProviderModule.send -> RPCProviderModule.sendAsync -> ViewController.post -> Window.postMessage -> iframe
```

### Case #4: Legacy Web3 using `sendAsync`
Expand All @@ -46,7 +46,7 @@ This is the legacy behavior of Web3 providers, though it is still widely support
```ts
web3.eth.sendTransaction(...);

RPCProviderModule.sendAsync -> PayloadTransport.post -> Window.postMessage -> iframe
RPCProviderModule.sendAsync -> ViewController.post -> Window.postMessage -> iframe
```

## React Native
Expand Down
2 changes: 1 addition & 1 deletion packages/@magic-sdk/provider/src/core/json-rpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-underscore-dangle, no-param-reassign */
/* eslint-disable no-param-reassign */

import { JsonRpcRequestPayload, JsonRpcResponsePayload, JsonRpcError } from '@magic-sdk/types';
import { isJsonRpcResponsePayload } from '../util/type-guards';
Expand Down
190 changes: 0 additions & 190 deletions packages/@magic-sdk/provider/src/core/payload-transport.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/@magic-sdk/provider/src/core/sdk-environment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import localForage from 'localforage';
import { ViewController } from './view-controller';
import { PayloadTransport } from './payload-transport';
import { SDKBase } from './sdk';
import { WithExtensions } from '../modules/base-extension';

Expand All @@ -16,7 +15,6 @@ export interface SDKEnvironment {
platform: 'web' | 'react-native';
defaultEndpoint: string;
ViewController: ConstructorOf<ViewController>;
PayloadTransport: ConstructorOf<PayloadTransport>;
configureStorage: () => Promise<typeof localForage>;
}

Expand Down
Loading