Skip to content

Commit 44a54a1

Browse files
Set up shared config
1 parent 453e4f8 commit 44a54a1

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

shared/config/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { version } from './version.mjs'

shared/config/version.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import pkg from '../../packages/nhsuk-frontend/package.json' with { type: 'json' }
2+
3+
/**
4+
* NHS.UK frontend release version
5+
*/
6+
export const version = pkg.version

shared/tasks/app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import nunjucks from 'nunjucks'
99
import PluginError from 'plugin-error'
1010

1111
import validatorConfig from '../../.htmlvalidate.js'
12-
import pkg from '../../package.json' with { type: 'json' }
12+
import * as config from '../config/index.mjs'
1313

1414
const { PORT = 3000 } = process.env
1515

@@ -33,7 +33,7 @@ export async function buildHTML() {
3333

3434
const html = env.render(path, {
3535
baseUrl: '/nhsuk-frontend/',
36-
version: pkg.version
36+
version: config.version
3737
})
3838

3939
const destPath = join('dist/app', dir)

shared/tasks/release.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import gulp from 'gulp'
22

3-
import pkg from '../../package.json' with { type: 'json' }
3+
import * as config from '../config/index.mjs'
44

55
/**
66
* Assets tasks
@@ -44,6 +44,6 @@ export async function createZip() {
4444
encoding: false
4545
}
4646
)
47-
.pipe(zip(`nhsuk-frontend-${pkg.version}.zip`))
47+
.pipe(zip(`nhsuk-frontend-${config.version}.zip`))
4848
.pipe(gulp.dest('dist'))
4949
}

shared/tasks/scripts.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import terser from 'gulp-terser'
77
import PluginError from 'plugin-error'
88
import webpack from 'webpack-stream'
99

10-
import pkg from '../../package.json' with { type: 'json' }
10+
import * as config from '../config/index.mjs'
1111

1212
/**
1313
* Compile JavaScript task
@@ -90,7 +90,7 @@ export function minifyJS() {
9090
)
9191
.pipe(
9292
rename({
93-
suffix: `-${pkg.version}.min`
93+
suffix: `-${config.version}.min`
9494
})
9595
)
9696
.pipe(

shared/tasks/styles.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import gulpSass from 'gulp-sass'
1111
import PluginError from 'plugin-error'
1212
import dartSass from 'sass-embedded'
1313

14-
import pkg from '../../package.json' with { type: 'json' }
14+
import * as config from '../config/index.mjs'
1515

1616
const sass = gulpSass(dartSass)
1717

@@ -74,7 +74,7 @@ export function minifyCSS() {
7474
.pipe(postcss([cssnano()]))
7575
.pipe(
7676
rename({
77-
suffix: `-${pkg.version}.min`
77+
suffix: `-${config.version}.min`
7878
})
7979
)
8080
.pipe(

0 commit comments

Comments
 (0)