From 083959e3e0ddd21629c3f673a18c519711537365 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Mon, 5 Feb 2024 17:36:58 +0800 Subject: [PATCH 01/26] test --- .github/workflows/ci-test.action.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/ci-test.action.yml diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml new file mode 100644 index 0000000..64c7082 --- /dev/null +++ b/.github/workflows/ci-test.action.yml @@ -0,0 +1,43 @@ +name: CI test + +on: + push: + branches: + - ci-test + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: 安装 Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + + - name: 安装依赖 + run: npm i + + - name: 更新版本号 + run: npm version minor + + - name: 测试更新结果 + run: npm version + + # - name: 安装 vsce + # run: npm install -g vsce + + # - name: 编译 + # run: vsce package -o dist.vsix + + # - name: 上传 + # uses: actions/upload-artifact@v3 + # with: + # name: code-coverage-report + # path: dist.vsix + + # - name: 编译上传 + # run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file From 7c2bc6815ccd5627d01797cc6dfefcf835251512 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Mon, 5 Feb 2024 17:45:12 +0800 Subject: [PATCH 02/26] test --- .github/workflows/ci-test.action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml index 64c7082..6dd65bd 100644 --- a/.github/workflows/ci-test.action.yml +++ b/.github/workflows/ci-test.action.yml @@ -22,7 +22,10 @@ jobs: run: npm i - name: 更新版本号 - run: npm version minor + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + npm version minor - name: 测试更新结果 run: npm version From 3f5a9d9e0c4fefa90e798db8a4bdb6c0dce5790c Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 11 Jun 2024 15:29:22 +0800 Subject: [PATCH 03/26] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=90=88=E5=B9=B6mapping=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/ast.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/utils/ast.ts b/src/utils/ast.ts index b21b451..43ff9e4 100644 --- a/src/utils/ast.ts +++ b/src/utils/ast.ts @@ -179,19 +179,20 @@ export namespace NestDecorator { export const ReqMethodSet = new Set(['Get', 'Post', 'Put', 'Delete', 'Patch', 'All', 'Options', 'Head', 'Search']) export type Mapping = { - method: Methods, - path: string[], - version: string[], + method: Methods + path: string[] + version: string[] fn: ts.MethodDeclaration fnName: string + filePath?: string className: string line: { - start: ts.LineAndCharacter, + start: ts.LineAndCharacter end: ts.LineAndCharacter } } - export const getMapping = (classNode: ts.ClassDeclaration, ast: ts.SourceFile) => { + export const getMapping = (classNode: ts.ClassDeclaration, ast: ts.SourceFile, filePath: string) => { const mappings: Mapping[] = [] const className = AST.getIdentifierName(classNode.name!) || '' classNode.members.forEach(_member => { @@ -214,6 +215,7 @@ export namespace NestDecorator { method: key as Methods, path: args.length ? AST.getStringList(args[0]) : [''], version, + filePath, fn: member, className, fnName: AST.getIdentifierName(member.name as ts.Identifier), @@ -226,5 +228,23 @@ export namespace NestDecorator { return mappings } + + /** + * 处理继承的合并 mapping , 子类覆盖父类的同名方法 mapping + */ + export const mergeMapping = (parentMappings: Mapping[], childMappings: Mapping[]) => { + const mappings: Mapping[] = [...parentMappings] + + childMappings.forEach(v => { + const _index = mappings.findIndex(_v => _v.fnName === v.fnName) + if (_index === -1) { + mappings.push(v) + } else { + mappings[_index] = v + } + }) + + return mappings + } } } \ No newline at end of file From 65148b2e4eb081785d124f6bdee3fc17ae5fa05d Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 10:10:40 +0800 Subject: [PATCH 04/26] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=86=85=E7=9A=84=E7=BB=A7=E6=89=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/project/app/nest.ts | 81 ++++++++++++++++++++++++++++++++++------- src/project/index.ts | 2 +- 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/src/project/app/nest.ts b/src/project/app/nest.ts index 22dc8b9..d62fdac 100644 --- a/src/project/app/nest.ts +++ b/src/project/app/nest.ts @@ -10,6 +10,15 @@ import { joinPath } from '../../utils'; type FilePath = string type ModuleName = string +/** + * 默认导出 + */ +const DEFAULT_KEY = '__DEFAULT__' +/** + * 匿名变量 + */ +const ANONYMOUS_KEY = '__ANONYMOUS__' + export namespace Nest { export type Controller = Omit & { version?: string[] @@ -294,22 +303,39 @@ export namespace Nest { const ast = this.getAST(_moduleInfo.path) const controller: Controller = { mappings: [], filePath: _moduleInfo.path } + const extendsClassNameMap: Map = new Map() + const importVarMap = this.importVarMap.get(_moduleInfo.path)! + const classMap = new Map() + + const handleClassDeclaration = (node: ts.Node) => { + const classNode = node as ts.ClassDeclaration + // 可能是匿名类 + const name = classNode.name ? AST.getIdentifierName(classNode.name as ts.Identifier) : ANONYMOUS_KEY + const { isDefault, isExport, decorators } = AST.filterDecorator(classNode.modifiers!) + classMap.set(isDefault ? DEFAULT_KEY : name, node) + // 仅目标类需要继续读取信息 + if (!isExport || _moduleInfo.isDefault !== isDefault || (!_moduleInfo.isDefault && _moduleInfo.name !== name)) return + // 有 Controller 装饰器 + if (decorators.hasOwnProperty('Controller')) { + const options = NestDecorator.Controller.getArgs(decorators.Controller) + Object.assign(controller, options) + controller.mappings.push(...NestDecorator.RequsetMapping.getMapping(classNode, ast, _moduleInfo.path)) + } + + // 继承的类,子类不管有没有 Controller 装饰器都需要加上继承的 Mapping + classNode.heritageClauses?.forEach(v => { + // TODO: 类只有单继承,可以链式继承(之后再实现链式继承) + extendsClassNameMap.set(name, AST.getIdentifierName(v.types[0].expression as ts.Identifier)) + }) + } + AST.traverse(ast, (node, next) => { switch (node.kind) { case ts.SyntaxKind.ImportDeclaration: this.saveImportVar(node as ts.ImportDeclaration) break - case ts.SyntaxKind.ClassDeclaration: { - const classNode = node as ts.ClassDeclaration - const name = AST.getIdentifierName(classNode.name as ts.Identifier) - const { isDefault, isExport, decorators } = AST.filterDecorator(classNode.modifiers!) - if (!isExport || _moduleInfo.isDefault !== isDefault || (!_moduleInfo.isDefault && _moduleInfo.name !== name)) return - // 找到指定 Controller - if (decorators.hasOwnProperty('Controller')) { - const options = NestDecorator.Controller.getArgs(decorators.Controller) - Object.assign(controller, options) - controller.mappings = NestDecorator.RequsetMapping.getMapping(classNode, ast) - } + case ts.SyntaxKind.ClassDeclaration: { // 类声明 + handleClassDeclaration(node) } break default: next() @@ -317,6 +343,35 @@ export namespace Nest { } }) + if (extendsClassNameMap.size) { // 处理继承 + const className = _moduleInfo.isDefault ? DEFAULT_KEY : _moduleInfo.name! + // 从入参的目标类上开始找父类 + const parentName = extendsClassNameMap.get(className)! + if (classMap.has(parentName)) { // 在当前文件中 + const parentClassNode = classMap.get(parentName) as ts.ClassDeclaration + const { decorators } = AST.filterDecorator(parentClassNode.modifiers!) + if (decorators.hasOwnProperty('Controller')) { // 父类是 Controller + const options = NestDecorator.Controller.getArgs(decorators.Controller) + if (!controller.path && options.path) { + controller.path = Array.isArray(options.path) ? options.path : [options.path] + } + controller.mappings.push(...NestDecorator.RequsetMapping.getMapping(parentClassNode, ast, _moduleInfo.path)) + controller.mappings = NestDecorator.RequsetMapping.mergeMapping( + controller.mappings, + NestDecorator.RequsetMapping.getMapping( + classMap.get(className)! as ts.ClassDeclaration, + ast, + _moduleInfo.path + ) + ) + } else { // TODO 父类不是 Controller,需要看整个继承链,先不管 + + } + } else if (importVarMap[parentName]) { // TODO 从其他地方导入的 + + } + } + if (!this.controllerMap.has(_moduleInfo.path)) this.controllerMap.set(_moduleInfo.path, {}) this.controllerMap.get(_moduleInfo.path)![_moduleInfo.name || 'DefaultExportModule'] = controller @@ -359,7 +414,7 @@ export namespace Nest { mapping.path.forEach(path => { let _path = joinPath(prefix, path) if (!_path.endsWith('/')) _path += '/' - const { version, ...rest } = mapping + const { version, filePath, ...rest } = mapping const _versions = [...new Set([...version, ...(_controller.version ?? [])])] if (!_versions.length) _versions.push('') _versions.forEach(_version => { @@ -367,7 +422,7 @@ export namespace Nest { ...rest, version: _version, path: _path, - filePath: _controller.filePath + filePath: filePath || _controller.filePath, }) }) }) diff --git a/src/project/index.ts b/src/project/index.ts index c95103a..ad6f151 100644 --- a/src/project/index.ts +++ b/src/project/index.ts @@ -232,7 +232,7 @@ export class Project { createApp( 'main', path.resolve(configPath, '../', config.sourceRoot || 'src'), - config.entryFile ||'main' + config.entryFile || 'main' ) } } From 2b57086135512f2199c9d98c9d7aa1fd216ab479 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 15:34:36 +0800 Subject: [PATCH 05/26] =?UTF-8?q?=E2=9C=A8=20feat:=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E8=B7=AF=E7=94=B1=E6=A8=A1=E5=9D=97=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=9A=84=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/project/app/nest.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/project/app/nest.ts b/src/project/app/nest.ts index d62fdac..1fa051c 100644 --- a/src/project/app/nest.ts +++ b/src/project/app/nest.ts @@ -233,6 +233,8 @@ export namespace Nest { }) } + const routerModules = [] + const traverseRouters = (routeNode: ts.Node, __prefix: string) => { if (routeNode.kind === ts.SyntaxKind.ArrayLiteralExpression) { const arr = routeNode as ts.ArrayLiteralExpression @@ -247,6 +249,7 @@ export namespace Nest { if (_module) { const _filePath = this.project.pathResolver(_moduleInfo.path, _module.path) module.importModules.push(this.findModule(Object.assign({}, _module, { path: _filePath }), prefix)) + routerModules.push(_module) } } else if (obj.children) { traverseRouters(obj.children, _path ? joinPath(__prefix, _path) : __prefix) @@ -257,6 +260,7 @@ export namespace Nest { if (_module) { const _filePath = this.project.pathResolver(_moduleInfo.path, _module.path) module.importModules.push(this.findModule(Object.assign({}, _module, { path: _filePath }), __prefix)) + routerModules.push(_module) } } }) @@ -285,7 +289,9 @@ export namespace Nest { } }) - _importModules.forEach(v => module.importModules.push(this.findModule(v))) + _importModules // 过滤使用路由模块进行注册的模块 + .filter(v => routerModules.every(_v => (v.name ?? '') !== (_v.name ?? ''))) + .forEach(v => module.importModules.push(this.findModule(v))) _controllers.forEach(v => module.controllers.push(this.findController(v))) if (!this.moduleMap.has(_moduleInfo.path)) this.moduleMap.set(_moduleInfo.path, {}) From 47bb40877eb4e1cb4b2d8e1bcd5f2857ccdc7005 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:13:54 +0800 Subject: [PATCH 06/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 37 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 6efe990..7c9205f 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -2,10 +2,8 @@ name: Build on: push: - branches: - - main - paths: - - 'package.json' + tags: + - "v*.*.*" jobs: build: @@ -21,19 +19,30 @@ jobs: registry-url: https://registry.npmjs.org/ - name: 安装依赖 - run: npm i + run: npm ci - name: 安装 vsce run: npm install -g vsce - # - name: 编译 - # run: vsce package -o dist.vsix + - name: 获取版本号 + id: get_tag + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - # - name: 上传 - # uses: actions/upload-artifact@v3 - # with: - # name: code-coverage-report - # path: dist.vsix + - name: 更新 NPM 版本号 + run: npm version $VERSION - - name: 编译上传 - run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file + - name: Configure git + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Commit changes + run: | + git add package.json + git commit -m "Update version to $VERSION" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: 编译上传 + # run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file From 1370b0036f5a071fbd2fb901c6322fdeaea370dc Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:16:00 +0800 Subject: [PATCH 07/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 7c9205f..9f143cd 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -19,7 +19,7 @@ jobs: registry-url: https://registry.npmjs.org/ - name: 安装依赖 - run: npm ci + run: npm i - name: 安装 vsce run: npm install -g vsce From 4998d7eb395ee637c93288a663bb5728b103172a Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:18:52 +0800 Subject: [PATCH 08/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-test.action.yml | 46 ---------------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/ci-test.action.yml diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml deleted file mode 100644 index 6dd65bd..0000000 --- a/.github/workflows/ci-test.action.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: CI test - -on: - push: - branches: - - ci-test - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: 安装 Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - registry-url: https://registry.npmjs.org/ - - - name: 安装依赖 - run: npm i - - - name: 更新版本号 - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - npm version minor - - - name: 测试更新结果 - run: npm version - - # - name: 安装 vsce - # run: npm install -g vsce - - # - name: 编译 - # run: vsce package -o dist.vsix - - # - name: 上传 - # uses: actions/upload-artifact@v3 - # with: - # name: code-coverage-report - # path: dist.vsix - - # - name: 编译上传 - # run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file From c2f78ef91c17db8e997d1256f9c9bc2872a7a4d6 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:20:06 +0800 Subject: [PATCH 09/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 9f143cd..a02251a 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -18,11 +18,11 @@ jobs: node-version: 18 registry-url: https://registry.npmjs.org/ - - name: 安装依赖 - run: npm i + # - name: 安装依赖 + # run: npm i - - name: 安装 vsce - run: npm install -g vsce + # - name: 安装 vsce + # run: npm install -g vsce - name: 获取版本号 id: get_tag From 01dd696dab9f69bde3477fc32373c0c5dd65d4bf Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:21:18 +0800 Subject: [PATCH 10/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index a02251a..43a984e 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -26,7 +26,10 @@ jobs: - name: 获取版本号 id: get_tag - run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + run: | + TAG_NAME=${GITHUB_REF#refs/tags/} + VERSION=${TAG_NAME#v} + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: 更新 NPM 版本号 run: npm version $VERSION From e17143e78893b31fad6ff5229a4642683a81f07c Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:23:07 +0800 Subject: [PATCH 11/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 32 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 43a984e..c0095b7 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -31,21 +31,27 @@ jobs: VERSION=${TAG_NAME#v} echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: 更新 NPM 版本号 - run: npm version $VERSION - - - name: Configure git - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - - - name: Commit changes + - name: Print version run: | - git add package.json - git commit -m "Update version to $VERSION" - git push + echo "The extracted version is: $VERSION" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ env.VERSION }} + + # - name: 更新 NPM 版本号 + # run: npm version $VERSION + + # - name: Configure git + # run: | + # git config --global user.name 'github-actions[bot]' + # git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + # - name: Commit changes + # run: | + # git add package.json + # git commit -m "Update version to $VERSION" + # git push + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - name: 编译上传 # run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file From 7f449e1295b924a499360cf9741e6f9a32b59f44 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:24:40 +0800 Subject: [PATCH 12/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index c0095b7..b5d0595 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -31,27 +31,29 @@ jobs: VERSION=${TAG_NAME#v} echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Print version - run: | - echo "The extracted version is: $VERSION" + # - name: Print version + # run: | + # echo "The extracted version is: $VERSION" + # env: + # VERSION: ${{ env.VERSION }} + + - name: 更新 NPM 版本号 + run: npm version $VERSION env: VERSION: ${{ env.VERSION }} - # - name: 更新 NPM 版本号 - # run: npm version $VERSION - - # - name: Configure git - # run: | - # git config --global user.name 'github-actions[bot]' - # git config --global user.email 'github-actions[bot]@users.noreply.github.com' + - name: Configure git + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' - # - name: Commit changes - # run: | - # git add package.json - # git commit -m "Update version to $VERSION" - # git push - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Commit changes + run: | + git add package.json + git commit -m "Update version to $VERSION" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - name: 编译上传 # run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file From c9aba53f0f6dd613377fc4cdf8f8561edc4ed78a Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:25:58 +0800 Subject: [PATCH 13/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index b5d0595..7c3fc42 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -18,11 +18,11 @@ jobs: node-version: 18 registry-url: https://registry.npmjs.org/ - # - name: 安装依赖 - # run: npm i + - name: 安装依赖 + run: npm i - # - name: 安装 vsce - # run: npm install -g vsce + - name: 安装 vsce + run: npm install -g vsce - name: 获取版本号 id: get_tag @@ -31,12 +31,6 @@ jobs: VERSION=${TAG_NAME#v} echo "VERSION=$VERSION" >> $GITHUB_ENV - # - name: Print version - # run: | - # echo "The extracted version is: $VERSION" - # env: - # VERSION: ${{ env.VERSION }} - - name: 更新 NPM 版本号 run: npm version $VERSION env: @@ -54,6 +48,7 @@ jobs: git push env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ env.VERSION }} # - name: 编译上传 # run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file From 4d72fc1af7402ce03d9a47ca1c0e97946ec82f52 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:27:55 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 7c3fc42..c13ca39 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -32,7 +32,7 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV - name: 更新 NPM 版本号 - run: npm version $VERSION + run: npm version $VERSION --no-git-tag-version env: VERSION: ${{ env.VERSION }} From c0f9426411580c6b76d63d5bfbc9ea0409ba588d Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:36:47 +0800 Subject: [PATCH 15/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index c13ca39..924267c 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -43,6 +43,7 @@ jobs: - name: Commit changes run: | + git checkout ci-test git add package.json git commit -m "Update version to $VERSION" git push From abd7265b612ec32ccbadaa797858b44e17e49f02 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 16:48:51 +0800 Subject: [PATCH 16/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 924267c..a63a5ce 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -43,7 +43,7 @@ jobs: - name: Commit changes run: | - git checkout ci-test + git checkout origin/ci-test git add package.json git commit -m "Update version to $VERSION" git push From ad20229891af8641fb344588c151813af5413aee Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:25:24 +0800 Subject: [PATCH 17/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-test.action.yml | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/ci-test.action.yml diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml new file mode 100644 index 0000000..d4a077c --- /dev/null +++ b/.github/workflows/ci-test.action.yml @@ -0,0 +1,46 @@ +name: CI test + +on: + push: + branches: + - ci-test + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: 安装 Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + + # - name: 获取版本号 + # id: get_tag + # run: | + # TAG_NAME=${GITHUB_REF#refs/tags/} + # VERSION=${TAG_NAME#v} + # echo "VERSION=$VERSION" >> $GITHUB_ENV + + # - name: 更新 NPM 版本号 + # run: npm version $VERSION --no-git-tag-version + # env: + # VERSION: ${{ env.VERSION }} + + - name: Configure git + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Commit changes + run: | + git checkout origin/ci-test + git add package.json + git commit -m "Update version to $VERSION" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ env.VERSION }} \ No newline at end of file From 7a0c7f2845639eabb0ad6f387a02d215163a6255 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:27:12 +0800 Subject: [PATCH 18/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-test.action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml index d4a077c..0047612 100644 --- a/.github/workflows/ci-test.action.yml +++ b/.github/workflows/ci-test.action.yml @@ -37,10 +37,10 @@ jobs: - name: Commit changes run: | - git checkout origin/ci-test - git add package.json - git commit -m "Update version to $VERSION" - git push + git checkout ci-test + # git add package.json + # git commit -m "Update version to $VERSION" + # git push env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION: ${{ env.VERSION }} \ No newline at end of file From 3bb84fbe3f5d768783f3ff0b6f2ba943cbc2879a Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:35:07 +0800 Subject: [PATCH 19/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-test.action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml index 0047612..fe97e1c 100644 --- a/.github/workflows/ci-test.action.yml +++ b/.github/workflows/ci-test.action.yml @@ -12,11 +12,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: 安装 Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - registry-url: https://registry.npmjs.org/ + # - name: 安装 Node.js + # uses: actions/setup-node@v3 + # with: + # node-version: 18 + # registry-url: https://registry.npmjs.org/ # - name: 获取版本号 # id: get_tag From f7af7a950501b52a47c71f0035420e413a486a68 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:37:00 +0800 Subject: [PATCH 20/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-test.action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml index fe97e1c..abf4394 100644 --- a/.github/workflows/ci-test.action.yml +++ b/.github/workflows/ci-test.action.yml @@ -2,8 +2,10 @@ name: CI test on: push: - branches: - - ci-test + tags: + - test-* + # branches: + # - ci-test jobs: build: From cdd55b944f2dcd8bf7a6310fa9fff5db2abca534 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:45:32 +0800 Subject: [PATCH 21/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-test.action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-test.action.yml b/.github/workflows/ci-test.action.yml index abf4394..3b94258 100644 --- a/.github/workflows/ci-test.action.yml +++ b/.github/workflows/ci-test.action.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: ci-test # - name: 安装 Node.js # uses: actions/setup-node@v3 From 6ffe1f434765a1a0b2486a9c1c1a9b93d949c1fc Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:46:44 +0800 Subject: [PATCH 22/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index a63a5ce..13c4c4e 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -11,6 +11,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + ref: ci-test - name: 安装 Node.js uses: actions/setup-node@v3 From 88209d6444553a01a5e847ccb455cc0af54a53f0 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:48:21 +0800 Subject: [PATCH 23/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 13c4c4e..4263b63 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -45,8 +45,7 @@ jobs: - name: Commit changes run: | - git checkout origin/ci-test - git add package.json + git add . git commit -m "Update version to $VERSION" git push env: From b094489242fd273ee607b153de5624a862888268 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 17:49:25 +0800 Subject: [PATCH 24/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 4263b63..8afd69c 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -45,7 +45,7 @@ jobs: - name: Commit changes run: | - git add . + git add package.json git commit -m "Update version to $VERSION" git push env: From 2cf98245fc73bf5f9692af23497ff0b3895602f4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 18 Jun 2024 09:52:51 +0000 Subject: [PATCH 25/26] Update version to 0.6.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7ba7231..e1837c5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nestjs-route-jumper", "displayName": "Nestjs Route Jumper", "description": "A tool developed for nestjs to search for controllers through access paths ", - "version": "0.0.6", + "version": "0.6.0", "publisher": "hmydgz", "icon": "resources/logo.png", "engines": { @@ -85,4 +85,4 @@ "tsconfig-paths": "^4.2.0", "typescript": "^5.3.3" } -} \ No newline at end of file +} From aec185f5d1f1b76645ff6f37b660032875cf65d7 Mon Sep 17 00:00:00 2001 From: hmydgz <920136080@qq.com> Date: Tue, 18 Jun 2024 18:01:23 +0800 Subject: [PATCH 26/26] =?UTF-8?q?=F0=9F=90=8E=20ci:=20=E6=B5=8B=E8=AF=95ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.adtion.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.adtion.yml b/.github/workflows/build.adtion.yml index 8afd69c..f3d2f45 100644 --- a/.github/workflows/build.adtion.yml +++ b/.github/workflows/build.adtion.yml @@ -46,11 +46,11 @@ jobs: - name: Commit changes run: | git add package.json - git commit -m "Update version to $VERSION" + git commit -m "CI Update version to $VERSION" git push env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION: ${{ env.VERSION }} - # - name: 编译上传 - # run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file + - name: 编译上传 + run: vsce publish -p ${{ secrets.VSCODE_PUBLISHER_TOKEN }} \ No newline at end of file