Skip to content

Commit 4f214d9

Browse files
authored
feat: update node&pnpm (#91)
这个 PR 完成了: - 升级node及pnpm版本 - ns增加排序字段seq ### 相关资料 - close https://guild.adventurer.tech/projects/4/tickets/342
1 parent f4ea0a5 commit 4f214d9

File tree

6 files changed

+55
-15
lines changed

6 files changed

+55
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ jobs:
5757
- name: Install Node.js
5858
uses: actions/setup-node@v4
5959
with:
60-
node-version: 20
60+
node-version: 22
6161

6262
- uses: pnpm/action-setup@v4
6363
name: Install pnpm
6464
with:
65-
version: 9
65+
version: 10.22.0
6666
run_install: false
6767

6868
- name: Get pnpm store directory

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
# Create base image with PNPM installed
33
###################
44

5-
FROM node:18-alpine AS pnpm
5+
FROM node:22-alpine3.21 AS base
66
ENV CI=1
77
RUN apk --no-cache add libc6-compat
8-
RUN npm install -g pnpm
8+
RUN npm install -g pnpm@10
99

1010
###################
1111
# Copy just my dependency files
1212
###################
1313

14-
FROM pnpm AS deps
14+
FROM base AS deps
1515
WORKDIR /app
1616
COPY package.json pnpm-lock.yaml .env ./
1717
COPY ssl ./ssl

openapi.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"hash": "5d0e06635b84acee1346a8f5fae28c04229f650970293ab167f1d6dcbddb8b24",
2+
"hash": "139fec2f3d22b1083b4bd083b1451f00e64c41705ab0a53056da6a19c6371562",
33
"openapi": "3.0.0",
44
"paths": {
55
"/hello": {
@@ -1822,7 +1822,9 @@
18221822
"key",
18231823
"-key",
18241824
"name",
1825-
"-name"
1825+
"-name",
1826+
"seq",
1827+
"-seq"
18261828
]
18271829
}
18281830
},
@@ -2009,7 +2011,9 @@
20092011
"key",
20102012
"-key",
20112013
"name",
2012-
"-name"
2014+
"-name",
2015+
"seq",
2016+
"-seq"
20132017
]
20142018
}
20152019
},
@@ -6544,6 +6548,10 @@
65446548
"exportable": {
65456549
"type": "boolean",
65466550
"description": "是否可导出"
6551+
},
6552+
"seq": {
6553+
"type": "number",
6554+
"description": "排序"
65476555
}
65486556
},
65496557
"required": [
@@ -6600,6 +6608,10 @@
66006608
"type": "boolean",
66016609
"description": "是否可导出"
66026610
},
6611+
"seq": {
6612+
"type": "number",
6613+
"description": "排序"
6614+
},
66036615
"id": {
66046616
"type": "string",
66056617
"description": "Entity id"
@@ -6669,6 +6681,10 @@
66696681
"exportable": {
66706682
"type": "boolean",
66716683
"description": "是否可导出"
6684+
},
6685+
"seq": {
6686+
"type": "number",
6687+
"description": "排序"
66726688
}
66736689
}
66746690
},
@@ -8002,7 +8018,9 @@
80028018
"key",
80038019
"-key",
80048020
"name",
8005-
"-name"
8021+
"-name",
8022+
"seq",
8023+
"-seq"
80068024
]
80078025
},
80088026
"name_like": {

package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"github-secret": "ts-node scripts/github-action-secret.ts"
2525
},
2626
"dependencies": {
27-
"@fastify/static": "8.2.0",
2827
"@alicloud/sms-sdk": "^1.1.6",
28+
"@fastify/static": "8.2.0",
2929
"@nestjs/bull": "^11.0.2",
3030
"@nestjs/cache-manager": "^3.0.1",
3131
"@nestjs/common": "^11.1.6",
@@ -145,6 +145,18 @@
145145
"pnpm": {
146146
"overrides": {
147147
"socks": "^2.7.4"
148-
}
149-
}
148+
},
149+
"onlyBuiltDependencies": [
150+
"@nestjs/core",
151+
"@scarf/scarf",
152+
"core-js",
153+
"mongodb-memory-server",
154+
"msgpackr-extract"
155+
]
156+
},
157+
"engines": {
158+
"node": ">=22",
159+
"pnpm": ">=10.4.1"
160+
},
161+
"packageManager": "[email protected]"
150162
}

src/namespace/entities/namespace.entity.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
22
import { IntersectionType } from '@nestjs/swagger';
3-
import { IsBoolean, IsNotEmpty, IsOptional, IsString } from 'class-validator';
3+
import { Type } from 'class-transformer';
4+
import { IsBoolean, IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';
45
import { Document } from 'mongoose';
56

67
import { IsNs } from 'src/common/validate';
78
import { SortFields } from 'src/lib/sort';
89
import { helper, MongoEntity } from 'src/mongo';
910

1011
@Schema()
11-
@SortFields(['key', 'name'])
12+
@SortFields(['key', 'name', 'seq'])
1213
export class NamespaceDoc {
1314
/**
1415
* 额外数据
@@ -91,6 +92,15 @@ export class NamespaceDoc {
9192
@IsBoolean()
9293
@Prop()
9394
exportable?: boolean;
95+
96+
/**
97+
* 排序
98+
*/
99+
@IsOptional()
100+
@IsNumber()
101+
@Type(() => Number)
102+
@Prop()
103+
seq?: number;
94104
}
95105

96106
export const NamespaceSchema = helper(SchemaFactory.createForClass(NamespaceDoc));

src/namespace/namespace.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class NamespaceService {
2929
}
3030

3131
list(query: ListNamespacesQuery = {}): Promise<NamespaceDocument[]> {
32-
const { limit = 10, sort, offset = 0, filter } = buildMongooseQuery(query);
32+
const { limit = 10, sort = 'seq', offset = 0, filter } = buildMongooseQuery(query);
3333
return this.namespaceModel.find(filter).sort(sort).skip(offset).limit(limit).exec();
3434
}
3535

0 commit comments

Comments
 (0)