Skip to content

Commit

Permalink
Merge pull request #44 from nhsuk/npm-publishing
Browse files Browse the repository at this point in the history
NPM publishing
  • Loading branch information
davidhunter08 authored Apr 18, 2024
2 parents 1a35926 + a460366 commit 98aef67
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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}}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NHS App Frontend Changelog

## 0.1.0-alpha.0 (Prerelease) - 18 April 2024

:tada: **Initial release of the NHS App Frontend**
13 changes: 7 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand All @@ -71,7 +72,7 @@ const bundle = gulp.series([
compileCSS,
minifyCSS,
copyAssets,
copyNunjucks
copySource
])

export { clean, bundle, compileCSS }
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "nhsapp-frontend",
"version": "0.0.2",
"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",
"files": [
"dist",
"src"
"dist"
],
"scripts": {
"prepack": "gulp bundle",
Expand Down Expand Up @@ -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"
}
}
File renamed without changes.

0 comments on commit 98aef67

Please sign in to comment.