diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index f7964132..125be7d3 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -192,7 +192,7 @@ jobs: latest=false tags: | type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }} - type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.ref == format('refs/heads/{0}', 'master') }} type=semver,pattern={{version}} diff --git a/back/loaders/deps.ts b/back/loaders/deps.ts index cb2ed171..d9413f4b 100644 --- a/back/loaders/deps.ts +++ b/back/loaders/deps.ts @@ -1,22 +1,9 @@ import path from 'path'; import fs from 'fs/promises'; import os from 'os'; -import chokidar from 'chokidar'; import config from '../config/index'; import Logger from './logger'; -async function linkToNodeModule(src: string, dst?: string) { - const target = path.join(config.rootPath, 'node_modules', dst || src); - const source = path.join(config.rootPath, src); - - try { - const stats = await fs.lstat(target); - if (!stats) { - await fs.symlink(source, target, 'dir'); - } - } catch (error) { } -} - async function linkCommand() { const homeDir = os.homedir(); let userBinDir = path.join(homeDir, 'bin'); @@ -59,17 +46,6 @@ async function linkCommandToDir(commandDir: string) { } } -export default async (src: string = 'deps') => { +export default async () => { await linkCommand(); - await linkToNodeModule(src); - - const source = path.join(config.rootPath, src); - const watcher = chokidar.watch(source, { - ignored: /(^|[\/\\])\../, // ignore dotfiles - persistent: true, - }); - - watcher - .on('add', () => linkToNodeModule(src)) - .on('change', () => linkToNodeModule(src)); }; diff --git a/shell/otask.sh b/shell/otask.sh index 75451e36..d311cce7 100755 --- a/shell/otask.sh +++ b/shell/otask.sh @@ -92,6 +92,9 @@ clear_non_sh_env() { append_node_dependency_path() { export PREV_NODE_PATH="${NODE_PATH:=}" + # 用户依赖目录加入 NODE_PATH,替代 symlink 到 node_modules 的方式 + export NODE_PATH="${NODE_PATH:+${NODE_PATH}:}${dir_dep}" + local pnpm_global_path=$(pnpm root -g 2>/dev/null) if [[ -n "$pnpm_global_path" ]]; then export QL_NODE_GLOBAL_PATH="$pnpm_global_path" diff --git a/shell/pub.sh b/shell/pub.sh index 1d5794f4..1d126bc6 100755 --- a/shell/pub.sh +++ b/shell/pub.sh @@ -1,26 +1,26 @@ #!/usr/bin/env bash echo -e "开始发布" -echo -e "切换 debian 分支" -git branch -D debian -git checkout -b debian -git push --set-upstream origin debian -f +echo -e "切换master分支" +git branch -D master +git checkout -b master +git push --set-upstream origin master -f echo -e "更新cdn文件" ts-node-transpile-only sample/tool.ts string=$(cat version.yaml | grep "version" | egrep "[^ ]*" -o | egrep "\d\.*") version="v$string" -echo -e "当前版本$version-debian" +echo -e "当前版本$version" echo -e "删除已经存在的本地tag" -git tag -d "$version-debian" &>/dev/null +git tag -d "$version" &>/dev/null echo -e "删除已经存在的远程tag" -git push origin :refs/tags/$version-debian &>/dev/null +git push origin :refs/tags/$version &>/dev/null echo -e "创建新tag" -git tag -a "$version-debian" -m "release $version-debian" +git tag -a "$version" -m "release $version" echo -e "提交tag" git push --tags