Skip to content

Commit

Permalink
fix: adopt to cdk 2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
wiget committed Dec 3, 2021
1 parent 372d15e commit 4207d69
Show file tree
Hide file tree
Showing 9 changed files with 2,341 additions and 1,753 deletions.
4 changes: 2 additions & 2 deletions cdk-assume-role-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"lodash.isempty": "^4.4.0"
},
"peerDependencies": {
"aws-cdk": ">=1.10.0",
"aws-cdk": ">=2.0.0",
"aws-sdk": ">=2.500.0"
},
"devDependencies": {
Expand All @@ -48,7 +48,7 @@
"@types/jest": "^26.0.13",
"@types/lodash.isempty": "^4.4.6",
"@types/node": "^12.12.38",
"aws-cdk": "^1.62.0",
"aws-cdk": "^2.0.0",
"aws-sdk": "^2.739.0",
"jest": "^26.4.2",
"rimraf": "^3.0.2",
Expand Down
6 changes: 5 additions & 1 deletion cdk-assume-role-plugin/src/profile-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ export class JsonFileProfileMapper implements ProfileMapper {
const { cdkAssumeRolePlugin } = pkg;
return cdkAssumeRolePlugin;
} catch (e) {
console.log(`Failed to parse file ${this._filename}: `, e.message);
if (e instanceof Error) {
console.log(`Failed to parse file ${this._filename}: `, e.message);
} else {
console.log(`Failed to parse file ${this._filename}: `, e);
}
}
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion cdk-assume-role-plugin/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

export const tokenCodeFn = async (
mfaSerial: string,
callback: (err?: Error, token?: string) => void,
callback: (err?: unknown, token?: string) => void,
): Promise<void> => {
try {
const { token } = await inquirer.prompt({
Expand Down
4 changes: 2 additions & 2 deletions cdk-multi-profile-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"lodash.isempty": "^4.4.0"
},
"peerDependencies": {
"aws-cdk": ">=1.10.0",
"aws-cdk": ">=2.0.0",
"aws-sdk": ">=2.500.0"
},
"devDependencies": {
Expand All @@ -52,7 +52,7 @@
"@types/jest": "^26.0.13",
"@types/lodash.isempty": "^4.4.6",
"@types/node": "^12.12.38",
"aws-cdk": "^1.62.0",
"aws-cdk": "^2.0.0",
"aws-sdk": "^2.739.0",
"jest": "^26.4.2",
"rimraf": "^3.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { green } from 'colors/safe';
import isEmpty from 'lodash.isempty';
import { SharedIniFileCredentials, Credentials, SSO } from 'aws-sdk';
import { CredentialProviderSource, Mode } from 'aws-cdk';
import { CredentialProviderSource, Mode } from 'aws-cdk/lib/api/aws-auth/credentials';

import { tokenCodeFn, getConfigFilename, getSSOCachePath } from './utils';
import { ProfileCredentialsCache } from './profile-credentials-cache';
Expand Down
6 changes: 5 additions & 1 deletion cdk-multi-profile-plugin/src/profile-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export class JsonFileProfileMapper implements ProfileMapper {
const { awsProfiles } = pkg;
return awsProfiles;
} catch (e) {
console.log(`Failed to parse file ${this._filename}: `, e.message);
if (e instanceof Error) {
console.log(`Failed to parse file ${this._filename}: `, e.message);
} else {
console.log(`Failed to parse file ${this._filename}: `, e);
}
}
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion cdk-multi-profile-plugin/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const tokenCache = new MfaTokenCache();

export const tokenCodeFn = async (
mfaSerial: string,
callback: (err?: Error, token?: string) => void,
callback: (err?: unknown, token?: string) => void,
): Promise<void> => {
try {
const { token } = await inquirer.prompt({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"resolutions": {
"**/aws-sdk": "2.739.0"
"**/aws-sdk": "2.978.0"
},
"workspaces": [
"examples/*",
Expand Down
Loading

0 comments on commit 4207d69

Please sign in to comment.