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

build: replaces tsdx with dts-cli #304

Merged
merged 33 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6352513
build: repalces tsdx with rollupjs
mathewmeconry Nov 17, 2023
20ebb2c
deps(client): removes ganache
mathewmeconry Nov 21, 2023
54aa428
build(client-common): replace tsdx with eslint, jest and rollup
mathewmeconry Nov 21, 2023
e7efab7
build(common): replace tsdx with eslint, jest and rollup
mathewmeconry Nov 21, 2023
6e45f8b
build(ipfs): replaces tsdx with rollupjs
mathewmeconry Nov 22, 2023
24e7589
build: adds missing cjs min files
mathewmeconry Nov 22, 2023
cfe9805
chore: removes console logs from testing
mathewmeconry Nov 22, 2023
7bde36f
chore: updates changelog for each package
mathewmeconry Nov 22, 2023
0e60256
ci: updates workflows to use node 18
mathewmeconry Nov 22, 2023
f9f3831
deps: updates tslib to newest version
mathewmeconry Nov 22, 2023
deedcb9
ci: test for node 16,18 and 20
mathewmeconry Nov 22, 2023
a8657ac
build: replaces previous changes with dts-cli
mathewmeconry Nov 22, 2023
8394115
chore(ipfs): cleanup previous config files
mathewmeconry Nov 22, 2023
1460ffb
test(client): removes restoreBlockTime
mathewmeconry Nov 22, 2023
0447a48
chore(client): update changelog
mathewmeconry Nov 22, 2023
4c6079c
test(client): enable hardhat logging
mathewmeconry Nov 22, 2023
8f2a27b
test(client): disable hardhat logging
mathewmeconry Nov 22, 2023
e5be886
ci: don't fail fast on test matrix
mathewmeconry Nov 22, 2023
550f9ca
test(multisig-client): set enddate to 0
mathewmeconry Nov 23, 2023
c168750
test(multisigclient): increases proposal enddate to 1h
mathewmeconry Nov 23, 2023
eb42c8d
test(client-common): increase timeout for promiseWithTimeout
mathewmeconry Nov 23, 2023
0d195c2
test(client-common): increase timeout more
mathewmeconry Nov 23, 2023
9939f38
test(client-common): decrease timeout
mathewmeconry Nov 23, 2023
a6a6e08
test(client-common): further refinment of timeout
mathewmeconry Nov 23, 2023
cf5eb9f
test(client-common): test with huge timeout
mathewmeconry Nov 23, 2023
4231e70
ci: changes js tests to figure out whats wrong
mathewmeconry Nov 23, 2023
4484e7e
test(client-common): increase timeout even higher
mathewmeconry Nov 23, 2023
80382f0
ci: js unit tests in sequenze
mathewmeconry Nov 23, 2023
7708f2b
test(client-common): unref setTimeout and reset timeout value
mathewmeconry Nov 23, 2023
5df125a
test(client-common): fixes wrong rpc network combination
mathewmeconry Nov 23, 2023
f0af0d7
ci: reset javascripts back to original form
mathewmeconry Nov 23, 2023
0aadbf6
build(common): increase min node version to 16
mathewmeconry Nov 24, 2023
3d1ead0
Merge branch 'develop' into feat/OS-816-remove-tsdx-in-all-packages
mathewmeconry Nov 24, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/documentation-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: 16.x
node-version: 18.x
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Generate Client Docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javascript_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: 16.x
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install deps
run: yarn install --frozen-lockfile
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/javascript_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: ['16.x']
node: ['16.x', '18.x', '20.x']
os: [ubuntu-latest]

steps:
Expand All @@ -48,6 +49,6 @@ jobs:
IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }}

- name: Run unit tests
run: yarn test --testPathIgnorePatterns=modules/client/test/integration --ci --coverage --passWithNoTests
run: yarn test --testPathIgnorePatterns=modules/client/test/integration --coverage --passWithNoTests
env:
IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/scan_vuln_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup NodeJS before scanning with Trivy
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'yarn'

- name: Install deps before scanning with Trivy
Expand Down
13 changes: 11 additions & 2 deletions modules/client-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,44 @@ TEMPLATE:

- Added `actions` to `SubgraphListItem` type

### Changed

- Replaces tsdx with dts-cli
- Upgrades typescript to v5

## [1.10.0]

### Added

- Add support for arbitrum network


## [1.9.0]

### Changed

- Subgraph version from 1.3.0 to 1.3.1

## [1.8.0]

### Added

