create-young-proj 0.10.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/dist/index.mjs +9 -9
  2. package/package.json +1 -1
  3. package/template-nuxt-admin/README.md +42 -1
  4. package/template-nuxt-admin/components/layout/Main.vue +2 -2
  5. package/template-nuxt-admin/components/layout/NavBar.vue +11 -2
  6. package/template-nuxt-admin/components/layout/SideBar.vue +6 -2
  7. package/template-nuxt-admin/components/layout/SubMenu.vue +9 -2
  8. package/template-nuxt-admin/components/layout/TabsBar.vue +4 -5
  9. package/template-nuxt-admin/composables/api.ts +17 -3
  10. package/template-nuxt-admin/composables/nav.ts +20 -3
  11. package/template-nuxt-admin/composables/tags.ts +29 -1
  12. package/template-nuxt-admin/middleware/auth.global.ts +16 -4
  13. package/template-nuxt-admin/nuxt.config.ts +5 -1
  14. package/template-nuxt-admin/pages/home/[id].vue +2 -2
  15. package/template-nuxt-admin/pages/index.vue +2 -7
  16. package/template-nuxt-admin/pages/login.vue +2 -2
  17. package/template-nuxt-admin/pages/system/menuList.vue +0 -1
  18. package/template-nuxt-admin/public/bg.webp +0 -0
  19. package/template-nuxt-admin/public/favicon.svg +2 -0
  20. package/template-nuxt-admin/public/logo.svg +2 -0
  21. package/template-nuxt-admin/server/plugins/env.ts +3 -4
  22. package/template-nuxt-admin/utils/tool.ts +17 -1
  23. package/template-nuxt-admin/public/favicon.ico +0 -0
  24. package/template-vue-admin/.vscode/extensions.json +0 -10
  25. package/template-vue-admin/.vscode/list-add.code-snippets +0 -108
  26. package/template-vue-admin/.vscode/list-export.code-snippets +0 -72
  27. package/template-vue-admin/.vscode/list.code-snippets +0 -61
  28. package/template-vue-admin/.vscode/settings.json +0 -7
  29. package/template-vue-admin/Dockerfile +0 -42
  30. package/template-vue-admin/README.md +0 -75
  31. package/template-vue-admin/_env +0 -8
  32. package/template-vue-admin/_gitignore +0 -30
  33. package/template-vue-admin/boot.mjs +0 -16
  34. package/template-vue-admin/build/custom-plugin.ts +0 -57
  35. package/template-vue-admin/build/index.ts +0 -7
  36. package/template-vue-admin/build/plugins.ts +0 -59
  37. package/template-vue-admin/config/.devrc +0 -2
  38. package/template-vue-admin/config/.onlinerc +0 -2
  39. package/template-vue-admin/config/.testrc +0 -2
  40. package/template-vue-admin/index.html +0 -21
  41. package/template-vue-admin/nitro.config.ts +0 -19
  42. package/template-vue-admin/package.json +0 -51
  43. package/template-vue-admin/plugins/init.ts +0 -31
  44. package/template-vue-admin/public/vite.svg +0 -1
  45. package/template-vue-admin/rome.json +0 -26
  46. package/template-vue-admin/routes/api/[...all].ts +0 -49
  47. package/template-vue-admin/routes/get/env.ts +0 -18
  48. package/template-vue-admin/src/App.vue +0 -14
  49. package/template-vue-admin/src/apis/delete.ts +0 -36
  50. package/template-vue-admin/src/apis/get.ts +0 -83
  51. package/template-vue-admin/src/apis/index.ts +0 -10
  52. package/template-vue-admin/src/apis/patch.ts +0 -78
  53. package/template-vue-admin/src/apis/post.ts +0 -76
  54. package/template-vue-admin/src/assets/img/login_background.jpg +0 -0
  55. package/template-vue-admin/src/auto-components.d.ts +0 -38
  56. package/template-vue-admin/src/auto-imports.d.ts +0 -302
  57. package/template-vue-admin/src/layouts/blank.vue +0 -9
  58. package/template-vue-admin/src/layouts/default/components/Link.vue +0 -23
  59. package/template-vue-admin/src/layouts/default/components/Logo.vue +0 -20
  60. package/template-vue-admin/src/layouts/default/components/Menu.vue +0 -54
  61. package/template-vue-admin/src/layouts/default/components/NavSearch.vue +0 -52
  62. package/template-vue-admin/src/layouts/default/components/ScrollPane.vue +0 -79
  63. package/template-vue-admin/src/layouts/default/components/TagsView.vue +0 -137
  64. package/template-vue-admin/src/layouts/default/components/TopMenu.vue +0 -21
  65. package/template-vue-admin/src/layouts/default/components/UserCenter.vue +0 -50
  66. package/template-vue-admin/src/layouts/default/index.vue +0 -95
  67. package/template-vue-admin/src/main.ts +0 -46
  68. package/template-vue-admin/src/modules/1-router.ts +0 -48
  69. package/template-vue-admin/src/modules/2-pinia.ts +0 -10
  70. package/template-vue-admin/src/modules/3-net.ts +0 -79
  71. package/template-vue-admin/src/modules/4-auth.ts +0 -124
  72. package/template-vue-admin/src/modules/5-checkupdate.ts +0 -38
  73. package/template-vue-admin/src/shims.d.ts +0 -12
  74. package/template-vue-admin/src/stores/index.ts +0 -9
  75. package/template-vue-admin/src/stores/local/index.ts +0 -31
  76. package/template-vue-admin/src/stores/session/index.ts +0 -63
  77. package/template-vue-admin/src/stores/tags.ts +0 -109
  78. package/template-vue-admin/src/typings/global.d.ts +0 -70
  79. package/template-vue-admin/src/typings/index.ts +0 -13
  80. package/template-vue-admin/src/typings/system.d.ts +0 -46
  81. package/template-vue-admin/src/views/403.vue +0 -33
  82. package/template-vue-admin/src/views/[...all_404].vue +0 -557
  83. package/template-vue-admin/src/views/base/login.vue +0 -194
  84. package/template-vue-admin/src/views/dashboard/[name].vue +0 -28
  85. package/template-vue-admin/src/views/index.vue +0 -25
  86. package/template-vue-admin/src/views/system/api.vue +0 -160
  87. package/template-vue-admin/src/views/system/hooks/useRole.ts +0 -286
  88. package/template-vue-admin/src/views/system/menuList.vue +0 -194
  89. package/template-vue-admin/src/views/system/role.vue +0 -131
  90. package/template-vue-admin/src/views/system/user.vue +0 -192
  91. package/template-vue-admin/src/vite-env.d.ts +0 -52
  92. package/template-vue-admin/tsconfig.json +0 -21
  93. package/template-vue-admin/tsconfig.node.json +0 -9
  94. package/template-vue-admin/unocss.config.ts +0 -47
  95. package/template-vue-admin/vite.config.ts +0 -32
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 17:35:12
4
- * @LastEditTime: 2023-07-28 11:34:29
4
+ * @LastEditTime: 2023-09-15 15:20:25
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -14,7 +14,7 @@ definePageMeta({
14
14
  const { nick } = storeToRefs(useUserStore())
15
15
  const { nav_arr } = storeToRefs(useNavStore())
16
16
 
17
- onMounted(() => {
17
+ useTabNoCache(() => {
18
18
  nav_arr.value.length === 0 && generateNavData()
19
19
  })
20
20
  </script>
@@ -1,17 +1,12 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 09:27:14
4
- * @LastEditTime: 2023-07-23 16:23:00
4
+ * @LastEditTime: 2023-09-18 14:15:35
5
5
  * @Description:
6
6
  -->
7
7
  <script setup lang="ts">
8
8
  definePageMeta({
9
- noCache: true,
10
- })
11
-
12
- navigateTo({
13
- path: '/home/index',
14
- replace: true,
9
+ redirect: '/home/index',
15
10
  })
16
11
  </script>
17
12
 
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 10:03:11
4
- * @LastEditTime: 2023-09-08 10:03:40
4
+ * @LastEditTime: 2023-09-15 15:19:59
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -63,7 +63,7 @@ function loginHandler() {
63
63
  })
64
64
  }
65
65
 
66
- onMounted(() => {
66
+ useTabNoCache(() => {
67
67
  if (SaveFlag.value && hasLogin.value) {
68
68
  navigateTo({
69
69
  path: '/',
@@ -284,7 +284,6 @@ useTabReOpen(getList)
284
284
  新建菜单
285
285
  </ElButton>
286
286
  </div>
287
- <br>
288
287
  <!-- 节点列表 -->
289
288
  <YoungTablePro
290
289
  :table-data="tableData" :table-head="tableHead" :tree-props="{ children: 'children' }" row-key="id"
@@ -0,0 +1,2 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32"><path fill="#666" d="M26 2h4v4h-4zm0 6h4v4h-4zm-6-6h4v4h-4zm0 6h4v4h-4z"/><path fill="#666" d="M28 16v6H4V6h12V4H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8v4H8v2h16v-2h-4v-4h8a2 2 0 0 0 2-2v-6ZM18 28h-4v-4h4Z"/></svg>
@@ -0,0 +1,2 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32"><path fill="#fff" d="M26 2h4v4h-4zm0 6h4v4h-4zm-6-6h4v4h-4zm0 6h4v4h-4z"/><path fill="#fff" d="M28 16v6H4V6h12V4H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8v4H8v2h16v-2h-4v-4h8a2 2 0 0 0 2-2v-6ZM18 28h-4v-4h4Z"/></svg>
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2022-12-30 17:19:42
4
- * @LastEditTime: 2023-07-31 17:52:20
4
+ * @LastEditTime: 2023-09-16 16:27:56
5
5
  * @Description:
6
6
  */
7
7
  import { resolve } from 'node:path'
@@ -22,9 +22,8 @@ export default defineNitroPlugin(async (nitroApp) => {
22
22
  NUXT_PUBLIC_TITLE: 'XXX-后台管理系统',
23
23
  NUXT_PUBLIC_SUB_TITLE: '做XXX我们是认真的!',
24
24
  NUXT_PUBLIC_SLOGAN: 'XXXXX, XXXXX',
25
- NUXT_PUBLIC_LOGIN_BG:
26
- 'https://dogefs.s3.ladydaily.com/~/source/unsplash/photo-1688380692117-63178554d76d?ixid=M3wyNjY4NDZ8MHwxfHRvcGljfHxhZXU2ckwtajZld3x8fHx8Mnx8MTY5MDAxMDMzNnw&ixlib=rb-4.0.3&w=1920&h=1080&fmt=webp',
27
- NUXT_PUBLIC_LOGIN_LOGO: 'https://api.iconify.design/logos:nuxt-icon.svg?color=%23f74d49',
25
+ NUXT_PUBLIC_LOGIN_BG: '/bg.webp',
26
+ NUXT_PUBLIC_LOGIN_LOGO: '/logo.svg',
28
27
  },
29
28
  })
30
29
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-05-28 16:01:24
4
- * @LastEditTime: 2023-09-08 10:12:37
4
+ * @LastEditTime: 2023-09-13 09:43:52
5
5
  * @Description:
6
6
  */
7
7
  import { randomId } from '@bluesyoung/utils'
@@ -181,3 +181,19 @@ export function useChangePassword() {
181
181
 
182
182
  vnode.component!.exposed?.show()
183
183
  }
184
+
185
+ /**
186
+ * 修改状态二次确认
187
+ */
188
+ export function useConfirm(cbk: Function, tip = '确定修改状态嘛?', successTip?: string) {
189
+ ElMessageBox.confirm(tip, '提示', {
190
+ type: 'warning',
191
+ confirmButtonText: '确定',
192
+ cancelButtonText: '取消',
193
+ })
194
+ .then(async () => {
195
+ await cbk()
196
+ successTip && ElMessage.success(successTip)
197
+ })
198
+ .catch(() => null)
199
+ }
@@ -1,10 +0,0 @@
1
- {
2
- "recommendations": [
3
- "vue.volar",
4
- "rome.rome",
5
- "obkoro1.korofileheader",
6
- "vue.vscode-typescript-vue-plugin",
7
- "antfu.unocss",
8
- "voorjaar.windicss-intellisense"
9
- ]
10
- }
@@ -1,108 +0,0 @@
1
- {
2
- "list-add-admin": {
3
- "prefix": "list-add",
4
- "body": [
5
- "<route lang=\"yaml\">",
6
- "meta:",
7
- " title: $1",
8
- " authPath: $2",
9
- "</route>",
10
- "",
11
- "<script lang=\"ts\" setup>",
12
- "import { useFormMode, YoungDialog, YoungPagination, YoungTable, YoungSelect } from '@bluesyoung/ui-vue3-element-plus';",
13
- "import type { TableHeadItem, TableDataItem, SelectOptionItem } from '@bluesyoung/ui-vue3-element-plus';",
14
- "import { deepClone } from '@bluesyoung/utils';",
15
- "import { $3 } from '@/typings';",
16
- "import { apis } from '@/modules/3-net';",
17
- "",
18
- "interface Form extends $3 {};",
19
- "const FORM_TEMP: Form = {};",
20
- "const {",
21
- " isAdd,",
22
- " isEdit,",
23
- " edit,",
24
- " del,",
25
- " sure,",
26
- " clear,",
27
- " form,",
28
- " formRef,",
29
- " validForm",
30
- "} = useFormMode<Form>(FORM_TEMP, {",
31
- " addCbk: async () => {",
32
- " const res = await validForm() as boolean;",
33
- " if (res) {",
34
- " const v = deepClone(form.value);",
35
- " // await apis.post.addUserItem(v);",
36
- " ElMessage.success('新增成功!');",
37
- " }",
38
- " return res;",
39
- " },",
40
- " modCbk: async () => {",
41
- " const res = await validForm() as boolean;",
42
- " if (res) {",
43
- " const v = deepClone(form.value);",
44
- " // await apis.patch.changeUserItem(v);",
45
- " ElMessage.success('修改成功!');",
46
- " }",
47
- " return res;",
48
- " },",
49
- " delCbk: async (row) => {",
50
- " // await apis.delete.deleteUser(row.id.toString());",
51
- " ElMessage.success('删除成功!');",
52
- " query.pageNum = 1;",
53
- " },",
54
- " cgEffect: () => getList()",
55
- "});",
56
- "const tableHead: TableHeadItem<Form>[] = [",
57
- " { prop: '', label: '' },",
58
- "];",
59
- "interface Query extends BaseQuery {};",
60
- "const query = reactive<Query>({",
61
- " pageNum: 1,",
62
- " pageSize: 50,",
63
- " total: 0,",
64
- "});",
65
- "",
66
- "const tableData = ref<TableDataItem<Form>[]>([]);",
67
- "const getList = async () => {",
68
- " // const { list, pageNum, pageSize, total } = await apis.get.getUserList(query);",
69
- " // tableData.value = deepClone(list || []);",
70
- " // query.pageNum = +pageNum || 1;",
71
- " // query.pageSize = +pageSize || 50;",
72
- " // query.total = +total || 0;",
73
- "};",
74
- "",
75
- "getList();",
76
- "</script>",
77
- "",
78
- "<template>",
79
- " <div class=\"flex\">",
80
- " <div class=\"m-2\">",
81
- " <ElInput v-model=\"query.\" placeholder=\"请输入\" />",
82
- " </div>",
83
- " <div class=\"m-2\">",
84
- " <ElButton type=\"primary\" @click=\"getList\">搜索</ElButton>",
85
- " </div>",
86
- " <div class=\"m-2\">",
87
- " <ElButton type=\"success\" @click=\"isAdd = true\">添加</ElButton>",
88
- " </div>",
89
- " </div>",
90
- " <div class=\"m-2\">",
91
- " <YoungTable :table-data=\"tableData\" :table-head=\"tableHead\" :table-height=\"680\" />",
92
- " <YoungPagination v-show=\"query.total > 0\" v-model:page=\"query.pageNum\" v-model:limit=\"query.pageSize\"",
93
- " :total=\"query.total\" @page-change=\"getList\" />",
94
- " </div>",
95
- " <YoungDialog :is-add=\"isAdd\" :is-edit=\"isEdit\" width=\"520px\" @sure=\"sure\" @clear=\"clear\">",
96
- " <template #body>",
97
- " <ElForm ref=\"formRef\" :model=\"form\" label-width=\"100px\">",
98
- " <ElFormItem label=\"\" prop=\"\">",
99
- " <ElInput v-model=\"form.\" class=\"!w-300px\" />",
100
- " </ElFormItem>",
101
- " </ElForm>",
102
- " </template>",
103
- " </YoungDialog>",
104
- "</template>",
105
- ],
106
- "description": "list-add-admin"
107
- }
108
- }
@@ -1,72 +0,0 @@
1
- {
2
- "list-export-admin": {
3
- "prefix": "list-export",
4
- "body": [
5
- "<route lang=\"yaml\">",
6
- "meta:",
7
- " title: $1",
8
- " authPath: $2",
9
- "</route>",
10
- "",
11
- "<script lang=\"ts\" setup>",
12
- "import { YoungTable, YoungPagination} from '@bluesyoung/ui-vue3-element-plus';",
13
- "import type { TableDataItem, TableHeadItem } from '@bluesyoung/ui-vue3-element-plus';",
14
- "import type { $3 } from '@/typings';",
15
- "import { apis } from '@/modules/3-net';",
16
- "",
17
- "interface Form extends $3 {};",
18
- "",
19
- "const tableHead: TableHeadItem<Form>[] = [",
20
- " { prop: '', label: '' },",
21
- "];",
22
- "const tableData = ref<TableDataItem<Form>[]>([]);",
23
- "",
24
- "type Query = BaseQuery & Partial<Form>;",
25
- "const query = reactive<Query>({",
26
- " pageNum: 1,",
27
- " pageSize: 10,",
28
- " total: 0,",
29
- "});",
30
- "",
31
- "const getList = async () => {",
32
- " // const { list, pageNum, pageSize, total } = await apis.get.getApiList(query);",
33
- " // tableData.value = deepClone(list || []);",
34
- " // query.pageNum = +pageNum || 1;",
35
- " // query.pageSize = +pageSize || 50;",
36
- " // query.total = +total || 0;",
37
- "};",
38
- "",
39
- "const exportHandler = async () => {",
40
- " const { useExport2Excel } = await import('@bluesyoung/ui-vue3-element-plus');",
41
- " await useExport2Excel({",
42
- " filename: '数据导出',",
43
- " tableHead: tableHead,",
44
- " tableData: tableData.value",
45
- " });",
46
- "};",
47
- "",
48
- "getList();",
49
- "</script>",
50
- "",
51
- "<template>",
52
- " <div class=\"flex\">",
53
- " <div class=\"m-2\">",
54
- " <ElInput v-model=\"query.\" placeholder=\"请输入\" />",
55
- " </div>",
56
- " <div class=\"m-2\">",
57
- " <ElButton type=\"primary\" @click=\"getList\">搜索</ElButton>",
58
- " </div>",
59
- " <div class=\"m-2\">",
60
- " <ElButton :disabled=\"tableData.length <= 0\" type=\"success\" @click=\"exportHandler\">导出</ElButton>",
61
- " </div>",
62
- " </div>",
63
- " <div class=\"m-2\">",
64
- " <YoungTable :table-data=\"tableData\" :table-head=\"tableHead\" :table-height=\"680\" />",
65
- " <YoungPagination v-model:page=\"query.pageNum\" v-model:limit=\"query.pageSize\" :total=\"query.total\"",
66
- " @page-change=\"getList\" />",
67
- " </div>",
68
- "</template>"
69
- ],
70
- "description": "list-export-admin"
71
- }
72
- }
@@ -1,61 +0,0 @@
1
- {
2
- "list-admin": {
3
- "prefix": "list",
4
- "body": [
5
- "<route lang=\"yaml\">",
6
- "meta:",
7
- " title: $1",
8
- " authPath: $2",
9
- "</route>",
10
- "",
11
- "<script lang=\"ts\" setup>",
12
- "import { YoungPagination, YoungTable } from '@bluesyoung/ui-vue3-element-plus';",
13
- "import type { TableHeadItem, TableDataItem } from '@bluesyoung/ui-vue3-element-plus';",
14
- "import { deepClone } from '@bluesyoung/utils';",
15
- "import { $3 } from '@/typings';",
16
- "import { apis } from '@/modules/3-net';",
17
- "",
18
- "interface Form extends $3 { };",
19
- "",
20
- "const tableHead: TableHeadItem<Form>[] = [",
21
- " { prop: '', label: '' },",
22
- "];",
23
- "interface Query extends BaseQuery {};",
24
- "const query = reactive<Query>({",
25
- " pageNum: 1,",
26
- " pageSize: 50,",
27
- " total: 0,",
28
- "});",
29
- "",
30
- "const tableData = ref<TableDataItem<Form>[]>([]);",
31
- "const roleList = ref<SelectOptionItem[]>([]);",
32
- "const getList = async () => {",
33
- " // const { list, pageNum, pageSize, total } = await apis.get.getUserList(query);",
34
- " // tableData.value = deepClone(list || []);",
35
- " // query.pageNum = +pageNum || 1;",
36
- " // query.pageSize = +pageSize || 50;",
37
- " // query.total = +total || 0;",
38
- "};",
39
- "",
40
- "getList();",
41
- "</script>",
42
- "",
43
- "<template>",
44
- " <div class=\"flex\">",
45
- " <div class=\"m-2\">",
46
- " <ElInput v-model=\"query.\" placeholder=\"请输入\" />",
47
- " </div>",
48
- " <div class=\"m-2\">",
49
- " <ElButton type=\"primary\" @click=\"getList\">搜索</ElButton>",
50
- " </div>",
51
- " </div>",
52
- " <div class=\"m-2\">",
53
- " <YoungTable :table-data=\"tableData\" :table-head=\"tableHead\" :table-height=\"680\" />",
54
- " <YoungPagination v-show=\"query.total > 0\" v-model:page=\"query.pageNum\" v-model:limit=\"query.pageSize\" :total=\"query.total\"",
55
- " @page-change=\"getList\" />",
56
- " </div>",
57
- "</template>",
58
- ],
59
- "description": "list-admin"
60
- }
61
- }
@@ -1,7 +0,0 @@
1
- {
2
- "editor.formatOnSave": true,
3
- "editor.defaultFormatter": "rome.rome",
4
- "[vue]": {
5
- "editor.defaultFormatter": "Vue.volar"
6
- }
7
- }
@@ -1,42 +0,0 @@
1
- # 拉取基础镜像
2
- FROM node:18-alpine as builder
3
-
4
- # 维护者
5
- MAINTAINER BluesYoung "bluesyoung_web@163.com"
6
-
7
- # 工作目录
8
- WORKDIR /app
9
-
10
- # 没有压缩包,首选 COPY,如果需要自动解包或下载,则使用 ADD
11
-
12
- # 对比依赖是否变更
13
- COPY package.json yarn.lock /app/
14
-
15
- # 设置npm仓库 + 下载依赖,上面的文件如果没有变化则跳过下载,直接使用缓存
16
- RUN npm config set registry https://registry.npmmirror.com && \
17
- yarn config set registry https://registry.npmmirror.com && \
18
- yarn
19
-
20
- # 加入代码
21
- COPY . /app
22
- # 打包
23
- RUN yarn build
24
-
25
- # 打包完成,构建最终的极简镜像
26
- FROM node:18-alpine
27
-
28
- # 工作目录
29
- WORKDIR /app
30
-
31
- # 复制运行需要的文件[及依赖]
32
- # 直接复制源代码
33
- COPY boot.mjs /app/
34
- COPY config /app/config
35
- # 复制上一步的打包产物
36
- COPY --from=builder /app/.output /app/.output
37
-
38
- # 暴露指定的端口号,暂不需要
39
- # EXPOSE 3001
40
-
41
- # 启动容器时运行的命令
42
- ENTRYPOINT ["node", "boot.mjs"]
@@ -1,75 +0,0 @@
1
- # 后台模板
2
-
3
- ## 用户代码片段(页面模板)
4
-
5
- 模板 | 触发关键字
6
- --- | ---
7
- 基础列表 | `list`
8
- 列表 + `Excel` 导出 | `list-export`
9
- 列表 + 弹出层 | `list-add`
10
-
11
- ## **Docker 部署**
12
-
13
- - 同一份代码,可以根据运行时的环境变量决定具体表现
14
- - `node` 服务:
15
- - 托管前端静态资源
16
- - 根据环境变量读取对应的配置文件,并以接口的形式暴露给前端
17
- - 跨域接口代理
18
-
19
- 环境变量
20
-
21
- ```sh
22
- # 部署环境 dev | test | online
23
- DEPLOY_ENV=dev
24
- # DEPLOY_ENV=test
25
- # DEPLOY_ENV=online
26
- # node 服务监听的端口号
27
- LISTEN_PORT=3000
28
- # 网关主机地址
29
- # APIGATEHOST='apisix.intranet.cn'
30
- ```
31
-
32
- ### 本地开发
33
-
34
- **确保上述的环境变量存在**
35
-
36
- 启动服务端程序 `yarn dev:server`
37
-
38
- 启动客户端程序 `yarn dev`
39
-
40
- ### 打包预览
41
-
42
- `yarn build`
43
-
44
- 确保上述的环境变量存在
45
-
46
- `node boot.mjs`
47
-
48
- ### 配置文件
49
-
50
- 存放于 `config` 目录下的 `.${env}rc` 文件,`env` 为对应的环境标识
51
-
52
- ## 常规部署
53
-
54
- - `nginx` 托管前端静态资源
55
- - 每次打包时读取环境变量,打包完成之后不可变
56
- - 使用 `nginx` 代理跨域
57
-
58
- 环境变量
59
-
60
- ```sh
61
- # 设置静态部署
62
- VITE_USE_DEFAULT_DEPLOY_METHOD=true
63
- # 其他的环境变量,根据环境区分
64
- VITE_TITLE=管理后台
65
- ```
66
-
67
- ### 本地开发
68
-
69
- 确保上述的环境变量存在,然后 `yarn dev` 即可
70
-
71
- ### 打包预览
72
-
73
- `yarn build`
74
-
75
- `yarn preview`
@@ -1,8 +0,0 @@
1
- # 部署环境 dev | test | online
2
- DEPLOY_ENV=dev
3
- # DEPLOY_ENV=test
4
- # DEPLOY_ENV=online
5
- # node 服务监听的端口号
6
- LISTEN_PORT=3000
7
- # 网关主机地址
8
- # APIGATEHOST='apisix.intranet.cn'
@@ -1,30 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- dist
12
- dist-ssr
13
- *.local
14
- .env
15
-
16
- # Editor directories and files
17
- .vscode/*
18
- !.vscode/extensions.json
19
- !.vscode/settings.json
20
- !.vscode/*.code-snippets
21
- .idea
22
- .DS_Store
23
- *.suo
24
- *.ntvs*
25
- *.njsproj
26
- *.sln
27
- *.sw?
28
-
29
- .nitro
30
- .output
@@ -1,16 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2022-09-16 11:48:05
4
- * @LastEditTime: 2022-12-29 16:21:59
5
- * @Description:
6
- */
7
- (async () => {
8
- const env = process.env.DEPLOY_ENV;
9
- const listenPort = process.env.LISTEN_PORT || 3003;
10
- console.log('当前环境:', env);
11
- console.log('服务监听端口:', listenPort);
12
-
13
- process.env.NITRO_PORT = listenPort;
14
-
15
- await import('./.output/server/index.mjs');
16
- })();
@@ -1,57 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2023-01-10 14:43:13
4
- * @LastEditTime: 2023-05-18 15:55:37
5
- * @Description:
6
- */
7
- import { networkInterfaces } from 'node:os';
8
-
9
- function getLocalIP(): string | undefined {
10
- const ips = networkInterfaces();
11
-
12
- function isPrivateIP(ip: string) {
13
- return (
14
- /^192\.168\.\d{1,3}\.\d{1,3}$/.test(ip) ||
15
- /^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(ip) ||
16
- /^172\.(1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}$/.test(ip)
17
- );
18
- }
19
-
20
- for (const name of Object.keys(ips)) {
21
- const networkInterface = ips[name];
22
-
23
- for (const interfaceInfo of networkInterface) {
24
- if (
25
- interfaceInfo.family === 'IPv4' &&
26
- !interfaceInfo.internal &&
27
- isPrivateIP(interfaceInfo.address)
28
- ) {
29
- return interfaceInfo.address;
30
- }
31
- }
32
- }
33
-
34
- return '127.0.0.1';
35
- }
36
-
37
- const virtualModuleId = 'virtual:local-server';
38
- export const localServer = `http://${getLocalIP()}:3000`;
39
-
40
- /**
41
- * 获取本机 ip 地址,拼接开发时的服务地址
42
- */
43
- export const serverPlugin = () => {
44
- return {
45
- name: 'local-server',
46
- resolveId(id) {
47
- if (id === virtualModuleId) {
48
- return virtualModuleId;
49
- }
50
- },
51
- load(id) {
52
- if (id === virtualModuleId) {
53
- return `export const server = '${localServer}';`;
54
- }
55
- },
56
- };
57
- };
@@ -1,7 +0,0 @@
1
- /*
2
- * @Author: zhangyang
3
- * @Date: 2023-01-10 14:46:42
4
- * @LastEditTime: 2023-01-10 14:46:43
5
- * @Description:
6
- */
7
- export * from './plugins';