refactor(DependenciesResolver): log workspace information and standardize workspace references

Signed-off-by: 孙振宇 <>
This commit is contained in:
孙振宇 2025-02-04 13:02:40 +08:00
parent 1723d23507
commit 2b8d69c163

View File

@ -38,6 +38,8 @@ class DependenciesResolver {
steps.log.info("Dependencies Resolver","Using ${mgr.manager} to resolve dependencies...") steps.log.info("Dependencies Resolver","Using ${mgr.manager} to resolve dependencies...")
steps.log.info("Dependencies Resolver","Workspace sets to: ${this.workspace}")
if (cachingEnabled) { if (cachingEnabled) {
steps.log.info("Dependencies Resolver","Dependencies caching is enabled") steps.log.info("Dependencies Resolver","Dependencies caching is enabled")
} }
@ -54,13 +56,13 @@ class DependenciesResolver {
def packageJsonFile = configurations.npmPackageJsonFile def packageJsonFile = configurations.npmPackageJsonFile
if (cachingEnabled) { if (cachingEnabled) {
steps.dir(workspace) { steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.npm-cache']]) { steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.npm-cache']]) {
steps.sh "npm install --cache .npm-cache" steps.sh "npm install --cache .npm-cache"
} }
} }
} else { } else {
steps.dir(workspace) { steps.dir(this.workspace) {
steps.sh "npm install" steps.sh "npm install"
} }
} }
@ -74,13 +76,13 @@ class DependenciesResolver {
def packageJsonFile = configurations.yarnPackageJsonFile def packageJsonFile = configurations.yarnPackageJsonFile
if (cachingEnabled) { if (cachingEnabled) {
steps.dir(workspace) { steps.dir(this.workspace) {
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.yarn-cache']]) { steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.yarn-cache']]) {
steps.sh "yarn install --cache-folder .yarn-cache" steps.sh "yarn install --cache-folder .yarn-cache"
} }
} }
} else { } else {
steps.dir(workspace) { steps.dir(this.workspace) {
steps.sh "yarn install" steps.sh "yarn install"
} }
} }