Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,62 @@
module.exports = {
// Add rules for JavaScript files
env: {
browser: true,
es6: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'plugin:storybook/recommended'],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:storybook/recommended',
],
plugins: ['prettier'],
parserOptions: {
ecmaVersion: 13,
sourceType: 'module',
},
rules: {
'prettier/prettier': 'error',
indent: ['error', 2],
// indent: ['error', 2], // Disabled as it conflicts with Prettier
semi: ['error', 'never'],
'no-var': 'error',
},
overrides: [
{
// Add rules for Test files
files: ['**/*.test.{js}'],
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:storybook/recommended',
],
plugins: ['prettier'],
parserOptions: {
ecmaVersion: 13,
sourceType: 'module',
},
rules: {
'prettier/prettier': 'error',
// indent: ['error', 2], // Disabled as it conflicts with Prettier
semi: ['error', 'never'],
'no-var': 'error',
},
// Include testing globals for vitest
globals: {
vi: true,
describe: true,
it: true,
expect: true,
beforeEach: true,
afterEach: true,
beforeAll: true,
afterAll: true,
},
},
],
}
39 changes: 39 additions & 0 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Node - CI - Lint and Test

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main

jobs:
run-tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v6
with:
node-version: '22'
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test-ci
run-lint:
name: Run lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v6
with:
node-version: '22'
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"indent": 4,
"semi": false,
"singleQuote": true,
"endOfLine": "auto"
Expand Down
38 changes: 2 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,45 +143,11 @@ Versions can be restricted from updating within the `pyproject.toml` using stand

[`pip-tools`]: https://pip-tools.readthedocs.io/en/latest/

## Working with NPM
## Frontend Node

This project includes an NPM-based setup for managing front-end assets like styles, scripts, and other resources. The `package.json` file contains predefined scripts to help with building and managing assets. You don't need to run these NPM commands if you are developing the Django app locally. You should only run these commands when needed, for example if you are changing javascript dependencies or modifying SCSS files.

### Prerequisites

Ensure you have Node.js (v16 or higher) and NPM installed. You can verify their installation with:

```bash
npm version
```

### Installing Dependencies

After cloning the repository, navigate to the project directory and install the required NPM dependencies:

```bash
npm install
```

### Building all frontend assets

To build all styles, scripts, and vendor files, run:

```bash
npm run build
```

The above script performs all the following tasks, which are available as individual commands:

- **Build Expanded Styles**: `npm run styles:expanded` (builds expanded human-readable css files)
- **Build Minified Styles**: `npm run styles:minified` (builds minified css files, optimised for production)
- **Build Expanded Scripts**: `npm run scripts:expanded` (builds expanded human-readable javascript files)
- **Build Minified Scripts**: `npm run scripts:minified` (builds minified javascript files, optimised for production)
- **Build Vendor Files**: `npm run vendor` (bundles and optimises third-party libraries)

```bash
npm run styles:expanded
```
See [Frontend Node](node/README.md) for details on working with the NPM-based frontend asset pipeline.

## Contributors

Expand Down
2 changes: 2 additions & 0 deletions docs/node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable-next-line MD041 -->
--8<-- "node/README.md"
2 changes: 1 addition & 1 deletion main/static/assets/css/theme.css

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

2 changes: 1 addition & 1 deletion main/static/assets/css/theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main/static/assets/css/theme.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main/static/assets/css/theme.min.css.map

Large diffs are not rendered by default.

Loading
Loading