- Add new class error `InvalidPermissionOperationType`

## [1.7.1]

### Fixed

- ENS name Regex

## [1.7.0]

### Added

- Add common schemas for validations
- Support for sepolia network
- Move functionality from `sdk-common` to `sdk-client-common`
- New error classes `InvalidVersionError`, `PluginUpdatePreparationError` and `ProposalNotFoundError`
- New error classes `InvalidVersionError`, `PluginUpdatePreparationError` and
`ProposalNotFoundError`
- Add `isSubdomain`, `isIpfsUri` and `isEnsName` functions
- Update SizeMismatchError error class

Expand Down
22 changes: 13 additions & 9 deletions modules/client-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
"node": ">=16"
},
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "TESTING=true tsdx test --verbose --runInBand",
"lint": "tsdx lint",
"prepare": "tsdx build",
"build": "yarn run clean && dts build",
"test": "TESTING=true dts test",
"lint": "dts lint",
"prepare": "yarn build",
"size": "size-limit",
"analyze": "size-limit --why",
"clean": "rm -Rf .turbo dist",
Expand Down Expand Up @@ -50,15 +49,17 @@
],
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.8",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/jest": "^29.5.9",
"dts-cli": "^2.0.3",
"husky": "^7.0.4",
"size-limit": "^7.0.8",
"tsdx": "^0.14.1",
"tslib": "^2.3.1",
"typescript": "^4.6.2"
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@aragon/osx-ethers-v1.0.0": "npm:@aragon/[email protected]",
"@aragon/osx-ethers": "^1.3.0-rc0.4",
"@aragon/osx-ethers-v1.0.0": "npm:@aragon/[email protected]",
"@aragon/sdk-ipfs": "^1.1.0",
"@ethersproject/abstract-signer": "^5.5.0",
"@ethersproject/bignumber": "^5.6.0",
Expand All @@ -69,5 +70,8 @@
"graphql": "^16.5.0",
"graphql-request": "^4.3.0",
"yup": "^1.2.0"
},
"jest": {
"preset": "ts-jest"
}
}
1 change: 1 addition & 0 deletions modules/client-common/test/unit/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ describe("Context instances", () => {
it("Should create a context with the correct DAOFactory address from the core-contracts-package", () => {
contextParams.daoFactoryAddress = "";
contextParams.network = "matic";
contextParams.web3Providers = "https://polygon-rpc.com/";
const context = new TestContext(contextParams);

expect(context).toBeInstanceOf(TestContext);
Expand Down
4 changes: 2 additions & 2 deletions modules/client-common/test/unit/promises.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("Test promise helpers", () => {
it("Should timeout", async () => {
const timeout = 100;
const promise = new Promise((resolve) =>
setTimeout(resolve, timeout * 2)
setTimeout(resolve, timeout * 2).unref()
);
await expect(promiseWithTimeout(promise, timeout)).rejects.toThrow(
"Time out",
Expand All @@ -51,7 +51,7 @@ describe("Test promise helpers", () => {
it("Should not timeout", async () => {
const timeout = 100;
const promise = new Promise((resolve) =>
setTimeout(resolve, timeout / 2)
setTimeout(resolve, timeout / 2).unref()
);
await expect(promiseWithTimeout(promise, timeout)).resolves
.toBeUndefined();
Expand Down
7 changes: 4 additions & 3 deletions modules/client-common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
"include": ["src", "types"],
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
"target": "es6",
"target": "es2018",
"importHelpers": true,
// output .d.ts declaration files for consumers
"declaration": true,
"outDir": "./dist",
// output .js.map sourcemap files for consumers
"sourceMap": true,
// match output dir to input dir. e.g. dist/index instead of dist/src/index
Expand All @@ -33,5 +33,6 @@
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
"noEmit": true,
"resolveJsonModule": true
}
},
"include": ["src", "types"],
}
10 changes: 10 additions & 0 deletions modules/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ TEMPLATE:
- Add `actions` to `TokenVotingProposalListItem`
- Add `actions` to `AddresslistVotingProposalListItem`

### Changed

- Replaces tsdx with dts-cli
- Upgrades typescript to v5
- Replaces ganache with hardhat

### Removed

- Removed `restoreBlockTime()` test helper function

## [1.18.2]
### Fixed

Expand Down
21 changes: 21 additions & 0 deletions modules/client/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require('@nomiclabs/hardhat-ethers');
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: '0.8.19',
networks: {
hardhat: {
forking: {
url: 'https://example.com',
blockNumber: 1,
// Disables forking for tests but necessary for the test-enviornment to function because of a dependency
enabled: false,
},
chainId: 31337,
// necessary to deploy osx 1.2.1 in hardhat node
allowUnlimitedContractSize: true,
accounts: {
count: 3,
},
},
},
};
29 changes: 18 additions & 11 deletions modules/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@
"node": ">=16"
},
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "TESTING=true tsdx test --verbose --runInBand",
"lint": "tsdx lint",
"prepare": "tsdx build",
"build": "yarn run clean && dts build",
"test": "TESTING=true dts test",
"lint": "dts lint",
"prepare": "yarn build",
"size": "size-limit",
"analyze": "size-limit --why",
"clean": "rm -Rf .turbo dist",
"examples": "node ./scripts/generate-examples-md.js ./examples ./examples.md"
},
"husky": {
"hooks": {
"pre-commit": "tsdx lint --fix"
"pre-commit": "yarn run lint --fix"
}
},
"prettier": {
Expand All @@ -49,16 +48,23 @@
],
"devDependencies": {
"@ensdomains/ens-contracts": "^0.0.15",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@size-limit/preset-small-lib": "^7.0.8",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/jest": "^29.0.3",
"ganache": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"@uniswap/sdk-core": "^4.0.9",
"dts-cli": "^2.0.3",
"glob": "^8.0.3",
"hardhat": "^2.19.1",
"husky": "^7.0.4",
"jest-environment-hardhat": "^1.1.9",
"jest-environment-jsdom": "^29.7.0",
"osx-ethers-v1": "npm:@aragon/[email protected]",
"size-limit": "^7.0.8",
"tsdx": "^0.14.1",
"tslib": "^2.3.1",
"typescript": "^4.6.2"
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"dependencies": {
"@aragon/osx-ethers": "1.3.0-rc0.4",
Expand All @@ -77,7 +83,8 @@
"yup": "^1.2.0"
},
"jest": {
"testEnvironment": "../../test-environment.js",
"preset": "ts-jest",
"testEnvironment": "./test-environment.ts",
"testTimeout": 120000
}
}
1 change: 0 additions & 1 deletion modules/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from "./tokenVoting";
export * from "./client-common";
export * from "./multisig";
export * from "./types";

// Selective reexports for completeness
export {
ApplyInstallationParams,
Expand Down
25 changes: 25 additions & 0 deletions modules/client/test-environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const TestEnvironment = require('jest-environment-hardhat/jsdom');

module.exports = class CustomTestEnvironment extends TestEnvironment.default {
async setup() {
await super.setup();

// disable hardhat node logging
await this.global.hardhat.provider.send('hardhat_setLoggingEnabled', [
false,
]);

if (typeof this.global.TextEncoder === 'undefined') {
const {TextEncoder, TextDecoder} = require('util');
this.global.TextEncoder = TextEncoder;
this.global.TextDecoder = TextDecoder;
}
const {FormData} = require('@web-std/form-data');
const {File, Blob} = require('@web-std/file');
const {fetch} = require('@web-std/fetch');
Object.assign(this.global, {FormData, File, Blob, fetch});
}
getVmContext() {
return super.getVmContext();
}
};
23 changes: 5 additions & 18 deletions modules/client/test/helpers/block-times.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,21 @@ export function mineBlockWithTime(
targetDate: Date,
) {
const val = Math.ceil(targetDate.getTime() / 1000);
return provider.send("evm_mine", [
`0x${val.toString(16)}`,
]);
provider.send("evm_setNextBlockTimestamp", [val]);
provider.send("evm_mine", []);
}

export function mineBlockWithTimeOffset(
export async function mineBlockWithTimeOffset(
provider: JsonRpcProvider,
secondsForward: number,
) {
const val = Math.ceil(Date.now() / 1000) + secondsForward;
const latestBlock = await provider.getBlock('latest');
const val = latestBlock.timestamp + secondsForward;
return provider.send("evm_mine", [
`0x${val.toString(16)}`,
]);
}

// export function setNextBlockTimeOffset(
// provider: JsonRpcProvider,
// secondsForward: number,
// ) {
// return provider.send("evm_increaseTime", [
// `0x${secondsForward.toString(16)}`,
// ]);
// }

export function restoreBlockTime(provider: JsonRpcProvider) {
return mineBlockWithTime(provider, new Date());
}

export async function getBlockTime(provider: JsonRpcProvider) {
const blockNumber = await provider.getBlockNumber();
const block = await provider.getBlock(blockNumber);
Expand Down
Loading