Skip to content

Commit fbac90a

Browse files
ShookLyngsduanyytop
authored andcommittedJul 31, 2024
refactor: revert tsconfig.json, remove "type" in package.json, and tune tsup config
1 parent a2722c5 commit fbac90a

18 files changed

+373
-380
lines changed
 

‎package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@
2121
"@changesets/cli": "^2.27.1",
2222
"@changesets/get-github-info": "^0.6.0",
2323
"@changesets/types": "^6.0.0",
24+
"@types/lodash": "^4.17.0",
2425
"@typescript-eslint/eslint-plugin": "^7.8.0",
2526
"@typescript-eslint/parser": "^7.8.0",
26-
"@types/lodash": "^4.17.0",
2727
"eslint": "^8.56.0",
2828
"husky": "^9.0.11",
2929
"lint-staged": "^15.2.2",
3030
"prettier": "^3.2.5",
3131
"ts-node": "^10.9.2",
32-
"tsup": "^7.2.0",
33-
"vite": "5.2.12",
34-
"vitest": "1.6.0",
35-
"typescript": "^5.4.3"
32+
"tsup": "^8.1.0",
33+
"typescript": "^5.4.3",
34+
"vitest": "1.6.0"
3635
},
3736
"lint-staged": {
3837
"{packages,apps,examples,tests}/**/*.{js,jsx,ts,tsx}": [

‎packages/btc/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
"lint": "tsc && eslint '{src,tests}/**/*.{js,ts}' && prettier --check '{src,tests}/**/*.{js,ts}'",
88
"lint:fix": "tsc && eslint --fix '{src,tests}/**/*.{js,ts}' && prettier --write '{src,tests}/**/*.{js,ts}'"
99
},
10-
"type": "module",
10+
"sideEffects": false,
1111
"main": "./dist/index.js",
1212
"types": "./dist/index.d.ts",
13-
"files": [
14-
"src",
15-
"dist"
16-
],
1713
"exports": {
1814
".": {
1915
"import": {
20-
"types": "./dist/index.d.ts",
21-
"default": "./dist/index.js"
16+
"types": "./dist/index.d.mts",
17+
"default": "./dist/index.mjs"
2218
},
2319
"require": {
24-
"types": "./dist/index.d.cts",
25-
"default": "./dist/index.cjs"
20+
"types": "./dist/index.d.js",
21+
"default": "./dist/index.js"
2622
}
2723
},
2824
"./package.json": "./package.json"
2925
},
26+
"files": [
27+
"src",
28+
"dist"
29+
],
3030
"dependencies": {
3131
"@bitcoinerlab/secp256k1": "^1.1.1",
3232
"@ckb-lumos/codec": "0.22.2",

‎packages/btc/src/bitcoin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import ECPairFactory, { ECPairInterface } from 'ecpair';
21
import ecc from '@bitcoinerlab/secp256k1';
32
import * as bitcoin from 'bitcoinjs-lib';
3+
import { ECPairFactory, ECPairInterface } from 'ecpair';
44
import { isTaprootInput } from 'bitcoinjs-lib/src/psbt/bip371';
55
import { isP2TR, isP2WPKH, isP2PKH } from 'bitcoinjs-lib/src/psbt/psbtutils';
66

‎packages/btc/tsconfig.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"moduleResolution": "Bundler",
4+
"module": "ESNext",
5+
"target": "ESNext",
6+
"lib": ["ESNext", "DOM"],
7+
"strict": true,
8+
"noEmit": true,
9+
"allowJs": true,
10+
"sourceMap": true,
11+
"skipLibCheck": true,
12+
"esModuleInterop": true,
13+
"strictNullChecks": true,
14+
"resolveJsonModule": true,
15+
"isolatedModules": true
16+
},
17+
"include": ["src"],
18+
"exclude": ["node_modules", "dist"]
19+
}

‎packages/btc/tsup.config.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { defineConfig } from 'tsup';
22

3-
import { dependencies, name } from './package.json';
4-
5-
import config from '../../tsup-base.config';
6-
73
export default defineConfig({
8-
...config,
9-
name,
4+
name: '@rgbpp-sdk/btc',
5+
dts: true,
6+
clean: true,
7+
sourcemap: true,
8+
format: ['esm', 'cjs'],
109
entry: ['src/index.ts'],
11-
external: Object.keys(dependencies),
12-
platform: 'browser',
1310
});

