Skip to content

Commit

Permalink
Merge branch 'main' into feature/tav-676-browser-edition
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Nov 20, 2023
2 parents 7936d83 + 4d1118b commit 587dd0b
Show file tree
Hide file tree
Showing 118 changed files with 10,853 additions and 9,800 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd-down.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x
cache: npm

- name: Prepare pulumi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x
cache: npm

- name: Prepare pulumi
Expand Down
41 changes: 27 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x
cache: yarn
- run: yarn
- run: yarn build-shared
Expand All @@ -63,7 +63,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x
cache: yarn
- run: yarn
- run: yarn build
Expand All @@ -76,7 +76,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x
cache: yarn
- run: yarn
- run: yarn build-shared
Expand All @@ -85,6 +85,24 @@ jobs:
env:
CONTINUE_ON_ERROR: true

storybook:
# Workaround for define plugin conflict warning
env:
NODE_ENV: development
continue-on-error: true
name: Test storybook
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: yarn
- run: yarn
- run: yarn build-shared
- run: yarn workspace desktop run verify-storybook

migrations:
strategy:
fail-fast: false
Expand All @@ -96,14 +114,15 @@ jobs:
- '12'
- '14'
- '15'
- '16'

name: Test migrations server=${{ matrix.server }} pg=${{ matrix.postgres }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x
cache: yarn
- run: yarn
- run: yarn build-shared
Expand All @@ -116,20 +135,14 @@ jobs:
- run: scripts/apply_and_revert_server_migrations.sh ${{ matrix.server }}

test-mobile:
strategy:
fail-fast: false
matrix:
node:
- '16.x'

name: Test mobile node=${{ matrix.node }}
name: Test mobile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
node-version: 20.x
cache: yarn

- run: yarn install --frozen-lockfile
Expand All @@ -145,7 +158,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x
cache: yarn

- name: Install and start postgres
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cut-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x

- name: Compute new release branch name
uses: actions/github-script@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-fix-in-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ jobs:
with:
ref: ${{ steps.branch.outputs.result }}

- name: Setup Node.js 16
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x
cache: yarn

- uses: chainguard-dev/actions/setup-gitsign@main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.x

- name: Push tag for current version
id: tagged
Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
# that they're across any changes that might need to be made to any particular
# server.
#
/packages/sync-server/config/default.json @beyondessential/tamanu-deployment-team
/packages/lan/config/default.json @beyondessential/tamanu-deployment-team
/packages/sync-server/config/default.json5 @beyondessential/tamanu-deployment-team
/packages/lan/config/default.json5 @beyondessential/tamanu-deployment-team
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

## Base images
# The general concept is to build in build-base, then copy into a slimmer run-base
FROM node:16-alpine AS base
FROM node:20-alpine AS base
WORKDIR /app
ENV NODE_ENV=production
COPY package.json license ./
COPY package.json yarn.lock license ./

FROM base AS build-base
RUN apk add --no-cache \
Expand All @@ -19,7 +19,7 @@ RUN apk add --no-cache \
jq \
make \
python3
COPY yarn.lock .yarnrc common.* babel.config.js ./
COPY .yarnrc common.* babel.config.js ./
COPY scripts/ scripts/

FROM base AS run-base
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.codeship
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.16.0 as base
FROM node:20.7.0 as base
RUN dpkg --add-architecture i386 \
&& apt update \
&& apt install -y \
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ You'll need to install postgres and configure databases for lan and sync.
<summary>Configuration overview</summary>

The modules use `config`, which helps manage different configurations easily. Each module has a
`config/` directory, with several files in it. The base configuration is in `config/default.json`,
`config/` directory, with several files in it. The base configuration is in `config/default.json5`,
and the values there will be used unless overridden by a more specific configuration (for eg
`config/development.json`).
`config/development.json5`).

The local configuration (`config/local.json`) will always take highest precedence and should not
The local configuration (`config/local.json5`) will always take highest precedence and should not
be checked into version control. This file should contain the information for database configuration,
local credentials, etc.

Expand Down Expand Up @@ -118,9 +118,9 @@ Install PostgreSQL from your package manager
By default, the Central server will not run migrations automatically. To enable automatic migrations, set `db.syncOnStartup` to `true` within your local configuration (see the `Config` section above).

#### Prerequisite
1. Duplicate `sync-server/config/local.example` as new file `config/local.json`.
1. Duplicate `sync-server/config/local.example` as new file `config/local.json5`.
2. Create db using `tamanu-central` or any customised name, new db can be with or without owner.
3. Store db name, root username, password or db owner credentials to `config/local.json` db config.
3. Store db name, root username, password or db owner credentials to `config/local.json5` db config.

#### Run

Expand Down Expand Up @@ -148,9 +148,9 @@ local development, this can just be another process on the same host.

#### Prerequisite
1. Start `sync-server`
2. Duplicate `lan/config/local.example` as new file `config/local.json`.
2. Duplicate `lan/config/local.example` as new file `config/local.json5`.
3. Create db using `tamanu-facility` or any customised name, new db can be with or without owner.
4. Store db name, root username, password or db owner credentials to `config/local.json` db config.
4. Store db name, root username, password or db owner credentials to `config/local.json5` db config.

