diff --git a/docs/contributing/tasks.md b/docs/contributing/tasks.md index 3c590d9dee..01d114a56c 100644 --- a/docs/contributing/tasks.md +++ b/docs/contributing/tasks.md @@ -91,8 +91,6 @@ This task will: This task will: -- check JavaScript code quality via ESLint (`npm run lint:js`) (using JavaScript Standard Style) -- compile JavaScript to Immediately Invoked Function Expression (IIFE) into `./packages/govuk-frontend-review/dist/javascripts` - compile JavaScript documentation into `./packages/govuk-frontend-review/dist/docs/jsdoc` ## Review app only diff --git a/packages/govuk-frontend-review/browsersync.config.js b/packages/govuk-frontend-review/browsersync.config.js index fb72981a7b..e8a0369567 100644 --- a/packages/govuk-frontend-review/browsersync.config.js +++ b/packages/govuk-frontend-review/browsersync.config.js @@ -1,5 +1,6 @@ const { join } = require('path') +const pkg = require('govuk-frontend/package.json') const { paths, ports } = require('govuk-frontend-config') const { packageTypeToPath } = require('govuk-frontend-lib/names') @@ -22,9 +23,14 @@ module.exports = { // Files to watch for auto reload files: [ - join(paths.app, 'dist/javascripts/**/*.mjs'), join(paths.app, 'dist/stylesheets/**/*.css'), join(paths.app, 'src/views/**/*.njk'), + + packageTypeToPath('govuk-frontend', { + modulePath: `govuk-frontend-${pkg.version}.min.js`, + moduleRoot: paths.app + }), + packageTypeToPath('govuk-frontend', { modulePath: '**/*.njk', moduleRoot: paths.app @@ -36,7 +42,10 @@ module.exports = { serveStatic: [ { route: '/javascripts', - dir: join(paths.app, 'dist/javascripts') + dir: packageTypeToPath('govuk-frontend', { + modulePath: '/', + moduleRoot: paths.app + }) }, { route: '/stylesheets', diff --git a/packages/govuk-frontend-review/nodemon.json b/packages/govuk-frontend-review/nodemon.json index 31d12be622..37010b4c76 100644 --- a/packages/govuk-frontend-review/nodemon.json +++ b/packages/govuk-frontend-review/nodemon.json @@ -6,7 +6,7 @@ "../../shared/lib", "../../shared/stats" ], - "ignore": ["./src/javascripts/**", "**/*.test.*"], + "ignore": ["**/*.test.*"], "events": { "restart": "browser-sync reload --config browsersync.config.js" }, diff --git a/packages/govuk-frontend-review/rollup.config.mjs b/packages/govuk-frontend-review/rollup.config.mjs deleted file mode 100644 index 8ca32b0c11..0000000000 --- a/packages/govuk-frontend-review/rollup.config.mjs +++ /dev/null @@ -1,45 +0,0 @@ -import resolve from '@rollup/plugin-node-resolve' -import terser from '@rollup/plugin-terser' -import { paths } from 'govuk-frontend-config' -import { defineConfig } from 'rollup' - -/** - * Rollup config - * Outputs self-executing function, suitable for + diff --git a/packages/govuk-frontend-review/src/views/examples/template-custom/index.njk b/packages/govuk-frontend-review/src/views/examples/template-custom/index.njk index 2838ef1ed2..a459230251 100644 --- a/packages/govuk-frontend-review/src/views/examples/template-custom/index.njk +++ b/packages/govuk-frontend-review/src/views/examples/template-custom/index.njk @@ -121,9 +121,9 @@ {% block bodyEnd %} - + diff --git a/packages/govuk-frontend-review/src/views/examples/template-default/index.njk b/packages/govuk-frontend-review/src/views/examples/template-default/index.njk index 7c72c80cff..7cdd4354a1 100644 --- a/packages/govuk-frontend-review/src/views/examples/template-default/index.njk +++ b/packages/govuk-frontend-review/src/views/examples/template-default/index.njk @@ -12,9 +12,9 @@ {% block bodyEnd %} - + diff --git a/packages/govuk-frontend-review/src/views/examples/translated/index.njk b/packages/govuk-frontend-review/src/views/examples/translated/index.njk index f4c38ccb75..f2242a226e 100644 --- a/packages/govuk-frontend-review/src/views/examples/translated/index.njk +++ b/packages/govuk-frontend-review/src/views/examples/translated/index.njk @@ -937,9 +937,9 @@ {% endblock %} {% block bodyEnd %} - + + {% endblock %} diff --git a/packages/govuk-frontend-review/src/views/tests/boilerplate.njk b/packages/govuk-frontend-review/src/views/tests/boilerplate.njk index 9832d919d2..22644af3b2 100644 --- a/packages/govuk-frontend-review/src/views/tests/boilerplate.njk +++ b/packages/govuk-frontend-review/src/views/tests/boilerplate.njk @@ -6,7 +6,7 @@ {% block head %} {{ super() }} {% endblock %} @@ -21,5 +21,5 @@ {% endblock %} {% block bodyEnd %} - + {% endblock %} diff --git a/packages/govuk-frontend-review/tasks/scripts.mjs b/packages/govuk-frontend-review/tasks/scripts.mjs index 7100ec5a56..d746da9199 100644 --- a/packages/govuk-frontend-review/tasks/scripts.mjs +++ b/packages/govuk-frontend-review/tasks/scripts.mjs @@ -1,25 +1,12 @@ -import { join } from 'path' - -import { npm, scripts, task } from 'govuk-frontend-tasks' +import { npm } from 'govuk-frontend-tasks' import gulp from 'gulp' /** * JavaScripts task (for watch) - * Compilation, documentation + * Documentation * * @type {import('govuk-frontend-tasks').TaskFunction} */ export const compile = (options) => gulp.series( - task.name('compile:js', () => - scripts.compile('all.mjs', { - ...options, - - srcPath: join(options.srcPath, 'javascripts'), - destPath: join(options.destPath, 'javascripts'), - configPath: join(options.basePath, 'rollup.config.mjs') - }) - ), - - // Build JSDoc for /docs/javascript npm.script('build:jsdoc', [], options) ) diff --git a/packages/govuk-frontend-review/tasks/watch.mjs b/packages/govuk-frontend-review/tasks/watch.mjs index 5ef0547506..8d06ec4d0a 100644 --- a/packages/govuk-frontend-review/tasks/watch.mjs +++ b/packages/govuk-frontend-review/tasks/watch.mjs @@ -36,22 +36,12 @@ export const watch = (options) => gulp.parallel( ], styles(options)) ), - /** - * JavaScripts lint watcher - */ - task.name('lint:js watch', () => - gulp.watch([ - `${slash(paths.app)}/src/javascripts/**/*.mjs` - ], npm.script('lint:js:cli', [slash(join(options.workspace, '**/*.{cjs,js,md,mjs}'))])) - ), - /** * JavaScripts build watcher */ task.name('compile:js watch', () => gulp.watch([ `${slash(paths.root)}/typedoc.config.js`, - `${slash(paths.app)}/src/javascripts/**/*.mjs`, `${slash(paths.package)}/dist/govuk/**/*.mjs` ], scripts(options)) )