1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-05-27 22:01:05 +03:00

Fix the types building

1829 added the spec files to 'src', presumably because they just
were't type checked otherwise, but this chaqnged the implicit rootDir
so the lib directory we shipped has types in src/ and spec/ which
meant lib/index.d.ts was at lib/src/index.d.ts.

Specify the rootDir on the build tsconfig to put it back in the
right place, and also try to make the base tsconfig never emit
to avoid it ever generating .d.ts files in silly places. Move all
the optoins related to emitting to -build since they aren't relevant
in the main one.

Is this a sensible way to do this? It doesn't feel terribly elegant.

Fixes https://github.com/vector-im/element-web/issues/18503
Regressed in https://github.com/matrix-org/matrix-js-sdk/pull/1829
This commit is contained in:
David Baker 2021-08-12 11:46:49 +01:00
parent 429f32dacb
commit b392dbf6f8
3 changed files with 10 additions and 5 deletions

View File

@ -9,7 +9,7 @@
"clean": "rimraf lib dist",
"build": "yarn build:dev && yarn build:compile-browser && yarn build:minify-browser",
"build:dev": "yarn clean && git rev-parse HEAD > git-revision.txt && yarn build:compile && yarn build:types",
"build:types": "tsc --emitDeclarationOnly",
"build:types": "tsc -p tsconfig-build.json --emitDeclarationOnly",
"build:compile": "babel -d lib --verbose --extensions \".ts,.js\" src",
"build:compile-browser": "mkdirp dist && browserify -d src/browser-index.js -p [ tsify -p ./tsconfig-build.json ] -t [ babelify --sourceMaps=inline --presets [ @babel/preset-env @babel/preset-typescript ] ] | exorcist dist/browser-matrix.js.map > dist/browser-matrix.js",
"build:minify-browser": "terser dist/browser-matrix.js --compress --mangle --source-map --output dist/browser-matrix.min.js",

View File

@ -1,5 +1,13 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": true,
"noEmit": false,
"emitDecoratorMetadata": true,
"target": "es2016",
"outDir": "./lib",
"rootDir": "src"
},
"exclude": [
"./spec/**/*.ts"
]

View File

@ -1,14 +1,11 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es2016",
"noImplicitAny": false,
"sourceMap": true,
"outDir": "./lib",
"noEmit": true,
"declaration": true
},
"include": [