()
| 131 | // enforce the same npm cache folder across different operating systems |
| 132 | const NPM_CACHE_FOLDER = path.join(homeDirectory, '.npm') |
| 133 | const getNpmCache = () => { |
| 134 | const o = {} |
| 135 | let key = core.getInput('cache-key') |
| 136 | const hash = lockHash() |
| 137 | if (!key) { |
| 138 | if (useYarn()) { |
| 139 | key = `yarn-${platformAndArch}-${hash}` |
| 140 | } else if (usePnpm()) { |
| 141 | key = `pnpm-${platformAndArch}-${hash}` |
| 142 | } else { |
| 143 | key = `npm-${platformAndArch}-${hash}` |
| 144 | } |
| 145 | } else { |
| 146 | console.log('using custom cache key "%s"', key) |
| 147 | } |
| 148 | |
| 149 | if (useYarn()) { |
| 150 | o.inputPath = path.join(homeDirectory, '.cache', 'yarn') |
| 151 | } else if (usePnpm()) { |
| 152 | o.inputPath = NPM_CACHE_FOLDER |
| 153 | } else { |
| 154 | o.inputPath = NPM_CACHE_FOLDER |
| 155 | } |
| 156 | |
| 157 | // use exact restore key to prevent npm cache from growing |
| 158 | // https://glebbahmutov.com/blog/do-not-let-npm-cache-snowball/ |
| 159 | o.restoreKeys = o.primaryKey = key |
| 160 | return o |
| 161 | } |
| 162 | |
| 163 | // custom Cypress binary cache folder |
| 164 | // see https://on.cypress.io/caching |
no test coverage detected