Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
ir4y committed Aug 16, 2024
0 parents commit 6a9d4b9
Show file tree
Hide file tree
Showing 75 changed files with 36,819 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
ios
android
*.d.ts
src/services/initialize.ts
htmlcov
contrib/
106 changes: 106 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
module.exports = {
env: {
browser: true,
es2020: true,
serviceworker: true,
},
globals: {
HTMLButtonElement: 'readonly',
JSX: true,
},
root: true,
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:import/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:storybook/recommended',
'eslint-config-prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
ecmaVersion: 'latest',
sourceType: 'module',
},
ignorePatterns: ['.eslintrc.cjs'],
plugins: ['react', '@typescript-eslint', 'react-refresh', 'prettier', 'import', 'string-to-lingui'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
project: 'src',

project: 'tsconfig.json',
},
},
},
rules: {
'react-refresh/only-export-components': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'string-to-lingui/t-call-in-function': 2,
'import/default': 'off',
'import/named': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-unresolved': [
2,
{
ignore: ['fhir/r4b'], // Fixes error: Unable to resolve path to module 'fhir/r4b'.
},
],
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['**/contrib/aidbox-types'],
message: 'Please use @beda.software/aidbox-types',
},
{
group: ['**/contrib/fhir-emr'],
message: 'Please use @beda.software/emr',
},
{
group: ['**/contrib/emr-config'],
message: 'Please use @beda.software/emr-config',
},
],
},
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', ['index', 'sibling', 'parent']],
'newlines-between': 'always',
pathGroupsExcludedImportTypes: ['builtin'],
pathGroups: [
{
pattern: 'aidbox-react/**',
group: 'external',
position: 'after',
},
{
pattern: '@beda.software/**',
group: 'external',
position: 'after',
},
{
pattern: 'src/**',
group: 'internal',
position: 'after',
},
],
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
}
};
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build image and restart services
on:
push:
branches:
- main
jobs:
Release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DISABLE_ESLINT_PLUGIN: true
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Prepare config
run: cp config/config.production.ts contrib/fhir-emr/shared/src/config.ts
- name: Install deps
run: yarn install --network-concurrency 1
- run: yarn extract
- run: yarn compile
- run: yarn build
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker builder
uses: docker/setup-buildx-action@v3
- run: docker run --rm --privileged tonistiigi/binfmt --install all
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Restart app
uses: appleboy/[email protected]
with:
host: ${{secrets.SSH_HOST}}
username: ${{secrets.SSH_USER}}
key: ${{secrets.SSH_PRIVATE_KEY}}
script_stop: true
script: |
cd rsdue-services/
make restart
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Logs
logs
*.log
.history
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
src/locale/
build/
tsconfig.node.tsbuildinfo
vite.config.d.ts
vite.config.js

contrib/emr-config/config.js

*storybook.log
storybook-static
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "contrib/fhir-emr"]
path = contrib/fhir-emr
url = [email protected]:beda-software/fhir-emr.git
10 changes: 10 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

. "$(dirname "$0")/_/husky.sh"

yarn run typecheck
yarn run lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"]
}
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
build
ios
android
*.d.ts
19 changes: 19 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"bracketSpacing": true,
"jsxBracketSameLine": false,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4,
"arrowParens": "always",
"printWidth": 120,
"jsxSingleQuote": false,
"overrides": [
{
"files": ["*.yaml", "*.yml"],
"options": {
"tabWidth": 2,
"singleQuote": false
}
}
]
}
28 changes: 28 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { dirname, join } from "path";
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],

addons: [
getAbsolutePath("@storybook/addon-onboarding"),
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@chromatic-com/storybook"),
getAbsolutePath("@storybook/addon-interactions"),
],

framework: {
name: getAbsolutePath("@storybook/react-vite"),
options: {},
},

typescript: {
reactDocgen: "react-docgen-typescript"
}
};
export default config;

function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}
19 changes: 19 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Preview } from '@storybook/react';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
options: {
storySort: {
order: ['Get started', '*'],
},
},
},
};

export default preview;
Loading

0 comments on commit 6a9d4b9

Please sign in to comment.