Skip to content

Commit e4cfe79

Browse files
committed
add sideEffects: false; adj. some type imports; change workspace config; cleanup deps;
1 parent ce8b6dd commit e4cfe79

38 files changed

+2366
-22626
lines changed

.github/workflows/blank.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@ jobs:
1919
matrix:
2020
node-version: [ 18.x ]
2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Set Branch
2424
id: short_ref
25-
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
25+
run: echo "short_ref=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
2626
- name: Set git_url_commit
2727
id: git_url_commit
28-
run: echo ::set-output name=git_url_commit::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}
28+
run: echo "git_url_commit=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" >> $GITHUB_OUTPUT
2929
- name: Set git_url_ci_run
3030
id: git_url_ci_run
31-
run: echo ::set-output name=git_url_ci_run::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}
31+
run: echo "git_url_ci_run=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> $GITHUB_OUTPUT
3232
- name: Set git_commit
3333
id: git_commit
34-
run: echo ::set-output name=git_commit::${GITHUB_REPOSITORY}/${GITHUB_SHA}
34+
run: echo "git_commit=${GITHUB_REPOSITORY}/${GITHUB_SHA}" >> $GITHUB_OUTPUT
3535
- name: Set git_ci_run
3636
id: git_ci_run
37-
run: echo ::set-output name=git_ci_run::${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}
37+
run: echo "git_ci_run=${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}" >> $GITHUB_OUTPUT
3838
- name: Use Node.js ${{ matrix.node-version }}
39-
uses: actions/setup-node@v3
39+
uses: actions/setup-node@v4
4040
with:
4141
node-version: ${{ matrix.node-version }}
4242

4343
- name: Cache CI node_modules
44-
uses: actions/cache@v3
44+
uses: actions/cache@v4
4545
env:
4646
cache-name: cache-node-modules
4747
with:
@@ -52,8 +52,6 @@ jobs:
5252
- name: Install Deps
5353
run: |
5454
npm ci
55-
cd server/feed
56-
npm ci
5755
5856
- name: Build
5957
env:
@@ -89,7 +87,7 @@ jobs:
8987
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
9088

9189
- name: Upload Artifact APP
92-
uses: actions/upload-artifact@v3
90+
uses: actions/upload-artifact@v4
9391
with:
9492
name: app-artifact
9593
path: apps/demo/build

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# default upload dir
1111
/upload
1212

13-
# NodeJS
13+
# Node.js
1414
node_modules
1515