#### Run

Expand All @@ -166,7 +166,7 @@ UI screens every time, and the live-reload turnaround is way faster than the des
is in addition to the fact that any backend functionality should have tests against it anyway)

The Facility server uses sequelize to manage database connections, and uses postgres exclusively.
As soon as you have postgres available, set the appropriate connection variables in your `local.json`.
As soon as you have postgres available, set the appropriate connection variables in your `local.json5`.
</details>

<details>
Expand Down
1 change: 0 additions & 1 deletion common.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"isolatedModules": true,
"module": "ES2020",
"lib": ["es2020"],
"moduleResolution": "Node16",
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
Expand Down
2 changes: 1 addition & 1 deletion docs/Surveys.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if they do
- `dryRun`, if true, will just `console.log` out the created records instead of
sending them to the sync server
- records will be sent to the sync server defined in `config.sync.host` (edit
config/default.json to change or config/local.json to temporarily override)
config/default.json5 to change or config/local.json5 to temporarily override)
- note that this will **NOT** delete any records. removing a question from an
xlsx will just stop it importing in future. to delete a record you'll need to
get its ID and send a DELETE request to the sync server manually
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tamanu",
"version": "1.37.0",
"version": "1.38.0",
"description": "This repo contains all the packages for Tamanu",
"main": "index.js",
"homepage": "https://github.com/beyondessential/tamanu.git#readme",
Expand Down Expand Up @@ -43,7 +43,7 @@
"build-report": "yarn build-shared && yarn workspace sync-server build && yarn workspace sync-server start report"
},
"engines": {
"node": "^16.16.0"
"node": "^20.9.0 || ^18.15.0"
},
"packageManager": "yarn@1.22.19",
"private": true,
Expand Down Expand Up @@ -83,7 +83,7 @@
"dependencies": {
"babel-eslint": "^10.0.1",
"concurrently": "^5.2.0",
"config": "3.0.1",
"config": "^3.3.9",
"pm2": "^4.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/build-tooling/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tamanu/build-tooling",
"version": "1.37.0",
"version": "1.38.0",
"description": "Build tooling for Tamanu packages",
"main": "index.mjs",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/constants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tamanu/constants",
"version": "1.37.0",
"version": "1.38.0",
"private": true,
"description": "Shared constants",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/csca/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "csca",
"version": "1.37.0",
"version": "1.38.0",
"private": true,
"description": "CSCA tooling for Tamanu desktop app",
"homepage": "https://github.com/beyondessential/tamanu.git#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/.storybook/__mocks__/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import defaultConfig from '../../../sync-server/config/default.json'
import defaultConfig from '../../../sync-server/config/default.json5'

export const mockLocalisationData = defaultConfig.localisation;

Expand Down
10 changes: 0 additions & 10 deletions packages/desktop/.storybook/__mocks__/electron.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
export const remote = {
app: {
getLocale: () => navigator.language,
},
getGlobal: key => {
if (key === 'osLocales') return navigator.language;
},
};

export const ipcRenderer = {
invoke: () => true,
};

export default {
remote,
ipcRenderer,
};
12 changes: 12 additions & 0 deletions packages/desktop/.storybook/__mocks__/electronRemote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const app = {
getLocale: () => navigator.language,
};

export const getGlobal = key => {
if (key === 'osLocales') return navigator.language;
};

export default {
app,
getGlobal,
};
3 changes: 2 additions & 1 deletion packages/desktop/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = async ({ config }) => {

// Allow reading in of config json with comments
config.module.rules.push({
test: /\.json$/i,
test: /\.json5?$/i,
loader: 'json5-loader',
options: {
esModule: false,
Expand All @@ -59,6 +59,7 @@ module.exports = async ({ config }) => {
sequelize: path.resolve(__dirname, './__mocks__/sequelize.js'),
config: path.resolve(__dirname, './__mocks__/config.js'),
electron: require.resolve('./__mocks__/electron.js'),
'@electron/remote': require.resolve('./__mocks__/electronRemote.js'),
yargs: path.resolve(__dirname, './__mocks__/module.js'),
child_process: path.resolve(__dirname, './__mocks__/module.js'),
};
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/desktop/app/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import { withPermissionCheck } from './withPermissionCheck';
import { withPermissionTooltip } from './withPermissionTooltip';
import { useFormButtonSubmitting } from '../hooks/useFormButtonSubmitting';

export const ButtonBase = props => {
export const ButtonBase = ({ functionallyDisabled, ...props }) => {
const locationsProps = getLocationProps(props);
return <MuiButtonBase {...props} {...locationsProps} />;
};

const StyledButton = styled(MuiButton)`
const StyledButton = styled(({ functionallyDisabled, ...props }) => <MuiButton {...props} />)`
font-weight: 500;
font-size: 14px;
line-height: 16px;
Expand Down
Loading

0 comments on commit 587dd0b

Please sign in to comment.