Skip to content

Commit 5c8b024

Browse files
committed
Merge branch 'next' into merge-next
2 parents 914aee2 + 0a64698 commit 5c8b024

File tree

321 files changed

+2300
-1709
lines changed

Some content is hidden

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

321 files changed

+2300
-1709
lines changed

.docker/alpine/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM node:22-alpine
2+
3+
# Create app directory
4+
WORKDIR /usr/src/app
5+
6+
# Install app dependencies
7+
COPY . .
8+
9+
RUN chmod +x .docker/build.sh && .docker/build.sh
10+
11+
ENV NODE_ENV=production \
12+
EGG_SERVER_ENV=prod \
13+
CNPMCORE_CONFIG_REGISTRY= \
14+
CNPMCORE_CONFIG_SOURCE_REGISTRY=https://registry.npmmirror.com \
15+
CNPMCORE_CONFIG_SOURCE_REGISTRY_IS_CNPM=true \
16+
CNPMCORE_DATABASE_TYPE= \
17+
CNPMCORE_DATABASE_NAME= \
18+
CNPMCORE_DATABASE_HOST= \
19+
CNPMCORE_DATABASE_PORT=3306 \
20+
CNPMCORE_DATABASE_USER= \
21+
CNPMCORE_DATABASE_PASSWORD= \
22+
CNPMCORE_REDIS_HOST= \
23+
CNPMCORE_REDIS_PORT=6379 \
24+
CNPMCORE_REDIS_PASSWORD= \
25+
CNPMCORE_REDIS_DB= \
26+
CNPMCORE_NFS_TYPE=s3 \
27+
CNPMCORE_NFS_S3_CLIENT_ENDPOINT= \
28+
CNPMCORE_NFS_S3_CLIENT_BUCKET= \
29+
CNPMCORE_NFS_S3_CLIENT_ID= \
30+
CNPMCORE_NFS_S3_CLIENT_SECRET= \
31+
CNPMCORE_NFS_S3_CLIENT_FORCE_PATH_STYLE=true \
32+
CNPMCORE_NFS_S3_CLIENT_DISABLE_URL=true \
33+
TZ=Asia/Shanghai
34+
35+
EXPOSE 7001
36+
CMD ["npm", "run", "start:foreground"]

.docker/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
npm install -g npminstall --registry=https://registry.npmmirror.com \
4+
&& npminstall -c \
5+
&& npm run tsc \
6+
&& npmupdate -c --production

.docker/debian/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM node:22
2+
3+
# Create app directory
4+
WORKDIR /usr/src/app
5+
6+
# Install app dependencies
7+
COPY . .
8+
9+
RUN chmod +x .docker/build.sh && .docker/build.sh
10+
11+
ENV NODE_ENV=production \
12+
EGG_SERVER_ENV=prod \
13+
CNPMCORE_CONFIG_REGISTRY= \
14+
CNPMCORE_CONFIG_SOURCE_REGISTRY=https://registry.npmmirror.com \
15+
CNPMCORE_CONFIG_SOURCE_REGISTRY_IS_CNPM=true \
16+
CNPMCORE_DATABASE_TYPE= \
17+
CNPMCORE_DATABASE_NAME= \
18+
CNPMCORE_DATABASE_HOST= \
19+
CNPMCORE_DATABASE_PORT=3306 \
20+
CNPMCORE_DATABASE_USER= \
21+
CNPMCORE_DATABASE_PASSWORD= \
22+
CNPMCORE_REDIS_HOST= \
23+
CNPMCORE_REDIS_PORT=6379 \
24+
CNPMCORE_REDIS_PASSWORD= \
25+
CNPMCORE_REDIS_DB= \
26+
CNPMCORE_NFS_TYPE=s3 \
27+
CNPMCORE_NFS_S3_CLIENT_ENDPOINT= \
28+
CNPMCORE_NFS_S3_CLIENT_BUCKET= \
29+
CNPMCORE_NFS_S3_CLIENT_ID= \
30+
CNPMCORE_NFS_S3_CLIENT_SECRET= \
31+
CNPMCORE_NFS_S3_CLIENT_FORCE_PATH_STYLE=true \
32+
CNPMCORE_NFS_S3_CLIENT_DISABLE_URL=true \
33+
TZ=Asia/Shanghai
34+
35+
EXPOSE 7001
36+
CMD ["npm", "run", "start:foreground"]

