Skip to content

Commit

Permalink
Publish type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Oct 23, 2023
1 parent 2ae5643 commit b16d38a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/govuk-frontend-review/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build:sassdoc": "sassdoc --config sassdoc.config.yaml ../govuk-frontend/src/govuk",
"build:types": "tsc --build tsconfig.build.json",
"build:jsdoc": "typedoc",
"postbuild": "npm run build:jsdoc && npm run build:sassdoc",
"postbuild": "npm run build:jsdoc && npm run build:sassdoc && npm run build:types",
"clean": "del-cli dist",
"proxy": "browser-sync start --config browsersync.config.js",
"serve": "nodemon",
Expand Down
4 changes: 3 additions & 1 deletion packages/govuk-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "4.7.0",
"main": "dist/govuk/all.bundle.js",
"module": "dist/govuk/all.mjs",
"types": "dist/govuk/all.d.mts",
"sass": "dist/govuk/all.scss",
"files": [
"dist",
Expand All @@ -13,6 +14,7 @@
],
"exports": {
".": {
"types": "./dist/govuk/all.d.mts",
"sass": "./dist/govuk/all.scss",
"import": "./dist/govuk/all.mjs",
"require": "./dist/govuk/all.bundle.js",
Expand Down Expand Up @@ -57,7 +59,7 @@
"clean": "npm run clean:package",
"clean:package": "del-cli dist",
"clean:release": "del-cli ../../dist --force",
"postbuild:package": "npm run build:stats && govuk-prototype-kit validate-plugin .",
"postbuild:package": "npm run build:stats && npm run build:types && govuk-prototype-kit validate-plugin .",
"version": "echo $npm_package_version"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/govuk-frontend/tasks/build/package.unit.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ describe('packages/govuk-frontend/dist/', () => {
.flatMap(
mapPathTo(['**/*.mjs'], ({ dir: requirePath, name }) => [
join(requirePath, `${name}.mjs`),
join(requirePath, `${name}.mjs.map`) // with source map
join(requirePath, `${name}.mjs.map`), // with source map
join(requirePath, `${name}.d.mts`) // with type declaration
])
)

Expand Down
5 changes: 5 additions & 0 deletions packages/govuk-frontend/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"include": ["./src/govuk/**/*.mjs"],
"exclude": ["**/*.test.*"],
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"lib": ["ESNext", "DOM"],
"noEmit": false,
"outDir": "./dist",
"rootDir": "./src",
"target": "ES2015",
"types": ["node", "typed-query-selector"]
}
Expand Down

0 comments on commit b16d38a

Please sign in to comment.