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(sdk): replaces tsdx with dts-cli #22

Merged
merged 7 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 sdk/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parser: '@typescript-eslint/parser'
parserOptions:
project: './sdk/tsconfig.json'
project: './sdk/tsconfig.lint.json'

# Custom eslint settings for the contracts can be defined here
ignorePatterns:
Expand Down
7 changes: 7 additions & 0 deletions sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [UPCOMING]

### Changed

- Replaces `tsdx` with `dts-cli`.
- Updates typescript verstion to `^5.1.0`.

## v1.0.0

### Added
Expand Down
15 changes: 8 additions & 7 deletions sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"node": ">=16"
},
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "TESTING=true tsdx test --verbose --runInBand",
"start": "dts watch",
"build": "dts build",
"test": "TESTING=true dts test --verbose --runInBand",
"lint:ts": "cd .. && yarn run lint:sdk:ts",
"prepare": "tsdx build",
"prepare": "yarn run build",
"size": "size-limit",
"analyze": "size-limit --why",
"clean": "rm -Rf .turbo dist",
Expand All @@ -44,15 +44,16 @@
],
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.8",
"@types/node": "^20.10.0",
"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"
"typescript": "^5.1.0"
},
"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 Down
1 change: 1 addition & 0 deletions sdk/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
8 changes: 6 additions & 2 deletions sdk/test/unit/promises.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ describe('Test promise helpers', () => {
describe('promiseWithTimeout', () => {
it('Should timeout', async () => {
const timeout = 100;
const promise = new Promise(resolve => setTimeout(resolve, timeout * 2));
const promise = new Promise(resolve =>
setTimeout(resolve, timeout * 2).unref()
);
await expect(promiseWithTimeout(promise, timeout)).rejects.toThrow(
'Time out'
);
});
it('Should not timeout', async () => {
const timeout = 100;
const promise = new Promise(resolve => setTimeout(resolve, timeout / 2));
const promise = new Promise(resolve =>
setTimeout(resolve, timeout / 2).unref()
);
await expect(
promiseWithTimeout(promise, timeout)
).resolves.toBeUndefined();
Expand Down
45 changes: 32 additions & 13 deletions sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
{
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
heueristik marked this conversation as resolved.
Show resolved Hide resolved
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"noImplicitAny": true,
"removeComments": true,
"resolveJsonModule": true,
"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
"rootDir": "./src",
// stricter type-checking for stronger correctness. Recommended by TS
"strict": true,
"target": "es6"
// linter checks for common issues
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
"noUnusedLocals": true,
"noUnusedParameters": true,
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "node",
// transpile JSX to React.createElement
"jsx": "react",
// interop between ESM and CJS modules. Recommended by TS
"esModuleInterop": true,
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
"skipLibCheck": true,
// error out if import and file system have a casing mismatch. Recommended by TS
"forceConsistentCasingInFileNames": true,
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
"noEmit": true,
"resolveJsonModule": true,
// TODO remove once generics are implemented in ContextCore
"useDefineForClassFields": false
},
"exclude": ["node_modules"],
"include": ["src/**/*", "test/**/*", "examples/**/*"]
"include": ["src", "types"]
}
39 changes: 39 additions & 0 deletions sdk/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
"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
"rootDir": "./",
// stricter type-checking for stronger correctness. Recommended by TS
"strict": true,
// linter checks for common issues
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
"noUnusedLocals": true,
"noUnusedParameters": true,
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "node",
// transpile JSX to React.createElement
"jsx": "react",
// interop between ESM and CJS modules. Recommended by TS
"esModuleInterop": true,
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
"skipLibCheck": true,
// error out if import and file system have a casing mismatch. Recommended by TS
"forceConsistentCasingInFileNames": true,
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
"noEmit": true,
"resolveJsonModule": true,
// TODO remove once generics are implemented in ContextCore
"useDefineForClassFields": false
}
}
Loading