Skip to content

Commit 468fdf4

Browse files
Move TypeScript build:types to watch task
We already have type checks in editors and IDEs, plus we run `lint:types` during the GitHub Actions workflow So this check is more useful as a watch task for early feedback Adds flag `--incremental` to use the compiler cache (10x faster) and flag `--pretty` to preserve colour output via `concurrently` CLI
1 parent ab7a427 commit 468fdf4

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696

9797
- description: TypeScript compiler
9898
name: lint-types
99-
run: npm run lint:types -- --incremental
99+
run: npm run lint:types -- --incremental --pretty
100100
cache: '**/*.tsbuildinfo'
101101

102102
steps:

packages/govuk-frontend-review/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build:sassdoc": "sassdoc --config sassdoc.config.yaml ../govuk-frontend/src/govuk",
1515
"build:types": "tsc --build tsconfig.build.json",
1616
"build:jsdoc": "typedoc",
17-
"postbuild": "npm run build:jsdoc && npm run build:sassdoc && npm run build:types",
17+
"postbuild": "npm run build:jsdoc && npm run build:sassdoc",
1818
"proxy": "browser-sync start --config browsersync.config.js",
1919
"serve": "nodemon",
2020
"start": "node src/start.mjs",

packages/govuk-frontend-review/tasks/watch.mjs

+8-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ export const watch = (options) =>
5252
task.name('lint:js watch', () =>
5353
gulp.watch(
5454
[join(options.srcPath, '**/*.{cjs,js,mjs}')],
55+
gulp.parallel(
56+
// Run TypeScript compiler
57+
npm.script('build:types', ['--incremental', '--pretty'], options),
5558

56-
// Run ESLint checks
57-
npm.script('lint:js:cli', [
58-
slash(join(options.workspace, '**/*.{cjs,js,mjs}'))
59-
])
59+
// Run ESLint checks
60+
npm.script('lint:js:cli', [
61+
slash(join(options.workspace, '**/*.{cjs,js,mjs}'))
62+
])
63+
)
6064
)
6165
)
6266
)

packages/govuk-frontend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"build:release": "gulp build:release --color",
5252
"build:stats": "npm run stats --workspace @govuk-frontend/stats",
5353
"build:types": "tsc --build tsconfig.build.json",
54-
"postbuild:package": "npm run build:stats && npm run build:types && govuk-prototype-kit validate-plugin .",
54+
"postbuild:package": "npm run build:stats && govuk-prototype-kit validate-plugin .",
5555
"dev": "gulp dev --color",
5656
"version": "echo $npm_package_version"
5757
},

packages/govuk-frontend/tasks/watch.mjs

+8-4
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ export const watch = (options) =>
4646
task.name('lint:js watch', () =>
4747
gulp.watch(
4848
[join(options.srcPath, '**/*.{cjs,js,mjs}')],
49+
gulp.parallel(
50+
// Run TypeScript compiler
51+
npm.script('build:types', ['--incremental', '--pretty'], options),
4952

50-
// Run ESLint checks
51-
npm.script('lint:js:cli', [
52-
slash(join(options.workspace, '**/*.{cjs,js,mjs}'))
53-
])
53+
// Run ESLint checks
54+
npm.script('lint:js:cli', [
55+
slash(join(options.workspace, '**/*.{cjs,js,mjs}'))
56+
])
57+
)
5458
)
5559
),
5660

0 commit comments

Comments
 (0)