Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…m-core into offline/offline-ready
  • Loading branch information
icrc-jofrancisco committed Jan 16, 2024
2 parents 01a286e + c07c4f8 commit a65ec2b
Show file tree
Hide file tree
Showing 289 changed files with 3,689 additions and 2,021 deletions.
43 changes: 35 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,28 +1,55 @@
{
"extends": ["ts-react-important-stuff"],
"env": {
"node": true,
"browser": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["**/*.test.tsx"],
"rules": {
// Disabling these rules for now just to keep the diff small. I'll enable them in a future PR that fixes lint issues.
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/triple-slash-reference": "off",
// Use `import type` instead of `import` for type imports https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how
"@typescript-eslint/consistent-type-imports": [
"error",
{
"fixStyle": "inline-type-imports"
}
],
"prefer-const": "off",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-unsafe-optional-chaining": "off",
"no-explicit-any": "off",
"no-extra-boolean-cast": "off",
"no-prototype-builtins": "off",
"no-useless-escape": "off",
"no-restricted-imports": [
"error",
{
"paths": [
// These two rules ensure that we're importing lodash and lodash-es correctly. Not doing so can bloat our bundle size significantly.
{
"name": "lodash",
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
"message": "Import specific methods from `lodash`. e.g. `import map from 'lodash/map'`"
},
{
"name": "lodash-es",
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
}
],
"patterns": [
"importNames": ["default"],
"message": "Import specific methods from `lodash-es`. e.g. `import { map } from 'lodash-es'`"
},
// These two rules ensure that we're importing Carbon components and icons from the correct packages (after v10). May be removed in the future.
{
"group": ["carbon-components-react"],
"name": "carbon-components-react",
"message": "Import from `@carbon/react` directly. e.g. `import { Toggle } from '@carbon/react'`"
},
{
"group": ["@carbon/icons-react"],
"name": "@carbon/icons-react",
"message": "Import from `@carbon/react/icons`. e.g. `import { ChevronUp } from '@carbon/react/icons'`"
}
]
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
actions: read

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: "18"
Expand Down Expand Up @@ -55,15 +55,15 @@ jobs:
pre_release:
runs-on: ubuntu-latest
needs: build
if: ${{ (github.event.head_commit == null ||
!startsWith(github.event.head_commit.message, '(chore) Release v')) &&

if: ${{ (github.event.head_commit == null ||
!startsWith(github.event.head_commit.message, '(chore) Release v')) &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: "18"
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:

- name: Build
run: yarn turbo run build --color --concurrency=5

- run: git config user.email "[email protected]" && git config user.name "OpenMRS CI"
- run: git add . && git commit -m "Prerelease version" --no-verify

Expand All @@ -101,7 +101,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: packages
path: |
Expand All @@ -114,9 +114,9 @@ jobs:
if: ${{ github.event_name == 'release' }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: "18"
Expand Down Expand Up @@ -145,8 +145,8 @@ jobs:

needs: pre_release

if: ${{ (github.event.head_commit == null ||
!startsWith(github.event.head_commit.message, '(release)')) &&
if: ${{ (github.event.head_commit == null ||
!startsWith(github.event.head_commit.message, '(release)')) &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}

steps:
Expand Down
42 changes: 38 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,52 @@ on:
- main

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
test-changes: ${{ steps.changes.outputs.test-sources }}

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Check if any source code has changed
id: changes
uses: dorny/paths-filter@v2
with:
filters: |
test-sources:
- 'packages/**/src/**/*!(.test).ts'
- 'packages/**/src/**/*!(.test).tsx'
- 'packages/**/src/**/*!(.test).js'
- 'packages/**/src/**/*!(.test).jsx'
- 'packages/**/src/**/*.scss'
- 'packages/**/src/routes.json'
- 'playwright.config.ts'
- 'e2e/**/*.ts'
- 'e2e/**/*.js'
- 'e2e/support/github/**/*.*'
- 'example.env'
- '.github/workflows/e2e.yml'
main:
needs: changes
if: ${{ needs.changes.outputs.test-changes == 'true' }}

runs-on: ubuntu-latest
timeout-minutes: 60
timeout-minutes: 15

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Copy test environment variables
run: cp example.env .env

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down Expand Up @@ -54,7 +88,7 @@ jobs:
run: docker stop $(docker ps -a -q)

- name: Upload report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/tx-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_dispatch:
schedule:
# every day at 8 PM UTC
- cron: "0 20 * * *"

name: "Scheduled Transifex Update"

jobs:
pull-translations-from-transifex:
name: pull-translations-from-transifex

runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- name: Push source file using transifex client
uses: transifex/cli-action@v2
with:
token: ${{ secrets.TRANSIFEX_TOKEN }}
args: pull
- name: Create PR if necessary
uses: peter-evans/create-pull-request@v5
with:
commit-message: "(chore) Update translations from Transifex"
title: "(chore) Update translations from Transifex"
body: "Automated updates of translations pulled from Transifex"
branch: "chore/update-transifex"
author: "OpenMRS Bot <[email protected]>"
token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/tx-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
workflow_dispatch:
push:
branches: [main]

name: "Update Transifex on Push"

jobs:
push-translations-to-transifex:
name: push-translations-to-transifex

runs-on: ubuntu-latest
permissions:
actions: read

steps:
- uses: actions/checkout@v4
- name: Push source file using transifex client
uses: transifex/cli-action@v2
with:
token: ${{ secrets.TRANSIFEX_TOKEN }}
48 changes: 28 additions & 20 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
[main]
host = https://www.transifex.com

[o:openmrs:p:openmrs-esm-core:r:esm-implementer-tools-app]
file_filter = packages/apps/esm-implementer-tools-app/translations/<lang>.json
source_file = packages/apps/esm-implementer-tools-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
replace_edited_strings = false
keep_translations = false

[openmrs-esm-core.esm-implementer-tools-app]
file_filter = packages/apps/esm-implementer-tools-app/translations/<lang>.json
source_file = packages/apps/esm-implementer-tools-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
[o:openmrs:p:openmrs-esm-core:r:esm-login-app]
file_filter = packages/apps/esm-login-app/translations/<lang>.json
source_file = packages/apps/esm-login-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
replace_edited_strings = false
keep_translations = false

[openmrs-esm-core.esm-login-app]
file_filter = packages/apps/esm-login-app/translations/<lang>.json
source_file = packages/apps/esm-login-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
[o:openmrs:p:openmrs-esm-core:r:esm-offline-tools-app]
file_filter = packages/apps/esm-offline-tools-app/translations/<lang>.json
source_file = packages/apps/esm-offline-tools-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
replace_edited_strings = false
keep_translations = false

[openmrs-esm-core.esm-offline-tools-app]
file_filter = packages/apps/esm-offline-tools-app/translations/<lang>.json
source_file = packages/apps/esm-offline-tools-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
[o:openmrs:p:openmrs-esm-core:r:esm-primary-navigation-app]
file_filter = packages/apps/esm-primary-navigation-app/translations/<lang>.json
source_file = packages/apps/esm-primary-navigation-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
replace_edited_strings = false
keep_translations = false

[openmrs-esm-core.esm-primary-navigation-app]
file_filter = packages/apps/esm-primary-navigation-app/translations/<lang>.json
source_file = packages/apps/esm-primary-navigation-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ This contains tooling and the app shell.
The following common libraries have been developed. They may also be used independently of the app shell.

- [@openmrs/esm-api](packages/framework/esm-api): helps make calls to the backend
- [@openmrs/esm-breadcrumbs](packages/framework/esm-breadcrumbs): management of UI breadcrumbs
- [@openmrs/esm-config](packages/framework/esm-config): validation and storage of frontend configuration
- [@openmrs/esm-error-handling](packages/framework/esm-error-handling): handling of errors
- [@openmrs/esm-extensions](packages/framework/esm-extensions): implementation of a frontend component extension system
- [@openmrs/esm-feature-flags](packages/framework/esm-feature-flags): hide features that are in progress
- [@openmrs/esm-globals](packages/framework/esm-globals): useful global variables and types
- [@openmrs/esm-navigation](packages/framework/esm-navigation): navigation utilities, breadcrumbs, and history
- [@openmrs/esm-offline](packages/framework/esm-offline): provides offline functionality
- [@openmrs/esm-react-utils](packages/framework/esm-react-utils): utilities for React components
- [@openmrs/esm-state](packages/framework/esm-state): brings in state management
Expand Down Expand Up @@ -212,3 +212,7 @@ The tag should be prefixed with `v` (e.g., `v3.2.1`), while the release title sh

For documentation about our design patterns, please visit our design system documentation website.

## Bumping Playwright Version

Be sure to update the Playwright version in the [Bamboo Playwright Docker image](e2e/support/bamboo/playwright.Dockerfile) whenever making version changes.
Also, ensure you specify fixed (pinned) versions of Playwright in the package.json file to maintain consistency between the Playwright version used in the Docker image for Bamboo test execution and the version used in the codebase.
2 changes: 1 addition & 1 deletion e2e/specs/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('Login as Admin user', async ({ page }) => {
});

await test.step('And I should be able to see various elements on the page', async () => {
await page.getByRole('button', { name: 'Users' }).click();
await page.getByRole('button', { name: /user/i }).click();
await expect(page.getByText(/super user/i)).toBeVisible();
await expect(page.getByText(/outpatient clinic/i)).toBeVisible();
await expect(page.getByRole('button', { name: /logout/i })).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion e2e/support/bamboo/playwright.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/playwright:v1.39.0-jammy
FROM mcr.microsoft.com/playwright:v1.40.1-jammy

ARG USER_ID
ARG GROUP_ID
Expand Down
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,25 @@
"coverage": "yarn test --coverage"
},
"devDependencies": {
"@jest/types": "^29.6.3",
"@playwright/test": "1.39.0",
"@playwright/test": "1.40.1",
"@swc/core": "^1.3.58",
"@swc/jest": "^0.2.22",
"@testing-library/dom": "^8.16.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.1",
"@swc/jest": "^0.2.29",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.11",
"@types/react-dom": "^18.0.6",
"@types/systemjs": "^6.1.0",
"@types/webpack-env": "^1.16.4",
"@typescript-eslint/parser": "^5.18.0",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"autoprefixer": "^10.4.2",
"classnames": "^2.3.2",
"cross-env": "7.0.2",
"dotenv": "^16.0.3",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-ts-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"fake-indexeddb": "^4.0.1",
"fork-ts-checker-webpack-plugin": "^7.2.13",
"husky": "^8.0.1",
Expand Down
Loading

0 comments on commit a65ec2b

Please sign in to comment.