From 9c6ff78396efeed19614bc89ba236605abd57ea2 Mon Sep 17 00:00:00 2001 From: Mike Monteith Date: Thu, 18 Apr 2024 12:29:36 +0100 Subject: [PATCH 1/5] NPM release pipeline --- .github/workflows/publish.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..63c7d8e --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,20 @@ +name: Publish to NPM + +on: + release: + types: + - published + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm ci + - run: npm publish ${IS_PRERELEASE:+--tag=prerelease} + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} + IS_PRERELEASE: ${{github.event.release.prerelease}} From 0325b43b20c8de98b26c067046ac31f6c670ccc4 Mon Sep 17 00:00:00 2001 From: Mike Monteith Date: Thu, 18 Apr 2024 15:27:05 +0100 Subject: [PATCH 2/5] Improve npm package bundle - Name our scss entrypoint all.scss, to keep in line with other gov/nhs frontends - Compile all source code into dist/nhsapp, not just nunjucks files - Add nhsuk-frontend as a regular dependency, not a devDependency --- gulpfile.js | 13 +++++++------ package-lock.json | 11 ++++++----- package.json | 9 +++++---- src/{nhsapp.scss => all.scss} | 0 4 files changed, 18 insertions(+), 15 deletions(-) rename src/{nhsapp.scss => all.scss} (100%) diff --git a/gulpfile.js b/gulpfile.js index 5b656e0..7ca7cdf 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -17,13 +17,14 @@ function clean() { /* Build the CSS from source */ function compileCSS() { return gulp - .src(['src/nhsapp.scss']) + .src(['src/all.scss']) .pipe(sass()) .on('error', (err) => { console.log(err) throw new Error(err) }) - .pipe(gulp.dest('dist/')) + .pipe(rename('nhsapp.css')) + .pipe(gulp.dest('dist')) } /* Minify CSS and add a min.css suffix */ @@ -50,10 +51,10 @@ function copyAssets() { } /** - * Copy nunjucks templates into a namespaced folder + * Copy nunjucks and source scss files into a namespaced directory */ -function copyNunjucks() { - return gulp.src('src/**/*.njk').pipe(gulp.dest('dist/nhsapp')) +function copySource() { + return gulp.src('src/**/*').pipe(gulp.dest('dist/nhsapp')) } /* Recompile CSS when there are any changes */ @@ -71,7 +72,7 @@ const bundle = gulp.series([ compileCSS, minifyCSS, copyAssets, - copyNunjucks + copySource ]) export { clean, bundle, compileCSS } diff --git a/package-lock.json b/package-lock.json index 8789c37..8a2e882 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,16 @@ { "name": "nhsapp-frontend", - "version": "0.0.2", + "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nhsapp-frontend", - "version": "0.0.2", + "version": "0.0.1", "license": "MIT", + "dependencies": { + "nhsuk-frontend": "^8.1.1" + }, "devDependencies": { "@11ty/eleventy": "3.0.0-alpha.6", "concurrently": "^8.2.2", @@ -20,7 +23,6 @@ "gulp-rename": "^2.0.0", "gulp-sass": "^5.1.0", "gulp-uglify": "^3.0.2", - "nhsuk-frontend": "^8.1.1", "nunjucks": "^3.2.4", "prettier": "^3.2.5", "sass": "^1.74.1" @@ -3264,8 +3266,7 @@ "node_modules/nhsuk-frontend": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/nhsuk-frontend/-/nhsuk-frontend-8.1.1.tgz", - "integrity": "sha512-w+2ovXA8kQgR8YImqufx+cgqkmDjFUcW+VhHhgfBWBRjSPbAghUjlpIbkh6L7KCX0NI4xafOtSRV0+hL7viG6g==", - "dev": true + "integrity": "sha512-w+2ovXA8kQgR8YImqufx+cgqkmDjFUcW+VhHhgfBWBRjSPbAghUjlpIbkh6L7KCX0NI4xafOtSRV0+hL7viG6g==" }, "node_modules/node-retrieve-globals": { "version": "5.0.0", diff --git a/package.json b/package.json index b8a7cfc..a6a8f6b 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { "name": "nhsapp-frontend", - "version": "0.0.2", + "version": "0.0.1", "description": "A CSS library built on top of nhsuk-frontend providing styles for the NHS App.", "main": "index.js", "type": "module", "files": [ - "dist", - "src" + "dist" ], "scripts": { "prepack": "gulp bundle", @@ -40,9 +39,11 @@ "gulp-rename": "^2.0.0", "gulp-sass": "^5.1.0", "gulp-uglify": "^3.0.2", - "nhsuk-frontend": "^8.1.1", "nunjucks": "^3.2.4", "prettier": "^3.2.5", "sass": "^1.74.1" + }, + "dependencies": { + "nhsuk-frontend": "^8.1.1" } } diff --git a/src/nhsapp.scss b/src/all.scss similarity index 100% rename from src/nhsapp.scss rename to src/all.scss From d9f08f5f007accc36d94d2562070b7b2d67396a3 Mon Sep 17 00:00:00 2001 From: Mike Monteith Date: Thu, 18 Apr 2024 15:30:45 +0100 Subject: [PATCH 3/5] Tag current version as an alpha release --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8a2e882..2756f85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nhsapp-frontend", - "version": "0.0.1", + "version": "0.0.1-alpha.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nhsapp-frontend", - "version": "0.0.1", + "version": "0.0.1-alpha.0", "license": "MIT", "dependencies": { "nhsuk-frontend": "^8.1.1" diff --git a/package.json b/package.json index a6a8f6b..d9375e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nhsapp-frontend", - "version": "0.0.1", + "version": "0.0.1-alpha.0", "description": "A CSS library built on top of nhsuk-frontend providing styles for the NHS App.", "main": "index.js", "type": "module", From ea82a2088f110f4b286987326527b25f31b5cb22 Mon Sep 17 00:00:00 2001 From: Mike Monteith Date: Thu, 18 Apr 2024 15:34:54 +0100 Subject: [PATCH 4/5] Start a changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7ce0494 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# NHS App Frontend Changelog + +## 0.0.1-alpha.0 (Prerelease) - 18 April 2024 + +:tada: **Initial release of the NHS App Frontend** From a460366660b712c4c0f5aeb97118b8072c61d84d Mon Sep 17 00:00:00 2001 From: Mike Monteith Date: Thu, 18 Apr 2024 15:35:50 +0100 Subject: [PATCH 5/5] First version should be 0.1.0, not 0.0.1 --- CHANGELOG.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ce0494..323507e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # NHS App Frontend Changelog -## 0.0.1-alpha.0 (Prerelease) - 18 April 2024 +## 0.1.0-alpha.0 (Prerelease) - 18 April 2024 :tada: **Initial release of the NHS App Frontend** diff --git a/package-lock.json b/package-lock.json index 2756f85..e23e30d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nhsapp-frontend", - "version": "0.0.1-alpha.0", + "version": "0.1.0-alpha.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nhsapp-frontend", - "version": "0.0.1-alpha.0", + "version": "0.1.0-alpha.0", "license": "MIT", "dependencies": { "nhsuk-frontend": "^8.1.1" diff --git a/package.json b/package.json index d9375e6..b0c9386 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nhsapp-frontend", - "version": "0.0.1-alpha.0", + "version": "0.1.0-alpha.0", "description": "A CSS library built on top of nhsuk-frontend providing styles for the NHS App.", "main": "index.js", "type": "module",