Skip to content

Commit

Permalink
fix: upgrade to @dhis2/cli-app-scripts@6 (DHIS2-9893) (#1006)
Browse files Browse the repository at this point in the history
  • Loading branch information
amcgee authored Mar 11, 2021
1 parent 2c9ed52 commit 28e9fec
Show file tree
Hide file tree
Showing 142 changed files with 4,861 additions and 2,791 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cypress/*
coverage/*
src/locales/*
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@ const { config } = require('@dhis2/cli-style')

module.exports = {
extends: [config.eslintReact],
overrides: [
{
files: ['*.test.js'],
rules: {
'import/no-unresolved': 0,
'import/order': 0,
},
},
],
}
3 changes: 3 additions & 0 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ jobs:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Lint
run: yarn d2-app-scripts i18n generate

- name: Lint
run: yarn lint

Expand Down
2 changes: 1 addition & 1 deletion d2.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const config = {
coreApp: true,

entryPoints: {
app: './src/App',
app: './src/App.js',
},
}

Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"cy:run": "d2-utils-cypress run --appStart 'yarn cy:start'"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "^4.0.7",
"@dhis2/cli-style": "^7.0.0",
"@dhis2/cli-app-scripts": "^6.0.0",
"@dhis2/cli-style": "^7.3.0",
"@dhis2/cli-utils-cypress": "^7.0.0",
"@dhis2/cypress-commands": "^7.0.0",
"@dhis2/cypress-plugins": "^7.0.0",
Expand All @@ -32,12 +32,10 @@
"query-string": "^6.12.1"
},
"dependencies": {
"@dhis2/app-runtime": "^2.2.1",
"@dhis2/ui": "^5.7.2",
"@dhis2/app-runtime": "^2.8.0",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/ui": "^6.5.5",
"classnames": "^2.2.6",
"react-router-dom": "^5.2.0"
},
"eslintConfig": {
"extends": "react-app"
}
}
22 changes: 10 additions & 12 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import React from 'react'
import { HashRouter } from 'react-router-dom'
import i18n from './locales'
import {
CssVariables,
CssReset,
CircularLoader,
ScreenCover,
} from '@dhis2/ui-core'

import { TaskContext } from './contexts/'
import { UserContext } from './contexts/'
import { useUser, useTasks } from './hooks/'

ComponentCover,
} from '@dhis2/ui'
import React from 'react'
import { HashRouter } from 'react-router-dom'
import styles from './App.module.css'
import { Sidebar } from './components/'
import { Router } from './components/'
import { UserContext } from './contexts/'
import { TaskContext } from './contexts/'
import { useUser, useTasks } from './hooks/'
import i18n from './locales'

const App = () => {
const { tasks, addTask, jobOverview, updateJobOverview } = useTasks()
Expand All @@ -27,9 +25,9 @@ const App = () => {
<CssReset />
<CssVariables spacers colors />
{loading && (
<ScreenCover dataTest="app-screen-cover">
<ComponentCover dataTest="app-screen-cover">
<CircularLoader dataTest="app-loader" />
</ScreenCover>
</ComponentCover>
)}
{error && (
<div data-test="app-error">
Expand Down
5 changes: 2 additions & 3 deletions src/components/BasicOptions/BasicOptions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { Divider } from '@dhis2/ui'

import PropTypes from 'prop-types'
import React from 'react'
import styles from './BasicOptions.module.css'

const LABEL = i18n.t('Basic options')
Expand Down
5 changes: 2 additions & 3 deletions src/components/DatePicker/DatePicker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import { InputField } from '@dhis2/ui'

import PropTypes from 'prop-types'
import React from 'react'
import { jsDateToISO8601 } from '../../utils/helper'

const DatePicker = ({ name, error, label, date, onChange, dataTest }) => {
Expand Down
5 changes: 2 additions & 3 deletions src/components/DatePicker/DatePickerField.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { ReactFinalForm } from '@dhis2/ui'

import PropTypes from 'prop-types'
import React from 'react'
import { DatePicker } from '../index'
const { Field } = ReactFinalForm

Expand Down
4 changes: 2 additions & 2 deletions src/components/Duration/DurationField.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { InputField } from '@dhis2/ui'
import { ReactFinalForm } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import { FormField } from '../index'

const { Field } = ReactFinalForm
Expand Down
7 changes: 3 additions & 4 deletions src/components/ElementSchemes/DataElementIdScheme.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useEffect, useState } from 'react'
import { useConfig } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { SingleSelectFieldFF } from '@dhis2/ui'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'

import { StyledField } from '../index'
import React, { useEffect, useState } from 'react'
import { fetchAttributes } from '../../utils/helper'
import { optionsPropType } from '../../utils/options'
import { StyledField } from '../index'

const DataElementIdScheme = ({
name,
Expand Down
7 changes: 3 additions & 4 deletions src/components/ElementSchemes/EventIdScheme.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react'
import PropTypes from 'prop-types'
import { SingleSelectFieldFF } from '@dhis2/ui'

import { StyledField } from '../index'
import PropTypes from 'prop-types'
import React from 'react'
import { optionsPropType } from '../../utils/options'
import { StyledField } from '../index'

const EventIdScheme = ({ name, label, eventIdSchemeOptions, dataTest }) => {
return (
Expand Down
9 changes: 4 additions & 5 deletions src/components/ElementSchemes/IdScheme.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useState, useEffect } from 'react'
import { useConfig } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { SingleSelectFieldFF } from '@dhis2/ui'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'

import { StyledField } from '../index'
import { optionsPropType } from '../../utils/options'
import React, { useState, useEffect } from 'react'
import { fetchAttributes } from '../../utils/helper'
import { optionsPropType } from '../../utils/options'
import { StyledField } from '../index'

const attributeFoundIn = (attribute, collection) =>
!!collection.find(({ value }) => value === attribute.value)
Expand Down
7 changes: 3 additions & 4 deletions src/components/ElementSchemes/OrgUnitIdScheme.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useEffect, useState } from 'react'
import { useConfig } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { SingleSelectFieldFF } from '@dhis2/ui'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'

import { StyledField } from '../index'
import React, { useEffect, useState } from 'react'
import { fetchAttributes } from '../../utils/helper'
import { optionsPropType } from '../../utils/options'
import { StyledField } from '../index'

const OrgUnitIdScheme = ({ name, label, orgUnitIdSchemeOptions, dataTest }) => {
const { baseUrl } = useConfig()
Expand Down
2 changes: 1 addition & 1 deletion src/components/ElementSchemes/SchemeContainer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import styles from './SchemeContainer.module.css'

const SchemeContainer = ({ children }) => (
Expand Down
5 changes: 2 additions & 3 deletions src/components/FileUpload/FileUpload.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import PropTypes from 'prop-types'
import { ReactFinalForm, FileInputFieldFF } from '@dhis2/ui'

import PropTypes from 'prop-types'
import React from 'react'
import { FormField } from '../index'
const { Field } = ReactFinalForm

Expand Down
4 changes: 2 additions & 2 deletions src/components/FormAlerts/FormAlerts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import { AlertStack, AlertBar } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'

const FormAlerts = ({ alerts, dataTest }) => (
<AlertStack data-test={dataTest}>
Expand Down
3 changes: 1 addition & 2 deletions src/components/FormField/FormField.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'

import React from 'react'
import styles from './FormField.module.css'

const FormField = ({ dataTest, label, required = false, children }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Icon/Icon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'
import React from 'react'

const createStyle = (width, height) => ({
width: width || 24,
Expand Down
5 changes: 2 additions & 3 deletions src/components/ImportButtonStrip/ImportButtonStrip.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { Button, ButtonStrip, Help } from '@dhis2/ui'

import PropTypes from 'prop-types'
import React from 'react'
import styles from './ImportButtonStrip.module.css'
const DRYRUN_HELPTEXT = i18n.t(
'A dry run tests the import settings without importing any data'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports[`matches snapshot 1`] = `
</div>
</div>
<p
class="jsx-2306638964 "
class="jsx-4256586228 "
data-test="import-strip-help"
>
A dry run tests the import settings without importing any data
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/AssignedUserMode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import { ReactFinalForm, CheckboxFieldFF } from '@dhis2/ui'
import React from 'react'
import { FormField, RadioGroupField } from '../index'
import { UserPicker } from './index'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/AtomicMode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import { RadioGroupField } from '../index'

const atomicModeOptions = [
Expand Down
7 changes: 3 additions & 4 deletions src/components/Inputs/ClassKey.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { SingleSelectFieldFF } from '@dhis2/ui'

import { StyledField } from '../index'
import PropTypes from 'prop-types'
import React from 'react'
import { useClassKeys } from '../../hooks/index'
import { StyledField } from '../index'

const NAME = 'classKey'
const LABEL = i18n.t('Class key')
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/Compression.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import { RadioGroupField } from '../index'

const compressionOptions = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/DataElementIdScheme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import { DataElementIdScheme as DataElementIdSchemeGeneric } from '../index'

const dataElementIdSchemeOptions = [
Expand Down
4 changes: 2 additions & 2 deletions src/components/Inputs/DataSetPicker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { hasValue, composeValidators } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import { ResourcePickerField } from '../index'
import { resourceTypes } from '../ResourcePicker/resourceTypes'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/Dates.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import { FormField } from '../index'

const DATATEST = 'input-dates'
Expand Down
4 changes: 2 additions & 2 deletions src/components/Inputs/EndDate.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import { hasValue, composeValidators } from '@dhis2/ui'
import { DatePickerField } from '../index'
import React from 'react'
import { DATE_VALIDATOR } from '../DatePicker/DatePickerField'
import { DatePickerField } from '../index'

const NAME = 'endDate'
const DATATEST = 'input-end-date'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/EventIdScheme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import { EventIdScheme as EventIdSchemeGeneric } from '../index'

const eventIdSchemeOptions = [
Expand Down
4 changes: 2 additions & 2 deletions src/components/Inputs/ExportButton.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { Button } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'

const DATATEST = 'input-export-submit'

Expand Down
6 changes: 3 additions & 3 deletions src/components/Inputs/FileUpload.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { FileUpload as FileUploadGeneric } from '../index'
import PropTypes from 'prop-types'
import React from 'react'
import { SINGLE_FILE_VALIDATOR } from '../FileUpload/FileUpload'
import { FileUpload as FileUploadGeneric } from '../index'

const NAME = 'files'
const LABEL = i18n.t('Select a file to import values from')
Expand Down
4 changes: 2 additions & 2 deletions src/components/Inputs/FirstRowIsHeader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import { ReactFinalForm, CheckboxFieldFF } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import { FormField } from '../index'

const { Field } = ReactFinalForm
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/FlushMode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import { RadioGroupField } from '../index'

const flushModeOptions = [
Expand Down
4 changes: 2 additions & 2 deletions src/components/Inputs/FollowUpStatus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import i18n from '@dhis2/d2-i18n'
import PropTypes from 'prop-types'
import React from 'react'
import { RadioGroupField } from '../index'

const followUpStatusOptions = [
Expand Down
Loading

0 comments on commit 28e9fec

Please sign in to comment.