create-chayns-app 1.1.28 → 1.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +130 -0
- package/package.json +24 -16
- package/templates/api-v5/internal/js/src/redux-modules/index.js +17 -0
- package/templates/api-v5/internal/js/src/redux-modules/loggerMiddleware.js +31 -0
- package/templates/api-v5/internal/js/src/utils/logger.js +31 -0
- package/templates/api-v5/internal/ts/src/redux-modules/index.ts +20 -0
- package/templates/api-v5/internal/ts/src/redux-modules/loggerMiddleware.ts +45 -0
- package/templates/api-v5/internal/ts/src/utils/logger.ts +31 -0
- package/templates/api-v5/page/src/components/AppWrapper.jsx +7 -9
- package/templates/api-v5/page/src/index.html +1 -1
- package/templates/api-v5/page/src/index.jsx +2 -2
- package/templates/api-v5/page-module/src/components/App.jsx +19 -16
- package/templates/api-v5/page-module/src/components/AppWrapper.jsx +10 -12
- package/templates/api-v5/page-module-redux/src/components/App.jsx +22 -16
- package/templates/api-v5/page-module-redux/src/components/AppWrapper.jsx +7 -7
- package/templates/api-v5/page-redux/src/components/AppWrapper.jsx +9 -11
- package/templates/api-v5/page-redux/src/index.html +1 -1
- package/templates/api-v5/page-redux/src/index.jsx +2 -2
- package/templates/api-v5/page-ts/src/components/AppWrapper.tsx +7 -9
- package/templates/api-v5/page-ts/src/index.html +1 -1
- package/templates/api-v5/page-ts/src/index.tsx +2 -2
- package/templates/api-v5/page-ts-module/src/components/App.tsx +17 -14
- package/templates/api-v5/page-ts-module/src/components/AppWrapper.tsx +7 -7
- package/templates/api-v5/page-ts-module-redux/src/components/App.tsx +21 -14
- package/templates/api-v5/page-ts-module-redux/src/components/AppWrapper.tsx +13 -9
- package/templates/api-v5/page-ts-redux/src/components/AppWrapper.tsx +9 -11
- package/templates/api-v5/page-ts-redux/src/index.html +1 -1
- package/templates/api-v5/page-ts-redux/src/index.tsx +1 -2
- package/templates/api-v5/shared/.env.development.local +0 -2
- package/templates/api-v5/shared/{ts/src/constants/server-urls.ts → js/src/constants/serverUrls.js} +0 -1
- package/templates/api-v5/shared/js/src/redux-modules/counter/slice.js +5 -0
- package/templates/api-v5/shared/js/src/redux-modules/index.js +7 -3
- package/templates/api-v5/shared/toolkit.config-module.js +4 -2
- package/templates/api-v5/shared/toolkit.config.js +3 -3
- package/templates/api-v5/shared/{js/src/constants/server-urls.js → ts/src/constants/serverUrls.ts} +0 -1
- package/templates/api-v5/shared/ts/src/hooks/redux.ts +5 -0
- package/templates/api-v5/shared/ts/src/redux-modules/counter/slice.ts +5 -0
- package/templates/api-v5/shared/ts/src/redux-modules/index.ts +8 -4
- package/templates/api-v5/shared/ts/src/types/environment.d.ts +2 -2
- package/templates/api-v5/shared/ts/src/types/global.d.ts +5 -0
- package/templates/api-v5/shared/ts/tsconfig.json +17 -19
- package/templates/page/README.md +5 -8
- package/templates/page/src/index.html +1 -1
- package/templates/shared/README.md +5 -8
- package/templates/shared/tests/setup.js +9 -0
- package/templates/shared/vitest.config.mjs +18 -0
- package/.github/workflows/publish.yml +0 -21
- package/dist/index.js +0 -40
- package/templates/api-v5/shared/js/src/redux-modules/counter/selectors.js +0 -5
- package/templates/api-v5/shared/js/template-package-redux.json +0 -40
- package/templates/api-v5/shared/js/template-package.json +0 -38
- package/templates/api-v5/shared/ts/src/redux-modules/counter/selectors.ts +0 -6
- package/templates/api-v5/shared/ts/template-package-redux.json +0 -39
- package/templates/api-v5/shared/ts/template-package.json +0 -37
- package/templates/page/template-package.json +0 -33
- package/templates/shared/template-gitignore +0 -30
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { WaitUntil } from 'chayns-api';
|
|
3
3
|
import { SmallWaitCursor } from '@chayns-components/core';
|
|
4
|
-
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
5
|
+
import { selectCounterValue } from '../redux-modules/counter/slice';
|
|
5
6
|
import './app.scss';
|
|
6
7
|
|
|
7
8
|
const App = () => {
|
|
9
|
+
const counter = useSelector(selectCounterValue);
|
|
8
10
|
|
|
9
|
-
const taskList = [
|
|
10
|
-
//
|
|
11
|
-
() =>
|
|
11
|
+
const [taskList] = useState(() => [
|
|
12
|
+
// first level tasks are executed one after the other
|
|
13
|
+
() =>
|
|
14
|
+
new Promise((resolve) => {
|
|
15
|
+
setTimeout(resolve, 1000);
|
|
16
|
+
}), // Add your initial Requests, textstrings here
|
|
12
17
|
[
|
|
13
|
-
//
|
|
14
|
-
]
|
|
15
|
-
]
|
|
18
|
+
// second level tasks are executed in parallel
|
|
19
|
+
],
|
|
20
|
+
]);
|
|
16
21
|
|
|
17
|
-
return (
|
|
22
|
+
return (
|
|
18
23
|
<WaitUntil
|
|
19
24
|
tasks={taskList}
|
|
20
|
-
loadingComponent={
|
|
21
|
-
<div style={{
|
|
22
|
-
<SmallWaitCursor/>
|
|
25
|
+
loadingComponent={
|
|
26
|
+
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
27
|
+
<SmallWaitCursor />
|
|
23
28
|
</div>
|
|
24
|
-
|
|
29
|
+
}
|
|
25
30
|
>
|
|
26
31
|
<h1>Hi! Welcome to your newly created chayns application!</h1>
|
|
27
|
-
|
|
32
|
+
<p>Count: {counter}</p>
|
|
33
|
+
</WaitUntil>
|
|
34
|
+
);
|
|
28
35
|
};
|
|
29
36
|
|
|
30
37
|
export default App;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { Provider } from 'react-redux';
|
|
2
3
|
import { ChaynsProvider, withCompatMode } from 'chayns-api';
|
|
3
4
|
import { PageProvider } from '@chayns-components/core';
|
|
4
5
|
import App from './App';
|
|
6
|
+
import store from '../redux-modules';
|
|
5
7
|
|
|
6
|
-
const AppWrapper = (
|
|
7
|
-
|
|
8
|
-
/* eslint-disable-next-line react/jsx-props-no-spreading */
|
|
8
|
+
const AppWrapper = (props: ComponentPropsWithoutRef<typeof ChaynsProvider>) => (
|
|
9
|
+
<div className="{{ package-name-underscore }}">
|
|
10
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
9
11
|
<ChaynsProvider {...props}>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
12
|
+
<Provider store={store}>
|
|
13
|
+
<PageProvider>
|
|
14
|
+
<App />
|
|
15
|
+
</PageProvider>
|
|
16
|
+
</Provider>
|
|
13
17
|
</ChaynsProvider>
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
16
20
|
|
|
17
21
|
export default withCompatMode(AppWrapper);
|
|
@@ -5,16 +5,14 @@ import { PageProvider } from '@chayns-components/core';
|
|
|
5
5
|
import App from './App';
|
|
6
6
|
import store from '../redux-modules';
|
|
7
7
|
|
|
8
|
-
const AppWrapper = () =>
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
}
|
|
8
|
+
const AppWrapper = () => (
|
|
9
|
+
<ChaynsProvider>
|
|
10
|
+
<Provider store={store}>
|
|
11
|
+
<PageProvider>
|
|
12
|
+
<App />
|
|
13
|
+
</PageProvider>
|
|
14
|
+
</Provider>
|
|
15
|
+
</ChaynsProvider>
|
|
16
|
+
);
|
|
19
17
|
|
|
20
18
|
export default AppWrapper;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import AppWrapper from './components/AppWrapper';
|
|
4
|
-
|
|
4
|
+
{{ logger-import }}
|
|
5
5
|
try {
|
|
6
6
|
const root = createRoot(document.querySelector('#root') as Element);
|
|
7
7
|
root.render(<AppWrapper />);
|
|
8
8
|
} catch (e) {
|
|
9
9
|
console.error('Encountered error at `ReactDOM.render`: ', e);
|
|
10
10
|
}
|
|
11
|
-
|
|
@@ -16,8 +16,13 @@ const slice = createSlice({
|
|
|
16
16
|
state.value += payload;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
|
+
selectors: {
|
|
20
|
+
selectCounterState: (state) => state,
|
|
21
|
+
selectCounterValue: (state) => state.value,
|
|
22
|
+
},
|
|
19
23
|
});
|
|
20
24
|
|
|
21
25
|
export const { increment, decrement, incrementByAmount } = slice.actions;
|
|
26
|
+
export const { selectCounterState, selectCounterValue } = slice.selectors;
|
|
22
27
|
export const counterReducer = slice.reducer;
|
|
23
28
|
export const counterSliceName = slice.name;
|
|
@@ -2,10 +2,14 @@ import { configureStore, combineReducers } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { counterReducer } from './counter/slice';
|
|
3
3
|
|
|
4
4
|
const rootReducer = combineReducers({
|
|
5
|
-
counter: counterReducer
|
|
5
|
+
counter: counterReducer,
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
export const createStore = (preloadedState) => configureStore({
|
|
9
9
|
reducer: rootReducer,
|
|
10
|
+
preloadedState,
|
|
10
11
|
});
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
const store = createStore();
|
|
14
|
+
|
|
15
|
+
export default store;
|
|
@@ -7,12 +7,12 @@ module.exports = buildToolkitConfig({
|
|
|
7
7
|
},
|
|
8
8
|
output: {
|
|
9
9
|
entryPoints: {
|
|
10
|
-
|
|
10
|
+
index: {
|
|
11
11
|
pathIndex: './src/index',
|
|
12
12
|
pathHtml: './src/index.html',
|
|
13
13
|
},
|
|
14
14
|
// Add more entrypoints here
|
|
15
15
|
},
|
|
16
|
-
cssVersion: '5.0'
|
|
16
|
+
cssVersion: '5.0',
|
|
17
17
|
},
|
|
18
|
-
})
|
|
18
|
+
});
|
|
@@ -16,8 +16,13 @@ const counterSlice = createSlice({
|
|
|
16
16
|
state.value += payload;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
|
+
selectors: {
|
|
20
|
+
selectCounterState: (state) => state,
|
|
21
|
+
selectCounterValue: (state) => state.value,
|
|
22
|
+
},
|
|
19
23
|
});
|
|
20
24
|
|
|
21
25
|
export const { increment, decrement, incrementByAmount } = counterSlice.actions;
|
|
26
|
+
export const { selectCounterState, selectCounterValue } = counterSlice.selectors;
|
|
22
27
|
export const counterReducer = counterSlice.reducer;
|
|
23
28
|
export const counterSliceName = counterSlice.name;
|
|
@@ -2,13 +2,17 @@ import { configureStore, combineReducers } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { counterReducer } from './counter/slice';
|
|
3
3
|
|
|
4
4
|
const rootReducer = combineReducers({
|
|
5
|
-
counter: counterReducer
|
|
5
|
+
counter: counterReducer,
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
export const createStore = (preloadedState?: RootState) => configureStore({
|
|
9
9
|
reducer: rootReducer,
|
|
10
|
+
preloadedState,
|
|
10
11
|
});
|
|
11
12
|
|
|
13
|
+
const store = createStore();
|
|
14
|
+
|
|
12
15
|
export type RootState = ReturnType<typeof rootReducer>;
|
|
13
|
-
export type AppDispatch = typeof
|
|
14
|
-
|
|
16
|
+
export type AppDispatch = ReturnType<typeof createStore>["dispatch"];
|
|
17
|
+
|
|
18
|
+
export default store;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"strict": true
|
|
20
|
-
}
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"baseUrl": "src",
|
|
6
|
+
"checkJs": false,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"jsx": "react",
|
|
11
|
+
"lib": ["DOM", "ESNext"],
|
|
12
|
+
"moduleResolution": "Node",
|
|
13
|
+
"target": "ES2020",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"strict": true
|
|
18
|
+
}
|
|
21
19
|
}
|
package/templates/page/README.md
CHANGED
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
## Get Started
|
|
15
15
|
|
|
16
|
-
To get started with working on the project first you have to install its
|
|
17
|
-
dependencies:
|
|
16
|
+
To get started with working on the project first you have to install its dependencies:
|
|
18
17
|
|
|
19
18
|
```bash
|
|
20
19
|
{{ install-command }}
|
|
@@ -24,16 +23,15 @@ Then you will have the following commands available:
|
|
|
24
23
|
|
|
25
24
|
### `{{ run-command }} dev`
|
|
26
25
|
|
|
27
|
-
This starts the project with a local server for development. Typically this will
|
|
28
|
-
|
|
26
|
+
This starts the project with a local server for development. Typically this will be on
|
|
27
|
+
[`http://localhost:1234/`](http://localhost:1234/), but this
|
|
29
28
|
[can be adjusted](https://github.com/TobitSoftware/chayns-toolkit#development-options).
|
|
30
29
|
|
|
31
30
|
### `{{ run-command }} build`
|
|
32
31
|
|
|
33
32
|
This builds your project for production.
|
|
34
33
|
|
|
35
|
-
> If you want to analyze your bundle size you can do so by passing the `-a` flag
|
|
36
|
-
> to this command.
|
|
34
|
+
> If you want to analyze your bundle size you can do so by passing the `-a` flag to this command.
|
|
37
35
|
|
|
38
36
|
### `{{ run-command }} lint`
|
|
39
37
|
|
|
@@ -45,7 +43,6 @@ Automatically formats all of the source code in your project.
|
|
|
45
43
|
|
|
46
44
|
---
|
|
47
45
|
|
|
48
|
-
This project is based on
|
|
49
|
-
[`chayns-toolkit`](https://github.com/TobitSoftware/chayns-toolkit). If you
|
|
46
|
+
This project is based on [`chayns-toolkit`](https://github.com/TobitSoftware/chayns-toolkit). If you
|
|
50
47
|
encounter any issues with the toolchain and the commands, please
|
|
51
48
|
[open an issue](https://github.com/TobitSoftware/chayns-toolkit/issues/new).
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<title>{{ readable-package-name }}</title>
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
|
-
<div class="tapp" id="root"
|
|
12
|
+
<div class="tapp" id="root"{{ tapp-style }}></div>
|
|
13
13
|
<script src="https://api.chayns-static.space/js/v4.0/chayns.min.js"></script>
|
|
14
14
|
</body>
|
|
15
15
|
</html>
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
## Get Started
|
|
15
15
|
|
|
16
|
-
To get started with working on the project first you have to install its
|
|
17
|
-
dependencies:
|
|
16
|
+
To get started with working on the project first you have to install its dependencies:
|
|
18
17
|
|
|
19
18
|
```bash
|
|
20
19
|
{{ install-command }}
|
|
@@ -24,16 +23,15 @@ Then you will have the following commands available:
|
|
|
24
23
|
|
|
25
24
|
### `{{ run-command }} dev`
|
|
26
25
|
|
|
27
|
-
This starts the project with a local server for development. Typically this will
|
|
28
|
-
|
|
26
|
+
This starts the project with a local server for development. Typically this will be on
|
|
27
|
+
[`http://localhost:1234/`](http://localhost:1234/), but this
|
|
29
28
|
[can be adjusted](https://github.com/TobitSoftware/chayns-toolkit#development-options).
|
|
30
29
|
|
|
31
30
|
### `{{ run-command }} build`
|
|
32
31
|
|
|
33
32
|
This builds your project for production.
|
|
34
33
|
|
|
35
|
-
> If you want to analyze your bundle size you can do so by passing the `-a` flag
|
|
36
|
-
> to this command.
|
|
34
|
+
> If you want to analyze your bundle size you can do so by passing the `-a` flag to this command.
|
|
37
35
|
|
|
38
36
|
### `{{ run-command }} lint`
|
|
39
37
|
|
|
@@ -45,7 +43,6 @@ Automatically formats all of the source code in your project.
|
|
|
45
43
|
|
|
46
44
|
---
|
|
47
45
|
|
|
48
|
-
This project is based on
|
|
49
|
-
[`chayns-toolkit`](https://github.com/TobitSoftware/chayns-toolkit). If you
|
|
46
|
+
This project is based on [`chayns-toolkit`](https://github.com/TobitSoftware/chayns-toolkit). If you
|
|
50
47
|
encounter any issues with the toolchain and the commands, please
|
|
51
48
|
[open an issue](https://github.com/TobitSoftware/chayns-toolkit/issues/new).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()],
|
|
6
|
+
test: {
|
|
7
|
+
globals: true,
|
|
8
|
+
environment: 'jsdom',
|
|
9
|
+
setupFiles: './tests/setup.js',
|
|
10
|
+
coverage: {
|
|
11
|
+
enabled: true,
|
|
12
|
+
provider: 'v8',
|
|
13
|
+
reporter: ['text', 'json', 'html'],
|
|
14
|
+
include: ['src/**'],
|
|
15
|
+
all: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
push:
|
|
6
|
-
tags:
|
|
7
|
-
- 'v*'
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
- uses: actions/setup-node@v1
|
|
15
|
-
with:
|
|
16
|
-
node-version: '20'
|
|
17
|
-
registry-url: https://registry.npmjs.org/
|
|
18
|
-
- run: npm ci
|
|
19
|
-
- run: npm publish
|
|
20
|
-
env:
|
|
21
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|