Skip to content

Commit 2adf1f2

Browse files
committed
Merge branch 'master' of https://github.com/shm-open/code-push-server into shm-open-master
2 parents a0cdc71 + f1e3e2a commit 2adf1f2

File tree

107 files changed

+9025
-3664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+9025
-3664
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.js

.eslintrc.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
module.exports = {
2+
extends: ['@shm-open/eslint-config-bundle'],
3+
rules: {
4+
'@typescript-eslint/naming-convention': [
5+
'error',
6+
{
7+
selector: 'default',
8+
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
9+
leadingUnderscore: 'allowSingleOrDouble',
10+
},
11+
{
12+
selector: 'variable',
13+
modifiers: ['destructured'],
14+
format: null,
15+
},
16+
{
17+
selector: [
18+
'classProperty',
19+
'objectLiteralProperty',
20+
'typeProperty',
21+
'classMethod',
22+
'objectLiteralMethod',
23+
'typeMethod',
24+
'accessor',
25+
'enumMember',
26+
],
27+
modifiers: ['requiresQuotes'],
28+
format: null,
29+
},
30+
{
31+
selector: 'enum',
32+
format: ['PascalCase'],
33+
},
34+
{
35+
selector: 'enumMember',
36+
format: ['UPPER_CASE'],
37+
},
38+
{
39+
selector: 'variableLike',
40+
format: ['camelCase', 'PascalCase'],
41+
leadingUnderscore: 'allow',
42+
},
43+
{
44+
selector: 'variable',
45+
modifiers: ['const'],
46+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
47+
},
48+
{
49+
selector: 'typeLike',
50+
format: ['PascalCase'],
51+
},
52+
{
53+
selector: 'objectLiteralProperty',
54+
format: ['camelCase', 'snake_case', 'UPPER_CASE', 'PascalCase'],
55+
},
56+
],
57+
},
58+
};

.github/workflows/nodejs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
- 3306:3306
3131

3232
steps:
33-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v3
3434
- name: Use Node.js ${{ matrix.node-version }}
35-
uses: actions/setup-node@v2
35+
uses: actions/setup-node@v3
3636
with:
3737
node-version: ${{ matrix.node-version }}
3838
- run: npm ci

.gitignore

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ pids
77
*.pid
88
*.seed
99
*.DS_Store
10+
bin/
11+
.nyc_output/
1012

11-
.grunt
13+
# deps
14+
node_modules/
1215

13-
# Dependency directory
14-
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
15-
node_modules
16-
17-
coverage
1816

1917
# vs code
2018
.history
21-
.idea
19+
.idea

