Skip to content

Commit 60c782f

Browse files
author
Niranjan Jayakar
authored
chore: migrate constructs to use "constructs" module (#10606)
This commits expands on a previous [commit]. The remaining CDK modules have been migrated to use the `Construct` and `IConstruct` from the "constructs" module instead of the "@aws-cdk/core" module. Migrating modules to use the "constructs" module, prevents merge conflicts from arising in these files when the construct compatibility layer in "@aws-cdk/core" module is removed in the v2 branch. [commit]: c179699 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 0331508 commit 60c782f

File tree

179 files changed

+667
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+667
-275
lines changed

packages/@aws-cdk/aws-amplify/lib/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as codebuild from '@aws-cdk/aws-codebuild';
22
import * as iam from '@aws-cdk/aws-iam';
3-
import { Construct, IResource, Lazy, Resource, SecretValue } from '@aws-cdk/core';
3+
import { IResource, Lazy, Resource, SecretValue } from '@aws-cdk/core';
4+
import { Construct } from 'constructs';
45
import { CfnApp } from './amplify.generated';
56
import { BasicAuth } from './basic-auth';
67
import { Branch, BranchOptions } from './branch';

packages/@aws-cdk/aws-amplify/lib/basic-auth.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import * as kms from '@aws-cdk/aws-kms';
22
import * as secretsmanager from '@aws-cdk/aws-secretsmanager';
3-
import { Construct, SecretValue } from '@aws-cdk/core';
3+
import { SecretValue } from '@aws-cdk/core';
4+
5+
// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch.
6+
// eslint-disable-next-line
7+
import { Construct as CoreConstruct } from '@aws-cdk/core';
48

59
/**
610
* Properties for a BasicAuth
@@ -78,7 +82,7 @@ export class BasicAuth {
7882
/**
7983
* Binds this Basic Auth configuration to an App
8084
*/
81-
public bind(scope: Construct, id: string): BasicAuthConfig {
85+
public bind(scope: CoreConstruct, id: string): BasicAuthConfig {
8286
const config = {
8387
enableBasicAuth: true,
8488
username: this.props.username,

packages/@aws-cdk/aws-amplify/lib/branch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as codebuild from '@aws-cdk/aws-codebuild';
2-
import { Construct, IResource, Lazy, Resource } from '@aws-cdk/core';
2+
import { IResource, Lazy, Resource } from '@aws-cdk/core';
3+
import { Construct } from 'constructs';
34
import { CfnBranch } from './amplify.generated';
45
import { IApp } from './app';
56
import { BasicAuth } from './basic-auth';

packages/@aws-cdk/aws-amplify/lib/domain.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Construct, Lazy, Resource, IResolvable } from '@aws-cdk/core';
1+
import { Lazy, Resource, IResolvable } from '@aws-cdk/core';
2+
import { Construct } from 'constructs';
23
import { CfnDomain } from './amplify.generated';
34
import { IApp } from './app';
45
import { IBranch } from './branch';

packages/@aws-cdk/aws-amplify/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@
5454
},
5555
"cdk-build": {
5656
"cloudformation": "AWS::Amplify",
57-
"jest": true
57+
"jest": true,
58+
"env": {
59+
"AWSLINT_BASE_CONSTRUCT": true
60+
}
5861
},
5962
"keywords": [
6063
"aws",

packages/@aws-cdk/aws-appsync/lib/data-source.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import { ITable } from '@aws-cdk/aws-dynamodb';
22
import { IGrantable, IPrincipal, IRole, Role, ServicePrincipal } from '@aws-cdk/aws-iam';
33
import { IFunction } from '@aws-cdk/aws-lambda';
4-
import { Construct, IResolvable } from '@aws-cdk/core';
4+
import { IResolvable } from '@aws-cdk/core';
5+
import { Construct } from 'constructs';
56
import { CfnDataSource } from './appsync.generated';
67
import { IGraphqlApi } from './graphqlapi-base';
78
import { BaseResolverProps, Resolver } from './resolver';
89

10+
// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch.
11+
// eslint-disable-next-line
12+
import { Construct as CoreConstruct } from '@aws-cdk/core';
13+
914
/**
1015
* Base properties for an AppSync datasource
1116
*/
@@ -83,7 +88,7 @@ export interface ExtendedDataSourceProps {
8388
/**
8489
* Abstract AppSync datasource implementation. Do not use directly but use subclasses for concrete datasources
8590
*/
86-
export abstract class BaseDataSource extends Construct {
91+
export abstract class BaseDataSource extends CoreConstruct {
8792
/**
8893
* the name of the data source
8994
*/

packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { IUserPool } from '@aws-cdk/aws-cognito';
22
import { ManagedPolicy, Role, ServicePrincipal, Grant, IGrantable } from '@aws-cdk/aws-iam';
3-
import { CfnResource, Construct, Duration, Expiration, IResolvable, Stack } from '@aws-cdk/core';
3+
import { CfnResource, Duration, Expiration, IResolvable, Stack } from '@aws-cdk/core';
4+
import { Construct } from 'constructs';
45
import { CfnApiKey, CfnGraphQLApi, CfnGraphQLSchema } from './appsync.generated';
56
import { IGraphqlApi, GraphqlApiBase } from './graphqlapi-base';
67
import { Schema } from './schema';

packages/@aws-cdk/aws-appsync/lib/resolver.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { Construct } from '@aws-cdk/core';
1+
import { Construct } from 'constructs';
22
import { CfnResolver } from './appsync.generated';
33
import { BaseDataSource } from './data-source';
44
import { IGraphqlApi } from './graphqlapi-base';
55
import { MappingTemplate } from './mapping-template';
66

7+
// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch.
8+
// eslint-disable-next-line
9+
import { Construct as CoreConstruct } from '@aws-cdk/core';
10+
711
/**
812
* Basic properties for an AppSync resolver
913
*/
@@ -56,7 +60,7 @@ export interface ResolverProps extends BaseResolverProps {
5660
/**
5761
* An AppSync resolver
5862
*/
59-
export class Resolver extends Construct {
63+
export class Resolver extends CoreConstruct {
6064
/**
6165
* the ARN of the resolver
6266
*/

packages/@aws-cdk/aws-appsync/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@
5353
},
5454
"cdk-build": {
5555
"cloudformation": "AWS::AppSync",
56-
"jest": true
56+
"jest": true,
57+
"env": {
58+
"AWSLINT_BASE_CONSTRUCT": true
59+
}
5760
},
5861
"keywords": [
5962
"aws",

packages/@aws-cdk/aws-autoscaling-hooktargets/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
},
104104
"maturity": "stable",
105105
"cdk-build": {
106-
"jest": true
106+
"jest": true,
107+
"env": {
108+
"AWSLINT_BASE_CONSTRUCT": true
109+
}
107110
}
108111
}

0 commit comments

Comments
 (0)