From c61e25f5be38c0f1e603001e571c58ac634e7441 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 13 Jan 2022 22:03:36 +0100 Subject: [PATCH] refactor: enable caches by default --- README.md | 4 ++-- action.yml | 4 ++-- src/actions/setup.ts | 4 ++-- tests/actions/setup.test.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7022ef9e..f7cc1327 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,9 @@ Here is a summary of all the variables that you can use and their purpose. | variable | default | description | | ---------------- | ------- | ------------------------------------------------------------------------------------ | | `expo-version` | `''` | [Expo CLI](https://github.com/expo/expo-cli) version to install, skips when omitted. | -| `expo-cache` | `false` | If it should use the [GitHub actions cache](#using-the-built-in-cache). | +| `expo-cache` | `true` | If it should use the [GitHub actions cache](#using-the-built-in-cache). | | `eas-version` | `''` | [EAS CLI](https://github.com/expo/eas-cli) version to install, skips when omitted. | -| `eas-cache` | `false` | If it should use the [GitHub actions cache](#using-the-built-in-cache). | +| `eas-cache` | `true` | If it should use the [GitHub actions cache](#using-the-built-in-cache). | | `packager` | `yarn` | The package manager to use. _(e.g. `yarn` or `npm`)_ | | `token` | `''` | The token of your Expo account | | `patch-watchers` | `true` | If it should [patch the `fs.inotify.` limits](#enospc-errors-on-linux). | diff --git a/action.yml b/action.yml index a4e7c40f..73cb882d 100644 --- a/action.yml +++ b/action.yml @@ -13,12 +13,12 @@ inputs: description: Expo CLI version to install expo-cache: description: If Expo CLI should be cached to speed up installation - default: false + default: true eas-version: description: EAS CLI version to install eas-cache: description: If EAS CLI should be cached to speed up installation - default: false + default: true packager: description: The package manager used to install the CLIs default: yarn diff --git a/src/actions/setup.ts b/src/actions/setup.ts index dd00c54d..3377043c 100644 --- a/src/actions/setup.ts +++ b/src/actions/setup.ts @@ -11,9 +11,9 @@ export type SetupInput = ReturnType; export function setupInput() { return { - easCache: getBooleanInput('eas-cache'), + easCache: !getInput('eas-cache') || getBooleanInput('eas-cache'), easVersion: getInput('eas-version'), - expoCache: getBooleanInput('expo-cache'), + expoCache: !getInput('expo-cache') || getBooleanInput('expo-cache'), expoVersion: getInput('expo-version'), packager: getInput('packager') || 'yarn', patchWatchers: !getInput('patch-watchers') || getBooleanInput('patch-watchers'), diff --git a/tests/actions/setup.test.ts b/tests/actions/setup.test.ts index 329bbccd..0c36f40e 100644 --- a/tests/actions/setup.test.ts +++ b/tests/actions/setup.test.ts @@ -14,9 +14,9 @@ jest.mock('../../src/worker'); describe(setupInput, () => { it('returns object with correct defaults', () => { expect(setupInput()).toMatchObject({ - easCache: undefined, + easCache: true, easVersion: undefined, - expoCache: undefined, + expoCache: true, expoVersion: undefined, packager: 'yarn', patchWatchers: true, @@ -72,7 +72,7 @@ describe(setupAction, () => { it(`installs ${cliName} using npm`, async () => { jest.mocked(packager.resolvePackage).mockResolvedValue('5.0.3'); - await setupAction({ ...input, [cliVersion]: '5.x', packager: 'npm' }); + await setupAction({ ...input, [cliVersion]: '5.x', [cliCache]: false, packager: 'npm' }); expect(packager.installPackage).toBeCalledWith(cliName, '5.0.3', 'npm'); expect(worker.installToolFromPackage).toBeCalled(); });