mirror of
				https://kkgithub.com/actions/setup-node.git
				synced 2025-11-04 04:31:55 +08:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			v2.3.0
			...
			malob/adr-
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| f43d8a1f27 | |||
| 3c1fbef7d3 | |||
| 5aa72c249a | |||
| d9aab2aba4 | 
							
								
								
									
										33
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							@ -35,39 +35,6 @@ jobs:
 | 
				
			|||||||
        run: __tests__/verify-node.sh "${{ matrix.node-version }}"
 | 
					        run: __tests__/verify-node.sh "${{ matrix.node-version }}"
 | 
				
			||||||
        shell: bash
 | 
					        shell: bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  node-pnpm-depencies-caching:
 | 
					 | 
				
			||||||
    name: Test pnpm (Node ${{ matrix.node-version}}, ${{ matrix.os }})
 | 
					 | 
				
			||||||
    runs-on: ${{ matrix.os }}
 | 
					 | 
				
			||||||
    strategy:
 | 
					 | 
				
			||||||
      fail-fast: false
 | 
					 | 
				
			||||||
      matrix:
 | 
					 | 
				
			||||||
        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
					 | 
				
			||||||
        node-version: [12, 14, 16]
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					 | 
				
			||||||
      - name: Install pnpm
 | 
					 | 
				
			||||||
        uses: pnpm/action-setup@v2
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          version: 6.10.0
 | 
					 | 
				
			||||||
      - name: Generate pnpm file
 | 
					 | 
				
			||||||
        run: pnpm install
 | 
					 | 
				
			||||||
      - name: Remove dependencies
 | 
					 | 
				
			||||||
        shell: pwsh
 | 
					 | 
				
			||||||
        run: Remove-Item node_modules -Force -Recurse
 | 
					 | 
				
			||||||
      - name: Clean global cache
 | 
					 | 
				
			||||||
        run: rm -rf ~/.pnpm-store
 | 
					 | 
				
			||||||
        shell: bash
 | 
					 | 
				
			||||||
      - name: Setup Node
 | 
					 | 
				
			||||||
        uses: ./
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          node-version: ${{ matrix.node-version }}
 | 
					 | 
				
			||||||
          cache: 'pnpm'
 | 
					 | 
				
			||||||
      - name: Install dependencies
 | 
					 | 
				
			||||||
        run: pnpm install
 | 
					 | 
				
			||||||
      - name: Verify node and pnpm
 | 
					 | 
				
			||||||
        run: __tests__/verify-node.sh "${{ matrix.node-version }}"
 | 
					 | 
				
			||||||
        shell: bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  node-yarn1-depencies-caching:
 | 
					  node-yarn1-depencies-caching:
 | 
				
			||||||
    name: Test yarn 1 (Node ${{ matrix.node-version}}, ${{ matrix.os }})
 | 
					    name: Test yarn 1 (Node ${{ matrix.node-version}}, ${{ matrix.os }})
 | 
				
			||||||
    runs-on: ${{ matrix.os }}
 | 
					    runs-on: ${{ matrix.os }}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								README.md
									
									
									
									
									
								
							@ -7,7 +7,7 @@
 | 
				
			|||||||
This action provides the following functionality for GitHub Actions users:
 | 
					This action provides the following functionality for GitHub Actions users:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
 | 
					- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
 | 
				
			||||||
- Optionally caching npm/yarn/pnpm dependencies
 | 
					- Optionally caching npm/yarn dependencies
 | 
				
			||||||
- Registering problem matchers for error output
 | 
					- Registering problem matchers for error output
 | 
				
			||||||
- Configuring authentication for GPR or npm
 | 
					- Configuring authentication for GPR or npm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -41,7 +41,7 @@ nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Caching packages dependencies
 | 
					### Caching packages dependencies
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `yarn`, `pnpm`. The `cache` input is optional, and caching is turned off by default.
 | 
					The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `yarn`. The `cache` input is optional, and caching is turned off by default.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Caching npm dependencies:**
 | 
					**Caching npm dependencies:**
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
@ -68,28 +68,6 @@ steps:
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
Yarn caching handles both yarn versions: 1 or 2. 
 | 
					Yarn caching handles both yarn versions: 1 or 2. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Caching pnpm (v6.10+) dependencies:**
 | 
					 | 
				
			||||||
