Skip to content

Commit

Permalink
Merge branch 'alpha' into env-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVandivier committed Oct 28, 2024
2 parents 4771b23 + 0d757db commit 031852e
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 71 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ cli/config/templates/init-typescript/entrypoint.tsx
cli/config/templates/init-typescript/App.test.tsx
cli/config/templates/init-typescript/global.d.ts
cli/config/templates/init-typescript/modules.d.ts
cli/config/templates/init-typescript/eslint.config.js
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [12.0.0-alpha.20](https://github.com/dhis2/app-platform/compare/v12.0.0-alpha.19...v12.0.0-alpha.20) (2024-10-28)


### Bug Fixes

* remove custom eslint from TS template ([71cef4b](https://github.com/dhis2/app-platform/commit/71cef4b335be3a697926e7cacd2641d35a6adb4d))

# [12.0.0-alpha.19](https://github.com/dhis2/app-platform/compare/v12.0.0-alpha.18...v12.0.0-alpha.19) (2024-10-10)


Expand Down
6 changes: 3 additions & 3 deletions adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/app-adapter",
"version": "12.0.0-alpha.19",
"version": "12.0.0-alpha.20",
"repository": {
"type": "git",
"url": "https://github.com/amcgee/dhis2-app-platform",
Expand All @@ -21,11 +21,11 @@
"build"
],
"dependencies": {
"@dhis2/pwa": "12.0.0-alpha.19",
"@dhis2/pwa": "12.0.0-alpha.20",
"moment": "^2.24.0"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "12.0.0-alpha.19",
"@dhis2/cli-app-scripts": "12.0.0-alpha.20",
"@testing-library/react": "^16.0.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
Expand Down
13 changes: 7 additions & 6 deletions cli/config/templates/init-typescript/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { CustomDataProvider } from '@dhis2/app-runtime'
import React from 'react'
import ReactDOM from 'react-dom'
import { createRoot } from 'react-dom/client'
import App from './App'

it('renders without crashing', () => {
const div = document.createElement('div')
const container = document.createElement('div')

const data = {
resource: 'test',
}

ReactDOM.render(
const root = createRoot(container)
root.render(
<CustomDataProvider data={data}>
<App />
</CustomDataProvider>,
div
</CustomDataProvider>
)
ReactDOM.unmountComponentAtNode(div)

root.unmount()
})
17 changes: 0 additions & 17 deletions cli/config/templates/init-typescript/eslint.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/cli-app-scripts",
"version": "12.0.0-alpha.19",
"version": "12.0.0-alpha.20",
"engines": {
"node": "^18.0.0 || >=20.0.0"
},
Expand Down Expand Up @@ -29,7 +29,7 @@
"@babel/preset-env": "^7.14.7",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.6.0",
"@dhis2/app-shell": "12.0.0-alpha.19",
"@dhis2/app-shell": "12.0.0-alpha.20",
"@dhis2/cli-helpers-engine": "^3.2.2",
"@jest/core": "^27.0.6",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.4",
Expand Down
32 changes: 4 additions & 28 deletions cli/src/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const handler = async ({ force, name, cwd, lib, typeScript }) => {
reporter.info('Installing @dhis2/cli-app-scripts...')
await exec({
cmd: 'yarn',
args: ['add', '--dev', '@dhis2/cli-app-scripts'],
args: ['add', '--dev', '@dhis2/cli-app-scripts@alpha'],
cwd: paths.base,
})
}
Expand Down Expand Up @@ -192,23 +192,18 @@ const handler = async ({ force, name, cwd, lib, typeScript }) => {
fs.copyFileSync(paths.initTSConfig, paths.tsConfig)

reporter.info('install TypeScript as a dev dependency')
// ToDO: restrict the major version of TS we install

await exec({
cmd: 'yarn',
args: ['add', 'typescript', '--dev'],
args: ['add', 'typescript@^5', '--dev'],
cwd: paths.base,
})

// install any other TS dependencies needed
reporter.info('install type definitions')
await exec({
cmd: 'yarn',
args: [
'add',
'@types/react @types/react-dom @types/jest',
'@types/eslint',
'--dev',
],
args: ['add', '@types/react @types/react-dom @types/jest', '--dev'],
cwd: paths.base,
})

Expand All @@ -230,25 +225,6 @@ const handler = async ({ force, name, cwd, lib, typeScript }) => {
paths.initModulesDeclaration,
path.join(typesDir, 'modules.d.ts')
)

// ToDO: make custom eslint config part of the template (and copy it)
// similar to: https://github.com/dhis2/data-exchange-app/pull/79/files#diff-e2954b558f2aa82baff0e30964490d12942e0e251c1aa56c3294de6ec67b7cf5
// install dependencies needed for eslint
// "@typescript-eslint/eslint-plugin"
// "@typescript-eslint/parser"

reporter.info('setting up eslint configuration')
await exec({
cmd: 'yarn',
args: ['add', 'eslint @eslint/js typescript-eslint', '--dev'],
cwd: paths.base,
})
// copy eslint config
fs.copyFileSync(paths.initEslint, paths.eslintConfig)

// ToDO: we're hardcoding running TS, we need to figure out how to pass the argument from the CLI

// ToDO: aim to have a TS project that runs with "yarn start" and "yarn build"
}

const extension = typeScript ? 'ts' : 'js'
Expand Down
8 changes: 2 additions & 6 deletions cli/src/lib/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ module.exports = (cwd = process.cwd(), { typeScript } = {}) => {
'../../config/templates/init-typescript/tsconfig.json'
),

initEslint: path.join(
__dirname,
'../../config/templates/init-typescript/eslint.config.js'
),
initGlobalDeclaration: path.join(
__dirname,
'../../config/templates/init-typescript/global.d.ts'
Expand All @@ -78,10 +74,10 @@ module.exports = (cwd = process.cwd(), { typeScript } = {}) => {
: '../../config/d2ConfigDefaults.js'
),
babelConfig: path.join(__dirname, '../../config/babel.config.js'),
jestConfigDefaults: path.join(__dirname, '../../config/jest.config.js'), // TODO: probably need a different jest.config for TS
jestConfigDefaults: path.join(__dirname, '../../config/jest.config.js'),

shellSource,
shellSourceEntrypoint: path.join(shellSource, 'src/App.jsx'), // TODO: double check the effect of having TS in shell folder
shellSourceEntrypoint: path.join(shellSource, 'src/App.jsx'),
shellSourcePublic: path.join(shellSource, 'public'),

// destination paths where we copy files to
Expand Down
2 changes: 1 addition & 1 deletion examples/pwa-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pwa-app",
"version": "12.0.0-alpha.19",
"version": "12.0.0-alpha.20",
"description": "",
"license": "BSD-3-Clause",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-app",
"version": "12.0.0-alpha.19",
"version": "12.0.0-alpha.20",
"repository": "https://github.com/amcgee/dhis2-app-platform",
"author": "Austin McGee <[email protected]>",
"license": "BSD-3-Clause",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "12.0.0-alpha.19",
"version": "12.0.0-alpha.20",
"private": true,
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions pwa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/pwa",
"version": "12.0.0-alpha.19",
"version": "12.0.0-alpha.20",
"description": "",
"license": "BSD-3-Clause",
"publishConfig": {
Expand All @@ -13,7 +13,7 @@
"deploy": "d2-app-scripts deploy"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "12.0.0-alpha.19"
"@dhis2/cli-app-scripts": "12.0.0-alpha.20"
},
"dependencies": {
"idb": "^6.0.0",
Expand Down
6 changes: 3 additions & 3 deletions shell/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/app-shell",
"version": "12.0.0-alpha.19",
"version": "12.0.0-alpha.20",
"engines": {
"node": "^18.0.0 || >=20.0.0"
},
Expand All @@ -15,10 +15,10 @@
"access": "public"
},
"dependencies": {
"@dhis2/app-adapter": "12.0.0-alpha.19",
"@dhis2/app-adapter": "12.0.0-alpha.20",
"@dhis2/app-runtime": "^3.11.1",
"@dhis2/d2-i18n": "^1.1.1",
"@dhis2/pwa": "12.0.0-alpha.19",
"@dhis2/pwa": "12.0.0-alpha.20",
"@dhis2/ui": "^9.11.7",
"classnames": "^2.2.6",
"moment": "^2.29.1",
Expand Down

0 comments on commit 031852e

Please sign in to comment.