-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: general configuration, application layout and directory structu…
…re (#1) * feat: general configuration, application layout and directory structure * fix: file capitalization * refactor: remove providers and replace cached-resources by current-user * refactor: rename auth-wall dir to auth because it contains a hook too * refactor: export directly Co-authored-by: Jan-Gerke Salomon <Mohammer5@users.noreply.github.com> Co-authored-by: Jan-Gerke Salomon <Mohammer5@users.noreply.github.com>
- Loading branch information
1 parent
079b995
commit 80b808d
Showing
40 changed files
with
1,157 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# For more information about the properties used in | ||
# this file, please see the EditorConfig documentation: | ||
# https://editorconfig.org/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'weekly' | ||
open-pull-requests-limit: 5 | ||
versioning-strategy: 'increase' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
titleOnly: false | ||
commitsOnly: false | ||
titleAndCommits: true | ||
allowMergeCommits: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: 'dhis2: verify (app)' | ||
|
||
on: push | ||
|
||
concurrency: | ||
group: ${{ github.workflow}}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
GIT_AUTHOR_NAME: '@dhis2-bot' | ||
GIT_AUTHOR_EMAIL: 'apps@dhis2.org' | ||
GIT_COMMITTER_NAME: '@dhis2-bot' | ||
GIT_COMMITTER_EMAIL: 'apps@dhis2.org' | ||
GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}} | ||
CI: true | ||
D2_VERBOSE: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- uses: c-hive/gha-yarn-cache@v1 | ||
- run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: app-build | ||
path: | | ||
**/build | ||
!**/node_modules | ||
retention-days: 1 | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- uses: c-hive/gha-yarn-cache@v1 | ||
- run: yarn install --frozen-lockfile | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- uses: c-hive/gha-yarn-cache@v1 | ||
- run: yarn install --frozen-lockfile | ||
|
||
# Can be removed if translations aren't required for tests, or if not using the App Platform | ||
- name: Generate translations | ||
run: yarn d2-app-scripts i18n generate | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
#e2e: | ||
# runs-on: ubuntu-latest | ||
# if: "!github.event.push.repository.fork && github.actor != 'dependabot[bot]'" | ||
# | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# containers: [1, 2, 3, 4] | ||
# | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v2 | ||
# | ||
# - uses: actions/setup-node@v1 | ||
# with: | ||
# node-version: 12.x | ||
# | ||
# - name: End-to-End tests | ||
# uses: cypress-io/github-action@v2 | ||
# with: | ||
# # This should be a command that serves the app. | ||
# start: yarn d2-app-scripts start | ||
# wait-on: 'http://localhost:3000' | ||
# wait-on-timeout: 300 | ||
# record: true | ||
# parallel: true | ||
# env: | ||
# BROWSER: none | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
# CYPRESS_dhis2BaseUrl: https://debug.dhis2.org/dev | ||
# CYPRESS_dhis2ApiVersion: 37 | ||
# CYPRESS_networkMode: stub | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [build, lint, test] # add e2e if you use it | ||
if: "!github.event.push.repository.fork && github.actor != 'dependabot[bot]'" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{env.GH_TOKEN}} | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: app-build | ||
|
||
- uses: dhis2/deploy-build@master | ||
with: | ||
# uncomment following line for monorepo apps: | ||
#cwd: ./packages/app | ||
build-dir: build/app | ||
github-token: ${{ env.GH_TOKEN }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: [publish] | ||
if: "!github.event.push.repository.fork && github.actor != 'dependabot[bot]'" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{env.GH_TOKEN}} | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Publish release to GitHub | ||
run: npx @dhis2/cli-utils release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ls: | ||
./**/{src,cypress,lib}: | ||
.css: kebab-case | ||
.module.css: kebab-case | ||
.feature: kebab-case | ||
.js: kebab-case | ||
.stories.js: kebab-case | ||
.stories.e2e.js: kebab-case | ||
.styles.js: kebab-case | ||
.test.js: kebab-case | ||
.jsx: kebab-case | ||
.ts: kebab-case | ||
.tsx: kebab-case | ||
.d.ts: kebab-case | ||
|
||
ignore: | ||
- node_modules | ||
- .d2 | ||
- build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
/* | ||
* The code snippet below was generated by @dhis2/cli-style. | ||
* There is nothing wrong with it, but somehow the VSCode | ||
* prettier plugin can't work with it. As a temporary hack | ||
* we use the theoretically equivalent code below, that doesn't | ||
* break the plugin. | ||
const { config } = require('@dhis2/cli-style') | ||
module.exports = { | ||
...require(config.prettier), | ||
} | ||
*/ | ||
|
||
const prettierConfig = require('@dhis2/cli-style/config/prettier.config.js') | ||
|
||
module.exports = { ...prettierConfig } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[main] | ||
host = https://www.transifex.com | ||
lang_map = fa_AF: prs, uz@Cyrl: uz, uz@Latn: uz_Latn | ||
|
||
[app-approval-app.en-pot] | ||
file_filter = i18n/<lang>.po | ||
minimum_perc = 0 | ||
source_file = i18n/en.pot | ||
source_lang = en | ||
type = PO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
module.exports = { | ||
type: 'app', | ||
|
||
title: 'Data Approval App', | ||
coreApp: true, | ||
entryPoints: { | ||
app: './src/App.js', | ||
app: './src/app/index.js', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: i18next-conv\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1)\n" | ||
"POT-Creation-Date: 2021-06-15T13:56:19.937Z\n" | ||
"PO-Revision-Date: 2021-06-15T13:56:19.937Z\n" | ||
|
||
msgid "Not authorized" | ||
msgstr "Not authorized" | ||
|
||
msgid "" | ||
"You don't have access to the Data Approval App. Contact a system " | ||
"administrator to request access." | ||
msgstr "" | ||
"You don't have access to the Data Approval App. Contact a system " | ||
"administrator to request access." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
setupFilesAfterEnv: ['<rootDir>/src/test-utils/setup-tests.js'], | ||
collectCoverageFrom: ['src/**/*.{js,jsx}', '!src/{setupTests.js}'], | ||
coveragePathIgnorePatterns: ['/node_modules/', '/src/locales/'], | ||
moduleNameMapper: { | ||
'\\.css$': 'identity-obj-proxy', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react' | ||
|
||
const ActionBar = () => <pre>ActionBar placeholder</pre> | ||
|
||
export { ActionBar } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ActionBar } from './action-bar.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { CssVariables } from '@dhis2/ui' | ||
import React from 'react' | ||
import { QueryParamProvider } from 'use-query-params' | ||
import { ActionBar } from '../action-bar' | ||
import { AuthWall } from '../auth' | ||
import { ContextSelector } from '../context-selector' | ||
import { CurrentUserProvider } from '../current-user' | ||
import { DataWorkspace } from '../data-workspace' | ||
import { Layout } from './layout.js' | ||
|
||
const App = () => ( | ||
<QueryParamProvider> | ||
<CssVariables spacers colors theme /> | ||
<CurrentUserProvider> | ||
<AuthWall> | ||
<Layout.Container> | ||
<Layout.Top> | ||
<ContextSelector /> | ||
</Layout.Top> | ||
<Layout.Content> | ||
<DataWorkspace /> | ||
</Layout.Content> | ||
<Layout.Bottom> | ||
<ActionBar /> | ||
</Layout.Bottom> | ||
</Layout.Container> | ||
</AuthWall> | ||
</CurrentUserProvider> | ||
</QueryParamProvider> | ||
) | ||
|
||
export { App } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { shallow } from 'enzyme' | ||
import React from 'react' | ||
import { App } from './app' | ||
|
||
describe('<App>', () => { | ||
it('renders without errors', () => { | ||
shallow(<App />) | ||
}) | ||
}) |
Oops, something went wrong.