```yaml
 | 
					 | 
				
			||||||
# This workflow uses actions that are not certified by GitHub.
 | 
					 | 
				
			||||||
# They are provided by a third-party and are governed by
 | 
					 | 
				
			||||||
# separate terms of service, privacy policy, and support
 | 
					 | 
				
			||||||
# documentation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
steps:
 | 
					 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					 | 
				
			||||||
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
 | 
					 | 
				
			||||||
  with:
 | 
					 | 
				
			||||||
    version: 6.10.0
 | 
					 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					 | 
				
			||||||
  with:
 | 
					 | 
				
			||||||
    node-version: '14'
 | 
					 | 
				
			||||||
    cache: 'pnpm'
 | 
					 | 
				
			||||||
- run: pnpm install
 | 
					 | 
				
			||||||
- run: pnpm test
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> At the moment, only `lock` files in the project root are supported.
 | 
					> At the moment, only `lock` files in the project root are supported.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Matrix Testing:
 | 
					### Matrix Testing:
 | 
				
			||||||
 | 
				
			|||||||
@ -14,18 +14,14 @@ describe('cache-restore', () => {
 | 
				
			|||||||
  const platform = process.env.RUNNER_OS;
 | 
					  const platform = process.env.RUNNER_OS;
 | 
				
			||||||
  const commonPath = '/some/random/path';
 | 
					  const commonPath = '/some/random/path';
 | 
				
			||||||
  const npmCachePath = `${commonPath}/npm`;
 | 
					  const npmCachePath = `${commonPath}/npm`;
 | 
				
			||||||
  const pnpmCachePath = `${commonPath}/pnpm`;
 | 
					 | 
				
			||||||
  const yarn1CachePath = `${commonPath}/yarn1`;
 | 
					  const yarn1CachePath = `${commonPath}/yarn1`;
 | 
				
			||||||
  const yarn2CachePath = `${commonPath}/yarn2`;
 | 
					  const yarn2CachePath = `${commonPath}/yarn2`;
 | 
				
			||||||
  const yarnFileHash =
 | 
					  const yarnFileHash =
 | 
				
			||||||
    'b8a0bae5243251f7c07dd52d1f78ff78281dfefaded700a176261b6b54fa245b';
 | 
					    'b8a0bae5243251f7c07dd52d1f78ff78281dfefaded700a176261b6b54fa245b';
 | 
				
			||||||
  const npmFileHash =
 | 
					  const npmFileHash =
 | 
				
			||||||
    'abf7c9b306a3149dcfba4673e2362755503bcceaab46f0e4e6fee0ade493e20c';
 | 
					    'abf7c9b306a3149dcfba4673e2362755503bcceaab46f0e4e6fee0ade493e20c';
 | 
				
			||||||
  const pnpmFileHash =
 | 
					 | 
				
			||||||
    '26309058093e84713f38869c50cf1cee9b08155ede874ec1b44ce3fca8c68c70';
 | 
					 | 
				
			||||||
  const cachesObject = {
 | 
					  const cachesObject = {
 | 
				
			||||||
    [npmCachePath]: npmFileHash,
 | 
					    [npmCachePath]: npmFileHash,
 | 
				
			||||||
    [pnpmCachePath]: pnpmFileHash,
 | 
					 | 
				
			||||||
    [yarn1CachePath]: yarnFileHash,
 | 
					    [yarn1CachePath]: yarnFileHash,
 | 
				
			||||||
    [yarn2CachePath]: yarnFileHash
 | 
					    [yarn2CachePath]: yarnFileHash
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
@ -34,8 +30,6 @@ describe('cache-restore', () => {
 | 
				
			|||||||
    switch (command) {
 | 
					    switch (command) {
 | 
				
			||||||
      case utils.supportedPackageManagers.npm.getCacheFolderCommand:
 | 
					      case utils.supportedPackageManagers.npm.getCacheFolderCommand:
 | 
				
			||||||
        return npmCachePath;
 | 
					        return npmCachePath;
 | 
				
			||||||
      case utils.supportedPackageManagers.pnpm.getCacheFolderCommand:
 | 
					 | 
				
			||||||
        return pnpmCachePath;
 | 
					 | 
				
			||||||
      case utils.supportedPackageManagers.yarn1.getCacheFolderCommand:
 | 
					      case utils.supportedPackageManagers.yarn1.getCacheFolderCommand:
 | 
				
			||||||
        return yarn1CachePath;
 | 
					        return yarn1CachePath;
 | 
				
			||||||
      case utils.supportedPackageManagers.yarn2.getCacheFolderCommand:
 | 
					      case utils.supportedPackageManagers.yarn2.getCacheFolderCommand:
 | 
				
			||||||
@ -72,8 +66,6 @@ describe('cache-restore', () => {
 | 
				
			|||||||
    hashFilesSpy.mockImplementation((pattern: string) => {
 | 
					    hashFilesSpy.mockImplementation((pattern: string) => {
 | 
				
			||||||
      if (pattern.includes('package-lock.json')) {
 | 
					      if (pattern.includes('package-lock.json')) {
 | 
				
			||||||
        return npmFileHash;
 | 
					        return npmFileHash;
 | 
				
			||||||
      } else if (pattern.includes('pnpm-lock.yaml')) {
 | 
					 | 
				
			||||||
        return pnpmFileHash;
 | 
					 | 
				
			||||||
      } else if (pattern.includes('yarn.lock')) {
 | 
					      } else if (pattern.includes('yarn.lock')) {
 | 
				
			||||||
        return yarnFileHash;
 | 
					        return yarnFileHash;
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
@ -105,7 +97,7 @@ describe('cache-restore', () => {
 | 
				
			|||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('Validate provided package manager', () => {
 | 
					  describe('Validate provided package manager', () => {
 | 
				
			||||||
    it.each([['npm7'], ['npm6'], ['pnpm6'], ['yarn1'], ['yarn2'], ['random']])(
 | 
					    it.each([['npm7'], ['npm6'], ['yarn1'], ['yarn2'], ['random']])(
 | 
				
			||||||
      'Throw an error because %s is not supported',
 | 
					      'Throw an error because %s is not supported',
 | 
				
			||||||
      async packageManager => {
 | 
					      async packageManager => {
 | 
				
			||||||
        await expect(restoreCache(packageManager)).rejects.toThrowError(
 | 
					        await expect(restoreCache(packageManager)).rejects.toThrowError(
 | 
				
			||||||
@ -119,8 +111,7 @@ describe('cache-restore', () => {
 | 
				
			|||||||
    it.each([
 | 
					    it.each([
 | 
				
			||||||
      ['yarn', '2.1.2', yarnFileHash],
 | 
					      ['yarn', '2.1.2', yarnFileHash],
 | 
				
			||||||
      ['yarn', '1.2.3', yarnFileHash],
 | 
					      ['yarn', '1.2.3', yarnFileHash],
 | 
				
			||||||
      ['npm', '', npmFileHash],
 | 
					      ['npm', '', npmFileHash]
 | 
				
			||||||
      ['pnpm', '', pnpmFileHash]
 | 
					 | 
				
			||||||
    ])(
 | 
					    ])(
 | 
				
			||||||
      'restored dependencies for %s',
 | 
					      'restored dependencies for %s',
 | 
				
			||||||
      async (packageManager, toolVersion, fileHash) => {
 | 
					      async (packageManager, toolVersion, fileHash) => {
 | 
				
			||||||
@ -148,8 +139,7 @@ describe('cache-restore', () => {
 | 
				
			|||||||
    it.each([
 | 
					    it.each([
 | 
				
			||||||
      ['yarn', '2.1.2', yarnFileHash],
 | 
					      ['yarn', '2.1.2', yarnFileHash],
 | 
				
			||||||
      ['yarn', '1.2.3', yarnFileHash],
 | 
					      ['yarn', '1.2.3', yarnFileHash],
 | 
				
			||||||
      ['npm', '', npmFileHash],
 | 
					      ['npm', '', npmFileHash]
 | 
				
			||||||
      ['pnpm', '', pnpmFileHash]
 | 
					 | 
				
			||||||
    ])(
 | 
					    ])(
 | 
				
			||||||
      'dependencies are changed %s',
 | 
					      'dependencies are changed %s',
 | 
				
			||||||
      async (packageManager, toolVersion, fileHash) => {
 | 
					      async (packageManager, toolVersion, fileHash) => {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,6 @@
 | 
				
			|||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
import * as cache from '@actions/cache';
 | 
					import * as cache from '@actions/cache';
 | 
				
			||||||
import * as glob from '@actions/glob';
 | 
					import * as glob from '@actions/glob';
 | 
				
			||||||
import fs from 'fs';
 | 
					 | 
				
			||||||
import path from 'path';
 | 
					import path from 'path';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import * as utils from '../src/cache-utils';
 | 
					import * as utils from '../src/cache-utils';
 | 
				
			||||||
@ -13,8 +12,6 @@ describe('run', () => {
 | 
				
			|||||||
    'b8a0bae5243251f7c07dd52d1f78ff78281dfefaded700a176261b6b54fa245b';
 | 
					    'b8a0bae5243251f7c07dd52d1f78ff78281dfefaded700a176261b6b54fa245b';
 | 
				
			||||||
  const npmFileHash =
 | 
					  const npmFileHash =
 | 
				
			||||||
    'abf7c9b306a3149dcfba4673e2362755503bcceaab46f0e4e6fee0ade493e20c';
 | 
					    'abf7c9b306a3149dcfba4673e2362755503bcceaab46f0e4e6fee0ade493e20c';
 | 
				
			||||||
  const pnpmFileHash =
 | 
					 | 
				
			||||||
    '26309058093e84713f38869c50cf1cee9b08155ede874ec1b44ce3fca8c68c70';
 | 
					 | 
				
			||||||
  const commonPath = '/some/random/path';
 | 
					  const commonPath = '/some/random/path';
 | 
				
			||||||
  process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
 | 
					  process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -29,7 +26,6 @@ describe('run', () => {
 | 
				
			|||||||
  let saveCacheSpy: jest.SpyInstance;
 | 
					  let saveCacheSpy: jest.SpyInstance;
 | 
				
			||||||
  let getCommandOutputSpy: jest.SpyInstance;
 | 
					  let getCommandOutputSpy: jest.SpyInstance;
 | 
				
			||||||
  let hashFilesSpy: jest.SpyInstance;
 | 
					  let hashFilesSpy: jest.SpyInstance;
 | 
				
			||||||
  let existsSpy: jest.SpyInstance;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(() => {
 | 
					  beforeEach(() => {
 | 
				
			||||||
    getInputSpy = jest.spyOn(core, 'getInput');
 | 
					    getInputSpy = jest.spyOn(core, 'getInput');
 | 
				
			||||||
@ -65,17 +61,10 @@ describe('run', () => {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    existsSpy = jest.spyOn(fs, 'existsSync');
 | 
					 | 
				
			||||||
    existsSpy.mockImplementation(() => true);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // utils
 | 
					    // utils
 | 
				
			||||||
    getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
 | 
					    getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(() => {
 | 
					 | 
				
			||||||
    existsSpy.mockRestore();
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  describe('Package manager validation', () => {
 | 
					  describe('Package manager validation', () => {
 | 
				
			||||||
    it('Package manager is not provided, skip caching', async () => {
 | 
					    it('Package manager is not provided, skip caching', async () => {
 | 
				
			||||||
      inputs['cache'] = '';
 | 
					      inputs['cache'] = '';
 | 
				
			||||||
@ -161,23 +150,6 @@ describe('run', () => {
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
					      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('should not save cache for pnpm', async () => {
 | 
					 | 
				
			||||||
      inputs['cache'] = 'pnpm';
 | 
					 | 
				
			||||||
      getStateSpy.mockImplementation(() => pnpmFileHash);
 | 
					 | 
				
			||||||
      getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/pnpm`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      await run();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      expect(getInputSpy).toHaveBeenCalled();
 | 
					 | 
				
			||||||
      expect(getStateSpy).toHaveBeenCalledTimes(2);
 | 
					 | 
				
			||||||
      expect(getCommandOutputSpy).toHaveBeenCalledTimes(1);
 | 
					 | 
				
			||||||
      expect(debugSpy).toHaveBeenCalledWith(`pnpm path is ${commonPath}/pnpm`);
 | 
					 | 
				
			||||||
      expect(infoSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `Cache hit occurred on the primary key ${pnpmFileHash}, not saving cache.`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('action saves the cache', () => {
 | 
					  describe('action saves the cache', () => {
 | 
				
			||||||
@ -267,33 +239,6 @@ describe('run', () => {
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
					      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('saves cache from pnpm', async () => {
 | 
					 | 
				
			||||||
      inputs['cache'] = 'pnpm';
 | 
					 | 
				
			||||||
      getStateSpy.mockImplementation((name: string) => {
 | 
					 | 
				
			||||||
        if (name === State.CacheMatchedKey) {
 | 
					 | 
				
			||||||
          return pnpmFileHash;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          return npmFileHash;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/pnpm`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      await run();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      expect(getInputSpy).toHaveBeenCalled();
 | 
					 | 
				
			||||||
      expect(getStateSpy).toHaveBeenCalledTimes(2);
 | 
					 | 
				
			||||||
      expect(getCommandOutputSpy).toHaveBeenCalledTimes(1);
 | 
					 | 
				
			||||||
      expect(debugSpy).toHaveBeenCalledWith(`pnpm path is ${commonPath}/pnpm`);
 | 
					 | 
				
			||||||
      expect(infoSpy).not.toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `Cache hit occurred on the primary key ${pnpmFileHash}, not saving cache.`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(saveCacheSpy).toHaveBeenCalled();
 | 
					 | 
				
			||||||
      expect(infoSpy).toHaveBeenLastCalledWith(
 | 
					 | 
				
			||||||
        `Cache saved with the key: ${npmFileHash}`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(() => {
 | 
					  afterEach(() => {
 | 
				
			||||||
 | 
				
			|||||||
@ -14,10 +14,6 @@ describe('cache-utils', () => {
 | 
				
			|||||||
  function getPackagePath(name: string) {
 | 
					  function getPackagePath(name: string) {
 | 
				
			||||||
    if (name === utils.supportedPackageManagers.npm.getCacheFolderCommand) {
 | 
					    if (name === utils.supportedPackageManagers.npm.getCacheFolderCommand) {
 | 
				
			||||||
      return `${commonPath}/npm`;
 | 
					      return `${commonPath}/npm`;
 | 
				
			||||||
    } else if (
 | 
					 | 
				
			||||||
      name === utils.supportedPackageManagers.pnpm.getCacheFolderCommand
 | 
					 | 
				
			||||||
    ) {
 | 
					 | 
				
			||||||
      return `${commonPath}/pnpm`;
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      if (name === utils.supportedPackageManagers.yarn1.getCacheFolderCommand) {
 | 
					      if (name === utils.supportedPackageManagers.yarn1.getCacheFolderCommand) {
 | 
				
			||||||
        return `${commonPath}/yarn1`;
 | 
					        return `${commonPath}/yarn1`;
 | 
				
			||||||
@ -38,7 +34,6 @@ describe('cache-utils', () => {
 | 
				
			|||||||
  describe('getPackageManagerInfo', () => {
 | 
					  describe('getPackageManagerInfo', () => {
 | 
				
			||||||
    it.each<[string, PackageManagerInfo | null]>([
 | 
					    it.each<[string, PackageManagerInfo | null]>([
 | 
				
			||||||
      ['npm', utils.supportedPackageManagers.npm],
 | 
					      ['npm', utils.supportedPackageManagers.npm],
 | 
				
			||||||
      ['pnpm', utils.supportedPackageManagers.pnpm],
 | 
					 | 
				
			||||||
      ['yarn', utils.supportedPackageManagers.yarn1],
 | 
					      ['yarn', utils.supportedPackageManagers.yarn1],
 | 
				
			||||||
      ['yarn1', null],
 | 
					      ['yarn1', null],
 | 
				
			||||||
      ['yarn2', null],
 | 
					      ['yarn2', null],
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										360
									
								
								__tests__/data/pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										360
									
								
								__tests__/data/pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							@ -1,360 +0,0 @@
 | 
				
			|||||||
lockfileVersion: 5.3
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
specifiers:
 | 
					 | 
				
			||||||
  express: ^4.17.1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
dependencies:
 | 
					 | 
				
			||||||
  express: 4.17.1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
packages:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /accepts/1.3.7:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      mime-types: 2.1.31
 | 
					 | 
				
			||||||
      negotiator: 0.6.2
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /array-flatten/1.1.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /body-parser/1.19.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      bytes: 3.1.0
 | 
					 | 
				
			||||||
      content-type: 1.0.4
 | 
					 | 
				
			||||||
      debug: 2.6.9
 | 
					 | 
				
			||||||
      depd: 1.1.2
 | 
					 | 
				
			||||||
      http-errors: 1.7.2
 | 
					 | 
				
			||||||
      iconv-lite: 0.4.24
 | 
					 | 
				
			||||||
      on-finished: 2.3.0
 | 
					 | 
				
			||||||
      qs: 6.7.0
 | 
					 | 
				
			||||||
      raw-body: 2.4.0
 | 
					 | 
				
			||||||
      type-is: 1.6.18
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /bytes/3.1.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /content-disposition/0.5.3:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      safe-buffer: 5.1.2
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /content-type/1.0.4:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /cookie-signature/1.0.6:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-4wOogrNCzD7oylE6eZmXNNqzriw=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /cookie/0.4.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /debug/2.6.9:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      ms: 2.0.0
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /depd/1.1.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /destroy/1.0.4:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /ee-first/1.1.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /encodeurl/1.0.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /escape-html/1.0.3:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /etag/1.8.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /express/4.17.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.10.0'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      accepts: 1.3.7
 | 
					 | 
				
			||||||
      array-flatten: 1.1.1
 | 
					 | 
				
			||||||
      body-parser: 1.19.0
 | 
					 | 
				
			||||||
      content-disposition: 0.5.3
 | 
					 | 
				
			||||||
      content-type: 1.0.4
 | 
					 | 
				
			||||||
      cookie: 0.4.0
 | 
					 | 
				
			||||||
      cookie-signature: 1.0.6
 | 
					 | 
				
			||||||
      debug: 2.6.9
 | 
					 | 
				
			||||||
      depd: 1.1.2
 | 
					 | 
				
			||||||
      encodeurl: 1.0.2
 | 
					 | 
				
			||||||
      escape-html: 1.0.3
 | 
					 | 
				
			||||||
      etag: 1.8.1
 | 
					 | 
				
			||||||
      finalhandler: 1.1.2
 | 
					 | 
				
			||||||
      fresh: 0.5.2
 | 
					 | 
				
			||||||
      merge-descriptors: 1.0.1
 | 
					 | 
				
			||||||
      methods: 1.1.2
 | 
					 | 
				
			||||||
      on-finished: 2.3.0
 | 
					 | 
				
			||||||
      parseurl: 1.3.3
 | 
					 | 
				
			||||||
      path-to-regexp: 0.1.7
 | 
					 | 
				
			||||||
      proxy-addr: 2.0.7
 | 
					 | 
				
			||||||
      qs: 6.7.0
 | 
					 | 
				
			||||||
      range-parser: 1.2.1
 | 
					 | 
				
			||||||
      safe-buffer: 5.1.2
 | 
					 | 
				
			||||||
      send: 0.17.1
 | 
					 | 
				
			||||||
      serve-static: 1.14.1
 | 
					 | 
				
			||||||
      setprototypeof: 1.1.1
 | 
					 | 
				
			||||||
      statuses: 1.5.0
 | 
					 | 
				
			||||||
      type-is: 1.6.18
 | 
					 | 
				
			||||||
      utils-merge: 1.0.1
 | 
					 | 
				
			||||||
      vary: 1.1.2
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /finalhandler/1.1.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      debug: 2.6.9
 | 
					 | 
				
			||||||
      encodeurl: 1.0.2
 | 
					 | 
				
			||||||
      escape-html: 1.0.3
 | 
					 | 
				
			||||||
      on-finished: 2.3.0
 | 
					 | 
				
			||||||
      parseurl: 1.3.3
 | 
					 | 
				
			||||||
      statuses: 1.5.0
 | 
					 | 
				
			||||||
      unpipe: 1.0.0
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /forwarded/0.2.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /fresh/0.5.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /http-errors/1.7.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      depd: 1.1.2
 | 
					 | 
				
			||||||
      inherits: 2.0.3
 | 
					 | 
				
			||||||
      setprototypeof: 1.1.1
 | 
					 | 
				
			||||||
      statuses: 1.5.0
 | 
					 | 
				
			||||||
      toidentifier: 1.0.0
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /http-errors/1.7.3:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      depd: 1.1.2
 | 
					 | 
				
			||||||
      inherits: 2.0.4
 | 
					 | 
				
			||||||
      setprototypeof: 1.1.1
 | 
					 | 
				
			||||||
      statuses: 1.5.0
 | 
					 | 
				
			||||||
      toidentifier: 1.0.0
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /iconv-lite/0.4.24:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
 | 
					 | 
				
			||||||
    engines: {node: '>=0.10.0'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      safer-buffer: 2.1.2
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /inherits/2.0.3:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /inherits/2.0.4:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /ipaddr.js/1.9.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.10'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /media-typer/0.3.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /merge-descriptors/1.0.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /methods/1.1.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /mime-db/1.48.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /mime-types/2.1.31:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      mime-db: 1.48.0
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /mime/1.6.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==}
 | 
					 | 
				
			||||||
    engines: {node: '>=4'}
 | 
					 | 
				
			||||||
    hasBin: true
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /ms/2.0.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /ms/2.1.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /negotiator/0.6.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /on-finished/2.3.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      ee-first: 1.1.1
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /parseurl/1.3.3:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /path-to-regexp/0.1.7:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /proxy-addr/2.0.7:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.10'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      forwarded: 0.2.0
 | 
					 | 
				
			||||||
      ipaddr.js: 1.9.1
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /qs/6.7.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==}
 | 
					 | 
				
			||||||
    engines: {node: '>=0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /range-parser/1.2.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /raw-body/2.4.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      bytes: 3.1.0
 | 
					 | 
				
			||||||
      http-errors: 1.7.2
 | 
					 | 
				
			||||||
      iconv-lite: 0.4.24
 | 
					 | 
				
			||||||
      unpipe: 1.0.0
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /safe-buffer/5.1.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /safer-buffer/2.1.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /send/0.17.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8.0'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      debug: 2.6.9
 | 
					 | 
				
			||||||
      depd: 1.1.2
 | 
					 | 
				
			||||||
      destroy: 1.0.4
 | 
					 | 
				
			||||||
      encodeurl: 1.0.2
 | 
					 | 
				
			||||||
      escape-html: 1.0.3
 | 
					 | 
				
			||||||
      etag: 1.8.1
 | 
					 | 
				
			||||||
      fresh: 0.5.2
 | 
					 | 
				
			||||||
      http-errors: 1.7.3
 | 
					 | 
				
			||||||
      mime: 1.6.0
 | 
					 | 
				
			||||||
      ms: 2.1.1
 | 
					 | 
				
			||||||
      on-finished: 2.3.0
 | 
					 | 
				
			||||||
      range-parser: 1.2.1
 | 
					 | 
				
			||||||
      statuses: 1.5.0
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /serve-static/1.14.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8.0'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      encodeurl: 1.0.2
 | 
					 | 
				
			||||||
      escape-html: 1.0.3
 | 
					 | 
				
			||||||
      parseurl: 1.3.3
 | 
					 | 
				
			||||||
      send: 0.17.1
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /setprototypeof/1.1.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /statuses/1.5.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /toidentifier/1.0.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==}
 | 
					 | 
				
			||||||
    engines: {node: '>=0.6'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /type-is/1.6.18:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.6'}
 | 
					 | 
				
			||||||
    dependencies:
 | 
					 | 
				
			||||||
      media-typer: 0.3.0
 | 
					 | 
				
			||||||
      mime-types: 2.1.31
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /unpipe/1.0.0:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /utils-merge/1.0.1:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.4.0'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /vary/1.1.2:
 | 
					 | 
				
			||||||
    resolution: {integrity: sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=}
 | 
					 | 
				
			||||||
    engines: {node: '>= 0.8'}
 | 
					 | 
				
			||||||
    dev: false
 | 
					 | 
				
			||||||
@ -20,7 +20,7 @@ inputs:
 | 
				
			|||||||
    description: Used to pull node distributions from node-versions.  Since there's a default, this is typically not supplied by the user.
 | 
					    description: Used to pull node distributions from node-versions.  Since there's a default, this is typically not supplied by the user.
 | 
				
			||||||
    default: ${{ github.token }}
 | 
					    default: ${{ github.token }}
 | 
				
			||||||
  cache:
 | 
					  cache:
 | 
				
			||||||
    description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm'
 | 
					    description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn'
 | 
				
			||||||
# TODO: add input to control forcing to pull from cloud or dist. 
 | 
					# TODO: add input to control forcing to pull from cloud or dist. 
 | 
				
			||||||
#       escape valve for someone having issues or needing the absolute latest which isn't cached yet
 | 
					#       escape valve for someone having issues or needing the absolute latest which isn't cached yet
 | 
				
			||||||
# Deprecated option, do not use. Will not be supported after October 1, 2019
 | 
					# Deprecated option, do not use. Will not be supported after October 1, 2019
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							@ -4290,10 +4290,6 @@ exports.supportedPackageManagers = {
 | 
				
			|||||||
        lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
					        lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
				
			||||||
        getCacheFolderCommand: 'npm config get cache'
 | 
					        getCacheFolderCommand: 'npm config get cache'
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    pnpm: {
 | 
					 | 
				
			||||||
        lockFilePatterns: ['pnpm-lock.yaml'],
 | 
					 | 
				
			||||||
        getCacheFolderCommand: 'pnpm store path'
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    yarn1: {
 | 
					    yarn1: {
 | 
				
			||||||
        lockFilePatterns: ['yarn.lock'],
 | 
					        lockFilePatterns: ['yarn.lock'],
 | 
				
			||||||
        getCacheFolderCommand: 'yarn cache dir'
 | 
					        getCacheFolderCommand: 'yarn cache dir'
 | 
				
			||||||
@ -4308,7 +4304,7 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
 | 
				
			|||||||
    if (stderr) {
 | 
					    if (stderr) {
 | 
				
			||||||
        throw new Error(stderr);
 | 
					        throw new Error(stderr);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return stdout.trim();
 | 
					    return stdout;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
 | 
					const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
 | 
				
			||||||
    const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
 | 
					    const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
 | 
				
			||||||
@ -4321,9 +4317,6 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
 | 
				
			|||||||
    if (packageManager === 'npm') {
 | 
					    if (packageManager === 'npm') {
 | 
				
			||||||
        return exports.supportedPackageManagers.npm;
 | 
					        return exports.supportedPackageManagers.npm;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (packageManager === 'pnpm') {
 | 
					 | 
				
			||||||
        return exports.supportedPackageManagers.pnpm;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else if (packageManager === 'yarn') {
 | 
					    else if (packageManager === 'yarn') {
 | 
				
			||||||
        const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
 | 
					        const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
 | 
				
			||||||
        core.debug(`Consumed yarn version is ${yarnVersion}`);
 | 
					        core.debug(`Consumed yarn version is ${yarnVersion}`);
 | 
				
			||||||
@ -5277,7 +5270,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			|||||||
var LockType;
 | 
					var LockType;
 | 
				
			||||||
(function (LockType) {
 | 
					(function (LockType) {
 | 
				
			||||||
    LockType["Npm"] = "npm";
 | 
					    LockType["Npm"] = "npm";
 | 
				
			||||||
    LockType["Pnpm"] = "pnpm";
 | 
					 | 
				
			||||||
    LockType["Yarn"] = "yarn";
 | 
					    LockType["Yarn"] = "yarn";
 | 
				
			||||||
})(LockType = exports.LockType || (exports.LockType = {}));
 | 
					})(LockType = exports.LockType || (exports.LockType = {}));
 | 
				
			||||||
var State;
 | 
					var State;
 | 
				
			||||||
@ -50605,13 +50597,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
 | 
				
			|||||||
    result["default"] = mod;
 | 
					    result["default"] = mod;
 | 
				
			||||||
    return result;
 | 
					    return result;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
 | 
					 | 
				
			||||||
    return (mod && mod.__esModule) ? mod : { "default": mod };
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
const core = __importStar(__webpack_require__(470));
 | 
					const core = __importStar(__webpack_require__(470));
 | 
				
			||||||
const cache = __importStar(__webpack_require__(692));
 | 
					const cache = __importStar(__webpack_require__(692));
 | 
				
			||||||
const fs_1 = __importDefault(__webpack_require__(747));
 | 
					 | 
				
			||||||
const constants_1 = __webpack_require__(196);
 | 
					const constants_1 = __webpack_require__(196);
 | 
				
			||||||
const cache_utils_1 = __webpack_require__(143);
 | 
					const cache_utils_1 = __webpack_require__(143);
 | 
				
			||||||
function run() {
 | 
					function run() {
 | 
				
			||||||
@ -50635,9 +50623,6 @@ const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, func
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
 | 
					    const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
 | 
				
			||||||
    if (!fs_1.default.existsSync(cachePath)) {
 | 
					 | 
				
			||||||
        throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (primaryKey === state) {
 | 
					    if (primaryKey === state) {
 | 
				
			||||||
        core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
					        core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							@ -8652,7 +8652,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			|||||||
var LockType;
 | 
					var LockType;
 | 
				
			||||||
(function (LockType) {
 | 
					(function (LockType) {
 | 
				
			||||||
    LockType["Npm"] = "npm";
 | 
					    LockType["Npm"] = "npm";
 | 
				
			||||||
    LockType["Pnpm"] = "pnpm";
 | 
					 | 
				
			||||||
    LockType["Yarn"] = "yarn";
 | 
					    LockType["Yarn"] = "yarn";
 | 
				
			||||||
})(LockType = exports.LockType || (exports.LockType = {}));
 | 
					})(LockType = exports.LockType || (exports.LockType = {}));
 | 
				
			||||||
var State;
 | 
					var State;
 | 
				
			||||||
@ -51588,10 +51587,6 @@ exports.supportedPackageManagers = {
 | 
				
			|||||||
        lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
					        lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
				
			||||||
        getCacheFolderCommand: 'npm config get cache'
 | 
					        getCacheFolderCommand: 'npm config get cache'
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    pnpm: {
 | 
					 | 
				
			||||||
        lockFilePatterns: ['pnpm-lock.yaml'],
 | 
					 | 
				
			||||||
        getCacheFolderCommand: 'pnpm store path'
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    yarn1: {
 | 
					    yarn1: {
 | 
				
			||||||
        lockFilePatterns: ['yarn.lock'],
 | 
					        lockFilePatterns: ['yarn.lock'],
 | 
				
			||||||
        getCacheFolderCommand: 'yarn cache dir'
 | 
					        getCacheFolderCommand: 'yarn cache dir'
 | 
				
			||||||
@ -51606,7 +51601,7 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
 | 
				
			|||||||
    if (stderr) {
 | 
					    if (stderr) {
 | 
				
			||||||
        throw new Error(stderr);
 | 
					        throw new Error(stderr);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return stdout.trim();
 | 
					    return stdout;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
 | 
					const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
 | 
				
			||||||
    const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
 | 
					    const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
 | 
				
			||||||
@ -51619,9 +51614,6 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
 | 
				
			|||||||
    if (packageManager === 'npm') {
 | 
					    if (packageManager === 'npm') {
 | 
				
			||||||
        return exports.supportedPackageManagers.npm;
 | 
					        return exports.supportedPackageManagers.npm;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (packageManager === 'pnpm') {
 | 
					 | 
				
			||||||
        return exports.supportedPackageManagers.pnpm;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else if (packageManager === 'yarn') {
 | 
					    else if (packageManager === 'yarn') {
 | 
				
			||||||
        const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
 | 
					        const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
 | 
				
			||||||
        core.debug(`Consumed yarn version is ${yarnVersion}`);
 | 
					        core.debug(`Consumed yarn version is ${yarnVersion}`);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
# 0. Caching dependencies
 | 
					# 0. Caching dependencies
 | 
				
			||||||
Date: 2021-05-21
 | 
					Date: 2021-05-21
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Status: Proposed
 | 
					Status: Accepted
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Context
 | 
					# Context
 | 
				
			||||||
`actions/setup-node` is the 2nd most popular action in GitHub Actions. A lot of customers use it in conjunction with [actions/cache](https://github.com/actions/cache) to speed up dependencies installation.  
 | 
					`actions/setup-node` is the 2nd most popular action in GitHub Actions. A lot of customers use it in conjunction with [actions/cache](https://github.com/actions/cache) to speed up dependencies installation.  
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										48
									
								
								docs/adrs/0001-support-caching-deps-for-monorepos.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								docs/adrs/0001-support-caching-deps-for-monorepos.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					# 0. Support caching dependencies for mono repos
 | 
				
			||||||
 | 
					Date: 2021-07-13
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Status: Proposed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Context
 | 
				
			||||||
 | 
					Currently, `actions/setup-node` supports caching dependencies for Npm and Yarn package managers.  
 | 
				
			||||||
 | 
					For the first iteration, we have decided to not support cases where `package-lock.json` / `yarn.lock` are located outside of repository root.  
 | 
				
			||||||
 | 
					Current implementation searches the following file patterns in the repository root: `package-lock.json`, `yarn.lock` (in order of resolving priorities)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Obviously, it made build-in caching unusable for mono-repos and repos with complex structure.  
 | 
				
			||||||
 | 
					We would like to revisit this decision and add customization for dependencies lock file location.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Proposal
 | 
				
			||||||
 | 
					We have the following options:
 | 
				
			||||||
 | 
					1. Allow to specify  directory where `package-lock.json` or `yarn.lock` are located
 | 
				
			||||||
 | 
					2. Allow to specify path to the dependencies lock file (including directory path and filename)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The second option looks more generic because it allows to:
 | 
				
			||||||
 | 
					- specify multiple dependencies files using file patterns like `**/package-lock.json` ([one of recommended approaches in actions/cache](https://github.com/actions/cache/blob/main/examples.md#macos-and-ubuntu))
 | 
				
			||||||
 | 
					- specify custom dependencies files like `src/npm-shrinkwrap.json`
 | 
				
			||||||
 | 
					- change default resolving priority if both `yarn.lock` and `package-lock.json` exist in repository
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Decision
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Add `cache-dependency-path` input that will accept path (relative to repository root) to dependencies lock file.  
 | 
				
			||||||
 | 
					If provided path contains wildcards, the action will search all maching files and calculate common hash like `${{ hashFiles('**/package-lock.json') }}` YAML construction does.  
 | 
				
			||||||
 | 
					The hash of provided matched files will be used as a part of cache key.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Yaml examples:
 | 
				
			||||||
 | 
					```yml
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
 | 
					  with:
 | 
				
			||||||
 | 
					    node-version: 14
 | 
				
			||||||
 | 
					    cache: npm
 | 
				
			||||||
 | 
					    cache-dependency-path: 'sub-project/package-lock.json'
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					```yml
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
 | 
					  with:
 | 
				
			||||||
 | 
					    node-version: 14
 | 
				
			||||||
 | 
					    cache: yarn
 | 
				
			||||||
 | 
					    cache-dependency-path: 'sub-project/**/yarn.lock'
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
import * as cache from '@actions/cache';
 | 
					import * as cache from '@actions/cache';
 | 
				
			||||||
import fs from 'fs';
 | 
					 | 
				
			||||||
import {State} from './constants';
 | 
					import {State} from './constants';
 | 
				
			||||||
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
 | 
					import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -27,13 +26,6 @@ const cachePackages = async (packageManager: string) => {
 | 
				
			|||||||
    packageManagerInfo,
 | 
					    packageManagerInfo,
 | 
				
			||||||
    packageManager
 | 
					    packageManager
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (!fs.existsSync(cachePath)) {
 | 
					 | 
				
			||||||
    throw new Error(
 | 
					 | 
				
			||||||
      `Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (primaryKey === state) {
 | 
					  if (primaryKey === state) {
 | 
				
			||||||
    core.info(
 | 
					    core.info(
 | 
				
			||||||
      `Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
 | 
					      `Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
 | 
				
			||||||
 | 
				
			|||||||
@ -15,10 +15,6 @@ export const supportedPackageManagers: SupportedPackageManagers = {
 | 
				
			|||||||
    lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
					    lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
				
			||||||
    getCacheFolderCommand: 'npm config get cache'
 | 
					    getCacheFolderCommand: 'npm config get cache'
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  pnpm: {
 | 
					 | 
				
			||||||
    lockFilePatterns: ['pnpm-lock.yaml'],
 | 
					 | 
				
			||||||
    getCacheFolderCommand: 'pnpm store path'
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  yarn1: {
 | 
					  yarn1: {
 | 
				
			||||||
    lockFilePatterns: ['yarn.lock'],
 | 
					    lockFilePatterns: ['yarn.lock'],
 | 
				
			||||||
    getCacheFolderCommand: 'yarn cache dir'
 | 
					    getCacheFolderCommand: 'yarn cache dir'
 | 
				
			||||||
@ -36,7 +32,7 @@ export const getCommandOutput = async (toolCommand: string) => {
 | 
				
			|||||||
    throw new Error(stderr);
 | 
					    throw new Error(stderr);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return stdout.trim();
 | 
					  return stdout;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const getPackageManagerVersion = async (
 | 
					const getPackageManagerVersion = async (
 | 
				
			||||||
@ -55,8 +51,6 @@ const getPackageManagerVersion = async (
 | 
				
			|||||||
export const getPackageManagerInfo = async (packageManager: string) => {
 | 
					export const getPackageManagerInfo = async (packageManager: string) => {
 | 
				
			||||||
  if (packageManager === 'npm') {
 | 
					  if (packageManager === 'npm') {
 | 
				
			||||||
    return supportedPackageManagers.npm;
 | 
					    return supportedPackageManagers.npm;
 | 
				
			||||||
  } else if (packageManager === 'pnpm') {
 | 
					 | 
				
			||||||
    return supportedPackageManagers.pnpm;
 | 
					 | 
				
			||||||
  } else if (packageManager === 'yarn') {
 | 
					  } else if (packageManager === 'yarn') {
 | 
				
			||||||
    const yarnVersion = await getPackageManagerVersion('yarn', '--version');
 | 
					    const yarnVersion = await getPackageManagerVersion('yarn', '--version');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
export enum LockType {
 | 
					export enum LockType {
 | 
				
			||||||
  Npm = 'npm',
 | 
					  Npm = 'npm',
 | 
				
			||||||
  Pnpm = 'pnpm',
 | 
					 | 
				
			||||||
  Yarn = 'yarn'
 | 
					  Yarn = 'yarn'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user