CHANGELOG.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,110 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [2.1.1](https://github.com/shm-open/code-push-server/compare/v2.1.0...v2.1.1) (2022-03-23)
6+
7+
8+
### Bug Fixes
9+
10+
* zh locale support ([6a55bc5](https://github.com/shm-open/code-push-server/commit/6a55bc57f0b28d9b0000a886dc302e6772719ea0))
11+
12+
## [2.1.0](https://github.com/shm-open/code-push-server/compare/v2.0.3...v2.1.0) (2022-03-23)
13+
14+
15+
### Features
16+
17+
* **app:** add i18n support ([57a6e98](https://github.com/shm-open/code-push-server/commit/57a6e98df10bfcfc14badd3b4a399815e3c4349a))
18+
19+
20+
### Bug Fixes
21+
22+
* **deps:** update dependency aws-sdk to v2.1098.0 ([381f51a](https://github.com/shm-open/code-push-server/commit/381f51a6bc6b5a85945bf2caac1b48e4b875c189))
23+
* **deps:** update dependency nodemailer to v6.7.3 ([154af3c](https://github.com/shm-open/code-push-server/commit/154af3c526ce000c3678627502c66c54f6bd6883))
24+
* **deps:** update dependency yargs to v17.4.0 ([763c924](https://github.com/shm-open/code-push-server/commit/763c924ee0a77db170ef307f0726f36da7e5ac0b))
25+
26+
### [2.0.3](https://github.com/shm-open/code-push-server/compare/v2.0.2...v2.0.3) (2022-03-09)
27+
28+
29+
### Bug Fixes
30+
31+
* **deps:** update dependency aws-sdk to v2.1089.0 ([2a40892](https://github.com/shm-open/code-push-server/commit/2a40892edcd945158b9ebb1c5b8f73942fabe4bf))
32+
* **deps:** update dependency fs-extra to v10.0.1 ([6e20737](https://github.com/shm-open/code-push-server/commit/6e207378305bdc3e9f0258a91a2074cbff0c608a))
33+
* **deps:** update dependency redis to v4.0.4 ([23e984a](https://github.com/shm-open/code-push-server/commit/23e984a7662a7cc365d3402cba1ee809d4602298))
34+
* **deps:** update dependency sequelize to v6.17.0 ([dd255d9](https://github.com/shm-open/code-push-server/commit/dd255d976f1e2cd3e3d965580b900cb7f99f738a))
35+
36+
### [2.0.2](https://github.com/shm-open/code-push-server/compare/v2.0.1...v2.0.2) (2022-02-21)
37+
38+
39+
### Bug Fixes
40+
41+
* log stringified account info ([85a09fa](https://github.com/shm-open/code-push-server/commit/85a09fad62bd21808461debba7140e1732851622))
42+
43+
### [2.0.1](https://github.com/shm-open/code-push-server/compare/v2.0.0...v2.0.1) (2022-02-21)
44+
45+
46+
### Bug Fixes
47+
48+
* **deps:** update dependency aws-sdk to v2.1077.0 ([fd22283](https://github.com/shm-open/code-push-server/commit/fd22283882e2462423bc25efa27c6b707957b41e))
49+
* **deps:** update dependency body-parser to v1.19.2 ([19d8acd](https://github.com/shm-open/code-push-server/commit/19d8acd994538cb683dc319e0f0aa164c75a882f))
50+
* **deps:** update dependency express to v4.17.3 ([915fd25](https://github.com/shm-open/code-push-server/commit/915fd25fedff2246d93c051bc7a56db52cbd61b7))
51+
* **deps:** update dependency kv-logger to v0.5.3 ([e7d2e0f](https://github.com/shm-open/code-push-server/commit/e7d2e0f28e1989227582505397139e0db617424d))
52+
* **deps:** update dependency sequelize to v6.16.2 ([ceb3e3e](https://github.com/shm-open/code-push-server/commit/ceb3e3ebac22983805d5dfa992c27c03f3da2f1f))
53+
* **deps:** update kv-logger to 0.5.1 ([6289835](https://github.com/shm-open/code-push-server/commit/6289835990e1ae964378fc28d2037d1ce752107a))
54+
* **deps:** update kv-logger to 0.5.2 and fix build issue ([cae80fe](https://github.com/shm-open/code-push-server/commit/cae80fe5ba00c920b79df3422fb8c86424a6dc07))
55+
* put x-request-id to res header ([e9c13a5](https://github.com/shm-open/code-push-server/commit/e9c13a5ea6cb48e8338cb3314312fce51587b631))
56+
57+
## [2.0.0](https://github.com/shm-open/code-push-server/compare/v1.2.0...v2.0.0) (2022-02-10)
58+
59+
60+
### ⚠ BREAKING CHANGES
61+
62+
* drop is_use_diff_text support
63+
* drop codePushWeb redirect support
64+
* drop upyun support
65+
* drop CONFIG_FILE support, please use env variable config items
66+
67+
### Features
68+
69+
* drop upyun support ([57bbdc5](https://github.com/shm-open/code-push-server/commit/57bbdc58d7c9174f4d00ad9ec1525f5f828e00b4))
70+
71+
72+
### Bug Fixes
73+
74+
* **deps:** update dependency aws-sdk to v2.1072.0 ([82f41e0](https://github.com/shm-open/code-push-server/commit/82f41e0e347802a851534af3d9558fe1a3919936))
75+
* **deps:** update dependency sequelize to v6.16.0 ([e3bb1e4](https://github.com/shm-open/code-push-server/commit/e3bb1e4f223f9a43430318fe20fc1af759c30721))
76+
* **deps:** update dependency sequelize to v6.16.1 ([568a5b0](https://github.com/shm-open/code-push-server/commit/568a5b02b280eb9211948a4d6a7380efac33d199))
77+
* update deps redis to v4, reuse the same redis client without quit ([98c2ca6](https://github.com/shm-open/code-push-server/commit/98c2ca60a3285353c9ce3cdab5f8eee1b9deffba))
78+
79+
80+
* drop codePushWeb redirect support ([255ea15](https://github.com/shm-open/code-push-server/commit/255ea1530aba7a57c66e0e304fa6c7b23485f219))
81+
* turn package-manager to ts ([e067aed](https://github.com/shm-open/code-push-server/commit/e067aed251a5376bc437502c9ceee86f9408988e))
82+
* turn top level app/www to ts ([76d8898](https://github.com/shm-open/code-push-server/commit/76d8898e563bbf52361b87b615bf7c13f40409e0))
83+
84+
## [1.2.0](https://github.com/shm-open/code-push-server/compare/v1.1.1...v1.2.0) (2022-02-08)
85+
86+
87+
### Features
88+
89+
* add typescript support ([6b1a5d7](https://github.com/shm-open/code-push-server/commit/6b1a5d7d8d836ab804f32c3931f4c57bde5f5dde))
90+
91+
92+
### Bug Fixes
93+
94+
* add more info logs for account/app management ([4e45c7e](https://github.com/shm-open/code-push-server/commit/4e45c7e651c503383e6bb659397d27b3a3c76809))
95+
* **deps:** update dependency aws-sdk to v2.1062.0 ([9a62e4a](https://github.com/shm-open/code-push-server/commit/9a62e4a93855b233befedd6fbcd8aec47fd9d61d))
96+
* **deps:** update dependency body-parser to v1.19.1 ([1173672](https://github.com/shm-open/code-push-server/commit/117367240a63028eebd992161a354d1404827fd6))
97+
* **deps:** update dependency cos-nodejs-sdk-v5 to v2.11.6 ([4e570d6](https://github.com/shm-open/code-push-server/commit/4e570d646b3bae386280aa02cab6b7f58d504d1a))
98+
* **deps:** update dependency express to v4.17.2 ([59a9cd3](https://github.com/shm-open/code-push-server/commit/59a9cd3e4a871c38e024986fb46ba98d457dd617))
99+
* **deps:** update dependency helmet to v5 ([ffff5da](https://github.com/shm-open/code-push-server/commit/ffff5dab25bb001e5772bfe7c189e337fe108aaa))
100+
* **deps:** update dependency helmet to v5.0.2 ([b601ee7](https://github.com/shm-open/code-push-server/commit/b601ee763f9ed49417ac97f51c50bcded62ce2ca))
101+
* **deps:** update dependency node-fetch to v2.6.7 ([2bcaa19](https://github.com/shm-open/code-push-server/commit/2bcaa1992f2a2d6e00595728ee4b07edbfb1b727))
102+
* **deps:** update dependency nodemailer to v6.7.2 ([58a2af0](https://github.com/shm-open/code-push-server/commit/58a2af07a8d23fd2930b4745c28456f50bae16eb))
103+
* **deps:** update dependency sequelize to v6.12.4 ([5ec26ae](https://github.com/shm-open/code-push-server/commit/5ec26aed33f2eac595ee9e4de26f0eb5dfc28440))
104+
* **deps:** update dependency sequelize to v6.14.0 ([1786ca2](https://github.com/shm-open/code-push-server/commit/1786ca20b637bc5562aa99b30b4404bbbb89a651))
105+
* **deps:** update dependency yargs to v17.3.1 ([a099f8c](https://github.com/shm-open/code-push-server/commit/a099f8c162a84341b543eeba3683f7afaf067a00))
106+
* replace log4js with simple kv-logger ([7e1829e](https://github.com/shm-open/code-push-server/commit/7e1829edac2886e1370590696b7815fb922b7b47))
107+
* simplify redis config ([deefe90](https://github.com/shm-open/code-push-server/commit/deefe90fd373fd3a7ce0a9d35321b7f32eed724e))
108+
5109
### [1.1.1](https://github.com/shm-open/code-push-server/compare/v1.1.0...v1.1.1) (2021-11-23)
6110

7111

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM node:lts-alpine
22

3+
ARG VERSION latest
4+
35
RUN npm install -g @shm-open/code-push-server@${VERSION} pm2@latest --no-optional
46

57
RUN mkdir /data/
@@ -10,4 +12,4 @@ COPY ./process.json /data/process.json
1012

1113
# CMD ["pm2-runtime", "/data/process.json"]
1214
# workaround for issue https://github.com/Unitech/pm2/issues/4950
13-
CMD ["sh", "-c", "pm2 ps && pm2-runtime /data/process.json"]
15+
CMD ["sh", "-c", "pm2 ps && pm2-runtime /data/process.json"]

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@ VERSION := $(shell node -p "require('./package.json').version")
44
.PHONY: test
55
test:
66
@echo "\nRunning integration tests..."
7-
@mocha test/api/init --exit
8-
@mocha test/api/users test/api/auth test/api/account test/api/accessKeys test/api/apps test/api/index --exit --recursive --timeout 15000
7+
@mocha tests/api/init --exit
8+
@mocha tests/api/users tests/api/auth tests/api/account tests/api/accessKeys tests/api/apps tests/api/index --exit --recursive --timeout 30000
9+
10+
.PHONY: coverage
11+
coverage:
12+
@echo "\nCheck test coverage..."
13+
@mocha tests/api/init --exit
14+
@nyc mocha tests/api/users tests/api/auth tests/api/account tests/api/accessKeys tests/api/apps tests/api/index --exit --recursive --timeout 30000
915

1016
.PHONY: release-docker
1117
release-docker:
1218
@echo "\nBuilding docker image..."
1319
docker pull node:lts-alpine
14-
docker build -t shmopen/code-push-server:latest --no-cache .
20+
docker build --build-arg VERSION=${VERSION} -t shmopen/code-push-server:latest --no-cache .
1521
docker tag shmopen/code-push-server:latest shmopen/code-push-server:${VERSION}
1622
docker push shmopen/code-push-server:${VERSION}
1723
docker push shmopen/code-push-server:latest

README.cn.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# CodePush 服务端
2+
3+
微软官方的 CodePush 在国内的网络访问较慢, 所以我们使用这个服务端来架设自己的 CodePush 服务
4+
5+
## 关于本项目
6+
7+
因为原 [code-push-server](https://github.com/lisong/code-push-server) 项目的作者没有积极维护了, 我们创建了这个项目用来:
8+
9+
- 保持依赖更新
10+
- 修复任何与最新的客户端的兼容问题
11+
- 我们只使用官方的 react-native-code-push 客户端, 所以定制的功能, 比如 [is_use_diff_text](https://github.com/lisong/code-push-server#advance-feature) 会被放弃.
12+
- 我们只在生产环境使用了 react-native-code-push, 对于其他的 CodePush 客户端, 大部分功能应该没有差别, 如果遇到任何问题的话, 都欢迎提交 issue 或者 PR.
13+
14+
## 支持的存储方式
15+
16+
- local: 在本地硬盘存储包文件
17+
- qiniu: 在[七牛云](http://www.qiniu.com/)存储包文件
18+
- s3: 在[aws](https://aws.amazon.com/)存储包文件
19+
- oss: 在[阿里云](https://www.aliyun.com/product/oss)存储包文件
20+
- tencentcloud: 在[腾迅云](https://cloud.tencent.com/product/cos)存储包文件
21+
22+
## 正确使用 code-push 热更新
23+
24+
- 苹果 App 允许使用热更新[Apple's developer agreement](https://developer.apple.com/programs/ios/information/iOS_Program_Information_4_3_15.pdf), 为了不影响用户体验,规定必须使用静默更新。 Google Play 不能使用静默更新,必须弹框告知用户 App 有更新。中国的 android 市场必须采用静默更新(如果弹框提示,App 会被“请上传最新版本的二进制应用包”原因驳回)。
25+
- react-native 不同平台 bundle 包不一样,在使用 code-push-server 的时候必须创建不同的应用来区分(eg. CodePushDemo-ios 和 CodePushDemo-android)
26+
- react-native-code-push 只更新资源文件,不会更新 java 和 Objective C,所以 npm 升级依赖包版本的时候,如果依赖包使用的本地化实现, 这时候必须更改应用版本号(ios 修改 Info.plist 中的 CFBundleShortVersionString, android 修改 build.gradle 中的 versionName), 然后重新编译 app 发布到应用商店。
27+
- 推荐使用 code-push release-react 命令发布应用,该命令合并了打包和发布命令(eg. code-push release-react CodePushDemo-ios ios -d Production)
28+
- 每次向 App Store 提交新的版本时,也应该基于该提交版本同时向 code-push-server 发布一个初始版本。(因为后面每次向 code-push-server 发布版本时,code-puse-server 都会和初始版本比较,生成补丁版本)
29+
30+
### CodePush 命令行
31+
32+
[code-push-cli](https://github.com/shm-open/code-push-cli) 是用来管理 App 以及发布 CodePush 版本的, 请查看命令行项目的说明了解更多
33+
34+
### 客户端
35+
36+
- [React Native](https://github.com/Microsoft/react-native-code-push)
37+
- [Cordova](https://github.com/microsoft/cordova-plugin-code-push)
38+
- [Capacitor](https://github.com/mapiacompany/capacitor-codepush)
39+
40+
## 如何安装 code-push-server
41+
42+
- [Docker](./docs/install-server-by-docker.cn.md) (推荐)
43+
- [直接安装](./docs/install-server.md)
44+
45+
## 默认帐号和密码
46+
47+
- 帐号: `admin`
48+
- 密码: `123456`
49+
50+
## 常见问题
51+
52+
- [修改密码](https://github.com/lisong/code-push-server/issues/43)
53+
- [code-push-server 使用+一些需要注意的地方](https://github.com/lisong/code-push-server/issues/135)
54+
- 支持的 targetBinaryVersion
55+
- `*`
56+
- `1.2.3`
57+
- `1.2`/`1.2.*`
58+
- `1.2.3 - 1.2.7`
59+
- `>=1.2.3 <1.2.7`
60+
- `~1.2.3`
61+
- `^1.2.3`

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Create your own account by visiting https://your-server.com/auth/register (in co
6060

6161
# Feature Roadmap
6262

63+
- [modify password](https://github.com/lisong/code-push-server/issues/43)
64+
- [code-push-server normal solution (CN)](https://github.com/lisong/code-push-server/issues/135)
6365
- targetBinaryVersion support
6466
- `*`
6567
- `1.2.3`
@@ -68,15 +70,3 @@ Create your own account by visiting https://your-server.com/auth/register (in co
6870
- `>=1.2.3 <1.2.7`
6971
- `~1.2.3`
7072
- `^1.2.3`
71-
72-
## Advance Feature
73-
74-
> use google diff-match-patch calculate text file diff patch
75-
76-
- support iOS and Android
77-
- use `"react-native-code-push": "git+https://[email protected]/lisong/react-native-code-push.git"` instead `"react-native-code-push": "x.x.x"` in `package.json`
78-
- change `apps`.`is_use_diff_text` to `1` in mysql codepush database
79-
80-
## License
81-
82-
MIT License [read](https://github.com/lisong/code-push-server/blob/master/LICENSE)

0 commit comments

Comments
 (0)