.env.example

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,44 @@
77
# CNPMCORE_DATABASE_USER=postgres
88
# CNPMCORE_DATABASE_PASSWORD=postgres
99
# CNPMCORE_DATABASE_NAME=cnpmcore
10+
11+
# CNPMCORE_CONFIG_ENABLE_ES=true
12+
# CNPMCORE_CONFIG_ES_CLIENT_NODE=http://localhost:9200
13+
# CNPMCORE_CONFIG_ES_CLIENT_AUTH_USERNAME=elastic
14+
# CNPMCORE_CONFIG_ES_CLIENT_AUTH_PASSWORD=abcdef
15+
16+
# https://github.com/cnpm/cnpmcore/blob/next/docs/elasticsearch-setup.md#%E6%96%B0%E5%BB%BA-env-%E6%96%87%E4%BB%B6
17+
# Password for the 'elastic' user (at least 6 characters)
18+
ELASTIC_PASSWORD="abcdef"
19+
20+
# Password for the 'kibana_system' user (at least 6 characters)
21+
KIBANA_PASSWORD="abcdef"
22+
23+
# Version of Elastic products
24+
STACK_VERSION=8.7.1
25+
# enable for arm64
26+
# STACK_VERSION_ARM64=-arm64
27+
# STACK_PLATFORM=linux/arm64
28+
29+
# Set the cluster name
30+
CLUSTER_NAME=docker-cluster
31+
32+
# Set to 'basic' or 'trial' to automatically start the 30-day trial
33+
LICENSE=basic
34+
#LICENSE=trial
35+
36+
# Port to expose Elasticsearch HTTP API to the host
37+
ES_PORT=9200
38+
#ES_PORT=127.0.0.1:9200
39+
40+
# Port to expose Kibana to the host
41+
KIBANA_PORT=5601
42+
#KIBANA_PORT=80
43+
44+
# Increase or decrease based on the available host memory (in bytes)
45+
ES_MEM_LIMIT=1073741824
46+
KB_MEM_LIMIT=1073741824
47+
LS_MEM_LIMIT=1073741824
48+
49+
# SAMPLE Predefined Key only to be used in POC environments
50+
ENCRYPTION_KEY=c34d38b3a14956121ff2170e5030b471551370178f43e5626eec58b04a30fae2

.eslintrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"extends": "eslint-config-egg/typescript",
3-
"rules": {
4-
5-
}
2+
"extends": [
3+
"eslint-config-egg/typescript",
4+
"eslint-config-egg/lib/rules/enforce-node-prefix"
5+
]
66
}

.github/workflows/nodejs.yml

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [ master, next ]
99
pull_request:
10-
branches: [ master ]
10+
branches: [ master, next ]
1111

1212
jobs:
1313
test-postgresql-fs-nfs:
@@ -41,7 +41,7 @@ jobs:
4141
strategy:
4242
fail-fast: false
4343
matrix:
44-
node-version: [18.20.0, 18, 20, 22]
44+
node-version: [20.18.0, 20, 22]
4545
os: [ubuntu-latest]
4646

4747
steps:
@@ -67,7 +67,7 @@ jobs:
6767
POSTGRES_PORT: 5432
6868

6969
- name: Code Coverage
70-
uses: codecov/codecov-action@v3
70+
uses: codecov/codecov-action@v5
7171
with:
7272
token: ${{ secrets.CODECOV_TOKEN }}
7373

@@ -93,7 +93,7 @@ jobs:
9393
strategy:
9494
fail-fast: false
9595
matrix:
96-
node-version: [18.20.0, 18, 20, 22]
96+
node-version: [20.18.0, 20, 22]
9797
os: [ubuntu-latest]
9898

9999
steps:
@@ -112,16 +112,16 @@ jobs:
112112
run: npm run ci
113113

114114
- name: Code Coverage
115-
uses: codecov/codecov-action@v3
115+
uses: codecov/codecov-action@v5
116116
with:
117117
token: ${{ secrets.CODECOV_TOKEN }}
118118

