Skip to content

Commit fce95d0

Browse files
committed
docs: update post
1 parent 44fa52f commit fce95d0

File tree

3 files changed

+113
-7
lines changed

3 files changed

+113
-7
lines changed

post/deploy/docker-env-install.md

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ docker network ls
238238
minio 的 `docker-compose.yml`
239239

240240
```yaml
241-
name: 'minio'
241+
name: "minio"
242242
services:
243243
minio:
244244
networks:
@@ -534,7 +534,7 @@ jobs:
534534
- 停止容器,删除容器
535535
- 停止镜像,删除镜像
536536

537-
为什么写了一大堆呢?其实就是 `git pull` 拉取代码失败后的重试机制,因为众所周知的问题,拉取 github 的代码经常失败(当时傻Ⅹ买了台国内服务器,结果自讨苦吃)
537+
为什么写了一大堆呢?其实就是 `git pull` 拉取代码失败后的重试机制,因为众所周知的问题,拉取 github 的代码经常失败(当时傻 Ⅹ 买了台国内服务器,结果自讨苦吃)
538538

539539
### Nextjs 开发中的踩坑
540540

@@ -562,7 +562,7 @@ http 没法访问 https,目前这里有两种方法
562562

563563
## Postgresql
564564

565-
先上 dockerc-compose.yml 文件
565+
先上 `docker-compose.yml` 文件
566566

567567
```yaml
568568
services:
@@ -571,14 +571,14 @@ services:
571571
container_name: postgres
572572
environment:
573573
POSTGRES_USER: postgres # 管理员用户不设置默认 postgres
574-
POSTGRES_PASSWORD: xxxxx # 密码
574+
POSTGRES_PASSWORD: 123456 # 密码
575575
ports:
576-
- '5432:5432'
576+
- "5432:5432"
577577
volumes:
578578
- ./data:/var/lib/postgresql/data
579579
restart: always
580580
healthcheck:
581-
test: ['CMD-SHELL', 'pg_isready -U postgres']
581+
test: ["CMD-SHELL", "pg_isready -U postgres"]
582582
interval: 5s
583583
timeout: 5s
584584
retries: 5
@@ -629,3 +629,41 @@ volumes:
629629
### 最终展示
630630

631631
![image](https://jsonq.top/cdn-static/2025/05/03/202505032216843.png)
632+
633+
## Redis
634+
635+
```yaml
636+
services:
637+
redis:
638+
image: redis:7-alpine
639+
container_name: redis
640+
ports:
641+
- "6379:6379"
642+
volumes:
643+
- ./data:/data
644+
- ./redis.conf:/usr/local/etc/redis/redis.conf
645+
- ./logs:/logs
646+
restart: always
647+
648+
volumes:
649+
redis_data:
650+
```
651+
652+
## Mysql
653+
654+
```yaml
655+
services:
656+
mysql:
657+
image: mysql:8
658+
container_name: mysql
659+
ports:
660+
- "3306:3306"
661+
environment:
662+
- MYSQL_ROOT_PASSWORD=123456
663+
- TZ=Asia/Shanghai
664+
volumes:
665+
- ./log:/var/log/mysql
666+
- ./data:/var/lib/mysql
667+
- ./conf.d:/etc/mysql/conf.d
668+
restart: always
669+
```

post/deploy/docker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ docker pull hub.uuuadc.top/library/mysql:5.7
140140
- docker logs : 查看容器日志
141141
- docker exec: 进入容器
142142
- docker rm : 删除容器
143-
- dokcer rmi : 删除镜像
143+
- docker rmi : 删除镜像
144144

145145
其中 `docker run``docker exec` 相对操作较为复杂,详细命令使用 `docker run --help` 查看
146146

post/other/use-npm-publish-pkg.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: 如何发布一个 npm 包
3+
date: 2025-10-22
4+
---
5+
6+
1.[npm](https://www.npmjs.com) 创建账号,如果提示需要 2FA 认证,可以去完善,选择第一个(第二个是扫码什么的,不会弄)
7+
8+
![image](https://jsonq.top/cdn-static/2025/10/22/202510221043357.png)
9+
10+
2. 新建一个项目,写点内容
11+
3. 补充 `package.json`
12+
13+
```json
14+
{
15+
"name": "my-package", // 包名,名字不能重复
16+
"description": "this is a description",
17+
"keywords": ["keyword1", "keyword2"],
18+
"version": "0.0.1", // 版本号
19+
"type": "module",
20+
"license": "MIT",
21+
"repository": {
22+
"type": "git",
23+
"url": "git+https://github.com/xxx.git"
24+
},
25+
"homepage": "https://github.com/xxx",
26+
"types": "./es/index.d.ts",
27+
// 如果你提供了 commonjs 的包,那就需要添加 exports 字段并补充 require 的文件指向,如果纯 esm 包可省略
28+
"exports": {
29+
".": {
30+
"types": "./es/index.d.ts",
31+
"import": "./es/index.js"
32+
}
33+
},
34+
// 告诉 npm 包,哪些文件需要发布,npm 会默认发布 package.json README.md LICENSE
35+
"files": ["dist", "es"],
36+
// 表明你的代码是否存在副作用 一般纯 js 包没有副作用 可以被构建工具更好的 tree-shaking
37+
"sideEffects": false,
38+
"scripts": {
39+
"build": "rslib build",
40+
"dev": "rslib build --watch"
41+
},
42+
"devDependencies": {}
43+
}
44+
```
45+
46+
发布完大概就是如下所示的目录结构
47+
48+
![image](https://jsonq.top/cdn-static/2025/10/22/202510221048196.png)
49+
50+
4. 上传至 github
51+
5. 如果使用 npm 镜像,需要切换会 npm 源 `npm config set registry https://registry.npmjs.org/`
52+
6. `npm login` 登录 npm,这里现在是直接让你 Enter 打开浏览器进行认证登录,比较方便
53+
54+
![image](https://jsonq.top/cdn-static/2025/10/22/202510221038798.png)
55+
56+
7. `npm publish` 发布
57+
58+
![image](https://jsonq.top/cdn-static/2025/10/22/202510221040976.png)
59+
60+
此时就可以去 npm 上查看到发布的包了,由于数据同步不是实时的,所以刚开始是搜索不到的
61+
62+
8. `npm version patch` 更新小版本,执行命令后,npm 会自动更改 package.json 的版本号,同时会给你的 git 仓库打一个 tag,你可以把这个 tag 推送到远程仓库
63+
64+
> 发布 主版本号(major).次版本号(minor).补丁版本号(patch) 也是同理执行对应的命令即可
65+
66+
![image](https://jsonq.top/cdn-static/2025/10/22/202510221044821.png)
67+
68+
9. `npm publish` 发布小版本

0 commit comments

Comments
 (0)