Skip to content

Commit

Permalink
Merge branch 'main' of github.com:nationalarchives/tna-frontend into …
Browse files Browse the repository at this point in the history
…feature/hero-cards
  • Loading branch information
ahosgood committed Nov 20, 2023
2 parents 560b8c3 + 989869f commit a8c0df2
Show file tree
Hide file tree
Showing 159 changed files with 7,114 additions and 4,297 deletions.
9 changes: 7 additions & 2 deletions .babelrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@
}
]
],
"plugins": []
}
"plugins": [],
"env": {
"test": {
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}
}
}
38 changes: 21 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
env: {
browser: true,
es2021: true,
},
"extends": ["eslint:recommended", "plugin:storybook/recommended"],
"overrides": [{
"env": {
"node": true
extends: ["eslint:recommended", "plugin:storybook/recommended"],
overrides: [
{
env: {
browser: true,
es2021: true,
node: true,
},
files: [".eslintrc.{js,cjs}", "**/*.test.js"],
parserOptions: {
sourceType: "module",
},
},
"files": [".eslintrc.{js,cjs}"],
"parserOptions": {
"sourceType": "script"
}
}],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
"rules": {}
};
rules: {},
};
4 changes: 2 additions & 2 deletions .github/actions/prototype-kit-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ runs:
echo -e "{% from \"nationalarchives/components/button/macro.njk\" import tnaButton %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/card/macro.njk\" import tnaCard %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/cookie-banner/macro.njk\" import tnaCookieBanner %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/featured-records/macro.njk\" import tnaFeaturedRecords %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/filters/macro.njk\" import tnaFilters %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/footer/macro.njk\" import tnaFooter %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/gallery/macro.njk\" import tnaGallery %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
Expand All @@ -50,7 +51,6 @@ runs:
echo -e "{% from \"nationalarchives/components/pagination/macro.njk\" import tnaPagination %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/phase-banner/macro.njk\" import tnaPhaseBanner %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/picture/macro.njk\" import tnaPicture %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/profile/macro.njk\" import tnaProfile %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/sensitive-image/macro.njk\" import tnaSensitiveImage %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/skip-link/macro.njk\" import tnaSkipLink %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html &&
echo -e "{% from \"nationalarchives/components/tabs/macro.njk\" import tnaTabs %}\n$(cat prototype/app/views/index.html)" > prototype/app/views/index.html
Expand All @@ -62,6 +62,7 @@ runs:
echo "{{ tnaButton({text:\"I am a button\",url:\"#\"}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaCard({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaCookieBanner({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaFeaturedRecords({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaFilters({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaFooter({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaGallery({}) }}" >> prototype/app/views/index.html &&
Expand All @@ -73,7 +74,6 @@ runs:
echo "{{ tnaPagination({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaPhaseBanner({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaPicture({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaProfile({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaSensitiveImage({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaSkipLink({}) }}" >> prototype/app/views/index.html &&
echo "{{ tnaTabs({}) }}" >> prototype/app/views/index.html &&
Expand Down
18 changes: 0 additions & 18 deletions .github/actions/test-build/action.yml

This file was deleted.

File renamed without changes.
9 changes: 9 additions & 0 deletions .github/actions/tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ runs:
- name: Start Storybook
run: npm start &
shell: bash
- name: Install Platwright
run: npx playwright install
shell: bash
- uses: nev7n/wait_for_response@v1
with:
url: "http://localhost:6006"
responseCode: 200
timeout: 30000
interval: 500
- name: Run tests
run: npm run test
shell: bash
64 changes: 36 additions & 28 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish new release
name: Publish release

on:
release:
Expand All @@ -7,16 +7,19 @@ on:

jobs:
check:
name: Pre-release checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check version numbers
- name: Get and validate version number
id: get-version
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
./tasks/validate-version.sh $VERSION
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
./tasks/validate-version.sh "$VERSION"
outputs:
version: ${{ steps.get-version.outputs.VERSION }}

lint:
runs-on: ubuntu-latest
Expand All @@ -36,40 +39,30 @@ jobs:
- name: Tests
uses: ./.github/actions/tests

test-build:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Test build Storybook
uses: ./.github/actions/test-build

test-build-package:
test-package:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Test build package
uses: ./.github/actions/test-build-package
uses: ./.github/actions/test-package

prototype-kit:
runs-on: ubuntu-latest
needs:
- test-build-package
- test-package
steps:
- uses: actions/checkout@v3
- name: GOV.UK prototype kit test
uses: ./.github/actions/prototype-kit-test

