Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use tsc for generating declarations
  • Loading branch information
Mrtenz committed Oct 16, 2023
commit 775f71de7119e4550a9f8533bf090a89bca0da3f
6 changes: 3 additions & 3 deletions constraints.pro
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/MetaMask/
% The license for the package must be specified.
gen_enforced_field(WorkspaceCwd, 'license').

% The type definitions entrypoint the package must be `./dist/index.d.ts`.
gen_enforced_field(WorkspaceCwd, 'types', './dist/index.d.ts').
gen_enforced_field(WorkspaceCwd, 'exports["."].types', './dist/index.d.ts').
% The type definitions entrypoint the package must be `./dist/types/index.d.ts`.
gen_enforced_field(WorkspaceCwd, 'types', './dist/types/index.d.ts').
gen_enforced_field(WorkspaceCwd, 'exports["."].types', './dist/types/index.d.ts').

% The entrypoint for the package must be `./dist/index.js`.
gen_enforced_field(WorkspaceCwd, 'main', './dist/index.js').
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"types": "./dist/types/index.d.ts"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"types": "./dist/types/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsup",
"build": "tsup && yarn build:types",
"build:types": "tsc --project tsconfig.build.json",
"build:docs": "typedoc",
"lint": "yarn lint:eslint && yarn lint:constraints && yarn lint:misc --check && yarn lint:dependencies --check && yarn lint:changelog",
"lint:changelog": "auto-changelog validate",
Expand Down
23 changes: 23 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"inlineSources": true,
"noEmit": false,
"outDir": "dist/types",
"rootDir": "src",
"sourceMap": true
},
"include": ["./src/**/*.ts"],
"exclude": [
"./src/**/__fixtures__/**/*",
"./src/**/__mocks__/**/*",
"./src/**/__test__/**/*",
"./src/**/__tests__/**/*",
"./src/**/__snapshots__/**/*",
"./src/**/*.test.ts",
"./src/**/*.test.*.ts"
]
}
4 changes: 0 additions & 4 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export default defineConfig({
// Clean the dist folder before bundling.
clean: true,

// Enables TypeScript declaration files.
// https://tsup.egoist.dev/#generate-declaration-file
dts: true,

// Enables shimming of `__dirname` and `import.meta.url`, so that they work
// in both CommonJS and ESM.
// https://tsup.egoist.dev/#inject-cjs-and-esm-shims
Expand Down