‎packages/ckb/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
"lint:fix": "tsc && eslint --fix --ext .ts {src,example}/* && prettier --write '{src,example}/**/*.{js,ts}'",
99
"splitCells": "npx ts-node example/paymaster.ts"
1010
},
11-
"type": "module",
11+
"sideEffects": false,
1212
"main": "./dist/index.js",
1313
"types": "./dist/index.d.ts",
14-
"files": [
15-
"src",
16-
"dist"
17-
],
1814
"exports": {
1915
".": {
2016
"import": {
21-
"types": "./dist/index.d.ts",
22-
"default": "./dist/index.js"
17+
"types": "./dist/index.d.mts",
18+
"default": "./dist/index.mjs"
2319
},
2420
"require": {
25-
"types": "./dist/index.d.cts",
26-
"default": "./dist/index.cjs"
21+
"types": "./dist/index.d.ts",
22+
"default": "./dist/index.js"
2723
}
2824
},
2925
"./package.json": "./package.json"
3026
},
27+
"files": [
28+
"src",
29+
"dist"
30+
],
3131
"dependencies": {
3232
"@ckb-lumos/base": "^0.22.2",
3333
"@ckb-lumos/codec": "^0.22.2",

‎packages/ckb/tsconfig.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"compilerOptions": {
4+
"moduleResolution": "Bundler",
5+
"module": "ESNext",
6+
"target": "ESNext",
7+
"lib": ["ESNext", "DOM"],
8+
"strict": true,
9+
"noEmit": true,
10+
"allowJs": true,
11+
"sourceMap": true,
12+
"skipLibCheck": true,
13+
"esModuleInterop": true,
14+
"strictNullChecks": true,
15+
"resolveJsonModule": true,
16+
"isolatedModules": true
17+
},
18+
"include": ["src"],
19+
"exclude": ["node_modules", "dist", "**/*.spec.ts", "example"],
20+
"ts-node": {
21+
// these options are overrides used only by ts-node
22+
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
23+
"compilerOptions": {
24+
"module": "CommonJS"
25+
}
26+
}
27+
}

‎packages/ckb/tsup.config.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { defineConfig } from 'tsup';
22

3-
import { dependencies, name } from './package.json';
4-
5-
import config from '../../tsup-base.config';
6-
73
export default defineConfig({
8-
...config,
9-
name,
4+
name: '@rgbpp-sdk/ckb',
5+
dts: true,
6+
clean: true,
7+
sourcemap: true,
8+
format: ['esm', 'cjs'],
109
entry: ['src/index.ts'],
11-
external: Object.keys(dependencies),
12-
platform: 'browser',
1310
});

‎packages/rgbpp/package.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,57 @@
66
"lint": "tsc && eslint --ext .ts src/* && prettier --check 'src/*.ts'",
77
"lint:fix": "tsc && eslint --fix --ext .ts src/* && prettier --write 'src/*.ts'"
88
},
9-
"type": "module",
9+
"sideEffects": false,
1010
"main": "./dist/index.js",
1111
"types": "./dist/index.d.ts",
12-
"files": [
13-
"src",
14-
"dist"
15-
],
1612
"exports": {
1713
".": {
1814
"import": {
19-
"types": "./dist/index.d.ts",
20-
"default": "./dist/index.js"
15+
"types": "./dist/index.d.mts",
16+
"default": "./dist/index.mjs"
2117
},
2218
"require": {
23-
"types": "./dist/index.d.cts",
24-
"default": "./dist/index.cjs"
19+
"types": "./dist/index.d.ts",
20+
"default": "./dist/index.js"
2521
}
2622
},
2723
"./btc": {
2824
"import": {
29-
"types": "./dist/btc.d.ts",
30-
"default": "./dist/btc.js"
25+
"types": "./dist/btc.d.mts",
26+
"default": "./dist/btc.mjs"
3127
},
3228
"require": {
33-
"types": "./dist/btc.d.cts",
34-
"default": "./dist/btc.cjs"
29+
"types": "./dist/btc.d.ts",
30+
"default": "./dist/btc.js"
3531
}
3632
},
3733
"./ckb": {
3834
"import": {
39-
"types": "./dist/ckb.d.ts",
40-
"default": "./dist/ckb.js"
35+
"types": "./dist/ckb.d.mts",
36+
"default": "./dist/ckb.mjs"
4137
},
4238
"require": {
43-
"types": "./dist/ckb.d.cts",
44-
"default": "./dist/ckb.cjs"
39+
"types": "./dist/ckb.d.ts",
40+
"default": "./dist/ckb.js"
4541
}
4642
},
4743
"./service": {
4844
"import": {
49-
"types": "./dist/service.d.ts",
50-
"default": "./dist/service.js"
45+
"types": "./dist/service.d.mts",
46+
"default": "./dist/service.mjs"
5147
},
5248
"require": {
53-
"types": "./dist/service.d.cts",
54-
"default": "./dist/service.cjs"
49+
"types": "./dist/service.d.ts",
50+
"default": "./dist/service.js"
5551
}
5652
},
5753
"./dist/*": "./dist/*",
5854
"./package.json": "./package.json"
5955
},
56+
"files": [
57+
"src",
58+
"dist"
59+
],
6060
"dependencies": {
6161
"@rgbpp-sdk/btc": "workspace:*",
6262
"@rgbpp-sdk/ckb": "workspace:*",

‎packages/rgbpp/tsconfig.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"compilerOptions": {
4+
"moduleResolution": "Bundler",
5+
"module": "ESNext",
6+
"target": "ESNext",
7+
"lib": ["ESNext", "DOM"],
8+
"strict": true,
9+
"noEmit": true,
10+
"allowJs": true,
11+
"sourceMap": true,
12+
"skipLibCheck": true,
13+
"esModuleInterop": true,
14+
"strictNullChecks": true,
15+
"resolveJsonModule": true,
16+
"isolatedModules": true
17+
},
18+
"include": ["src/**/*.ts"],
19+
"exclude": ["node_modules", "dist"]
20+
}