publish-npm:
name: Build package and publish to npm
runs-on: ubuntu-latest
needs:
- check
- lint
- tests
- test-build
- prototype-kit
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -88,14 +81,29 @@ jobs:
run: npm whoami
- name: Publish to npm
run: cd package && npm publish
- name: Rename package directory
run: mv package "tna-frontend-${{ needs.check.outputs.version }}"
- name: Compress package
run: zip -r "tna-frontend-${{ needs.check.outputs.version }}.zip" "tna-frontend-${{ needs.check.outputs.version }}"
- name: Upload the package to the GitHub release
run: gh release upload "v${{ needs.check.outputs.version }}" "tna-frontend-${{ needs.check.outputs.version }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# notify-slack:
# runs-on: ubuntu-latest
# needs:
# - publish-npm
# steps:
# - uses: actions/checkout@v3
# - uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_TITLE: "A deployment to ${{ github.head_ref || github.ref_name }} is imminent"
notify-slack:
runs-on: ubuntu-latest
needs:
- check
- publish-npm
steps:
- uses: actions/checkout@v3
- name: Get release notes
id: get-release-notes
run: ./tasks/get-release-notes.sh "${{ needs.check.outputs.version }}" > RELEASE_NOTES.txt
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: "`v${{ needs.check.outputs.version }}` of `tna-frontend` has just been published"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: "https://raw.githubusercontent.com/nationalarchives/tna-frontend/main/src/nationalarchives/assets/images/apple-touch-icon.png"
MSG_MINIMAL: true
SLACK_MESSAGE: $(cat RELEASE_NOTES.txt)
4 changes: 1 addition & 3 deletions .github/workflows/publish-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ concurrency:

jobs:
github-pages:
name: Build and deploy to GitHub Pages
runs-on: ubuntu-latest
environment:
name: github-pages
Expand All @@ -51,7 +50,6 @@ jobs:
uses: actions/deploy-pages@v2

chromatic:
name: Build and deploy to Chromatic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -69,4 +67,4 @@ jobs:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: storybook
exitZeroOnChanges: true
# autoAcceptChanges: true # TODO: Enable once release - won't be pushing new features directly to main
autoAcceptChanges: true
11 changes: 7 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ on:
pull_request:
types:
- opened
- reopened
- edited
- ready_for_review
- synchronize

concurrency:
group: pull-request-${{ github.ref }}
cancel-in-progress: true

jobs:
chromatic:
name: Upload to Chromatic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -33,3 +30,9 @@ jobs:
storybookBuildDir: storybook
exitZeroOnChanges: true
onlyChanged: true
externals: |
- ".storybook/**"
- "src/nationalarchives/variables/**"
- "src/nationalarchives/tools/**"
- "src/nationalarchives/utilities/**"
- "src/nationalarchives/lib/**"
17 changes: 7 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- '**'

concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -20,24 +24,17 @@ jobs:
- name: Tests
uses: ./.github/actions/tests

test-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Test build Storybook
uses: ./.github/actions/test-build

test-build-package:
test-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Test build package
uses: ./.github/actions/test-build-package
uses: ./.github/actions/test-package

prototype-kit:
runs-on: ubuntu-latest
needs:
- test-build-package
- test-package
steps:
- uses: actions/checkout@v3
- name: GOV.UK prototype kit test
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ package
storybook
*.zip
*.tgz
build-storybook.log
build-storybook.log
chromatic.config.json
chromatic.log
RELEASE_NOTES.txt
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/hydrogen
lts/iron
1 change: 1 addition & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
"@storybook/addon-a11y",
"@storybook/addon-interactions",
"@storybook/addon-mdx-gfm",
"@chromaui/addon-visual-tests",
],
framework: {
name: "@storybook/html-webpack5",
Expand Down
35 changes: 35 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,38 @@
document.addEventListener("DOMContentLoaded", removeAllClasses, false);
}
</script>
<!-- <link
rel="preload"
href="/static/media/src/nationalarchives/assets/fonts/OpenSans-Medium.ttf"
as="font"
type="font/ttf"
crossorigin="anonymous"
/>
<link
rel="preload"
href="/static/media/src/nationalarchives/assets/fonts/OpenSans-Bold.ttf"
as="font"
type="font/ttf"
crossorigin="anonymous"
/>
<link
rel="preload"
href="/static/media/src/nationalarchives/assets/fonts/RobotoMono-Regular.ttf"
as="font"
type="font/ttf"
crossorigin="anonymous"
/>
<link
rel="preload"
href="/static/media/src/nationalarchives/assets/fonts/fa-solid-900.woff2"
as="font"
type="font/woff2"
crossorigin="anonymous"
/>
<link
rel="preload"
href="/static/media/src/nationalarchives/assets/fonts/fa-brands-400.woff2"
as="font"
type="font/woff2"
crossorigin="anonymous"
/> -->
Loading

0 comments on commit a8c0df2

Please sign in to comment.