create-packer 1.11.2 → 1.11.4
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/package.json +1 -1
- package/template/react/src/app.store.ts +6 -6
- package/template/react/src/providers/defineStore.ts +22 -0
- package/template/react/src/providers/index.ts +1 -0
- package/template/react/src/router/index.ts +1 -1
- package/template/react/src/router/{routes.tsx → router.config.tsx} +3 -3
- package/template/react/src/router/router.container.tsx +2 -2
- package/template/react/src/router/{paths.ts → router.paths.ts} +0 -0
- package/template/vue/src/main.ts +1 -1
- package/template/vue/src/{routes → router}/index.ts +2 -3
- /package/template/vue/src/{routes/names.ts → router/router.names.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { combine } from 'zustand/middleware'
|
|
1
|
+
import { defineStore } from '@/providers'
|
|
3
2
|
|
|
4
|
-
export const useApp =
|
|
5
|
-
|
|
3
|
+
export const useApp = defineStore({
|
|
4
|
+
state: () => ({}),
|
|
5
|
+
actions: () => {
|
|
6
6
|
return {}
|
|
7
|
-
}
|
|
8
|
-
)
|
|
7
|
+
}
|
|
8
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StateCreator } from 'zustand/vanilla'
|
|
2
|
+
import create from 'zustand'
|
|
3
|
+
import { combine } from 'zustand/middleware'
|
|
4
|
+
|
|
5
|
+
export interface defineStoreOptionsType<S extends object, A extends object> {
|
|
6
|
+
state: () => S
|
|
7
|
+
actions?: StateCreator<{ state: S }, [], [], A>
|
|
8
|
+
}
|
|
9
|
+
export function defineStore<S extends object, U extends object>(
|
|
10
|
+
options: defineStoreOptionsType<S, U>
|
|
11
|
+
) {
|
|
12
|
+
return create(
|
|
13
|
+
combine({ state: options.state() }, (setState, getState, store, $$storeMutations) => {
|
|
14
|
+
return {
|
|
15
|
+
reset() {
|
|
16
|
+
setState(() => options.state(), true)
|
|
17
|
+
},
|
|
18
|
+
...(options.actions?.(setState, getState, store, $$storeMutations) || {})
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defineStore'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './router.container'
|
|
2
|
-
export { default as routePaths } from '
|
|
2
|
+
export { default as routePaths } from '././router.paths'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { lazy } from 'react'
|
|
2
2
|
import { RouteObject } from 'react-router-dom'
|
|
3
|
-
import paths from './paths'
|
|
3
|
+
import paths from './router.paths'
|
|
4
4
|
import Layout from '@/layout'
|
|
5
5
|
import Home from '@/pages/home'
|
|
6
6
|
|
|
7
7
|
const NotFound = lazy(() => import('@/pages/notFound'))
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const routerConfig: RouteObject[] = [
|
|
10
10
|
{
|
|
11
11
|
path: paths.root,
|
|
12
12
|
element: <Layout />,
|
|
@@ -23,4 +23,4 @@ const routes: RouteObject[] = [
|
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
-
export default
|
|
26
|
+
export default routerConfig
|
|
File without changes
|
package/template/vue/src/main.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
|
|
2
|
-
import names from './names'
|
|
3
|
-
import Home from '@/pages/Home'
|
|
2
|
+
import names from './router.names'
|
|
4
3
|
|
|
5
4
|
const routes: (RouteRecordRaw & { name: string })[] = [
|
|
6
|
-
{ path: '/', name: names.home, component:
|
|
5
|
+
{ path: '/', name: names.home, component: () => import('@/pages/home') },
|
|
7
6
|
{ path: '/404', name: names.notFound, component: () => import('@/pages/notFound') }
|
|
8
7
|
]
|
|
9
8
|
const router = createRouter({
|
|
File without changes
|