create-chayns-app 1.1.5 → 1.1.6
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/.github/workflows/publish.yml +2 -2
- package/dist/index.js +8 -8
- package/package.json +14 -12
- package/templates/api-v5/page/src/components/App.jsx +9 -0
- package/templates/api-v5/page/src/index.html +19 -0
- package/templates/api-v5/page/src/index.jsx +17 -0
- package/templates/api-v5/page-module/src/components/App.jsx +30 -0
- package/templates/api-v5/page-module/src/components/AppWrapper.jsx +16 -0
- package/templates/api-v5/page-module/src/components/app.scss +3 -0
- package/templates/api-v5/page-module-redux/src/components/App.jsx +32 -0
- package/templates/api-v5/page-module-redux/src/components/AppWrapper.jsx +20 -0
- package/templates/api-v5/page-module-redux/src/components/app.scss +3 -0
- package/templates/api-v5/page-redux/src/components/App.jsx +7 -0
- package/templates/api-v5/page-redux/src/components/AppWrapper.jsx +17 -0
- package/templates/api-v5/page-redux/src/index.html +19 -0
- package/templates/api-v5/page-redux/src/index.jsx +15 -0
- package/templates/api-v5/page-ts/src/components/App.tsx +7 -0
- package/templates/api-v5/page-ts/src/index.html +19 -0
- package/templates/api-v5/page-ts/src/index.tsx +16 -0
- package/templates/api-v5/page-ts-module/src/components/App.tsx +30 -0
- package/templates/api-v5/page-ts-module/src/components/AppWrapper.tsx +16 -0
- package/templates/api-v5/page-ts-module/src/components/app.scss +3 -0
- package/templates/api-v5/page-ts-module-redux/src/components/App.tsx +31 -0
- package/templates/api-v5/page-ts-module-redux/src/components/AppWrapper.tsx +16 -0
- package/templates/api-v5/page-ts-module-redux/src/components/app.scss +3 -0
- package/templates/api-v5/page-ts-redux/src/components/App.tsx +7 -0
- package/templates/api-v5/page-ts-redux/src/components/AppWrapper.tsx +17 -0
- package/templates/api-v5/page-ts-redux/src/index.html +19 -0
- package/templates/api-v5/page-ts-redux/src/index.tsx +15 -0
- package/templates/api-v5/shared/js/src/redux-modules/counter/counterSelectors.js +3 -0
- package/templates/api-v5/shared/js/src/redux-modules/counter/counterSlice.js +23 -0
- package/templates/api-v5/shared/js/src/redux-modules/index.js +11 -0
- package/templates/api-v5/shared/js/template-package-redux.json +36 -0
- package/templates/api-v5/shared/js/template-package.json +34 -0
- package/templates/api-v5/shared/toolkit.config-module.js +9 -0
- package/templates/api-v5/shared/toolkit.config.js +5 -0
- package/templates/api-v5/shared/ts/src/redux-modules/counter/counterSelectors.ts +4 -0
- package/templates/api-v5/shared/ts/src/redux-modules/counter/counterSlice.ts +23 -0
- package/templates/api-v5/shared/ts/src/redux-modules/index.ts +14 -0
- package/templates/api-v5/shared/ts/template-package-redux.json +39 -0
- package/templates/api-v5/shared/ts/template-package.json +37 -0
- package/templates/api-v5/shared/ts/tsconfig.json +21 -0
- package/templates/page/src/index.html +1 -4
- package/templates/page/template-package.json +6 -5
- package/templates/shared/README.md +51 -0
- package/templates/shared/template-gitignore +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-chayns-app",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Create a new chayns® development project in one command.",
|
|
6
6
|
"keywords": [
|
|
@@ -34,19 +34,21 @@
|
|
|
34
34
|
"start": "node src/index.js"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
37
|
+
"@reduxjs/toolkit": "^1.9.0",
|
|
38
|
+
"@vercel/ncc": "^0.34.0",
|
|
39
|
+
"chalk": "4.1.2",
|
|
40
|
+
"commander": "^9.4.1",
|
|
40
41
|
"enquirer": "^2.3.6",
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"execa": "
|
|
43
|
-
"fast-glob": "^3.2.
|
|
44
|
-
"is-npm": "
|
|
42
|
+
"eslint": "^8.27.0",
|
|
43
|
+
"execa": "5.1.1",
|
|
44
|
+
"fast-glob": "^3.2.12",
|
|
45
|
+
"is-npm": "5.0.0",
|
|
45
46
|
"mkdirp": "^1.0.4",
|
|
46
|
-
"ora": "
|
|
47
|
-
"prettier": "^2.
|
|
48
|
-
"prettier-plugin-packagejson": "^2.
|
|
49
|
-
"
|
|
47
|
+
"ora": "5.4.1",
|
|
48
|
+
"prettier": "^2.7.1",
|
|
49
|
+
"prettier-plugin-packagejson": "^2.3.0",
|
|
50
|
+
"react-redux": "^8.0.5",
|
|
51
|
+
"validate-npm-package-name": "^5.0.0"
|
|
50
52
|
},
|
|
51
53
|
"publishConfig": {
|
|
52
54
|
"access": "public"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1, user-scalable=no"
|
|
8
|
+
/>
|
|
9
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
10
|
+
|
|
11
|
+
<%= CHAYNS_TOOLKIT_CSS_TAG %>
|
|
12
|
+
|
|
13
|
+
<title>{{ readable-package-name }}</title>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class="tapp" id="root" {{ tapp-style }}></div>
|
|
17
|
+
<script src="https://api.chayns-static.space/js/v4.0/chayns.min.js"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { ChaynsProvider } from "chayns-api";
|
|
4
|
+
|
|
5
|
+
import App from './components/App';
|
|
6
|
+
|
|
7
|
+
chayns.ready
|
|
8
|
+
.then(() => {
|
|
9
|
+
try {
|
|
10
|
+
ReactDOM.render(<ChaynsProvider><App /></ChaynsProvider>, document.querySelector('#root'));
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.error('Encountered error at `ReactDOM.render`: ', e);
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
.catch((error) => {
|
|
16
|
+
console.warn('No chayns environment found.', error);
|
|
17
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WaitUntil } from "chayns-api";
|
|
3
|
+
import { SmallWaitCursor } from "chayns-components";
|
|
4
|
+
import './app.scss';
|
|
5
|
+
|
|
6
|
+
const App = () => {
|
|
7
|
+
|
|
8
|
+
const taskList = [
|
|
9
|
+
// tasks in first level are executed one after another
|
|
10
|
+
() => chayns.ready,
|
|
11
|
+
() => new Promise((resolve) => {setTimeout(resolve, 1000)}), // Add your initial Requests, textstrings here
|
|
12
|
+
[
|
|
13
|
+
// tasks on second level are executed parallel
|
|
14
|
+
]
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
return (<div className="{{ package-name-underscore }}">
|
|
18
|
+
<WaitUntil
|
|
19
|
+
tasks={taskList}
|
|
20
|
+
loadingComponent={(
|
|
21
|
+
<div style={{ textAlign: 'center' }}>
|
|
22
|
+
<SmallWaitCursor show/>
|
|
23
|
+
</div>
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
<h1>Hi! Welcome to your newly created chayns application!</h1>
|
|
27
|
+
</WaitUntil></div>);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default App;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChaynsProvider, withCompatMode } from "chayns-api";
|
|
3
|
+
import App from "./App";
|
|
4
|
+
|
|
5
|
+
const AppWrapper = ({ ...props }) => {
|
|
6
|
+
return (
|
|
7
|
+
<div className="tapp">
|
|
8
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
9
|
+
<ChaynsProvider {...props}>
|
|
10
|
+
<App/>
|
|
11
|
+
</ChaynsProvider>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default withCompatMode(AppWrapper);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WaitUntil } from "chayns-api";
|
|
3
|
+
import { SmallWaitCursor } from "chayns-components";
|
|
4
|
+
import { useSelector } from "react-redux";
|
|
5
|
+
import { selectCount } from "../redux-modules/counter/counterSelectors";
|
|
6
|
+
|
|
7
|
+
const App = () => {
|
|
8
|
+
const counter = useSelector(selectCount);
|
|
9
|
+
|
|
10
|
+
const taskList = [
|
|
11
|
+
// tasks on first level are executed parallel
|
|
12
|
+
() => chayns.ready,
|
|
13
|
+
() => new Promise((resolve) => {setTimeout(resolve, 1000)}), // Add your initial Requests, textstrings here
|
|
14
|
+
[
|
|
15
|
+
// tasks in second level are executed one after another
|
|
16
|
+
]
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
return (<div className="{{ package-name-underscore }}">
|
|
20
|
+
<WaitUntil
|
|
21
|
+
tasks={taskList}
|
|
22
|
+
loadingComponent={(
|
|
23
|
+
<div style={{ textAlign: 'center' }}>
|
|
24
|
+
<SmallWaitCursor show/>
|
|
25
|
+
</div>
|
|
26
|
+
)}
|
|
27
|
+
>
|
|
28
|
+
<h1>Hi! Welcome to your newly created chayns application! {counter}</h1>
|
|
29
|
+
</WaitUntil></div>);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default App;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChaynsProvider, withCompatMode } from "chayns-api";
|
|
3
|
+
import App from "./App";
|
|
4
|
+
import store from '../redux-modules';
|
|
5
|
+
import { Provider } from "react-redux";
|
|
6
|
+
|
|
7
|
+
const AppWrapper = ({ ...props }) => {
|
|
8
|
+
return (
|
|
9
|
+
<div className="tapp">
|
|
10
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
11
|
+
<ChaynsProvider {...props}>
|
|
12
|
+
<Provider store={store}>
|
|
13
|
+
<App/>
|
|
14
|
+
</Provider>
|
|
15
|
+
</ChaynsProvider>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default withCompatMode(AppWrapper);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Provider } from "react-redux";
|
|
3
|
+
import { ChaynsProvider } from 'chayns-api';
|
|
4
|
+
import store from '../redux-modules';
|
|
5
|
+
import App from "./App";
|
|
6
|
+
|
|
7
|
+
const AppWrapper = () => {
|
|
8
|
+
return (
|
|
9
|
+
<ChaynsProvider>
|
|
10
|
+
<Provider store={store}>
|
|
11
|
+
<App />
|
|
12
|
+
</Provider>
|
|
13
|
+
</ChaynsProvider>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default AppWrapper;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1, user-scalable=no"
|
|
8
|
+
/>
|
|
9
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
10
|
+
|
|
11
|
+
<%= CHAYNS_TOOLKIT_CSS_TAG %>
|
|
12
|
+
|
|
13
|
+
<title>{{ readable-package-name }}</title>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class="tapp" id="root" {{ tapp-style }}></div>
|
|
17
|
+
<script src="https://api.chayns-static.space/js/v4.0/chayns.min.js"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import AppWrapper from "./components/AppWrapper";
|
|
4
|
+
|
|
5
|
+
chayns.ready
|
|
6
|
+
.then(() => {
|
|
7
|
+
try {
|
|
8
|
+
ReactDOM.render(<AppWrapper/>, document.querySelector('#root'));
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error('Encountered error at `ReactDOM.render`: ', e);
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
.catch((error) => {
|
|
14
|
+
console.warn('No chayns environment found.', error);
|
|
15
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1, user-scalable=no"
|
|
8
|
+
/>
|
|
9
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
10
|
+
|
|
11
|
+
<%= CHAYNS_TOOLKIT_CSS_TAG %>
|
|
12
|
+
|
|
13
|
+
<title>{{ readable-package-name }}</title>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class="tapp" id="root" {{ tapp-style }}></div>
|
|
17
|
+
<script src="https://api.chayns-static.space/js/v4.0/chayns.min.js"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { ChaynsProvider } from 'chayns-api';
|
|
4
|
+
import App from './components/App';
|
|
5
|
+
|
|
6
|
+
chayns.ready
|
|
7
|
+
.then(() => {
|
|
8
|
+
try {
|
|
9
|
+
ReactDOM.render(<ChaynsProvider><App /></ChaynsProvider>, document.querySelector('#root'));
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.error('Encountered error at `ReactDOM.render`: ', e);
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
.catch((error: Error) => {
|
|
15
|
+
console.warn('No chayns environment found.', error);
|
|
16
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WaitUntil } from "chayns-api";
|
|
3
|
+
import { SmallWaitCursor } from "chayns-components";
|
|
4
|
+
import './app.scss';
|
|
5
|
+
|
|
6
|
+
const App = () => {
|
|
7
|
+
|
|
8
|
+
const taskList = [
|
|
9
|
+
// tasks on first level are executed parallel
|
|
10
|
+
() => chayns.ready,
|
|
11
|
+
() => new Promise((resolve) => {setTimeout(resolve, 1000)}), // Add your initial Requests, textstrings here
|
|
12
|
+
[
|
|
13
|
+
// tasks in second level are executed one after another
|
|
14
|
+
]
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
return (<div className="{{ package-name-underscore }}">
|
|
18
|
+
<WaitUntil
|
|
19
|
+
tasks={taskList}
|
|
20
|
+
loadingComponent={(
|
|
21
|
+
<div style={{ textAlign: 'center' }}>
|
|
22
|
+
<SmallWaitCursor show/>
|
|
23
|
+
</div>
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
<h1>Hi! Welcome to your newly created chayns application!</h1>
|
|
27
|
+
</WaitUntil></div>);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default App;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChaynsProvider, withCompatMode } from "chayns-api";
|
|
3
|
+
import App from "./App";
|
|
4
|
+
|
|
5
|
+
const AppWrapper = ({ ...props }) => {
|
|
6
|
+
return (
|
|
7
|
+
<div className="tapp">
|
|
8
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
9
|
+
<ChaynsProvider {...props}>
|
|
10
|
+
<App/>
|
|
11
|
+
</ChaynsProvider>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default withCompatMode(AppWrapper);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WaitUntil } from "chayns-api";
|
|
3
|
+
import { SmallWaitCursor } from "chayns-components";
|
|
4
|
+
|
|
5
|
+
import './app.scss';
|
|
6
|
+
|
|
7
|
+
const App = () => {
|
|
8
|
+
|
|
9
|
+
const taskList = [
|
|
10
|
+
// tasks on first level are executed parallel
|
|
11
|
+
() => chayns.ready,
|
|
12
|
+
() => new Promise((resolve) => {setTimeout(resolve, 1000)}), // Add your initial Requests, textstrings here
|
|
13
|
+
[
|
|
14
|
+
// tasks in second level are executed one after another
|
|
15
|
+
]
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
return (<div className="{{ package-name-underscore }}">
|
|
19
|
+
<WaitUntil
|
|
20
|
+
tasks={taskList}
|
|
21
|
+
loadingComponent={(
|
|
22
|
+
<div style={{ textAlign: 'center' }}>
|
|
23
|
+
<SmallWaitCursor show/>
|
|
24
|
+
</div>
|
|
25
|
+
)}
|
|
26
|
+
>
|
|
27
|
+
<h1>Hi! Welcome to your newly created chayns application!</h1>
|
|
28
|
+
</WaitUntil></div>);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default App;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChaynsProvider, withCompatMode } from "chayns-api";
|
|
3
|
+
import App from "./App";
|
|
4
|
+
|
|
5
|
+
const AppWrapper = ({ ...props }) => {
|
|
6
|
+
return (
|
|
7
|
+
<div className="tapp">
|
|
8
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
9
|
+
<ChaynsProvider {...props}>
|
|
10
|
+
<App/>
|
|
11
|
+
</ChaynsProvider>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default withCompatMode(AppWrapper);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Provider } from "react-redux";
|
|
3
|
+
import { ChaynsProvider } from "chayns-api";
|
|
4
|
+
import App from "./App";
|
|
5
|
+
import store from '../redux-modules';
|
|
6
|
+
|
|
7
|
+
const AppWrapper = ({ ...props }) => {
|
|
8
|
+
return (
|
|
9
|
+
<ChaynsProvider {...props}>
|
|
10
|
+
<Provider store={store}>
|
|
11
|
+
<App/>
|
|
12
|
+
</Provider>
|
|
13
|
+
</ChaynsProvider>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default AppWrapper;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1, user-scalable=no"
|
|
8
|
+
/>
|
|
9
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
10
|
+
|
|
11
|
+
<%= CHAYNS_TOOLKIT_CSS_TAG %>
|
|
12
|
+
|
|
13
|
+
<title>{{ readable-package-name }}</title>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class="tapp" id="root" {{ tapp-style }}></div>
|
|
17
|
+
<script src="https://api.chayns-static.space/js/v4.0/chayns.min.js"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import AppWrapper from './components/AppWrapper';
|
|
4
|
+
|
|
5
|
+
chayns.ready
|
|
6
|
+
.then(() => {
|
|
7
|
+
try {
|
|
8
|
+
ReactDOM.render(<AppWrapper />, document.querySelector('#root'));
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error('Encountered error at `ReactDOM.render`: ', e);
|
|
11
|
+
}
|
|
12
|
+
})
|
|
13
|
+
.catch((error: Error) => {
|
|
14
|
+
console.warn('No chayns environment found.', error);
|
|
15
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
const initialState = { value: 0 };
|
|
4
|
+
|
|
5
|
+
const counterSlice = createSlice({
|
|
6
|
+
name: 'counter',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
increment(state) {
|
|
10
|
+
state.value++;
|
|
11
|
+
},
|
|
12
|
+
decrement(state) {
|
|
13
|
+
state.value--;
|
|
14
|
+
},
|
|
15
|
+
incrementByAmount(state, { payload }) {
|
|
16
|
+
state.value += payload;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const { increment, decrement, incrementByAmount } = counterSlice.actions;
|
|
22
|
+
export const counterReducer = counterSlice.reducer;
|
|
23
|
+
export const counterSliceName = counterSlice.name;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { configureStore, combineReducers } from '@reduxjs/toolkit';
|
|
2
|
+
import { counterReducer } from "./counter/counterSlice";
|
|
3
|
+
|
|
4
|
+
const rootReducer = combineReducers({
|
|
5
|
+
counter: counterReducer
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const Store = configureStore({
|
|
9
|
+
reducer: rootReducer,
|
|
10
|
+
});
|
|
11
|
+
export default Store;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{ package-name }}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "{{ description }}",
|
|
6
|
+
"keywords": ["chayns", "chayns-toolkit", "react"],
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "chayns-toolkit build",
|
|
9
|
+
"dev": "chayns-toolkit dev",
|
|
10
|
+
"start": "chayns-toolkit dev",
|
|
11
|
+
"format": "prettier . --write",
|
|
12
|
+
"lint": "chayns-toolkit lint"
|
|
13
|
+
},
|
|
14
|
+
"prettier": {
|
|
15
|
+
"proseWrap": "always",
|
|
16
|
+
"singleQuote": true,
|
|
17
|
+
"tabWidth": 4
|
|
18
|
+
},
|
|
19
|
+
"eslintConfig": {
|
|
20
|
+
"extends": "@chayns-toolkit"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"chayns-components": "^4.24.25",
|
|
24
|
+
"prop-types": "^15.8.1",
|
|
25
|
+
"react": "^17.0.2",
|
|
26
|
+
"react-dom": "^17.0.2",
|
|
27
|
+
"chayns-api": "^1.0.0",
|
|
28
|
+
"react-redux": "^8.0.4",
|
|
29
|
+
"@reduxjs/toolkit": "^1.8.6"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"chayns-toolkit": "^2.0.0-beta.26",
|
|
33
|
+
"prettier": "^2.7.1",
|
|
34
|
+
"prettier-plugin-packagejson": "^2.3.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{ package-name }}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "{{ description }}",
|
|
6
|
+
"keywords": ["chayns", "chayns-toolkit", "react"],
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "chayns-toolkit build",
|
|
9
|
+
"dev": "chayns-toolkit dev",
|
|
10
|
+
"start": "chayns-toolkit dev",
|
|
11
|
+
"format": "prettier . --write",
|
|
12
|
+
"lint": "chayns-toolkit lint"
|
|
13
|
+
},
|
|
14
|
+
"prettier": {
|
|
15
|
+
"proseWrap": "always",
|
|
16
|
+
"singleQuote": true,
|
|
17
|
+
"tabWidth": 4
|
|
18
|
+
},
|
|
19
|
+
"eslintConfig": {
|
|
20
|
+
"extends": "@chayns-toolkit"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"chayns-components": "^4.24.25",
|
|
24
|
+
"prop-types": "^15.8.1",
|
|
25
|
+
"react": "^17.0.2",
|
|
26
|
+
"react-dom": "^17.0.2",
|
|
27
|
+
"chayns-api": "^1.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"chayns-toolkit": "^2.0.0-beta.26",
|
|
31
|
+
"prettier": "^2.7.1",
|
|
32
|
+
"prettier-plugin-packagejson": "^2.3.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
const initialState = { value: 0 };
|
|
4
|
+
|
|
5
|
+
const counterSlice = createSlice({
|
|
6
|
+
name: 'counter',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
increment(state) {
|
|
10
|
+
state.value++;
|
|
11
|
+
},
|
|
12
|
+
decrement(state) {
|
|
13
|
+
state.value--;
|
|
14
|
+
},
|
|
15
|
+
incrementByAmount(state, { payload }) {
|
|
16
|
+
state.value += payload;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const { increment, decrement, incrementByAmount } = counterSlice.actions;
|
|
22
|
+
export const counterReducer = counterSlice.reducer;
|
|
23
|
+
export const counterSliceName = counterSlice.name;
|