create-young-proj 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,159 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2023-11-08 15:46:58
4
+ * @LastEditTime: 2023-11-27 11:18:38
5
+ * @Description:
6
+ */
7
+ import { defineConfig } from 'vitepress'
8
+
9
+ // https://vitepress.dev/reference/site-config
10
+ export default defineConfig({
11
+ title: '前端知识库',
12
+ description: '多种实用工具,满足不同需求',
13
+ lang: 'zh-CN',
14
+ locales: {
15
+ root: {
16
+ label: '简体中文',
17
+ lang: 'zh',
18
+ }
19
+ },
20
+ base: '/wlb/fe/',
21
+ lastUpdated: true,
22
+ themeConfig: {
23
+ search: {
24
+ provider: 'local',
25
+ options: {
26
+ detailedView: true,
27
+ translations: {
28
+ button: {
29
+ buttonText: '搜索文档',
30
+ buttonAriaLabel: '搜索文档'
31
+ },
32
+ modal: {
33
+ noResultsText: '无法找到相关结果',
34
+ resetButtonTitle: '清除查询条件',
35
+ displayDetails: '显示详细信息',
36
+ footer: {
37
+ selectText: '选择',
38
+ navigateText: '切换',
39
+ closeText: '关闭'
40
+ }
41
+ }
42
+ },
43
+ }
44
+ },
45
+
46
+ // https://vitepress.dev/reference/default-theme-config
47
+ nav: [
48
+ { text: '快速开始', link: '/newer' },
49
+ { text: '通用知识', link: '/common/dev-env', activeMatch: '^/common/' },
50
+ ],
51
+
52
+ docFooter: {
53
+ prev: '上一篇',
54
+ next: '下一篇',
55
+ },
56
+
57
+ outline: {
58
+ label: '本页目录',
59
+ },
60
+
61
+ lastUpdatedText: '最后更新时间',
62
+
63
+ sidebarMenuLabel: '菜单',
64
+
65
+ footer: {
66
+ message: 'Released under the MIT License.',
67
+ copyright: 'Copyright © 2023-PRESENT BluesYoung-web',
68
+ },
69
+
70
+ sidebar: {
71
+ '/': [
72
+ {
73
+ text: '快速开始',
74
+ items: [
75
+ { text: '新人必读', link: '/newer' },
76
+ { text: '前端规范', link: '/standards' },
77
+ { text: '常见问题及解决方案', link: '/problems' },
78
+ ]
79
+ },
80
+ {
81
+ text: '通用知识',
82
+ base: '/common/',
83
+ items: [
84
+ { text: '1. 开发环境', link: 'dev-env' },
85
+ { text: '2. 开发必备知识点', link: 'basic-knowledge' },
86
+ { text: '3. 常用 vite 插件', link: 'vite-plugin' },
87
+ ]
88
+ },
89
+ {
90
+ text: '项目脚手架与模板介绍',
91
+ base: '/templates/',
92
+ items: [
93
+ { text: '1. 使用方法', link: 'how-to-use' },
94
+ { text: '2. template-nuxt-admin', link: 'nuxt-admin' },
95
+ { text: '3. template-nuxt-website', link: 'nuxt-website' },
96
+ { text: '4. template-uni-app', link: 'uni-app' },
97
+ { text: '5. template-vue-thin', link: 'vue-thin' },
98
+ { text: '6. template-vue-mobile', link: 'vue-mobile' },
99
+ { text: '7. template-admin-server', link: 'admin-server' },
100
+ ]
101
+ },
102
+ {
103
+ text: '项目部署',
104
+ items: [
105
+ { text: '使用 Docker 部署项目', link: '/common/project-deploy' },
106
+ ]
107
+ },
108
+ ],
109
+ '/libs/': [
110
+ {
111
+ text: '开源',
112
+ base: '/libs/public/',
113
+ items: [
114
+ { text: 'ui-vue3-element-plus', link: 'ui-vue3-element-plus' },
115
+ { text: 'http', link: 'http' },
116
+ { text: 'logger', link: 'logger' },
117
+ { text: 'rpc', link: 'rpc' },
118
+ { text: 'ui-vue3', link: 'ui-vue3' },
119
+ ],
120
+ collapsed: true
121
+ },
122
+ {
123
+ text: '内部',
124
+ base: '/libs/private/',
125
+ items: [
126
+ { text: '来游戏平台-通行证 JSSDK', link: 'lyx-js-sdk' },
127
+ { text: '悬浮球', link: 'young-float-ball' },
128
+ ]
129
+ }
130
+ ],
131
+ },
132
+
133
+ socialLinks: [
134
+ {
135
+ icon: {
136
+ svg: '<svg xmlns="http://www.w3.org/2000/svg" width="1.09em" height="1em" viewBox="0 0 256 236"><path fill="#E24329" d="m128.075 236.075l47.104-144.97H80.97l47.104 144.97Z"/><path fill="#FC6D26" d="M128.075 236.074L80.97 91.104H14.956l113.119 144.97Z"/><path fill="#FCA326" d="M14.956 91.104L.642 135.16a9.752 9.752 0 0 0 3.542 10.903l123.891 90.012l-113.12-144.97Z"/><path fill="#E24329" d="M14.956 91.105H80.97L52.601 3.79c-1.46-4.493-7.816-4.492-9.275 0l-28.37 87.315Z"/><path fill="#FC6D26" d="m128.075 236.074l47.104-144.97h66.015l-113.12 144.97Z"/><path fill="#FCA326" d="m241.194 91.104l14.314 44.056a9.752 9.752 0 0 1-3.543 10.903l-123.89 90.012l113.119-144.97Z"/><path fill="#E24329" d="M241.194 91.105h-66.015l28.37-87.315c1.46-4.493 7.816-4.492 9.275 0l28.37 87.315Z"/></svg>'
137
+ },
138
+ link: 'gitlab仓库的完整地址',
139
+ },
140
+ ],
141
+
142
+ editLink: {
143
+ pattern: 'https://gitlab地址/-/ide/project/此处换成仓库的具体路径/edit/master/-/:path',
144
+ text: '在 gitlab 上编辑此页'
145
+ }
146
+ },
147
+ head: [
148
+ ['link', { rel: 'icon', href: 'https://api.iconify.design/noto:rocket.svg?color=%2312b2e7' }]
149
+ ],
150
+ markdown: {
151
+ container: {
152
+ tipLabel: '提示',
153
+ warningLabel: '注意',
154
+ dangerLabel: '警告',
155
+ detailsLabel: '详细信息',
156
+ infoLabel: '信息',
157
+ }
158
+ },
159
+ })
@@ -0,0 +1,26 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2023-11-08 16:14:48
4
+ * @LastEditTime: 2023-11-08 16:39:59
5
+ * @Description:
6
+ */
7
+ // https://vitepress.dev/guide/custom-theme
8
+ import { h } from 'vue'
9
+ import type { Theme } from 'vitepress'
10
+ import DefaultTheme from 'vitepress/theme'
11
+ import './style.css'
12
+ import HomePage from '../components/HomePage.vue'
13
+ import 'uno.css'
14
+
15
+ export default {
16
+ extends: DefaultTheme,
17
+ Layout: () => {
18
+ return h(DefaultTheme.Layout, null, {
19
+ // https://vitepress.dev/guide/extending-default-theme#layout-slots
20
+ 'home-features-after': () => h(HomePage),
21
+ })
22
+ },
23
+ enhanceApp({ app, router, siteData }) {
24
+ // ...
25
+ }
26
+ } satisfies Theme
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Customize default theme styling by overriding CSS variables:
3
+ * https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
4
+ */
5
+
6
+ /**
7
+ * Colors
8
+ *
9
+ * Each colors have exact same color scale system with 3 levels of solid
10
+ * colors with different brightness, and 1 soft color.
11
+ *
12
+ * - `XXX-1`: The most solid color used mainly for colored text. It must
13
+ * satisfy the contrast ratio against when used on top of `XXX-soft`.
14
+ *
15
+ * - `XXX-2`: The color used mainly for hover state of the button.
16
+ *
17
+ * - `XXX-3`: The color for solid background, such as bg color of the button.
18
+ * It must satisfy the contrast ratio with pure white (#ffffff) text on
19
+ * top of it.
20
+ *
21
+ * - `XXX-soft`: The color used for subtle background such as custom container
22
+ * or badges. It must satisfy the contrast ratio when putting `XXX-1` colors
23
+ * on top of it.
24
+ *
25
+ * The soft color must be semi transparent alpha channel. This is crucial
26
+ * because it allows adding multiple "soft" colors on top of each other
27
+ * to create a accent, such as when having inline code block inside
28
+ * custom containers.
29
+ *
30
+ * - `default`: The color used purely for subtle indication without any
31
+ * special meanings attched to it such as bg color for menu hover state.
32
+ *
33
+ * - `brand`: Used for primary brand colors, such as link text, button with
34
+ * brand theme, etc.
35
+ *
36
+ * - `tip`: Used to indicate useful information. The default theme uses the
37
+ * brand color for this by default.
38
+ *
39
+ * - `warning`: Used to indicate warning to the users. Used in custom
40
+ * container, badges, etc.
41
+ *
42
+ * - `danger`: Used to show error, or dangerous message to the users. Used
43
+ * in custom container, badges, etc.
44
+ * -------------------------------------------------------------------------- */
45
+
46
+ :root {
47
+ --vp-c-default-1: var(--vp-c-gray-1);
48
+ --vp-c-default-2: var(--vp-c-gray-2);
49
+ --vp-c-default-3: var(--vp-c-gray-3);
50
+ --vp-c-default-soft: var(--vp-c-gray-soft);
51
+
52
+ --vp-c-brand-1: var(--vp-c-indigo-1);
53
+ --vp-c-brand-2: var(--vp-c-indigo-2);
54
+ --vp-c-brand-3: var(--vp-c-indigo-3);
55
+ --vp-c-brand-soft: var(--vp-c-indigo-soft);
56
+
57
+ --vp-c-tip-1: var(--vp-c-brand-1);
58
+ --vp-c-tip-2: var(--vp-c-brand-2);
59
+ --vp-c-tip-3: var(--vp-c-brand-3);
60
+ --vp-c-tip-soft: var(--vp-c-brand-soft);
61
+
62
+ --vp-c-warning-1: var(--vp-c-yellow-1);
63
+ --vp-c-warning-2: var(--vp-c-yellow-2);
64
+ --vp-c-warning-3: var(--vp-c-yellow-3);
65
+ --vp-c-warning-soft: var(--vp-c-yellow-soft);
66
+
67
+ --vp-c-danger-1: var(--vp-c-red-1);
68
+ --vp-c-danger-2: var(--vp-c-red-2);
69
+ --vp-c-danger-3: var(--vp-c-red-3);
70
+ --vp-c-danger-soft: var(--vp-c-red-soft);
71
+ }
72
+
73
+ /**
74
+ * Component: Button
75
+ * -------------------------------------------------------------------------- */
76
+
77
+ :root {
78
+ --vp-button-brand-border: transparent;
79
+ --vp-button-brand-text: var(--vp-c-white);
80
+ --vp-button-brand-bg: var(--vp-c-brand-3);
81
+ --vp-button-brand-hover-border: transparent;
82
+ --vp-button-brand-hover-text: var(--vp-c-white);
83
+ --vp-button-brand-hover-bg: var(--vp-c-brand-2);
84
+ --vp-button-brand-active-border: transparent;
85
+ --vp-button-brand-active-text: var(--vp-c-white);
86
+ --vp-button-brand-active-bg: var(--vp-c-brand-1);
87
+ }
88
+
89
+ /**
90
+ * Component: Home
91
+ * -------------------------------------------------------------------------- */
92
+
93
+ :root {
94
+ --vp-home-hero-name-color: transparent;
95
+ --vp-home-hero-name-background: -webkit-linear-gradient(
96
+ 120deg,
97
+ #bd34fe 30%,
98
+ #41d1ff
99
+ );
100
+
101
+ --vp-home-hero-image-background-image: linear-gradient(
102
+ -45deg,
103
+ #bd34fe 50%,
104
+ #47caff 50%
105
+ );
106
+ --vp-home-hero-image-filter: blur(44px);
107
+ }
108
+
109
+ @media (min-width: 640px) {
110
+ :root {
111
+ --vp-home-hero-image-filter: blur(56px);
112
+ }
113
+ }
114
+
115
+ @media (min-width: 960px) {
116
+ :root {
117
+ --vp-home-hero-image-filter: blur(68px);
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Component: Custom Block
123
+ * -------------------------------------------------------------------------- */
124
+
125
+ :root {
126
+ --vp-custom-block-tip-border: transparent;
127
+ --vp-custom-block-tip-text: var(--vp-c-text-1);
128
+ --vp-custom-block-tip-bg: var(--vp-c-brand-soft);
129
+ --vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
130
+ }
131
+
132
+ /**
133
+ * Component: Algolia
134
+ * -------------------------------------------------------------------------- */
135
+
136
+ .DocSearch {
137
+ --docsearch-primary-color: var(--vp-c-brand-1) !important;
138
+ }
139
+
@@ -0,0 +1,41 @@
1
+ # 拉取基础镜像
2
+ FROM intranet-harbor.laiyouxi.com/base/alpine/node:20.9.0 as builder
3
+ # 添加部分元数据,暂无意义
4
+ LABEL vendor="Lyx-yunwei" \
5
+ com.example.release-date="2022-11-10" \
6
+ com.example.version.is-production="false"
7
+
8
+ # 维护者
9
+ MAINTAINER BluesYoung "bluesyoung_web@163.com"
10
+ # 配置环境变量
11
+ ENV WORK_DIR=/app
12
+
13
+ # 工作目录
14
+ WORKDIR /app
15
+
16
+ # 没有压缩包,首选 COPY,如果需要自动解包或下载,则使用 ADD
17
+
18
+ # 对比依赖是否变更
19
+ COPY package.json yarn.lock /app/
20
+
21
+ # 设置npm仓库 + 下载依赖,上面的文件如果没有变化则跳过下载,直接使用缓存
22
+ RUN npm config set registry https://registry.npmmirror.com && \
23
+ yarn config set registry https://registry.npmmirror.com && \
24
+ yarn
25
+
26
+ # 加入代码
27
+ COPY . /app
28
+ # 打包
29
+ RUN yarn build
30
+
31
+ # 打包完成,构建最终的极简镜像
32
+ FROM intranet-harbor.laiyouxi.com/base/alpine/node:20.9.0
33
+
34
+ WORKDIR /app
35
+ # 复制源码
36
+ COPY boot.mjs /app/
37
+ COPY config /app/config
38
+ # 复制编译后的代码
39
+ COPY --from=builder /app/.output /app/.output
40
+
41
+ ENTRYPOINT ["node", "boot.mjs"]
@@ -0,0 +1,102 @@
1
+ # template-vitepress
2
+
3
+ [![](https://img.shields.io/badge/Author-BluesYoung--web-blue)](https://gitee.com/BluesYoung-web)
4
+
5
+ ## 本地运行
6
+
7
+ ::: code-group
8
+ ```bash [yarn]
9
+ # 装依赖
10
+ yarn
11
+ # 运行
12
+ yarn dev
13
+ ```
14
+ ```bash [pnpm]
15
+ # 装依赖
16
+ pnpm i
17
+ # 运行
18
+ pnpm dev
19
+ ```
20
+ ```bash [bun]
21
+ # 装依赖
22
+ bun i
23
+ # 运行
24
+ bun dev
25
+ ```
26
+ ```bash [npm]
27
+ # 装依赖
28
+ npm i
29
+ # 运行
30
+ npm run dev
31
+ ```
32
+ :::
33
+
34
+ ## 到手之后需要自行调整的内容
35
+
36
+ ### `.vitepress/config.mts`
37
+
38
+ <TodoItem>seo 相关<code ml-1>title, description</code></TodoItem>
39
+
40
+ :::danger
41
+ <TodoItem>部署相关<code ml-1>base</code></TodoItem>
42
+
43
+ - 根路径部署就删掉,否则为部署的路径,**必须以 `/` 结尾**
44
+
45
+ - [官方文档](https://vitepress.dev/reference/site-config#base)
46
+ :::
47
+
48
+ <TodoItem><a href="https://vitepress.dev/reference/default-theme-nav" target="_blank">顶部导航</a> <code ml-1>themeConfig -> nav</code></TodoItem>
49
+
50
+ <TodoItem><a href="https://vitepress.dev/reference/default-theme-sidebar" target="_blank">侧边栏导航</a> <code ml-1>themeConfig -> sidebar</code></TodoItem>
51
+
52
+ <TodoItem>替换仓库地址 <code ml-1>themeConfig -> socialLinks -> link</code></TodoItem>
53
+
54
+ <TodoItem>替换仓库地址 <code ml-1>themeConfig -> editLink -> pattern</code></TodoItem>
55
+
56
+ ### `index.md`
57
+
58
+ <TodoItem>标题及描述 <code ml-1>hero -> [name, text, tagline]</code></TodoItem>
59
+
60
+ <TodoItem>快捷导航 <code ml-1>hero -> actions</code></TodoItem>
61
+
62
+ <TodoItem>特性介绍 <code ml-1>features</code></TodoItem>
63
+
64
+ ### 首页贡献者
65
+
66
+ `.vitepress/components/HomePage.vue -> teamMembers` 按需修改
67
+
68
+ :::info
69
+ 如果不需要展示,将 `.vitepress/theme/index.ts -> 'home-features-after'` 这一行注释即可
70
+ :::
71
+
72
+ ## 文档书写
73
+
74
+ ### 简介
75
+
76
+ 标题:`使用 # 符号表示标题,数量代表标题级别。例如:# 一级标题、## 二级标题`
77
+
78
+ 段落和换行:`段落之间使用空行分隔,要插入换行符,可以在行末添加两个空格`
79
+
80
+ 强调:`使用 * 或 _ 包围文本来斜体显示,使用两个 * 或 _ 包围文本来加粗显示。例如:*斜体文本*、**加粗文本**`
81
+
82
+ 列表:`使用 *、+ 或 - 开头创建无序列表,使用数字后跟句点创建有序列表。嵌套列表时缩进四个空格或一个制表符`
83
+
84
+ 链接:`使用 [显示文本](链接地址) 的格式创建链接。例如:[OpenAI](https://openai.com)`
85
+
86
+ 图片:`使用 ![替代文本](图片链接地址) 的格式插入图片。例如:![Logo](https://example.com/logo.png)`
87
+
88
+ 引用块:`使用 > 表示引用块。可以嵌套使用多个 > 表示多层引用`
89
+
90
+ 代码块:`使用三个反引号 ```` 或四个空格缩进来创建代码块。可以指定语言以进行语法高亮`
91
+
92
+ 水平线:`使用三个或更多连续的 -、* 或 _ 创建水平线分隔线`
93
+
94
+ 转义字符:`在特殊字符前添加反斜杠 \ 可以转义字符的原始含义`
95
+
96
+ ### 外部教程
97
+
98
+ [vitepress 扩展语法](https://vitepress.dev/guide/markdown)
99
+
100
+ [基础语法](https://www.markdownguide.org/basic-syntax/)
101
+
102
+ [中文技术文档的写作规范——阮一峰](https://github.com/ruanyf/document-style-guide)
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ *.log
3
+ cache
4
+ dist
5
+ .output
6
+ .nitro
@@ -0,0 +1,2 @@
1
+ shamefully-hoist=true
2
+ strict-peer-dependencies=false
@@ -0,0 +1 @@
1
+ 20.9.0
@@ -0,0 +1,17 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2022-09-16 11:48:05
4
+ * @LastEditTime: 2023-11-09 11:59:07
5
+ * @Description:
6
+ */
7
+ (async () => {
8
+ const env = process.env.DEPLOY_ENV || 'dev';
9
+ const listenPort = process.env.LISTEN_PORT || 3333;
10
+ console.log('当前环境:', env);
11
+ console.log('服务监听端口:', listenPort);
12
+
13
+ process.env.NITRO_PORT = listenPort;
14
+
15
+ await import('./.output/server/index.mjs');
16
+ })();
17
+
@@ -0,0 +1,53 @@
1
+ ---
2
+ # https://vitepress.dev/reference/default-theme-home-page
3
+ layout: home
4
+
5
+ hero:
6
+ name: 前端知识库
7
+ text: 知识共建,共创未来
8
+ tagline: 多种实用工具,满足不同需求
9
+ image:
10
+ src: https://api.iconify.design/noto:rocket.svg?color=%2312b2e7&width=320
11
+ actions:
12
+ - theme: brand
13
+ text: 快速开始
14
+ link: /newer
15
+ - theme: alt
16
+ text: 前端规范
17
+ link: /standards
18
+ - theme: alt
19
+ text: 常见问题及解决方案
20
+ link: /problems
21
+
22
+ features:
23
+ - title: '@bluesyoung/ui-vue3-element-plus'
24
+ icon: <span class="i-ep-element-plus text-[#409eff]"></span>
25
+ details: 基于 element-plus 二次封装的常用组件库
26
+ link: /libs/public/ui-vue3-element-plus
27
+
28
+ - title: '@bluesyoung/http'
29
+ icon: <span class="i-logos-lighttpd"></span>
30
+ details: 基于 axios 封装的 http 请求库, 拥有完善的 TS 类型提示, 支持 web/微信小程序
31
+ link: /libs/public/http
32
+
33
+ - title: '@bluesyoung/utils'
34
+ icon: <span class="i-tabler-tools text-[#409eff]"></span>
35
+ details: 常用工具函数
36
+ link: https://gitee.com/-/ide/project/BluesYoung-web/young/edit/master/-/packages/utils/dist/index.d.ts
37
+
38
+ - title: '@bluesyoung/logger'
39
+ icon: <span class="i-vscode-icons-file-type-log"></span>
40
+ details: 基于 consola 封装的日志工具, 默认格式化为容器部署要求的格式, 并保留了扩充能力
41
+ link: /libs/public/logger
42
+
43
+ - title: '@bluesyoung/rpc'
44
+ icon: <span class="i-simple-icons-trpc text-[#409eff]"></span>
45
+ details: 页面与其嵌套的 iframe 或由其打开的子页面之间进行通信
46
+ link: /libs/public/rpc
47
+
48
+ - title: '@bluesyoung/ui-vue3'
49
+ icon: <span class="i-logos-vue"></span>
50
+ details: 基于 vue3 + @vueuse/core 封装的组件,无额外的依赖
51
+ link: /libs/public/ui-vue3
52
+ ---
53
+
@@ -0,0 +1,19 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2022-12-28 11:59:56
4
+ * @LastEditTime: 2023-11-14 09:18:38
5
+ * @Description:
6
+ */
7
+ export default defineNitroConfig({
8
+ /**
9
+ * 托管前端静态资源
10
+ */
11
+ serveStatic: 'node',
12
+ publicAssets: [
13
+ {
14
+ dir: '.vitepress/dist',
15
+ },
16
+ ],
17
+ preset: 'bun'
18
+ });
19
+
@@ -0,0 +1,26 @@
1
+ {
2
+ "scripts": {
3
+ "dev": "vitepress dev",
4
+ "docs:dev": "vitepress dev",
5
+ "docs:build": "vitepress build",
6
+ "docs:preview": "vitepress preview",
7
+ "build": "vitepress build && nitropack build",
8
+ "postinstall": "nitropack prepare"
9
+ },
10
+ "devDependencies": {
11
+ "@iconify/json": "^2.2.139",
12
+ "@types/md5": "^2.3.5",
13
+ "@types/node": "20",
14
+ "nitropack": "^2.7.2",
15
+ "pathe": "^1.1.1",
16
+ "unocss": "^0.57.2",
17
+ "unplugin-vue-components": "^0.25.2",
18
+ "vitepress": "^1.0.0-rc.25",
19
+ "vue": "^3.3.8"
20
+ },
21
+ "dependencies": {
22
+ "c12": "^1.5.1",
23
+ "md5": "^2.3.0"
24
+ },
25
+ "version": "1.0.0"
26
+ }