Skip to content

Commit

Permalink
refactor: build chain to rollup (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkrem authored Jul 28, 2023
1 parent c95cbc6 commit dbad8f5
Show file tree
Hide file tree
Showing 190 changed files with 6,564 additions and 10,381 deletions.
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"rules": {
"@typescript-eslint/ban-ts-ignore": ["off"],
"@typescript-eslint/ban-ts-comment": ["off"],
"@typescript-eslint/camelcase": ["off"],
"@typescript-eslint/explicit-function-return-type": ["off"],
"@typescript-eslint/interface-name-prefix": ["off"],
Expand All @@ -13,6 +14,8 @@
"comma-dangle": ["error", "always-multiline"],
"no-async-promise-executor": ["off"],
"no-empty-pattern": ["off"],
"no-use-before-define": ["off"],
"prefer-regex-literals": ["off"],
"no-undef": ["error"],
"no-var": ["error"],
"object-curly-spacing": ["error", "always"],
Expand All @@ -33,7 +36,8 @@
"standard",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/build.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
on: push

name: CI Checks

jobs:
ci:
name: CI
runs-on: ubuntu-latest
strategy:
matrix:
test-prefix:
- misc/logger
- misc/encoding
- misc/keyvaluestorage
- misc/time
- misc/heartbeat
- misc/history
- misc/environment
- misc/cacao
- misc/identity-keys
- misc/events
- misc/did-jwt
- misc/safe-json
- crypto/ecies-25519
- crypto/crypto
- crypto/randombytes
- jsonrpc/types
- jsonrpc/provider
- jsonrpc/utils
- jsonrpc/http-connection
- jsonrpc/ws-connection
- browser/window-getters
- browser/window-metadata
- relay/relay-api
- relay/relay-auth
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Check node_modules cache
id: cache-node-modules
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-nodemodules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nodemodules-
- name: Install NPM Dependencies
run: npm install

- name: Bootstrap packages
run: npm run bootstrap

- name: Prettier
run: npm run prettier --prefix=${{ matrix.test-prefix }} --if-present

- name: Lint
run: npm run lint --prefix=${{ matrix.test-prefix }} --if-present

- name: Build
run: npm run build

- name: Test
run: npm run test --prefix=${{ matrix.test-prefix }} --if-present
env:
TEST_PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ zip
.nyc_output
tsconfig.tsbuildinfo

.vscode
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all",
"printWidth": 100
"printWidth": 100,
"arrowParens": "always"
}
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.configPath": ".prettierrc",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[tsx]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.workingDirectories": ["./"]
}
36 changes: 13 additions & 23 deletions browser/window-getters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"files": [
"dist"
],
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
"unpkg": "dist/umd/index.min.js",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"browser": "dist/index.es.js",
"unpkg": "dist/index.umd.js",
"types": "dist/types/index.d.ts",
"homepage": "https://github.com/walletconnect/walletconnect-utils",
"repository": {
"type": "git",
Expand All @@ -27,37 +29,25 @@
},
"scripts": {
"clean": "rm -rf dist",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build:umd": "webpack",
"build": "run-s clean build:cjs build:esm build:umd ",
"build:pre": "npm run clean",
"build:types": "tsc",
"build:source": "rollup --config rollup.config.js",
"build": "npm run build:pre; npm run build:source; npm run build:types",
"test": "env TS_NODE_PROJECT=\"tsconfig.cjs.json\" mocha --timeout 5000 --exit -r ts-node/register ./test/**/*.test.ts",
"lint": "eslint -c '../../.eslintrc' --fix './src/**/*.ts'",
"npm-publish:latest": "npm publish --access public --tag latest",
"npm-publish:canary": "npm publish --access public --tag canary",
"prepublishOnly": "npm run test && npm run build"
"prepublishOnly": "npm run test && npm run build",
"prettier": "prettier --config ../../.prettierrc --check {src,test}/**/*.ts",
"format": "prettier --config ../../.prettierrc --write {src,test}/**/*.ts"
},
"devDependencies": {
"@types/bn.js": "4.11.6",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.7",
"husky": "^4.3.0",
"typescript": "^4.9.5",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11"
},
"husky": {
"hooks": {
"pre-commit": "run-s lint"
}
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": false,
"trailingComma": "es5"
},
"dependencies": {
"tslib": "1.14.1"
}
"dependencies": {}
}
4 changes: 4 additions & 0 deletions browser/window-getters/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { name, dependencies } from "./package.json";
import createConfig from "../../rollup.config";

export default createConfig(name, Object.keys(dependencies));
2 changes: 1 addition & 1 deletion browser/window-getters/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function getFromWindow<T>(name: string): T | undefined {
let res: T | undefined = undefined;
let res: T | undefined;
if (typeof window !== "undefined" && typeof window[name] !== "undefined") {
res = window[name];
}
Expand Down
7 changes: 0 additions & 7 deletions browser/window-getters/tsconfig.esm.json

This file was deleted.

4 changes: 3 additions & 1 deletion browser/window-getters/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"extends": "../../tsconfig.json",
"include": ["./src/**/*"],
"compilerOptions": {
"outDir": "./dist"
"rootDir": "src",
"outDir": "./dist/types",
"emitDeclarationOnly": true
}
}
16 changes: 0 additions & 16 deletions browser/window-getters/webpack.config.js

This file was deleted.

35 changes: 13 additions & 22 deletions browser/window-metadata/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"files": [
"dist"
],
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
"unpkg": "dist/umd/index.min.js",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"browser": "dist/index.es.js",
"unpkg": "dist/index.umd.js",
"types": "dist/types/index.d.ts",
"homepage": "https://github.com/walletconnect/walletconnect-utils",
"repository": {
"type": "git",
Expand All @@ -27,38 +29,27 @@
},
"scripts": {
"clean": "rm -rf dist",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build:umd": "webpack",
"build": "run-s clean build:cjs build:esm build:umd ",
"build:pre": "npm run clean",
"build:types": "tsc",
"build:source": "rollup --config rollup.config.js",
"build": "npm run build:pre; npm run build:source; npm run build:types",
"test": "env TS_NODE_PROJECT=\"tsconfig.cjs.json\" mocha --timeout 5000 --exit -r ts-node/register ./test/**/*.test.ts",
"lint": "eslint -c '../../.eslintrc' --fix './src/**/*.ts'",
"npm-publish:latest": "npm publish --access public --tag latest",
"npm-publish:canary": "npm publish --access public --tag canary",
"prepublishOnly": "npm run test && npm run build"
"prepublishOnly": "npm run test && npm run build",
"prettier": "prettier --config ../../.prettierrc --check {src,test}/**/*.ts",
"format": "prettier --config ../../.prettierrc --write {src,test}/**/*.ts"
},
"dependencies": {
"@walletconnect/window-getters": "^1.0.1",
"tslib": "1.14.1"
"@walletconnect/window-getters": "^1.0.1"
},
"devDependencies": {
"@types/bn.js": "4.11.6",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.7",
"husky": "^4.3.0",
"typescript": "^4.9.5",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11"
},
"husky": {
"hooks": {
"pre-commit": "run-s lint"
}
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": false,
"trailingComma": "es5"
}
}
4 changes: 4 additions & 0 deletions browser/window-metadata/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { name, dependencies } from "./package.json";
import createConfig from "../../rollup.config";

export default createConfig(name, Object.keys(dependencies));
Loading

0 comments on commit dbad8f5

Please sign in to comment.