Skip to content

Commit

Permalink
chore: remove circular imports (#240)
Browse files Browse the repository at this point in the history
This project uses circular imports, which cannot be bundled using
`node-bundle`. Get rid of the circular import.

Fixes #
  • Loading branch information
rix0rrr authored Dec 11, 2024
1 parent 2513881 commit b1abc49
Show file tree
Hide file tree
Showing 9 changed files with 657 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@ project.eslint?.addRules({
// Allow PR backports to all releasable branches
new github.PullRequestBackport(project);

project.addDevDeps('madge');
project.postCompileTask.exec('madge lib/index.js --circular');

project.synth();
11 changes: 11 additions & 0 deletions lib/private/handlers/client-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { AwsDestination } from '@aws-cdk/cloud-assembly-schema';
import type { ClientOptions } from '../../aws';

export function destinationToClientOptions(destination: AwsDestination): ClientOptions {
return {
assumeRoleArn: destination.assumeRoleArn,
assumeRoleExternalId: destination.assumeRoleExternalId,
assumeRoleAdditionalOptions: destination.assumeRoleAdditionalOptions,
region: destination.region,
};
}
2 changes: 1 addition & 1 deletion lib/private/handlers/container-images.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import { DockerImageDestination } from '@aws-cdk/cloud-assembly-schema';
import { destinationToClientOptions } from '.';
import { destinationToClientOptions } from './client-options';
import { DockerImageManifestEntry } from '../../asset-manifest';
import type { IECRClient } from '../../aws';
import { EventType } from '../../progress';
Expand Down
2 changes: 1 addition & 1 deletion lib/private/handlers/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createReadStream, promises as fs } from 'fs';
import * as path from 'path';
import { FileAssetPackaging, FileSource } from '@aws-cdk/cloud-assembly-schema';
import * as mime from 'mime';
import { destinationToClientOptions } from '.';
import { destinationToClientOptions } from './client-options';
import { FileManifestEntry } from '../../asset-manifest';
import { IS3Client } from '../../aws';
import { PutObjectCommandInput } from '../../aws-types';
Expand Down
11 changes: 0 additions & 11 deletions lib/private/handlers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { AwsDestination } from '@aws-cdk/cloud-assembly-schema';
import { ContainerImageAssetHandler } from './container-images';
import { FileAssetHandler } from './files';
import {
Expand All @@ -7,7 +6,6 @@ import {
FileManifestEntry,
type IManifestEntry,
} from '../../asset-manifest';
import type { ClientOptions } from '../../aws';
import type { IAssetHandler, IHandlerHost, IHandlerOptions } from '../asset-handler';

export function makeAssetHandler(
Expand All @@ -25,12 +23,3 @@ export function makeAssetHandler(

throw new Error(`Unrecognized asset type: '${asset}'`);
}

export function destinationToClientOptions(destination: AwsDestination): ClientOptions {
return {
assumeRoleArn: destination.assumeRoleArn,
assumeRoleExternalId: destination.assumeRoleExternalId,
assumeRoleAdditionalOptions: destination.assumeRoleAdditionalOptions,
region: destination.region,
};
}
1 change: 1 addition & 0 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b1abc49

Please sign in to comment.