119119
test-mysql57-oss-nfs:
120120
runs-on: ${{ matrix.os }}
121121
if: |
122122
contains('
123-
refs/heads/master
124-
refs/heads/dev
123+
refs/heads/master-skip-oss
124+
refs/heads/dev-skip-oss
125125
', github.ref)
126126
127127
services:
@@ -135,16 +135,14 @@ jobs:
135135
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
136136

137137
redis:
138-
# https://docs.github.com/en/actions/using-containerized-services/about-service-containers#example-mapping-redis-ports
139138
image: redis
140139
ports:
141-
# Opens tcp port 6379 on the host and service container
142140
- 6379:6379
143141

144142
strategy:
145143
fail-fast: false
146144
matrix:
147-
node-version: [18.20.0, 18, 20, 22]
145+
node-version: [20, 22]
148146
os: [ubuntu-latest]
149147

150148
steps:
@@ -169,6 +167,59 @@ jobs:
169167
CNPMCORE_NFS_OSS_SECRET: ${{ secrets.CNPMCORE_NFS_OSS_SECRET }}
170168

171169
- name: Code Coverage
172-
uses: codecov/codecov-action@v3
170+
uses: codecov/codecov-action@v5
171+
with:
172+
token: ${{ secrets.CODECOV_TOKEN }}
173+
174+
test-mysql57-s3-nfs:
175+
runs-on: ${{ matrix.os }}
176+
177+
services:
178+
mysql:
179+
image: mysql:5.7
180+
env:
181+
MYSQL_ALLOW_EMPTY_PASSWORD: true
182+
MYSQL_DATABASE: cnpmcore_unittest
183+
ports:
184+
- 3306:3306
185+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
186+
187+
redis:
188+
image: redis
189+
ports:
190+
- 6379:6379
191+
192+
strategy:
193+
fail-fast: false
194+
matrix:
195+
node-version: [20, 22]
196+
os: [ubuntu-latest]
197+
198+
steps:
199+
- name: Checkout Git Source
200+
uses: actions/checkout@v4
201+
202+
- name: Use Node.js ${{ matrix.node-version }}
203+
uses: actions/setup-node@v4
204+
with:
205+
node-version: ${{ matrix.node-version }}
206+
207+
- name: Install Dependencies
208+
run: npm i
209+
210+
- name: Continuous Integration
211+
run: npm run ci "test/cli/npm/install.test.ts"
212+
env:
213+
CNPMCORE_NFS_TYPE: s3
214+
CNPMCORE_NFS_REMOVE_BEFORE_UPLOAD: true
215+
CNPMCORE_NFS_S3_CLIENT_BUCKET: cnpmcore-unittest-github-nodejs-${{ matrix.node-version }}
216+
CNPMCORE_NFS_S3_CLIENT_ENDPOINT: ${{ secrets.CNPMCORE_NFS_S3_ENDPOINT }}
217+
CNPMCORE_NFS_S3_CLIENT_ID: ${{ secrets.CNPMCORE_NFS_S3_ID }}
218+
CNPMCORE_NFS_S3_CLIENT_SECRET: ${{ secrets.CNPMCORE_NFS_S3_SECRET }}
219+
CNPMCORE_NFS_S3_CLIENT_FORCE_PATH_STYLE: true
220+
# CNPMCORE_NFS_S3_CLIENT_DISABLE_URL: true
221+
222+
- name: Code Coverage
223+
uses: codecov/codecov-action@v5
173224
with:
174225
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Release
22
on:
33
push:
4-
branches: [ master ]
4+
branches: [ master, next ]
55

66
jobs:
77
release:

.oxlintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"plugins": ["import"],
3+
"rules": {
4+
"import/no-cycle": "error"
5+
}
6+
}

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
11
# Changelog
22

3-
## [3.75.1](https://github.com/cnpm/cnpmcore/compare/v3.75.0...v3.75.1) (2025-03-09)
3+
## [4.0.2](https://github.com/cnpm/cnpmcore/compare/v4.0.1...v4.0.2) (2025-02-10)
4+
5+
* should return default value when env is empty string ([#759](https://github.com/cnpm/cnpmcore/issues/759)) ([b6c781e](https://github.com/cnpm/cnpmcore/commit/b6c781ec250150a689a9d04080ebca716f0840dd))
6+
7+
## [4.0.1](https://github.com/cnpm/cnpmcore/compare/v4.0.0...v4.0.1) (2025-02-09)
8+
9+
10+
### Bug Fixes
11+
12+
* remove npm-cli-login for ssri security ([#754](https://github.com/cnpm/cnpmcore/issues/754)) ([d18981e](https://github.com/cnpm/cnpmcore/commit/d18981e658902dab54297cc5cc4798a6a9e1c84f))
13+
14+
## [4.0.0](https://github.com/cnpm/cnpmcore/compare/v3.74.0...v4.0.0) (2025-02-09)
15+
416

17+
### ⚠ BREAKING CHANGES
18+
19+
* only support egg >= 4.0.0
20+
21+
the first app on egg v4
22+
23+
https://github.com/eggjs/egg/issues/3644
24+
25+
### Features
26+
27+
* use egg v4 ([#747](https://github.com/cnpm/cnpmcore/issues/747)) ([4427a4f](https://github.com/cnpm/cnpmcore/commit/4427a4fca58e3d1aca4c27f817798f3820db89b9))
28+
29+
## [3.75.1](https://github.com/cnpm/cnpmcore/compare/v3.75.0...v3.75.1) (2025-03-09)
530

631
### Bug Fixes
732

DEVELOPER.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ npm run dev
5353

5454
# 访问
5555
curl -v http://127.0.0.1:7001
56-
57-
# cnpmcore_admin 注册管理员
58-
npm login --registry=http://127.0.0.1:7001
5956
```
6057

6158
### 开发运行 - PostgreSQL

0 commit comments

Comments
 (0)