fix(caching): optimize npm and yarn installation commands to prefer offline cache usage
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
81b3095925
commit
ab424b3d65
@ -1,5 +1,4 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
|
||||
@ -66,10 +66,7 @@ class DependenciesResolver {
|
||||
if (cachingEnabled) {
|
||||
steps.dir(this.workspace) {
|
||||
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.npm-cache', cacheValidityDecidingFile: 'package-lock.json']]) {
|
||||
def cacheExists = steps.fileExists('.npm-cache')
|
||||
if (!cacheExists) {
|
||||
steps.sh "npm install --cache .npm-cache"
|
||||
}
|
||||
steps.sh "npm install --cache .npm-cache --prefer-offline"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -91,10 +88,7 @@ class DependenciesResolver {
|
||||
if (cachingEnabled) {
|
||||
steps.dir(this.workspace) {
|
||||
steps.cache(maxCacheSize: 512, caches: [[$class: 'ArbitraryFileCache', includes: '**/*', path: '.yarn-cache', cacheValidityDecidingFile: 'yarn.lock']]) {
|
||||
def cacheExists = steps.fileExists('.yarn-cache')
|
||||
if (!cacheExists) {
|
||||
steps.sh "yarn install --cache-folder .yarn-cache"
|
||||
}
|
||||
steps.sh "yarn install --cache-folder .yarn-cache --prefer-offline"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user