( directory: string )
| 232 | * - return true otherwise |
| 233 | */ |
| 234 | const projectHasYarnBerryManagedDependencies = async ( |
| 235 | directory: string |
| 236 | ): Promise<boolean> => { |
| 237 | const workDir = directory || process.env.GITHUB_WORKSPACE || '.'; |
| 238 | core.debug(`check if "${workDir}" has locally managed yarn3 dependencies`); |
| 239 | |
| 240 | // if .yarn/cache directory exists the cache is managed by version control system |
| 241 | const yarnCacheFile = path.join(workDir, '.yarn', 'cache'); |
| 242 | if ( |
| 243 | fs.existsSync(yarnCacheFile) && |
| 244 | fs.lstatSync(yarnCacheFile).isDirectory() |
| 245 | ) { |
| 246 | core.debug( |
| 247 | `"${workDir}" has .yarn/cache - dependencies are kept in the repository` |
| 248 | ); |
| 249 | return Promise.resolve(false); |
| 250 | } |
| 251 | |
| 252 | // NOTE: yarn1 returns 'undefined' with return code = 0 |
| 253 | const enableGlobalCache = await getCommandOutput( |
| 254 | 'yarn config get enableGlobalCache', |
| 255 | workDir |
| 256 | ); |
| 257 | // only local cache is not managed by yarn |
| 258 | const managed = enableGlobalCache.includes('false'); |
| 259 | if (managed) { |
| 260 | core.debug(`"${workDir}" dependencies are managed by yarn 3 locally`); |
| 261 | return true; |
| 262 | } else { |
| 263 | core.debug(`"${workDir}" dependencies are not managed by yarn 3 locally`); |
| 264 | return false; |
| 265 | } |
| 266 | }; |
| 267 | |
| 268 | /** |
| 269 | * A function to report the repo contains Yarn managed projects |
nothing calls this directly
no test coverage detected