Skip to content

Commit ed7f67d

Browse files
authored
refactor: update all dev dependencies to latest version (#71)
* refactor: use node 14 as primary version to build from * refactor: add explicit return types to all files * refactor: update all dev dependencies to latest version * refactor: update strict typings in test utils
1 parent 13d7820 commit ed7f67d

10 files changed

Lines changed: 658 additions & 497 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
- ubuntu-latest
1818
- windows-latest
1919
include:
20-
- node: 12
20+
- node: 14
2121
os: macos-latest
2222
checkUpToDate: true
23-
- node: 12
23+
- node: 14
2424
os: ubuntu-latest
2525
checkUpToDate: true
2626
steps:

build/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8880,9 +8880,12 @@ function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
88808880
'Content-Type': 'application/octet-stream',
88818881
'Content-Range': getContentRange(start, end)
88828882
};
8883-
yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
8883+
const uploadChunkResponse = yield requestUtils_1.retryHttpClientResponse(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
88848884
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
88858885
}));
8886+
if (!requestUtils_1.isSuccessStatusCode(uploadChunkResponse.message.statusCode)) {
8887+
throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`);
8888+
}
88868889
});
88878890
}
88888891
function uploadFile(httpClient, cacheId, archivePath, options) {
@@ -22772,7 +22775,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
2277222775
var __importStar = (this && this.__importStar) || function (mod) {
2277322776
if (mod && mod.__esModule) return mod;
2277422777
var result = {};
22775-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22778+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
2277622779
__setModuleDefault(result, mod);
2277722780
return result;
2277822781
};
@@ -28992,7 +28995,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
2899228995
var __importStar = (this && this.__importStar) || function (mod) {
2899328996
if (mod && mod.__esModule) return mod;
2899428997
var result = {};
28995-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28998+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
2899628999
__setModuleDefault(result, mod);
2899729000
return result;
2899829001
};
@@ -86609,7 +86612,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
8660986612
var __importStar = (this && this.__importStar) || function (mod) {
8661086613
if (mod && mod.__esModule) return mod;
8661186614
var result = {};
86612-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
86615+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
8661386616
__setModuleDefault(result, mod);
8661486617
return result;
8661586618
};
@@ -92258,7 +92261,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
9225892261
var __importStar = (this && this.__importStar) || function (mod) {
9225992262
if (mod && mod.__esModule) return mod;
9226092263
var result = {};
92261-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
92264+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
9226292265
__setModuleDefault(result, mod);
9226392266
return result;
9226492267
};
@@ -107561,7 +107564,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
107561107564
var __importStar = (this && this.__importStar) || function (mod) {
107562107565
if (mod && mod.__esModule) return mod;
107563107566
var result = {};
107564-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
107567+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
107565107568
__setModuleDefault(result, mod);
107566107569
return result;
107567107570
};

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@
2121
"clean": "rimraf build"
2222
},
2323
"dependencies": {
24-
"@actions/cache": "^1.0.3",
24+
"@actions/cache": "^1.0.4",
2525
"@actions/core": "^1.2.6",
2626
"@actions/exec": "^1.0.4",
2727
"@actions/io": "^1.0.2",
28-
"@actions/tool-cache": "^1.5.5",
28+
"@actions/tool-cache": "^1.6.1",
2929
"libnpm": "^3.0.1"
3030
},
3131
"devDependencies": {
32-
"@types/jest": "^26.0.4",
33-
"@types/node": "^12.12.49",
34-
"@typescript-eslint/eslint-plugin": "^3.6.1",
35-
"@typescript-eslint/parser": "^3.6.1",
32+
"@types/jest": "^26.0.16",
33+
"@types/node": "^14.14.10",
34+
"@typescript-eslint/eslint-plugin": "^4.9.0",
35+
"@typescript-eslint/parser": "^4.9.0",
3636
"@zeit/ncc": "^0.22.3",
37-
"eslint": "^7.4.0",
38-
"eslint-plugin-jest": "^23.18.0",
39-
"husky": "^4.2.5",
40-
"jest": "^26.0.1",
41-
"jest-circus": "^26.1.0",
37+
"eslint": "^7.14.0",
38+
"eslint-plugin-jest": "^24.1.3",
39+
"husky": "^4.3.0",
40+
"jest": "^26.6.3",
41+
"jest-circus": "^26.6.3",
4242
"rimraf": "^3.0.2",
43-
"ts-jest": "^26.1.2",
44-
"typescript": "^3.9.6"
43+
"ts-jest": "^26.4.4",
44+
"typescript": "^4.1.2"
4545
},
4646
"husky": {
4747
"hooks": {

src/cache.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import os from 'os';
1010
*
1111
* @see https://github.com/actions/toolkit/issues/47
1212
*/
13-
export async function fromLocalCache(version: string) {
13+
export async function fromLocalCache(version: string): Promise<string | undefined> {
1414
return toolCache.find('expo-cli', version);
1515
}
1616

@@ -20,15 +20,15 @@ export async function fromLocalCache(version: string) {
2020
*
2121
* @see https://github.com/actions/toolkit/issues/47
2222
*/
23-
export async function toLocalCache(root: string, version: string) {
23+
export async function toLocalCache(root: string, version: string): Promise<string> {
2424
return toolCache.cacheDir(root, 'expo-cli', version);
2525
}
2626

2727
/**
2828
* Download the remotely stored `expo-cli` from cache, if any.
2929
* Note, this cache is shared between jobs.
3030
*/
31-
export async function fromRemoteCache(version: string, packager: string, customCacheKey?: string) {
31+
export async function fromRemoteCache(version: string, packager: string, customCacheKey?: string): Promise<string | undefined> {
3232
// see: https://github.com/actions/toolkit/blob/8a4134761f09d0d97fb15f297705fd8644fef920/packages/tool-cache/src/tool-cache.ts#L401
3333
const target = path.join(process.env['RUNNER_TOOL_CACHE'] || '', 'expo-cli', version, os.arch());
3434
const cacheKey = customCacheKey || getRemoteKey(version, packager);
@@ -43,7 +43,7 @@ export async function fromRemoteCache(version: string, packager: string, customC
4343
* Store the root of `expo-cli` in the remote cache, for future reuse.
4444
* Note, this cache is shared between jobs.
4545
*/
46-
export async function toRemoteCache(source: string, version: string, packager: string, customCacheKey?: string) {
46+
export async function toRemoteCache(source: string, version: string, packager: string, customCacheKey?: string): Promise<void> {
4747
const cacheKey = customCacheKey || getRemoteKey(version, packager);
4848

4949
try {
@@ -61,6 +61,6 @@ export async function toRemoteCache(source: string, version: string, packager: s
6161
/**
6262
* Get the cache key to use when (re)storing the Expo CLI from remote cache.
6363
*/
64-
function getRemoteKey(version: string, packager: string) {
64+
function getRemoteKey(version: string, packager: string): string {
6565
return `expo-cli-${process.platform}-${os.arch()}-${packager}-${version}`;
6666
}

src/expo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type AuthOptions = {
1212
* This step is required for publishing and building new apps.
1313
* It uses the `EXPO_CLI_PASSWORD` environment variable for improved security.
1414
*/
15-
export async function authWithCredentials(username?: string, password?: string) {
15+
export async function authWithCredentials(username?: string, password?: string): Promise<void> {
1616
if (!username || !password) {
1717
return core.info('Skipping authentication: `expo-username` and/or `expo-password` not set...');
1818
}
@@ -35,7 +35,7 @@ export async function authWithCredentials(username?: string, password?: string)
3535
*
3636
* @see https://github.com/actions/toolkit/blob/905b2c7b0681b11056141a60055f1ba77358b7e9/packages/core/src/core.ts#L39
3737
*/
38-
export async function authWithToken(token?: string) {
38+
export async function authWithToken(token?: string): Promise<void> {
3939
if (!token) {
4040
return core.info('Skipping authentication: `expo-token` not set...');
4141
}
@@ -57,7 +57,7 @@ export async function authWithToken(token?: string) {
5757
* Authenticate with Expo using either the token or username/password method.
5858
* If both of them are set, token has priority.
5959
*/
60-
export function authenticate(options: AuthOptions) {
60+
export function authenticate(options: AuthOptions): Promise<void> {
6161
if (options.token) {
6262
return authWithToken(options.token);
6363
}

src/install.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type InstallConfig = {
1919
* This uses the npm registry and accepts latest, dist-tags or version ranges.
2020
* It's used to determine the cached version of `expo-cli`.
2121
*/
22-
export async function resolve(version: string) {
22+
export async function resolve(version: string): Promise<string> {
2323
return (await registry.manifest(`expo-cli@${version}`)).version;
2424
}
2525

@@ -28,7 +28,7 @@ export async function resolve(version: string) {
2828
* Here you can provide any semver range or dist tag used in the registry.
2929
* It returns the path where Expo is installed.
3030
*/
31-
export async function install(config: InstallConfig) {
31+
export async function install(config: InstallConfig): Promise<string> {
3232
const exact = await resolve(config.version);
3333
let root: string | undefined = await fromLocalCache(exact);
3434

@@ -54,7 +54,7 @@ export async function install(config: InstallConfig) {
5454
* Install `expo-cli`, by version, using npm or yarn.
5555
* It creates a temporary directory to store all required files.
5656
*/
57-
export async function fromPackager(version: string, packager: string) {
57+
export async function fromPackager(version: string, packager: string): Promise<string> {
5858
const root = process.env['RUNNER_TEMP'] || '';
5959
const tool = await io.which(packager);
6060

src/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { authenticate } from './expo';
33
import { install, InstallConfig } from './install';
44
import { patchWatchers } from './system';
55

6-
export async function run() {
6+
export async function run(): Promise<void> {
77
const config: InstallConfig = {
88
version: getInput('expo-version') || 'latest',
99
packager: getInput('expo-packager') || 'yarn',

src/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as cli from '@actions/exec';
88
*
99
* @see https://github.com/expo/expo-github-action/issues/20
1010
*/
11-
export async function patchWatchers() {
11+
export async function patchWatchers(): Promise<void> {
1212
if (process.platform !== 'linux') {
1313
return core.info('Skipping patch for watchers, not running on Linux...');
1414
}

tests/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ const originalPlatform = process.platform;
55
* Change the node platform for testing purposes.
66
* With this you can fake the `process.platform`.
77
*/
8-
export function setPlatform(platform: NodeJS.Platform) {
8+
export function setPlatform(platform: NodeJS.Platform): void {
99
Object.defineProperty(process, 'platform', { value: platform });
1010
}
1111

1212
/**
1313
* Revert the platform to the original one.
1414
*/
15-
export function restorePlatform() {
15+
export function restorePlatform(): void {
1616
setPlatform(originalPlatform);
1717
}
1818

@@ -22,13 +22,13 @@ const originalEnv = { ...process.env };
2222
/**
2323
* Change the environment variable for testing purposes.
2424
*/
25-
export function setEnv(name: string, value: string) {
25+
export function setEnv(name: string, value: string): void {
2626
process.env[name] = value;
2727
}
2828

2929
/**
3030
* Revert the environment variable changes.
3131
*/
32-
export function restoreEnv() {
32+
export function restoreEnv(): void {
3333
process.env = originalEnv;
3434
}

0 commit comments

Comments
 (0)