Skip to content

Commit

Permalink
chore(dep): substantial dep mgmt effort.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aori Nevo authored and Aori Nevo committed Sep 11, 2023
1 parent ca79cea commit 53fc79f
Show file tree
Hide file tree
Showing 22 changed files with 4,093 additions and 3,851 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
},
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['12', '14', '16']
node: ['16', '18', '20']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 18
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand Down
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,44 @@
"lib"
],
"dependencies": {
"@octokit/plugin-retry": "^3.0.9",
"@octokit/plugin-throttling": "^3.5.2",
"@octokit/rest": "^18.12.0",
"@types/js-yaml": "^3.12.6",
"chalk": "^4.1.0",
"@octokit/plugin-retry": "^6.0.0",
"@octokit/plugin-throttling": "^7.0.0",
"@octokit/rest": "^20.0.1",
"@types/js-yaml": "^4.0.5",
"chalk": "^4.1.2",
"child-process-promise": "^2.2.1",
"commander": "^6.2.1",
"fs-extra": "^9.1.0",
"joi": "^17.4.0",
"js-yaml": "^3.14.1",
"lodash": "^4.17.19",
"log-symbols": "^4.0.0",
"fs-extra": "^11.1.1",
"joi": "^17.10.1",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"log-symbols": "^5.1.0",
"netrc": "^0.1.4",
"ora": "^5.3.0",
"ora": "^7.0.1",
"preferences": "^2.0.2",
"simple-git": "^2.36.1"
"simple-git": "^3.19.1"
},
"devDependencies": {
"@octokit/plugin-rest-endpoint-methods": "^5.0.0",
"@octokit/types": "^6.8.3",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@types/fs-extra": "^9.0.6",
"@types/jest": "^27.0.0",
"@types/lodash": "^4.14.167",
"@types/log-symbols": "^2.0.0",
"@types/node": "^16.0.0",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/parser": "^4.15.0",
"eslint": "^7.19.0",
"@octokit/plugin-rest-endpoint-methods": "^9.0.0",
"@octokit/types": "^11.1.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/fs-extra": "^11.0.1",
"@types/jest": "^29.5.4",
"@types/lodash": "^4.14.198",
"@types/log-symbols": "^3.0.0",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"jest": "^27.0.0",
"prettier": "2.5.1",
"semantic-release": "^17.3.8",
"ts-jest": "^27.0.0",
"typescript": "^3.9.9"
"jest": "^29.6.4",
"prettier": "^3.0.3",
"semantic-release": "^21.1.1",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/git.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable class-methods-use-this */
import fs from 'fs-extra';
import simpleGit, { SimpleGit } from 'simple-git/promise';
import simpleGit from 'simple-git';

import { IMigrationContext } from '../migration-context';
import IRepoAdapter, { IEnvironmentVariables, IRepo, RetryMethod } from './base';
Expand Down Expand Up @@ -90,7 +90,7 @@ abstract class GitAdapter implements IRepoAdapter {

protected abstract getRepositoryUrl(repo: IRepo): string;

protected git(repo: IRepo): SimpleGit {
protected git(repo: IRepo): any {
return simpleGit(this.getRepoDir(repo));
}

Expand Down
2 changes: 1 addition & 1 deletion src/adapters/github.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const mockMigrationContext = () =>
title: 'Test migration',
},
},
} as IMigrationContext);
}) as IMigrationContext;