1616
# Logs

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,18 @@ npm i -S @content-ui/md @content-ui/react @content-ui/struct @content-ui/md-mui
2929
npm i -S react-progress-state @ui-controls/progress @ui-schema/kit-codemirror @codemirror/state
3030
```
3131

32-
> all packages are ESM-only, those with the `ESM` flag support strict-ESM for browser + NodeJS
32+
> all packages are ESM-only, those with the `ESM` flag support strict-ESM for browser + Node.js
3333
3434
See [CustomCodeMirror.tsx](./apps/demo/src/components/CustomCodeMirror.tsx) for an example CodeMirror component, for viewer and input, with nested syntax highlighting and quite some other things.
3535

3636
See [WidgetMarkdownEditor.tsx](./apps/demo/src/components/CustomWidgets/WidgetMarkdownEditor.tsx) for an example [UI-Schema widget](https://ui-schema.bemit.codes) with Markdown editor, linting and preview.
3737

3838
## Development
3939

40-
Clone repository, then install all NodeJS deps:
40+
Clone repository, then install all dependencies:
4141

4242
```shell
4343
npm i
44-
45-
cd server/feed
46-
npm i
4744
```
4845

4946
Start development servers from root folder:

apps/demo/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# default upload dir
1111
/upload
1212

13-
# NodeJS
13+
# Node.js
1414
node_modules
1515

1616
# Logs

apps/demo/package.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"name": "@content-ui/dev-demo",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"start": "cross-env PORT=4221 npm run webpack-dev-server -- --config webpack.config.js",
7+
"build": "npm run webpack -- --config webpack.config.js",
8+
"webpack": "cross-env NODE_ENV=production webpack --mode=production",
9+
"webpack-dev-server": "cross-env NODE_ENV=development webpack-dev-server --mode=development --hot"
10+
},
11+
"type": "module",
12+
"license": "MIT",
13+
"dependencies": {
14+
"@codemirror/commands": "^6.0.0",
15+
"@codemirror/lang-css": "^6.0.0",
16+
"@codemirror/lang-html": "^6.0.0",
17+
"@codemirror/lang-javascript": "^6.0.0",
18+
"@codemirror/lang-json": "^6.0.0",
19+
"@codemirror/lang-lezer": "^6.0.0",
20+
"@codemirror/lang-markdown": "^6.0.0",
21+
"@codemirror/language": "^6.1.0",
22+
"@codemirror/language-data": "^6.1.0",
23+
"@codemirror/legacy-modes": "^6.1.0",
24+
"@codemirror/search": "^6.0.0",
25+
"@codemirror/state": "^6.0.0",
26+
"@codemirror/view": "^6.0.0",
27+
"@content-ui/input": "*",
28+
"@content-ui/md": "*",
29+
"@content-ui/md-mui": "*",
30+
"@content-ui/struct": "*",
31+
"@emotion/react": "^11.9.0",
32+
"@emotion/styled": "^11.8.1",
33+
"@mui/icons-material": "^5.10",
34+
"@mui/lab": "^5.0.0-alpha.80",
35+
"@mui/material": "^5.1",
36+
"@mui/x-date-pickers": "^5.0.16",
37+
"@ui-controls/progress": "~0.0.4",
38+
"@ui-schema/dictionary": "~0.0.11",
39+
"@ui-schema/ds-material": "~0.4.1",
40+
"@ui-schema/kit-codemirror": "~0.1.1",
41+
"@ui-schema/material-code": "~0.4.4",
42+
"@ui-schema/material-pickers": "^0.4.0-alpha.4",
43+
"@ui-schema/ui-schema": "~0.4.5",
44+
"i18next": "^22.0.4",
45+
"i18next-browser-languagedetector": "^7.0.1",
46+
"i18next-chained-backend": "^4.0.0",
47+
"i18next-http-backend": "^2.0.1",
48+
"i18next-localstorage-backend": "^4.0.0",
49+
"i18next-resources-to-backend": "^1.0.0",
50+
"immutable": "^4.0.0",
51+
"moment": "^2.29.4",
52+
"nanoid": "^4.0.0",
53+
"react": "^18.3.1",
54+
"react-api-fetch": "~0.3.1",
55+
"react-dom": "^18.3.1",
56+
"react-helmet": "^6.1.0",
57+
"react-i18next": "^11.18.6",
58+
"react-progress-state": "~0.3.1",
59+
"react-router": "^6.26.2",
60+
"react-router-dom": "^6.26.2",
61+
"react-use-immutable": "~0.2.1",
62+
"react-use-snack": "~0.1.0",
63+
"typescript": "~5.3.3"
64+
},
65+
"devDependencies": {
66+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
67+
"@types/react": "^18.3.8",
68+
"@types/react-dom": "^18.3.0",
69+
"@types/react-helmet": "^6.1.11",
70+
"babel-loader": "^9.2.1",
71+
"concurrently": "^9.0.1",
72+
"copy-webpack-plugin": "^12.0.2",
73+
"cross-env": "^7.0.3",
74+
"css-loader": "^7.1.2",
75+
"dotenv": "^16.4.5",
76+
"eslint-webpack-plugin": "^4.2.0",
77+
"html-webpack-plugin": "^5.6.0",
78+
"react-dev-utils": "^12.0.1",
79+
"react-refresh": "^0.14.2",
80+
"rimraf": "^5.0.10",
81+
"style-loader": "^4.0.0",
82+
"terser-webpack-plugin": "^5.3.10",
83+
"ts-node": "^10.9.2",
84+
"tsconfig-paths-webpack-plugin": "^4.1.0",
85+
"webpack": "^5.94.0",
86+
"webpack-cli": "^5.1.4",
87+
"webpack-dev-server": "^4.15.2"
88+
},
89+
"workspaces": {
90+
"packages": [
91+
"./apps/sandbox",
92+
"./server/feed",
93+
"./packages/input",
94+
"./packages/md",
95+
"./packages/md-mui",
96+
"./packages/react",
97+
"./packages/struct"
98+
]
99+
}
100+
}

apps/demo/src/App.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { contentUIDecorators, ContentLeafsProvider } from '@content-ui/react/ContentLeafsContext'
22
import React from 'react'
33
import { StyledEngineProvider, ThemeProvider } from '@mui/material/styles'
4-
import { DndProvider } from 'react-dnd'
5-
import { HTML5Backend } from 'react-dnd-html5-backend'
64
import CssBaseline from '@mui/material/CssBaseline'
75
import { customTheme } from './theme'
86
import { Layout } from './components/Layout'
@@ -115,9 +113,7 @@ export const App: React.ComponentType<{}> = () => {
115113
<LocalizationProvider dateAdapter={AdapterMoment}>
116114
<UIMetaProvider t={browserT} widgets={customWidgets}>
117115
<ContentLeafsProvider deco={contentUIDecorators} renderMap={contentUIMapping}>
118-
<DndProvider backend={HTML5Backend}>
119-
<Layout/>
120-
</DndProvider>
116+
<Layout/>
121117
</ContentLeafsProvider>
122118
</UIMetaProvider>
123119
</LocalizationProvider>

apps/demo/src/lib/toHumanSize.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

apps/demo/src/lib/urlHelper.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

apps/demo/src/lib/useAppApi.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// import { useAuthToken } from '@control-ui/auth'
2-
// import { IAuthTokenMsal } from '@control-ui/auth-msal'
31
import { extractHeaders, headersJson, useApi } from 'react-api-fetch'
42
import { FetcherFetchMethod } from 'react-api-fetch/fetcher'
53

@@ -16,7 +14,6 @@ export type ApiConnect<D = {}, HR = {}> =
1614
} & HR>
1715

1816
export const useAppApi = (): ApiConnect => {
19-
// const {appToken} = useAuthToken<IAuthTokenMsal>()
2017
return useApi({
2118
// bearer: appToken ? 'Bearer ' + appToken : undefined,
2219
extractHeaders: extractHeaders,

apps/demo/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../tsconfig.json"
3+
}

apps/demo/webpack.config.js

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default {
6262
cacheDirectory: true,
6363
cacheCompression: false,
6464
compact: minimize,
65+
rootMode: 'upward',
6566
plugins: isProd ? [] : [reactRefreshBabel],
6667
},
6768
}],
@@ -109,76 +110,6 @@ export default {
109110
providedExports: true,
110111
usedExports: true,
111112
} : {},
112-
splitChunks: isProd ?
113-
{
114-
chunks: 'all',
115-
usedExports: true,
116-
maxAsyncRequests: 35,
117-
maxInitialRequests: 35,
118-
cacheGroups: {
119-
react: {
120-
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
121-
// reuseExistingChunk: true,
122-
usedExports: true,
123-
name: 'react',
124-
priority: 10,
125-
chunks: 'all',
126-
enforce: true,
127-
},
128-
uic: {
129-
test: /[\\/]node_modules[\\/](@mui|@emotion|@control-ui|@bemit)[\\/]/,
130-
usedExports: true,
131-
name: 'uic',
132-
priority: 9,
133-
chunks: 'all',
134-
minChunks: 1,
135-
minSize: 175000,
136-
maxSize: 475000,
137-
// enforce: true,
138-
},
139-
common: {
140-
test: /[\\/]node_modules[\\/](immutable|react-helmet|react-error-boundary|react-router|react-router-dom|i18next*|react-i18next)[\\/]/,
141-
usedExports: true,
142-
name: 'cmn',
143-
priority: 8,
144-
chunks: 'all',
145-
minChunks: 1,
146-
minSize: 275000,
147-
maxSize: 375000,
148-
// enforce: true,
149-
},
150-
vendor: {
151-
test: /[\\/]node_modules[\\/]/,
152-
reuseExistingChunk: true,
153-
usedExports: true,
154-
name: 'vendor',
155-
chunks: 'all',
156-
priority: -2,
157-
minChunks: 5,
158-
maxSize: 265000,
159-
},
160-
defaultVendors: {
161-
test: /[\\/]node_modules[\\/]/,
162-
priority: -10,
163-
reuseExistingChunk: true,
164-
minSize: 125000,
165-
maxSize: 420000,
166-
},
167-
},
168-
} :
169-
{
170-
chunks: 'all',
171-
name: false,
172-
cacheGroups: {
173-
default: false,
174-
vendors: {
175-
chunks: 'all',
176-
test: /[\\/]node_modules[\\/]/,
177-
reuseExistingChunk: true,
178-
priority: -15,
179-
},
180-
},
181-
},
182113
},
183114
devServer: {
184115
static: [

0 commit comments

Comments
 (0)