‎packages/rgbpp/tsup.config.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { defineConfig } from 'tsup';
22

3-
import { dependencies, name } from './package.json';
4-
5-
import config from '../../tsup-base.config';
6-
73
export default defineConfig({
8-
...config,
9-
name,
4+
name: 'rgbpp',
5+
dts: true,
6+
clean: true,
7+
sourcemap: true,
8+
format: ['esm', 'cjs'],
109
entry: ['src/index.ts', 'src/btc.ts', 'src/ckb.ts', 'src/service.ts'],
11-
external: Object.keys(dependencies),
12-
platform: 'browser',
1310
});

‎packages/service/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
"lint": "tsc && eslint '{src,tests}/**/*.{js,ts}' && prettier --check '{src,tests}/**/*.{js,ts}'",
88
"lint:fix": "tsc && eslint --fix '{src,tests}/**/*.{js,ts}' && prettier --write '{src,tests}/**/*.{js,ts}'"
99
},
10-
"type": "module",
10+
"sideEffects": false,
1111
"main": "./dist/index.js",
1212
"types": "./dist/index.d.ts",
13-
"files": [
14-
"src",
15-
"dist"
16-
],
1713
"exports": {
1814
".": {
1915
"import": {
20-
"types": "./dist/index.d.ts",
21-
"default": "./dist/index.js"
16+
"types": "./dist/index.d.mts",
17+
"default": "./dist/index.mjs"
2218
},
2319
"require": {
24-
"types": "./dist/index.d.cts",
25-
"default": "./dist/index.cjs"
20+
"types": "./dist/index.d.ts",
21+
"default": "./dist/index.js"
2622
}
2723
},
2824
"./package.json": "./package.json"
2925
},
26+
"files": [
27+
"src",
28+
"dist"
29+
],
3030
"dependencies": {
3131
"@ckb-lumos/codec": "0.22.2",
3232
"@ckb-lumos/base": "0.22.2",

‎packages/service/tsconfig.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"moduleResolution": "Bundler",
4+
"module": "ESNext",
5+
"target": "ESNext",
6+
"lib": ["ESNext", "DOM"],
7+
"strict": true,
8+
"noEmit": true,
9+
"allowJs": true,
10+
"sourceMap": true,
11+
"skipLibCheck": true,
12+
"esModuleInterop": true,
13+
"strictNullChecks": true,
14+
"resolveJsonModule": true,
15+
"isolatedModules": true
16+
},
17+
"include": ["src"],
18+
"exclude": ["node_modules", "dist"]
19+
}

‎packages/service/tsup.config.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { defineConfig } from 'tsup';
22

3-
import { dependencies, name } from './package.json';
4-
5-
import config from '../../tsup-base.config';
6-
73
export default defineConfig({
8-
...config,
9-
name,
4+
name: '@rgbpp-sdk/service',
5+
dts: true,
6+
clean: true,
7+
sourcemap: true,
8+
format: ['esm', 'cjs'],
109
entry: ['src/index.ts'],
11-
external: Object.keys(dependencies),
12-
platform: 'browser',
1310
});

‎pnpm-lock.yaml

+215-218
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tsconfig.json

-62
This file was deleted.

‎tsup-base.config.ts

-13
This file was deleted.

‎vitest.config.mts

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ export default defineConfig({
44
test: {
55
watch: false,
66
reporters: ['verbose'],
7-
exclude: ['dist', 'node_modules'],
87
},
98
});

0 commit comments

Comments
 (0)
Please sign in to comment.