更新ci npm缓存设置

pull/1989/head
lyswhut 2024-05-18 18:55:41 +08:00
parent 8a20b773fb
commit 53b470ed09
4 changed files with 16 additions and 10 deletions

View File

@ -9,15 +9,20 @@ runs:
with:
node-version: '20'
# - name: Get npm cache directory
# run: node -p -e '`NPM_CACHE_DIR=${require("child_process").execSync("npm config get cache").toString()}`' >> $GITHUB_ENV
# run: echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
# https://docs.npmjs.com/cli/v10/configuring-npm/folders#cache
- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
with:
path: |
${{ env.NPM_CACHE }}
key: ${{ runner.os }}-node-modules-cache-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-npm-cache-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-cache-
${{ runner.os }}-npm-cache-
- name: Install dependencies
run: npm ci

View File

@ -44,7 +44,7 @@ jobs:
name: Windows
runs-on: windows-latest
env:
NPM_CACHE: '%APPDATA%\npm-cache'
NPM_CACHE: '%LocalAppData%/npm-cache'
# needs: CheckCode
steps:
- name: Check out git repository
@ -131,7 +131,7 @@ jobs:
runs-on: macos-latest
# needs: CheckCode
env:
NPM_CACHE: $HOME/.npm
NPM_CACHE: ~/.npm
steps:
- name: Check out git repository
uses: actions/checkout@v4
@ -178,7 +178,7 @@ jobs:
name: Linux
runs-on: ubuntu-latest
env:
NPM_CACHE: $HOME/.npm
NPM_CACHE: ~/.npm
# needs: CheckCode
steps:
- name: Install package

View File

@ -44,7 +44,7 @@ jobs:
name: Windows
runs-on: windows-latest
env:
NPM_CACHE: '%APPDATA%\npm-cache'
NPM_CACHE: '%LocalAppData%/npm-cache'
# needs: CheckCode
steps:
- name: Check out git repository
@ -78,7 +78,7 @@ jobs:
name: Windows_7
runs-on: windows-latest
env:
NPM_CACHE: '%APPDATA%\npm-cache'
NPM_CACHE: '%LocalAppData%/npm-cache'
# needs: CheckCode
steps:
- name: Check out git repository
@ -115,7 +115,7 @@ jobs:
name: Mac
runs-on: macos-latest
env:
NPM_CACHE: $HOME/.npm
NPM_CACHE: ~/.npm
# needs: CheckCode
steps:
- name: Check out git repository
@ -153,7 +153,7 @@ jobs:
name: Linux
runs-on: ubuntu-latest
env:
NPM_CACHE: $HOME/.npm
NPM_CACHE: ~/.npm
# needs: CheckCode
steps:
- name: Install package

View File

@ -188,7 +188,7 @@ const useSearchPlayMusic = () => {
// console.log(paths, data)
let info
if (paths.length) {
let name = paths[0]
let name = paths[0].trim()
let singer = ''
if (name.includes('-')) [name, singer] = name.split('-').map(val => val.trim())
info = {
@ -197,6 +197,7 @@ const useSearchPlayMusic = () => {
}
} else info = data
info = verifyInfo(info)
if (!info.name) return
const musicList = await searchMusic(info.name, info.singer || '', info.albumName || '', info.interval || null)
if (musicList.length) {
console.log('find music:', musicList)