describe('GithubAdapter', () => {
describe('reposEqual', () => {
Expand Down
6 changes: 4 additions & 2 deletions src/adapters/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class GithubAdapter extends GitAdapter {
branch: this.branchName,
});
status.push('No PR exists');
} catch (e) {
} catch (e: any) {
if (e.code === 404) {
status.push('No branch or PR exists');
} else {
Expand Down Expand Up @@ -323,7 +323,9 @@ class GithubAdapter extends GitAdapter {
// master.
const upstreamBranch = `remotes/origin/${this.branchName}`;
const commits = await this.git(repo).log([`HEAD..${upstreamBranch}`]);
const allShepherd = commits.all.every(({ message }) => this.isShepherdCommitMessage(message));
const allShepherd = commits.all.every(({ message }: any) =>
this.isShepherdCommitMessage(message)
);
if (!allShepherd) {
// RIP.
return SafetyStatus.NonShepherdCommits;
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const handleCommand =
migrationContext.migration.repos = await loadRepoList(migrationContext);

await handler(migrationContext, options);
} catch (e) {
} catch (e: any) {
logger.error(e);
process.exit(1);
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async (context: IMigrationContext, options: any): Promise<void> =
try {
await adapter.resetChangedFiles(repo);
resetSpinner.succeed('Successfully reset repo');
} catch (e) {
} catch (e: any) {
logger.error(e);
resetSpinner.fail('Failed to remove changes; not applying migration');
return;
Expand All @@ -23,7 +23,7 @@ export default async (context: IMigrationContext, options: any): Promise<void> =
try {
await adapter.resetRepoBeforeApply(repo, options.forceResetBranch);
resetBranchSpinner.succeed('Successfully reset branch');
} catch (e) {
} catch (e: any) {
logger.error(e);
resetBranchSpinner.fail('Failed to reset branch; not applying migration');
return;
Expand All @@ -45,7 +45,7 @@ export default async (context: IMigrationContext, options: any): Promise<void> =
try {
await adapter.resetChangedFiles(repo);
spinner.succeed('Successfully reset repo');
} catch (e) {
} catch (e: any) {
logger.error(e);
spinner.fail('Failed to reset repo');
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default async (context: IMigrationContext) => {
try {
await adapter.checkoutRepo(repo);
spinner.succeed('Checked out repo');
} catch (e) {
} catch (e: any) {
logger.error(e);
spinner.fail('Failed to check out repo; skipping');
return;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async (context: IMigrationContext) => {
try {
await adapter.commitRepo(repo);
spinner.succeed('Changes committed');
} catch (e) {
} catch (e: any) {
logger.error(e);
spinner.fail('Failed to commit changes');
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/pr-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async (context: IMigrationContext) => {
const status = await adapter.getPullRequestStatus(repo);
spinner.destroy();
status.forEach((s) => logger.info(s));
} catch (e) {
} catch (e: any) {
logger.error(e);
spinner.fail('Failed to determine PR status');
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default async (context: IMigrationContext) => {
try {
await context.adapter.createPullRequest(repo, message);
prSpinner.succeed('Pull request created');
} catch (e) {
} catch (e: any) {
logger.error(e);
prSpinner.fail('Failed to create pull request');
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async (context: IMigrationContext, options: any) => {
try {
await adapter.pushRepo(repo, options.force);
spinner.succeed('Changes pushed');
} catch (e) {
} catch (e: any) {
logger.error(e);
spinner.fail('Failed to push changes');
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async (context: IMigrationContext) => {
await adapter.resetChangedFiles(repo);
spinner.succeed('Reset changes');
} catch (e) {
logger.error(e);
logger.error(e as string);
spinner.fail('Failed to reset changes');
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/services/github.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Octokit } from '@octokit/rest';
import { IMigrationContext } from '../migration-context';
import GithubService from './github';

const mockMigrationContext = () => ({} as IMigrationContext);
const mockMigrationContext = () => ({}) as IMigrationContext;

describe('GithubService', () => {
describe('getDefaultBranchForRepo', () => {
Expand Down
6 changes: 1 addition & 5 deletions src/services/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,12 @@ export default class GithubService {
this.octokit = new RetryableThrottledOctokit({
auth: token,
throttle: {
enabled: false,
onRateLimit: (retryAfter: number, options: any) => {
context.logger.warn(`Hit rate limit for ${options.method} ${options.url}`);
context.logger.warn(`Retrying in ${retryAfter} second(s)`);
return options.request.retryCount < 5;
},
onAbuseLimit: (retryAfter: number, options: any) => {
context.logger.warn(`Hit abuse limit for ${options.method} ${options.url}`);
context.logger.warn(`Retrying in ${retryAfter} second(s)`);
return options.request.retryCount < 5;
},
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/execute-steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default async (
stdout: childProcessResult.stdout,
stderr: childProcessResult.stderr,
});
} catch (e) {
} catch (e: any) {
// This could either be an error from the process itself (which will have an exit code)
// or an error from JavaScript world (e.g. the script wasn't executable)
if (e.code !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions src/util/migration-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Joi from 'joi';
import fs from 'fs';
import yaml from 'js-yaml';
import * as yaml from 'js-yaml';
import { cloneDeep, mapValues } from 'lodash';
import path from 'path';

Expand All @@ -26,7 +26,7 @@ export interface IMigrationSpec {

export function loadSpec(directory: string): IMigrationSpec {
const docPath = path.join(directory, 'shepherd.yml');
const spec = yaml.safeLoad(fs.readFileSync(docPath, 'utf8'));
const spec = yaml.load(fs.readFileSync(docPath, 'utf8'));
const normalizedSpec = normalizeSpec(spec);
const validationResult = validateSpec(normalizedSpec);
if (validationResult.error) {
Expand Down
2 changes: 1 addition & 1 deletion src/util/persisted-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const makeContext = (workingDirectory: string) =>
adapter: {
reposEqual: (r1: IRepo, r2: IRepo) => isEqual(r1, r2),
},
} as IMigrationContext);
}) as IMigrationContext;

describe('persisted-data', () => {
it('loads repo list from a file', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/util/persisted-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const jsonStringify = (data: any) => JSON.stringify(data, undefined, 2);
const migrateToJsonIfNeeded = async (migrationContext: IMigrationContext) => {
const legacyFile = getLegacyRepoListFile(migrationContext);
if (await fs.pathExists(legacyFile)) {
const data = yaml.safeLoad(await fs.readFile(legacyFile, 'utf8'));
const data = yaml.load(await fs.readFile(legacyFile, 'utf8'));
await fs.outputFile(getRepoListFile(migrationContext), jsonStringify(data));
await fs.remove(legacyFile);
}
Expand Down
Loading

0 comments on commit 53fc79f

Please sign in to comment.