diff --git a/docs/src/apps.rst b/docs/src/apps.rst index a46d784911fca..b3bc952b1bf8a 100644 --- a/docs/src/apps.rst +++ b/docs/src/apps.rst @@ -27,11 +27,11 @@ as shown in the following example. import { App } from '@aws-cdk/cdk' - const app = new App(process.argv); // input: ARGV + const app = new App(); // input: ARGV // - process.stdout.write(app.run()); + app.run(); An |app-construct| is a collection of |stack| objects, as shown in the following example. @@ -41,7 +41,7 @@ example. import { App } from '@aws-cdk/cdk' import { MyStack } from './my-stack' - const app = new App(process.argv); + const app = new App(); const dev = new MyStack(app, { name: 'Dev', region: 'us-west-2', dev: true }) const preProd = new MyStack(app, { name: 'PreProd', region: 'us-west-2', preProd: true }) @@ -58,7 +58,7 @@ example. prodStages: prod }); - process.stdout.write(app.run()); + app.run(); Use the |toolkit| to list the stacks in this executable, as shown in the following example. diff --git a/docs/src/examples.rst b/docs/src/examples.rst index c8095533ccf45..4269ac53ab6fa 100644 --- a/docs/src/examples.rst +++ b/docs/src/examples.rst @@ -68,7 +68,7 @@ the |cdk|. import { MyStack } from './my-stack' import { DeploymentPipeline } from './my-deployment' - const app = new App(process.argv); + const app = new App(); // Use the default environment new MyStack(app, { name: 'Dev' }); @@ -107,9 +107,7 @@ the |cdk|. prodStages: prod }); - app.exec() - .then(stdout => process.stdout.write(stdout)) - .catch(e => { throw e }); + app.run(); .. _dynamodb_example: @@ -140,11 +138,11 @@ and sort key **Timestamp**. } } - const app = new cdk.App(process.argv); + const app = new cdk.App(); new MyStack(app, 'MyStack'); - process.stdout.write(app.run()); + app.run(); .. _creating_rds_example: @@ -183,11 +181,11 @@ The following example creates the Aurora database **MyAuroraDatabase**. } } - const app = new cdk.App(process.argv); + const app = new cdk.App(); new MyStack(app, 'MyStack'); - process.stdout.write(app.run()); + app.run(); .. _creating_s3_example: @@ -213,8 +211,8 @@ encryption provided by |S3|. } } - const app = new cdk.App(process.argv); + const app = new cdk.App(); new MyStack(app, 'MyStack'); - process.stdout.write(app.run()); + app.run() diff --git a/docs/src/getting-started.rst b/docs/src/getting-started.rst index b80532513b073..448ffe39b119f 100644 --- a/docs/src/getting-started.rst +++ b/docs/src/getting-started.rst @@ -203,7 +203,7 @@ class. Let's create our first, empty **App**: } } - process.stdout.write(new MyApp(process.argv).run()); + new MyApp().run(); .. group-tab:: TypeScript @@ -219,7 +219,7 @@ class. Let's create our first, empty **App**: } } - process.stdout.write(new MyApp(process.argv).run()); + new MyApp().run(); .. group-tab:: Java @@ -454,7 +454,7 @@ Define a stack and add it to the app. } } - process.stdout.write(new MyApp(process.argv).run()); + new MyApp().run(); .. group-tab:: TypeScript @@ -472,14 +472,13 @@ Define a stack and add it to the app. } class MyApp extends cdk.App { - constructor(argv: string[]) { - super(argv); - + constructor() { + super(); new MyStack(this, 'hello-cdk'); } } - process.stdout.write(new MyApp(process.argv).run()); + new MyApp().run(); .. group-tab:: Java diff --git a/docs/src/passing-in-data.rst b/docs/src/passing-in-data.rst index cde1fec8e302f..d79a682c15355 100644 --- a/docs/src/passing-in-data.rst +++ b/docs/src/passing-in-data.rst @@ -155,7 +155,7 @@ Finally, connect the dots in your app. .. code-block:: ts - const app = new cdk.App(process.argv); + const app = new cdk.App(); const myStack = new HelloCdkStack(app, "HelloCdkStack"); @@ -163,7 +163,7 @@ Finally, connect the dots in your app. theBucketRefProps: myStack.myBucketRefProps }); - process.stdout.write(app.run()); + app.run(); .. _using_cfn_parameter: diff --git a/docs/src/stacks.rst b/docs/src/stacks.rst index 1d0ddc1ec8796..fcd356ce9eef0 100644 --- a/docs/src/stacks.rst +++ b/docs/src/stacks.rst @@ -47,7 +47,7 @@ And then, add instances of this class to your app: .. code-block:: js - const app = new App(process.argv); + const app = new App(); new MyStack(app, 'NorthAmerica', { env: { region: 'us-east-1' } }); new MyStack(app, 'Europe', { env: { region: 'us-west-2' } }); diff --git a/examples/cdk-examples-java/project/src/main/java/software/amazon/awscdk/examples/HelloJavaApp.java b/examples/cdk-examples-java/project/src/main/java/software/amazon/awscdk/examples/HelloJavaApp.java index 0fe2f07ba9266..675e68c577207 100644 --- a/examples/cdk-examples-java/project/src/main/java/software/amazon/awscdk/examples/HelloJavaApp.java +++ b/examples/cdk-examples-java/project/src/main/java/software/amazon/awscdk/examples/HelloJavaApp.java @@ -6,10 +6,10 @@ public class HelloJavaApp { public static void main(final String[] args) { - App app = new App(Arrays.asList(args)); + App app = new App(); new HelloJavaStack(app, "hello-cdk"); - System.out.println(app.run()); + app.run(); } } diff --git a/examples/cdk-examples-typescript/advanced-usage/index.ts b/examples/cdk-examples-typescript/advanced-usage/index.ts index 479534795eca3..afe41ba90102a 100644 --- a/examples/cdk-examples-typescript/advanced-usage/index.ts +++ b/examples/cdk-examples-typescript/advanced-usage/index.ts @@ -188,7 +188,7 @@ class CloudFormationExample extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new PolicyExample(app, 'PolicyExample'); new IncludeExample(app, 'IncludeExample'); @@ -199,4 +199,4 @@ new CloudFormationExample(app, 'CloudFormationExample'); new EnvContextExample(app, 'EnvContextExampleNA', { env: { region: 'us-east-1' }}); new EnvContextExample(app, 'EnvContextExampleEU', { env: { region: 'eu-west-2' }}); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/bucket-import-export/index.ts b/examples/cdk-examples-typescript/bucket-import-export/index.ts index a9c97c25d06d2..ca3139123773b 100644 --- a/examples/cdk-examples-typescript/bucket-import-export/index.ts +++ b/examples/cdk-examples-typescript/bucket-import-export/index.ts @@ -57,7 +57,7 @@ class Consumer extends cdk.Stack { // first. In the future the toolkit will be able to understand the relationships // between the stacks and will deploy them in order. -const app = new cdk.App(process.argv); +const app = new cdk.App(); const producer = new Producer(app, 'produce'); @@ -65,4 +65,4 @@ new Consumer(app, 'consume', { userBucketRef: producer.myBucketRef }); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/chat-app/index.ts b/examples/cdk-examples-typescript/chat-app/index.ts index bb2d8deef5bd5..98b2d31d1f69b 100644 --- a/examples/cdk-examples-typescript/chat-app/index.ts +++ b/examples/cdk-examples-typescript/chat-app/index.ts @@ -86,10 +86,10 @@ class ChatAppFunction extends lambda.Function { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); // Add the stack to the app // (apps can host many stacks, for example, one for each region) new MyStack(app, 'ChatAppStack', { env: { region: 'us-west-2' } }); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/cloudformation/index.ts b/examples/cdk-examples-typescript/cloudformation/index.ts index 10ff49dfe3580..f849b004e6b20 100644 --- a/examples/cdk-examples-typescript/cloudformation/index.ts +++ b/examples/cdk-examples-typescript/cloudformation/index.ts @@ -11,8 +11,8 @@ class CloudFormationExample extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new CloudFormationExample(app); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/custom-resource/index.ts b/examples/cdk-examples-typescript/custom-resource/index.ts index 24cc28c1aae60..b33fdb391671a 100644 --- a/examples/cdk-examples-typescript/custom-resource/index.ts +++ b/examples/cdk-examples-typescript/custom-resource/index.ts @@ -95,10 +95,10 @@ class FailAfterCreatingStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new SucceedingStack(app, 'SucceedingStack'); new FailCreationStack(app, 'FailCreationStack'); new FailAfterCreatingStack(app, 'FailAfterCreatingStack'); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/ec2/cdk.json b/examples/cdk-examples-typescript/ec2/cdk.json index 843ed5b0a7d0c..d289e305bca01 100644 --- a/examples/cdk-examples-typescript/ec2/cdk.json +++ b/examples/cdk-examples-typescript/ec2/cdk.json @@ -9,6 +9,6 @@ "us-east-1e", "us-east-1f" ], - "ssm:585695036304:us-east-1:/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2": "ami-14c5486b" + "ssm:585695036304:us-east-1:/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2": "ami-0ff8a91507f77f867" } -} \ No newline at end of file +} diff --git a/examples/cdk-examples-typescript/ec2/index.ts b/examples/cdk-examples-typescript/ec2/index.ts index fd12ee6b9cc3f..4d54db5723741 100644 --- a/examples/cdk-examples-typescript/ec2/index.ts +++ b/examples/cdk-examples-typescript/ec2/index.ts @@ -62,11 +62,11 @@ class CommonInfrastructure extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); const infra = new CommonInfrastructure(app, 'infra'); new AppWithVpc(app, 'app-with-vpc'); new MyApp(app, 'my-app', { infra }); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/ec2/out.json b/examples/cdk-examples-typescript/ec2/out.json deleted file mode 100644 index baa8a87bcb3f7..0000000000000 --- a/examples/cdk-examples-typescript/ec2/out.json +++ /dev/null @@ -1,861 +0,0 @@ -{ - "Resources": { - "MyVpcF9F0CA6F": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [] - } - }, - "MyVpcPublicSubnet1SubnetF6608456": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1a", - "CidrBlock": "10.0.0.0/20", - "MapPublicIpOnLaunch": true, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet1RouteTableC46AB2F4": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet1RouteTableAssociatioin3562612E": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPublicSubnet1RouteTableC46AB2F4" - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet1SubnetF6608456" - } - } - }, - "MyVpcPublicSubnet1EIP096967CB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc" - } - }, - "MyVpcPublicSubnet1NATGatewayAD3400C1": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "MyVpcPublicSubnet1EIP096967CB", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet1SubnetF6608456" - } - } - }, - "MyVpcPublicSubnet1DefaultRoute95FDF9EB": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "MyVpcIGW5C4A4F63" - }, - "RouteTableId": { - "Ref": "MyVpcPublicSubnet1RouteTableC46AB2F4" - } - } - }, - "MyVpcPrivateSubnet1Subnet5057CF7E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1a", - "CidrBlock": "10.0.16.0/20", - "MapPublicIpOnLaunch": false, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet1RouteTable8819E6E2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet1RouteTableAssociatioin90CF6BAB": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet1RouteTable8819E6E2" - }, - "SubnetId": { - "Ref": "MyVpcPrivateSubnet1Subnet5057CF7E" - } - } - }, - "MyVpcPrivateSubnet1DefaultRouteA8CDE2FA": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "MyVpcPublicSubnet1NATGatewayAD3400C1" - }, - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet1RouteTable8819E6E2" - } - } - }, - "MyVpcPublicSubnet2Subnet492B6BFB": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1b", - "CidrBlock": "10.0.32.0/20", - "MapPublicIpOnLaunch": true, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet2RouteTable1DF17386": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet2RouteTableAssociatioin8E74FB35": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPublicSubnet2RouteTable1DF17386" - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet2Subnet492B6BFB" - } - } - }, - "MyVpcPublicSubnet2EIP8CCBA239": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc" - } - }, - "MyVpcPublicSubnet2NATGateway91BFBEC9": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "MyVpcPublicSubnet2EIP8CCBA239", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet2Subnet492B6BFB" - } - } - }, - "MyVpcPublicSubnet2DefaultRoute052936F6": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "MyVpcIGW5C4A4F63" - }, - "RouteTableId": { - "Ref": "MyVpcPublicSubnet2RouteTable1DF17386" - } - } - }, - "MyVpcPrivateSubnet2Subnet0040C983": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1b", - "CidrBlock": "10.0.48.0/20", - "MapPublicIpOnLaunch": false, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet2RouteTableCEDCEECE": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet2RouteTableAssociatioin803693C0": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet2RouteTableCEDCEECE" - }, - "SubnetId": { - "Ref": "MyVpcPrivateSubnet2Subnet0040C983" - } - } - }, - "MyVpcPrivateSubnet2DefaultRoute9CE96294": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "MyVpcPublicSubnet2NATGateway91BFBEC9" - }, - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet2RouteTableCEDCEECE" - } - } - }, - "MyVpcPublicSubnet3Subnet57EEE236": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1c", - "CidrBlock": "10.0.64.0/20", - "MapPublicIpOnLaunch": true, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet3RouteTable15028F08": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet3RouteTableAssociatioinA3FD1B71": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPublicSubnet3RouteTable15028F08" - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet3Subnet57EEE236" - } - } - }, - "MyVpcPublicSubnet3EIPC5ACADAB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc" - } - }, - "MyVpcPublicSubnet3NATGatewayD4B50EBE": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "MyVpcPublicSubnet3EIPC5ACADAB", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet3Subnet57EEE236" - } - } - }, - "MyVpcPublicSubnet3DefaultRoute3A83AB36": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "MyVpcIGW5C4A4F63" - }, - "RouteTableId": { - "Ref": "MyVpcPublicSubnet3RouteTable15028F08" - } - } - }, - "MyVpcPrivateSubnet3Subnet772D6AD7": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1c", - "CidrBlock": "10.0.80.0/20", - "MapPublicIpOnLaunch": false, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet3RouteTableB790927C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet3RouteTableAssociatioinFB4A6FE6": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet3RouteTableB790927C" - }, - "SubnetId": { - "Ref": "MyVpcPrivateSubnet3Subnet772D6AD7" - } - } - }, - "MyVpcPrivateSubnet3DefaultRouteEC11C0C5": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "MyVpcPublicSubnet3NATGatewayD4B50EBE" - }, - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet3RouteTableB790927C" - } - } - }, - "MyVpcPublicSubnet4Subnet0F57C8E4": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1d", - "CidrBlock": "10.0.96.0/20", - "MapPublicIpOnLaunch": true, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet4RouteTableE1FD8A16": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet4RouteTableAssociatioinE9DB213C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPublicSubnet4RouteTableE1FD8A16" - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet4Subnet0F57C8E4" - } - } - }, - "MyVpcPublicSubnet4EIP439B79CC": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc" - } - }, - "MyVpcPublicSubnet4NATGateway0DBB343F": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "MyVpcPublicSubnet4EIP439B79CC", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet4Subnet0F57C8E4" - } - } - }, - "MyVpcPublicSubnet4DefaultRoute362F154C": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "MyVpcIGW5C4A4F63" - }, - "RouteTableId": { - "Ref": "MyVpcPublicSubnet4RouteTableE1FD8A16" - } - } - }, - "MyVpcPrivateSubnet4Subnet95C81229": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1d", - "CidrBlock": "10.0.112.0/20", - "MapPublicIpOnLaunch": false, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet4RouteTable0648568A": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet4RouteTableAssociatioin75E2E707": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet4RouteTable0648568A" - }, - "SubnetId": { - "Ref": "MyVpcPrivateSubnet4Subnet95C81229" - } - } - }, - "MyVpcPrivateSubnet4DefaultRouteDB825D32": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "MyVpcPublicSubnet4NATGateway0DBB343F" - }, - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet4RouteTable0648568A" - } - } - }, - "MyVpcPublicSubnet5Subnet9898EC04": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1e", - "CidrBlock": "10.0.128.0/20", - "MapPublicIpOnLaunch": true, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet5RouteTable47744C51": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet5RouteTableAssociatioin12276814": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPublicSubnet5RouteTable47744C51" - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet5Subnet9898EC04" - } - } - }, - "MyVpcPublicSubnet5EIP333EF3CC": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc" - } - }, - "MyVpcPublicSubnet5NATGatewayF3C9FD0E": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "MyVpcPublicSubnet5EIP333EF3CC", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet5Subnet9898EC04" - } - } - }, - "MyVpcPublicSubnet5DefaultRoute997FE912": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "MyVpcIGW5C4A4F63" - }, - "RouteTableId": { - "Ref": "MyVpcPublicSubnet5RouteTable47744C51" - } - } - }, - "MyVpcPrivateSubnet5SubnetA6599B0A": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1e", - "CidrBlock": "10.0.144.0/20", - "MapPublicIpOnLaunch": false, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet5RouteTableB0EA15BC": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet5RouteTableAssociatioinFD571ABF": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet5RouteTableB0EA15BC" - }, - "SubnetId": { - "Ref": "MyVpcPrivateSubnet5SubnetA6599B0A" - } - } - }, - "MyVpcPrivateSubnet5DefaultRouteBD8E52B3": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "MyVpcPublicSubnet5NATGatewayF3C9FD0E" - }, - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet5RouteTableB0EA15BC" - } - } - }, - "MyVpcPublicSubnet6Subnet9AC4DA35": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1f", - "CidrBlock": "10.0.160.0/20", - "MapPublicIpOnLaunch": true, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet6RouteTableC8299934": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPublicSubnet6RouteTableAssociatioin857343BC": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPublicSubnet6RouteTableC8299934" - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet6Subnet9AC4DA35" - } - } - }, - "MyVpcPublicSubnet6EIPFFBE0CF8": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc" - } - }, - "MyVpcPublicSubnet6NATGatewayA97872CF": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "AllocationId": { - "Fn::GetAtt": [ - "MyVpcPublicSubnet6EIPFFBE0CF8", - "AllocationId" - ] - }, - "SubnetId": { - "Ref": "MyVpcPublicSubnet6Subnet9AC4DA35" - } - } - }, - "MyVpcPublicSubnet6DefaultRouteE85EA4E7": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "MyVpcIGW5C4A4F63" - }, - "RouteTableId": { - "Ref": "MyVpcPublicSubnet6RouteTableC8299934" - } - } - }, - "MyVpcPrivateSubnet6Subnet31CB6279": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": "us-east-1f", - "CidrBlock": "10.0.176.0/20", - "MapPublicIpOnLaunch": false, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet6RouteTable1798CF92": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyVpcPrivateSubnet6RouteTableAssociatioin8B2BA4BC": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet6RouteTable1798CF92" - }, - "SubnetId": { - "Ref": "MyVpcPrivateSubnet6Subnet31CB6279" - } - } - }, - "MyVpcPrivateSubnet6DefaultRoute3ABC2D24": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "MyVpcPublicSubnet6NATGatewayA97872CF" - }, - "RouteTableId": { - "Ref": "MyVpcPrivateSubnet6RouteTable1798CF92" - } - } - }, - "MyVpcIGW5C4A4F63": { - "Type": "AWS::EC2::InternetGateway" - }, - "MyVpcVPCGW488ACE0D": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "InternetGatewayId": { - "Ref": "MyVpcIGW5C4A4F63" - }, - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyFleetInstanceSecurityGroup774E8234": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "app-with-vpc/MyFleet/InstanceSecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Outbound traffic allowed by default", - "FromPort": -1, - "IpProtocol": "-1", - "ToPort": -1 - } - ], - "SecurityGroupIngress": [], - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "MyFleetInstanceSecurityGroupPort80LBtofleetF4E3C93F": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "Description": "Port 80 LB to fleet", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "MyFleetInstanceSecurityGroup774E8234", - "GroupId" - ] - }, - "IpProtocol": "tcp", - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "LBSecurityGroup8A41EA2B", - "GroupId" - ] - }, - "ToPort": 80 - } - }, - "MyFleetInstanceRole25A84AB8": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ec2.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "MyFleetInstanceProfile70A58496": { - "Type": "AWS::IAM::InstanceProfile", - "Properties": { - "Roles": [ - { - "Ref": "MyFleetInstanceRole25A84AB8" - } - ] - } - }, - "MyFleetLaunchConfig5D7F9801": { - "Type": "AWS::AutoScaling::LaunchConfiguration", - "Properties": { - "IamInstanceProfile": { - "Ref": "MyFleetInstanceProfile70A58496" - }, - "ImageId": "ami-14c5486b", - "InstanceType": "m4.xlarge", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "MyFleetInstanceSecurityGroup774E8234", - "GroupId" - ] - } - ], - "UserData": { - "Fn::Base64": "#!/bin/bash\n" - } - }, - "DependsOn": [ - "MyFleetInstanceRole25A84AB8" - ] - }, - "MyFleetASG88E55886": { - "Type": "AWS::AutoScaling::AutoScalingGroup", - "Properties": { - "DesiredCapacity": "1", - "LaunchConfigurationName": { - "Ref": "MyFleetLaunchConfig5D7F9801" - }, - "LoadBalancerNames": [ - { - "Ref": "LB8A12904C" - } - ], - "MaxSize": "1", - "MinSize": "1", - "VPCZoneIdentifier": [ - { - "Ref": "MyVpcPrivateSubnet1Subnet5057CF7E" - }, - { - "Ref": "MyVpcPrivateSubnet2Subnet0040C983" - }, - { - "Ref": "MyVpcPrivateSubnet3Subnet772D6AD7" - }, - { - "Ref": "MyVpcPrivateSubnet4Subnet95C81229" - }, - { - "Ref": "MyVpcPrivateSubnet5SubnetA6599B0A" - }, - { - "Ref": "MyVpcPrivateSubnet6Subnet31CB6279" - } - ] - } - }, - "LBSecurityGroup8A41EA2B": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "app-with-vpc/LB/SecurityGroup", - "SecurityGroupEgress": [], - "SecurityGroupIngress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Default rule allow on 80", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 - } - ], - "VpcId": { - "Ref": "MyVpcF9F0CA6F" - } - } - }, - "LBSecurityGroupPort80LBtofleet0986F2E8": { - "Type": "AWS::EC2::SecurityGroupEgress", - "Properties": { - "Description": "Port 80 LB to fleet", - "DestinationSecurityGroupId": { - "Fn::GetAtt": [ - "MyFleetInstanceSecurityGroup774E8234", - "GroupId" - ] - }, - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "LBSecurityGroup8A41EA2B", - "GroupId" - ] - }, - "IpProtocol": "tcp", - "ToPort": 80 - } - }, - "LB8A12904C": { - "Type": "AWS::ElasticLoadBalancing::LoadBalancer", - "Properties": { - "Listeners": [ - { - "InstancePort": "80", - "InstanceProtocol": "http", - "LoadBalancerPort": "80", - "Protocol": "http" - } - ], - "Scheme": "internet-facing", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "LBSecurityGroup8A41EA2B", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "MyVpcPublicSubnet1SubnetF6608456" - }, - { - "Ref": "MyVpcPublicSubnet2Subnet492B6BFB" - }, - { - "Ref": "MyVpcPublicSubnet3Subnet57EEE236" - }, - { - "Ref": "MyVpcPublicSubnet4Subnet0F57C8E4" - }, - { - "Ref": "MyVpcPublicSubnet5Subnet9898EC04" - }, - { - "Ref": "MyVpcPublicSubnet6Subnet9AC4DA35" - } - ] - } - } - } -} diff --git a/examples/cdk-examples-typescript/hello-cdk/index.ts b/examples/cdk-examples-typescript/hello-cdk/index.ts index fdfa32218df2b..794add4b1a3db 100644 --- a/examples/cdk-examples-typescript/hello-cdk/index.ts +++ b/examples/cdk-examples-typescript/hello-cdk/index.ts @@ -15,8 +15,8 @@ class HelloCDK extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new HelloCDK(app, 'Hello'); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/resource-overrides/index.ts b/examples/cdk-examples-typescript/resource-overrides/index.ts index 8d7b786c89022..28242156cee2a 100644 --- a/examples/cdk-examples-typescript/resource-overrides/index.ts +++ b/examples/cdk-examples-typescript/resource-overrides/index.ts @@ -113,6 +113,6 @@ class ResourceOverridesExample extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new ResourceOverridesExample(app, 'resource-overrides'); -process.stdout.write(app.run()); \ No newline at end of file +app.run(); \ No newline at end of file diff --git a/examples/cdk-examples-typescript/sns-sqs/index.ts b/examples/cdk-examples-typescript/sns-sqs/index.ts index 5e58c2aafe9b3..ee08629aae682 100644 --- a/examples/cdk-examples-typescript/sns-sqs/index.ts +++ b/examples/cdk-examples-typescript/sns-sqs/index.ts @@ -43,7 +43,7 @@ class CFN extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new ACL(app, 'acl'); new CFN(app, 'cfn'); -process.stdout.write(app.run()); +app.run(); diff --git a/examples/cdk-examples-typescript/use-vpc-from-another-stack/index.ts b/examples/cdk-examples-typescript/use-vpc-from-another-stack/index.ts index defa0a18c002a..af3e7df400718 100644 --- a/examples/cdk-examples-typescript/use-vpc-from-another-stack/index.ts +++ b/examples/cdk-examples-typescript/use-vpc-from-another-stack/index.ts @@ -8,7 +8,7 @@ import ec2 = require('@aws-cdk/aws-ec2'); import elb = require('@aws-cdk/aws-elasticloadbalancing'); import cdk = require('@aws-cdk/cdk'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const vpcStack = new cdk.Stack(app, 'VPCStack'); const exportedVpc = new ec2.VpcNetwork(vpcStack, 'VPC', { @@ -38,4 +38,4 @@ new elb.LoadBalancer(appStack, 'LB', { targets: [asg] }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts b/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts index 9bb68f13fcfb2..d1c1704fd7bed 100644 --- a/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts +++ b/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts @@ -24,10 +24,6 @@ async function main() { // read applet properties from the provided file const props = YAML.load(appletFile); - // the cx request is expected to be passed as the second parameter for this applet program. - // that's how cdk toolkit will use it. - const request = process.argv[3] || JSON.stringify({}); - // the 'applet' attribute tells us how to load the applet. in the javascript case // it will be in the format : where is technically passed to "require" // and is expected to be exported from the module. @@ -57,7 +53,7 @@ async function main() { } // create the CDK app - const app = new cdk.App([ progname, request ]); + const app = new cdk.App(); const constructName = props.name || className; @@ -65,7 +61,7 @@ async function main() { new AppletStack(app, constructName, props); // transfer control to the app - process.stdout.write(app.run()); + app.run(); } function parseApplet(applet: string) { diff --git a/packages/@aws-cdk/applet-js/package-lock.json b/packages/@aws-cdk/applet-js/package-lock.json index d2bb8dec5e227..f173ee7d6429c 100644 --- a/packages/@aws-cdk/applet-js/package-lock.json +++ b/packages/@aws-cdk/applet-js/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/applet-js", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assert/lib/expect.ts b/packages/@aws-cdk/assert/lib/expect.ts index 2205658cdf0e2..63108bd990b4d 100644 --- a/packages/@aws-cdk/assert/lib/expect.ts +++ b/packages/@aws-cdk/assert/lib/expect.ts @@ -18,7 +18,12 @@ export function expect(stack: api.SynthesizedStack | cdk.Stack, skipValidation = sstack = { name: 'test', template: stack.toCloudFormation(), - metadata: {} + metadata: {}, + environment: { + name: 'test', + account: 'test', + region: 'test' + } }; } else { sstack = stack; diff --git a/packages/@aws-cdk/assert/package-lock.json b/packages/@aws-cdk/assert/package-lock.json index 67de337aac83d..b1432bbfff333 100644 --- a/packages/@aws-cdk/assert/package-lock.json +++ b/packages/@aws-cdk/assert/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assert", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assets/test/integ.assets.directory.lit.ts b/packages/@aws-cdk/assets/test/integ.assets.directory.lit.ts index a09c6b3598540..5a47748ef53e4 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.directory.lit.ts +++ b/packages/@aws-cdk/assets/test/integ.assets.directory.lit.ts @@ -18,6 +18,6 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'aws-cdk-asset-test'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/assets/test/integ.assets.file.lit.ts b/packages/@aws-cdk/assets/test/integ.assets.file.lit.ts index 1a04a147f23db..f5bb206972f17 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.file.lit.ts +++ b/packages/@aws-cdk/assets/test/integ.assets.file.lit.ts @@ -18,6 +18,6 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'aws-cdk-asset-file-test'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.ts b/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.ts index d15da0a982f8a..a489c0f4f993e 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.ts +++ b/packages/@aws-cdk/assets/test/integ.assets.permissions.lit.ts @@ -18,6 +18,6 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'aws-cdk-asset-refs'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts b/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts index 1c8299214bfc7..94e7cff503d9c 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts +++ b/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts @@ -22,6 +22,6 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'aws-cdk-asset-refs'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts index e900817594247..63868c142da91 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts @@ -46,8 +46,8 @@ class BookStack extends cdk.Stack { } class BookApp extends cdk.App { - constructor(argv: string[]) { - super(argv); + constructor() { + super(); new BookStack(this, 'restapi-books-example'); } @@ -69,4 +69,4 @@ function helloCode(_event: any, _context: any, callback: any) { }); } -process.stdout.write(new BookApp(process.argv).run()); +new BookApp().run(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts index a6277f8f1d081..da9b1d89c2eba 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts @@ -1,7 +1,7 @@ import cdk = require('@aws-cdk/cdk'); import apigateway = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'test-apigateway-restapi-defaults'); @@ -10,4 +10,4 @@ const api = new apigateway.RestApi(stack, 'my-api'); // at least one method is required api.root.addMethod('GET'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts index d26054c81ff7b..a492d0a2fb9f9 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts @@ -55,8 +55,8 @@ class Test extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new Test(app, 'test-apigateway-restapi'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts b/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts index 0f36540d287ae..7b4781d97dae5 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts +++ b/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts @@ -4,7 +4,7 @@ import elb = require('@aws-cdk/aws-elasticloadbalancing'); import cdk = require('@aws-cdk/cdk'); import autoscaling = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-integ'); const vpc = new ec2.VpcNetwork(stack, 'VPC', { @@ -28,4 +28,4 @@ const lb = new elb.LoadBalancer(stack, 'LB', { lb.addTarget(asg); lb.addListener({ externalPort: 80 }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.ts b/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.ts index 455d1a2714d02..d882ab6e597cf 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.ts +++ b/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.ts @@ -4,7 +4,7 @@ import elbv2 = require('@aws-cdk/aws-elasticloadbalancingv2'); import cdk = require('@aws-cdk/cdk'); import autoscaling = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-integ'); const vpc = new ec2.VpcNetwork(stack, 'VPC', { @@ -33,4 +33,4 @@ listener.addTargets('Target', { listener.connections.allowDefaultPortFromAnyIpv4('Open to the world'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-cloudformation/package-lock.json b/packages/@aws-cdk/aws-cloudformation/package-lock.json index bdd10f16c02bd..1826e9c15aa27 100644 --- a/packages/@aws-cdk/aws-cloudformation/package-lock.json +++ b/packages/@aws-cdk/aws-cloudformation/package-lock.json @@ -1,16 +1,20 @@ { - "requires": true, + "name": "@aws-cdk/aws-cloudformation", + "version": "0.10.0", "lockfileVersion": 1, + "requires": true, "dependencies": { "@types/lodash": { "version": "4.14.116", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", - "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==" + "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==", + "dev": true }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true } } } diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts index b687e4f9d6a43..e5a38bd07793e 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts @@ -55,8 +55,8 @@ class SucceedingStack extends cdk.Stack { }); } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new SucceedingStack(app, 'SucceedingStack'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-cloudfront/package-lock.json b/packages/@aws-cdk/aws-cloudfront/package-lock.json index d1f4292cef409..28a7390b8d905 100644 --- a/packages/@aws-cdk/aws-cloudfront/package-lock.json +++ b/packages/@aws-cdk/aws-cloudfront/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudfront", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts index 5c58c1e00a869..6fa067ffca602 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts @@ -2,7 +2,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import cloudfront = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); @@ -50,4 +50,4 @@ new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably2', { loggingConfig: {} }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.ts index 708712b4ba8d0..5a8e4b636738b 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.ts @@ -2,7 +2,7 @@ import cdk = require('@aws-cdk/cdk'); import cloudfront = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); @@ -24,4 +24,4 @@ new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { ] }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.ts index 5ee5ccc5d9adf..88addd15e43f1 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.ts @@ -2,7 +2,7 @@ import cdk = require('@aws-cdk/cdk'); import cloudfront = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); @@ -25,4 +25,4 @@ new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { defaultRootObject: '' }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts index 86d0019de1198..5cf28d1164a3e 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts @@ -2,7 +2,7 @@ import cdk = require('@aws-cdk/cdk'); import cloudfront = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); @@ -30,4 +30,4 @@ new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { } }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts index 6b43ca51db955..747f5a0c6b2e6 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts @@ -3,7 +3,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import cloudfront = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); @@ -20,4 +20,4 @@ new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { ] }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-cloudtrail/package-lock.json b/packages/@aws-cdk/aws-cloudtrail/package-lock.json index 7cf2046a2dad1..b06be8386707c 100644 --- a/packages/@aws-cdk/aws-cloudtrail/package-lock.json +++ b/packages/@aws-cdk/aws-cloudtrail/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudtrail", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts b/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts index 15ae9ab165eca..33e45b97c1b19 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts +++ b/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts @@ -7,7 +7,7 @@ import cdk = require('@aws-cdk/cdk'); import cloudwatch = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, `aws-cdk-cloudwatch`); @@ -43,4 +43,4 @@ dashboard.add(new cloudwatch.SingleValueWidget({ metrics: [metric] })); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codebuild/package-lock.json b/packages/@aws-cdk/aws-codebuild/package-lock.json index a18fe44ab7f23..5aef8b04d16e0 100644 --- a/packages/@aws-cdk/aws-codebuild/package-lock.json +++ b/packages/@aws-cdk/aws-codebuild/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codebuild", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.ts b/packages/@aws-cdk/aws-codebuild/test/integ.caching.ts index 05d677ccd01d0..0204175c391cc 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.caching.ts +++ b/packages/@aws-cdk/aws-codebuild/test/integ.caching.ts @@ -3,7 +3,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import codebuild = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codebuild'); @@ -21,4 +21,4 @@ new codebuild.Project(stack, 'MyProject', { } }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.ts b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.ts index 0a10137370443..65e919df967fd 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.ts +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.ts @@ -3,7 +3,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import codebuild = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codebuild'); @@ -16,4 +16,4 @@ new codebuild.Project(stack, 'MyProject', { } }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts index 42bc40ebccad9..9d2080b85d8e9 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.ts @@ -4,7 +4,7 @@ import sns = require('@aws-cdk/aws-sns'); import cdk = require('@aws-cdk/cdk'); import { CodeCommitSource, Project } from '../lib'; -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codebuild-events'); @@ -38,4 +38,4 @@ onCommitRule.addTarget(topic, { } }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.ts b/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.ts index 2212842af8231..db8a43325917d 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.ts +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.ts @@ -3,7 +3,7 @@ import assets = require('@aws-cdk/assets'); import cdk = require('@aws-cdk/cdk'); import { Project } from '../lib'; -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codebuild-project-shell'); @@ -11,4 +11,4 @@ new Project(stack, 'MyProject', { buildScriptAsset: new assets.ZipDirectoryAsset(stack, 'Bundle', { path: 'script_bundle' }) }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codecommit/package-lock.json b/packages/@aws-cdk/aws-codecommit/package-lock.json index b99747141b6ca..242150141b9cb 100644 --- a/packages/@aws-cdk/aws-codecommit/package-lock.json +++ b/packages/@aws-cdk/aws-codecommit/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codecommit", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts b/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts index f2a51fd98e6ce..d7d1fd8cdb88e 100644 --- a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts +++ b/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts @@ -2,7 +2,7 @@ import sns = require('@aws-cdk/aws-sns'); import cdk = require('@aws-cdk/cdk'); import codecommit = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codecommit-events'); const repo = new codecommit.Repository(stack, 'Repo', { repositoryName: 'aws-cdk-codecommit-events' }); @@ -10,4 +10,4 @@ const topic = new sns.Topic(stack, 'MyTopic'); repo.onReferenceCreated('OnReferenceCreated', topic); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.ts index abc3c186e7f43..e62dd1b6ecc52 100644 --- a/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/test/integ.deployment-group.ts @@ -4,7 +4,7 @@ import lb = require('@aws-cdk/aws-elasticloadbalancing'); import cdk = require('@aws-cdk/cdk'); import codedeploy = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-server-dg'); @@ -27,4 +27,4 @@ new codedeploy.ServerDeploymentGroup(stack, 'CodeDeployGroup', { loadBalancer: elb, }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts index 7167d3bbb9afb..d5ae5c5dc6546 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts @@ -3,7 +3,7 @@ import codecommit = require('@aws-cdk/aws-codecommit'); import cdk = require('@aws-cdk/cdk'); import codepipeline = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation'); /// !show @@ -44,4 +44,4 @@ new cfn.PipelineExecuteChangeSetAction(stack, 'ExecuteChanges', { }); /// !hide -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.ts index dd1e85495223a..ca513ebdcec49 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.lambda-pipeline.ts @@ -3,7 +3,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import codepipeline = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-lambda'); @@ -35,4 +35,4 @@ new lambda.PipelineInvokeAction(stack, 'Lambda', { lambda: lambdaFun, }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts index 2e3d49653bfbf..341b05d3eef90 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts @@ -6,7 +6,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import codepipeline = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation'); @@ -40,4 +40,4 @@ new cfn.PipelineCreateReplaceChangeSetAction(stack, 'DeployCFN', { templatePath: new ArtifactPath(source.artifact, 'test.yaml') }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.ts index 45c8e85331c62..0fc1b075f2bf8 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit-build.ts @@ -3,7 +3,7 @@ import codecommit = require('@aws-cdk/aws-codecommit'); import cdk = require('@aws-cdk/cdk'); import codepipeline = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codecommit-codebuild'); @@ -29,4 +29,4 @@ project.addBuildToPipeline(buildStage, 'build', { inputArtifact: source.artifact, }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.ts index 4795d8a9a161c..794a3364031cd 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-commit.ts @@ -2,7 +2,7 @@ import codecommit = require('@aws-cdk/aws-codecommit'); import cdk = require('@aws-cdk/cdk'); import codepipeline = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codecommit'); @@ -20,4 +20,4 @@ new codepipeline.ManualApprovalAction(stack, 'manual', { stage: buildStage, }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.ts index 597a71a8e4a99..511901f2ac31b 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-code-deploy.ts @@ -3,7 +3,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import codepipeline = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codedeploy'); @@ -43,4 +43,4 @@ new codedeploy.PipelineDeployAction(stack, 'CodeDeploy', { deploymentGroupName: 'IntegTestDeploymentGroup', }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.ts index 09509d4f9eca3..6158c938f704a 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-events.ts @@ -6,7 +6,7 @@ import sns = require('@aws-cdk/aws-sns'); import cdk = require('@aws-cdk/cdk'); import codepipeline = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-pipeline-event-target'); @@ -46,4 +46,4 @@ sourceAction.onStateChange('OnActionStateChange', topic).addEventPattern({ detail: { state: [ 'STARTED' ] } }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ts index 22385d111eae7..e8124d879bea9 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ts +++ b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ts @@ -36,7 +36,7 @@ for (let i = 0; i < 10; i++) { // 'K' to 'T' LSI_NON_KEY.push(String.fromCharCode(75 + i)); } -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, STACK_NAME); @@ -118,4 +118,4 @@ tableWithLocalSecondaryIndex.addLocalSecondaryIndex({ sortKey: LSI_SORT_KEY }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.ts b/packages/@aws-cdk/aws-ec2/test/integ.vpc.ts index e6d69b41e7d5d..201a5619b46b4 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc.ts +++ b/packages/@aws-cdk/aws-ec2/test/integ.vpc.ts @@ -1,10 +1,10 @@ import { App, Stack } from '@aws-cdk/cdk'; import { VpcNetwork } from '../lib'; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'aws-cdk-ec2-vpc'); new VpcNetwork(stack, 'MyVpc'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.ts b/packages/@aws-cdk/aws-ecr/test/integ.basic.ts index 848b1d97cb31b..373962e57fdb7 100644 --- a/packages/@aws-cdk/aws-ecr/test/integ.basic.ts +++ b/packages/@aws-cdk/aws-ecr/test/integ.basic.ts @@ -1,7 +1,7 @@ import cdk = require('@aws-cdk/cdk'); import ecr = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); const repo = new ecr.Repository(stack, 'Repo'); @@ -11,4 +11,4 @@ new cdk.Output(stack, 'RepositoryURI', { value: repo.repositoryUri }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.ts b/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.ts index e8aae2ba98181..f7cccc03f82e4 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.ts @@ -3,7 +3,7 @@ import ec2 = require('@aws-cdk/aws-ec2'); import cdk = require('@aws-cdk/cdk'); import elb = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elb-integ'); const vpc = new ec2.VpcNetwork(stack, 'VPC', { @@ -23,4 +23,4 @@ new elb.LoadBalancer(stack, 'LB', { targets: [] }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.ts index 40405b38ef4d6..32d7327497bbd 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.ts @@ -3,7 +3,7 @@ import ec2 = require('@aws-cdk/aws-ec2'); import cdk = require('@aws-cdk/cdk'); import elbv2 = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); const vpc = new ec2.VpcNetwork(stack, 'VPC', { @@ -33,4 +33,4 @@ listener.addTargets('ConditionalTarget', { listener.connections.allowDefaultPortFromAnyIpv4('Open to the world'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.ts index a2127662a7384..bf2b1769bc9c9 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.ts @@ -3,7 +3,7 @@ import ec2 = require('@aws-cdk/aws-ec2'); import cdk = require('@aws-cdk/cdk'); import elbv2 = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); const vpc = new ec2.VpcNetwork(stack, 'VPC', { @@ -28,4 +28,4 @@ group.addDependency(vpc); // The target's security group must allow being routed by the LB and the clients. -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.ts b/packages/@aws-cdk/aws-iam/test/integ.group.ts index d2879a2f8a206..0946283d97390 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.group.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.group.ts @@ -3,10 +3,10 @@ import { App, Stack } from "@aws-cdk/cdk"; import { Group } from "../lib"; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'integ-iam-role-1'); new Group(stack, 'MyGroup'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.ts b/packages/@aws-cdk/aws-iam/test/integ.policy.ts index f699c93e02bbc..5d66f6eaa37b2 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.policy.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.policy.ts @@ -2,7 +2,7 @@ import { App, Stack } from "@aws-cdk/cdk"; import { Policy, PolicyStatement } from "../lib"; import { User } from "../lib/user"; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'aws-cdk-iam-policy'); @@ -16,4 +16,4 @@ const policy2 = new Policy(stack, 'GoodbyePolicy'); policy2.addStatement(new PolicyStatement().addResource('*').addAction('lambda:InvokeFunction')); policy2.attachToUser(user); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.ts b/packages/@aws-cdk/aws-iam/test/integ.role.ts index 8107fb95c4dfb..8b976678d625f 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.role.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.role.ts @@ -1,7 +1,7 @@ import { App, Stack } from "@aws-cdk/cdk"; import { Policy, PolicyStatement, Role, ServicePrincipal } from "../lib"; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'integ-iam-role-1'); @@ -15,4 +15,4 @@ const policy = new Policy(stack, 'HelloPolicy', { policyName: 'Default' }); policy.addStatement(new PolicyStatement().addAction('ec2:*').addResource('*')); policy.attachToRole(role); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.ts b/packages/@aws-cdk/aws-iam/test/integ.user.ts index e9fc8fe293c22..ea1b19acd4429 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.user.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.user.ts @@ -1,7 +1,7 @@ import { App, Stack } from "@aws-cdk/cdk"; import { User } from "../lib"; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'aws-cdk-iam-user'); @@ -11,4 +11,4 @@ new User(stack, 'MyUser', { passwordResetRequired: true }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.ts b/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.ts index 015fcb455644c..3cb7b94c10c93 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.ts @@ -1,7 +1,7 @@ import { App, Stack } from "@aws-cdk/cdk"; import { Group, Policy, PolicyStatement, User } from "../lib"; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'integ-iam-role-1'); @@ -18,4 +18,4 @@ const policy = new Policy(stack, 'MyPolicy'); policy.attachToGroup(g1); policy.addStatement(new PolicyStatement().addResource(g2.groupArn).addAction('iam:*')); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.ts b/packages/@aws-cdk/aws-kms/test/integ.key.ts index aecf85c959fcc..f682b1d19fe6e 100644 --- a/packages/@aws-cdk/aws-kms/test/integ.key.ts +++ b/packages/@aws-cdk/aws-kms/test/integ.key.ts @@ -2,7 +2,7 @@ import { PolicyStatement } from '@aws-cdk/aws-iam'; import { App, AwsAccountId, Stack } from '@aws-cdk/cdk'; import { EncryptionKey } from '../lib'; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, `aws-cdk-kms-1`); @@ -15,4 +15,4 @@ key.addToResourcePolicy(new PolicyStatement() key.addAlias('alias/bar'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts b/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts index 3363db8af1a74..d6b2bfdd034e4 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts @@ -16,8 +16,8 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'lambda-test-assets-file'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts b/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts index 799dfdba52586..e0696c5261edd 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts @@ -16,8 +16,8 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'lambda-test-assets'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.ts b/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.ts index 7beb2cd7a9b56..ef05d3c149e71 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.bucket-notifications.ts @@ -2,7 +2,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import lambda = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'lambda-bucket-notifications'); @@ -19,7 +19,7 @@ const bucketB = new s3.Bucket(stack, 'YourBucket'); bucketA.onObjectCreated(fn, { suffix: '.png' }); bucketB.onEvent(s3.EventType.ObjectRemoved, fn); -process.stdout.write(app.run()); +app.run(); // tslint:disable:no-console function handler(event: any, _context: any, callback: any) { diff --git a/packages/@aws-cdk/aws-lambda/test/integ.events.ts b/packages/@aws-cdk/aws-lambda/test/integ.events.ts index a8e72fb866cd9..318f21e414edc 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.events.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.events.ts @@ -2,7 +2,7 @@ import events = require('@aws-cdk/aws-events'); import cdk = require('@aws-cdk/cdk'); import lambda = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'lambda-events'); @@ -18,7 +18,7 @@ timer.addTarget(fn); const timer2 = new events.EventRule(stack, 'Timer2', { scheduleExpression: 'rate(2 minutes)' }); timer2.addTarget(fn); -process.stdout.write(app.run()); +app.run(); // tslint:disable:no-console function handler(event: any, _context: any, callback: any) { diff --git a/packages/@aws-cdk/aws-lambda/test/integ.inline.ts b/packages/@aws-cdk/aws-lambda/test/integ.inline.ts index 846c1512f49dc..d2f469c0f75ed 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.inline.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.inline.ts @@ -2,7 +2,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import lambda = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-lambda-2'); @@ -36,4 +36,4 @@ const fn = new lambda.InlineJavaScriptFunction(stack, 'MyLambda', { bucket.grantReadWrite(fn.role); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.ts b/packages/@aws-cdk/aws-lambda/test/integ.lambda.ts index adda9bf9d8ae6..4f1630042bea8 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.lambda.ts @@ -2,7 +2,7 @@ import iam = require('@aws-cdk/aws-iam'); import cdk = require('@aws-cdk/cdk'); import lambda = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-lambda-1'); @@ -21,4 +21,4 @@ new lambda.Alias(stack, 'Alias', { version, }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.ts b/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.ts index ae39a6e6dc1cf..e2f622f8bdafb 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.ts +++ b/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.ts @@ -2,7 +2,7 @@ import ec2 = require('@aws-cdk/aws-ec2'); import cdk = require('@aws-cdk/cdk'); import lambda = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-vpc-lambda'); const vpc = new ec2.VpcNetwork(stack, 'VPC', { maxAZs: 2 }); @@ -16,4 +16,4 @@ const fn = new lambda.Function(stack, 'MyLambda', { fn.connections.allowToAnyIPv4(new ec2.TcpAllPorts(), 'Talk to everyone'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.ts b/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.ts index 2dca07491e077..8b2966461a9db 100644 --- a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.ts +++ b/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.ts @@ -21,6 +21,6 @@ class MetricFilterIntegStack extends Stack { } } -const app = new App(process.argv); +const app = new App(); new MetricFilterIntegStack(app, 'aws-cdk-metricfilter-integ'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.ts b/packages/@aws-cdk/aws-rds/test/integ.cluster.ts index c667d4307e9bb..468b1d442ce77 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster.ts +++ b/packages/@aws-cdk/aws-rds/test/integ.cluster.ts @@ -4,7 +4,7 @@ import cdk = require('@aws-cdk/cdk'); import { DatabaseCluster, DatabaseClusterEngine } from '../lib'; import { ClusterParameterGroup } from '../lib/cluster-parameter-group'; -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); const vpc = new ec2.VpcNetwork(stack, 'VPC', { maxAZs: 2 }); @@ -33,4 +33,4 @@ const cluster = new DatabaseCluster(stack, 'Database', { cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-route53/package-lock.json b/packages/@aws-cdk/aws-route53/package-lock.json index d44925fc41ecc..5e3f3c8fecf8b 100644 --- a/packages/@aws-cdk/aws-route53/package-lock.json +++ b/packages/@aws-cdk/aws-route53/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-route53", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.ts b/packages/@aws-cdk/aws-route53/test/integ.route53.ts index 1a2b0d6491de4..dd20866e2fb9a 100644 --- a/packages/@aws-cdk/aws-route53/test/integ.route53.ts +++ b/packages/@aws-cdk/aws-route53/test/integ.route53.ts @@ -2,7 +2,7 @@ import ec2 = require('@aws-cdk/aws-ec2'); import cdk = require('@aws-cdk/cdk'); import { PrivateHostedZone, PublicHostedZone, TXTRecord } from '../lib'; -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-route53-integ'); @@ -25,4 +25,4 @@ new TXTRecord(privateZone, 'TXT', { new cdk.Output(stack, 'PrivateZoneId', { value: privateZone.hostedZoneId }); new cdk.Output(stack, 'PublicZoneId', { value: publicZone.hostedZoneId }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-s3/README.md b/packages/@aws-cdk/aws-s3/README.md index 9f8d0690c230a..be325f8118192 100644 --- a/packages/@aws-cdk/aws-s3/README.md +++ b/packages/@aws-cdk/aws-s3/README.md @@ -169,7 +169,7 @@ class Consumer extends Stack { Now, let's define our CDK app to bind these together: ```ts -const app = new App(process.argv); +const app = new App(); const producer = new Producer(app, 'produce'); @@ -177,7 +177,7 @@ new Consumer(app, 'consume', { userBucketRef: producer.myBucketRef }); -process.stdout.write(app.run()); +app.run(); ``` ### Bucket Notifications diff --git a/packages/@aws-cdk/aws-s3/test/demo.import-export.ts b/packages/@aws-cdk/aws-s3/test/demo.import-export.ts index 04ae78a402f99..e30ce772effcd 100644 --- a/packages/@aws-cdk/aws-s3/test/demo.import-export.ts +++ b/packages/@aws-cdk/aws-s3/test/demo.import-export.ts @@ -57,7 +57,7 @@ class Consumer extends cdk.Stack { // first. In the future the toolkit will be able to understand the relationships // between the stacks and will deploy them in order. -const app = new cdk.App(process.argv); +const app = new cdk.App(); const producer = new Producer(app, 'produce'); @@ -65,4 +65,4 @@ new Consumer(app, 'consume', { userBucketRef: producer.myBucketRef }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts index 469c22b27b4be..3fa83e89f9d77 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts @@ -17,6 +17,6 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'aws-cdk-s3-urls'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket.ts index e84a96f983535..23394833864fc 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.ts @@ -3,7 +3,7 @@ import iam = require('@aws-cdk/aws-iam'); import cdk = require('@aws-cdk/cdk'); import s3 = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-s3'); @@ -19,4 +19,4 @@ const user = new iam.User(stack, 'MyUser'); bucket.grantReadWrite(user); otherwiseEncryptedBucket.grantRead(user); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts index 3acf5d8f51533..3849e4732363f 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts @@ -14,6 +14,6 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'aws-cdk-s3-urls'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.ts b/packages/@aws-cdk/aws-s3/test/integ.lifecycle.ts index 69b5397863e3a..283b693036bd3 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.ts +++ b/packages/@aws-cdk/aws-s3/test/integ.lifecycle.ts @@ -1,7 +1,7 @@ import { App, Stack } from '@aws-cdk/cdk'; import { Bucket } from '../lib'; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'aws-cdk-s3'); @@ -12,4 +12,4 @@ new Bucket(stack, 'MyBucket', { }] }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-s3/test/integ.notifications.ts b/packages/@aws-cdk/aws-s3/test/integ.notifications.ts index 13dc8ae64a459..087f5d799381d 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.notifications.ts +++ b/packages/@aws-cdk/aws-s3/test/integ.notifications.ts @@ -3,7 +3,7 @@ import { Stack } from '@aws-cdk/cdk'; import s3 = require('../lib'); import { Topic } from './notification-dests'; -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new Stack(app, 'test-3'); @@ -17,4 +17,4 @@ bucket.onEvent(s3.EventType.ObjectRemoved, topic3, { prefix: 'home/myusername/' const bucket2 = new s3.Bucket(stack, 'Bucket2'); bucket2.onObjectRemoved(topic3, { prefix: 'foo' }, { suffix: 'foo/bar' }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sns/examples/sns-codecommit-event-rule-target.lit.ts b/packages/@aws-cdk/aws-sns/examples/sns-codecommit-event-rule-target.lit.ts index 09b812aebe574..fbd00168040b3 100644 --- a/packages/@aws-cdk/aws-sns/examples/sns-codecommit-event-rule-target.lit.ts +++ b/packages/@aws-cdk/aws-sns/examples/sns-codecommit-event-rule-target.lit.ts @@ -27,6 +27,6 @@ class IntegStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new IntegStack(app, 'aws-cdk-sns-event-target'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.ts b/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.ts index 71e71f2a8f89a..df29601947726 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.ts +++ b/packages/@aws-cdk/aws-sns/test/integ.sns-bucket-notifications.ts @@ -16,8 +16,8 @@ class MyStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new MyStack(app, 'sns-bucket-notifications'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-event-rule-target.ts b/packages/@aws-cdk/aws-sns/test/integ.sns-event-rule-target.ts index fcb68fe3bfea9..4f6036f7c4a30 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-event-rule-target.ts +++ b/packages/@aws-cdk/aws-sns/test/integ.sns-event-rule-target.ts @@ -8,7 +8,7 @@ import sns = require('../lib'); // Connect the topic with a queue. This means that the queue should have // a message sent to it every minute. -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-sns-event-target'); @@ -22,4 +22,4 @@ topic.subscribeQueue(queue); event.addTarget(topic); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.ts b/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.ts index ea2b7b290cf7d..71649af6d6e06 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.ts +++ b/packages/@aws-cdk/aws-sns/test/integ.sns-lambda.ts @@ -24,8 +24,8 @@ class SnsToSqs extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new SnsToSqs(app, 'aws-cdk-sns-lambda'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-sqs.lit.ts b/packages/@aws-cdk/aws-sns/test/integ.sns-sqs.lit.ts index 2a06739b435b9..13360fde556b0 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-sqs.lit.ts +++ b/packages/@aws-cdk/aws-sns/test/integ.sns-sqs.lit.ts @@ -15,8 +15,8 @@ class SnsToSqs extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new SnsToSqs(app, 'aws-cdk-sns-sqs'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.ts b/packages/@aws-cdk/aws-sns/test/integ.sns.ts index 554ca0792bbd0..36c128ae0a58f 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns.ts +++ b/packages/@aws-cdk/aws-sns/test/integ.sns.ts @@ -12,8 +12,8 @@ class SNSInteg extends Stack { } } -const app = new App(process.argv); +const app = new App(); new SNSInteg(app, 'SNSInteg'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sqs/package-lock.json b/packages/@aws-cdk/aws-sqs/package-lock.json index 17648fcec76b2..77f031d62a42a 100644 --- a/packages/@aws-cdk/aws-sqs/package-lock.json +++ b/packages/@aws-cdk/aws-sqs/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-sqs", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.ts b/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.ts index eace128f9eb6e..af70672113be7 100644 --- a/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.ts +++ b/packages/@aws-cdk/aws-sqs/test/integ.bucket-notifications.ts @@ -2,7 +2,7 @@ import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import sqs = require('../lib'); -const app = new cdk.App(process.argv); +const app = new cdk.App(); const stack = new cdk.Stack(app, 'sqs-bucket-notifications'); @@ -17,4 +17,4 @@ bucket2.onObjectCreated(queue, { suffix: '.png' }); const encryptedQueue = new sqs.Queue(stack, 'EncryptedQueue', { encryption: sqs.QueueEncryption.Kms }); bucket1.onObjectRemoved(encryptedQueue); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts b/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts index 034ab118fbca4..4786149bdf426 100644 --- a/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts +++ b/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts @@ -1,7 +1,7 @@ import { App, Output, Stack } from '@aws-cdk/cdk'; import { Queue } from '../lib'; -const app = new App(process.argv); +const app = new App(); const stack = new Stack(app, 'aws-cdk-sqs'); @@ -16,4 +16,4 @@ new Queue(stack, 'FifoQueue', { new Output(stack, 'QueueUrl', { value: queue.queueUrl }); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/@aws-cdk/cdk/lib/app.ts b/packages/@aws-cdk/cdk/lib/app.ts index bdf22d987c230..ee861781761f0 100644 --- a/packages/@aws-cdk/cdk/lib/app.ts +++ b/packages/@aws-cdk/cdk/lib/app.ts @@ -1,43 +1,21 @@ import cxapi = require('@aws-cdk/cx-api'); -import jsBase64 = require('js-base64'); +import fs = require('fs'); +import path = require('path'); import { Stack } from './cloudformation/stack'; import { Construct, MetadataEntry, PATH_SEP, Root } from './core/construct'; import { resolve } from './core/tokens'; -/** - * Cloud Executable interface version. - */ -const CX_VERSION = 'CloudExecutable/1.0'; - /** * Represents a CDK program. */ export class App extends Root { - private readonly progname?: string; - private readonly request?: cxapi.CXRequest; - - constructor(argv?: string[]) { + /** + * Initializes a CDK application. + * @param request Optional toolkit request (e.g. for tests) + */ + constructor() { super(); - - argv = argv || []; - - if (argv.length >= 1) { - // if the first argument ends with "/node" or "node.exe", skip it (this is argv[0] in node programs). - if (/[\/\\]node(?:\.exe)?$/.test(argv[0])) { - argv = argv.slice(1); - } - - this.progname = argv[0].split('/').pop()!; - } - - if (argv.length > 1) { - try { - this.request = this.parseRequest(argv[1]); - } catch (e) { - throw new Error(`Cannot parse request '${argv[1]}': ${e.message}`); - } - this.loadContext(); - } + this.loadContext(); } private get stacks() { @@ -53,40 +31,24 @@ export class App extends Root { } /** - * Runs the program - * @returns STDOUT + * Runs the program. Output is written to output directory as specified in the request. */ - public run(): string { - // no arguments - print usage and exit successfully. - if (!this.request || !this.request.type) { - return this.usage; - } + public run(): void { + const outdir = process.env[cxapi.OUTDIR_ENV]; + if (!outdir) { + process.stderr.write(`ERROR: The environment variable "${cxapi.OUTDIR_ENV}" is not defined\n`); + process.stderr.write('AWS CDK Toolkit (>= 0.11.0) is required in order to interact with this program.\n'); + process.exit(1); + return; + } + + const result: cxapi.SynthesizeResponse = { + stacks: this.synthesizeStacks(Object.keys(this.stacks)), + runtime: this.collectRuntimeInformation() + }; - const result = this.runCommand(); - return JSON.stringify(result, undefined, 2); - } - - /** - * @deprecated Use app.run(). - */ - public async exec(): Promise { - return this.run(); - } - - /** - * Lists all stacks in this app. - */ - public listStacks(): cxapi.StackInfo[] { - return Object.keys(this.stacks).map(name => { - const stack = this.stacks[name]; - const region = stack.env.region; - const account = stack.env.account; - let environment: cxapi.Environment | undefined; - if (account && region) { - environment = { name: `${account}/${region}`, account, region }; - } - return { name, environment }; - }); + const outfile = path.join(outdir, cxapi.OUTFILE_NAME); + fs.writeFileSync(outfile, JSON.stringify(result, undefined, 2)); } /** @@ -103,19 +65,20 @@ export class App extends Root { throw new Error(`Stack validation failed with the following errors:\n ${errorList}`); } - let environment: cxapi.Environment | undefined; - if (stack.env.account && stack.env.region) { - environment = { - name: `${stack.env.account}/${stack.env.region}`, - account: stack.env.account, - region: stack.env.region - }; - } + const account = stack.env.account || 'unknown-account'; + const region = stack.env.region || 'unknown-region'; + const environment: cxapi.Environment = { + name: `${account}/${region}`, + account, + region + }; + + const missing = Object.keys(stack.missingContext).length ? stack.missingContext : undefined; return { name: stack.id, environment, - missing: Object.keys(stack.missingContext).length ? stack.missingContext : undefined, + missing, template: stack.toCloudFormation(), metadata: this.collectMetadata(stack) }; @@ -184,61 +147,13 @@ export class App extends Root { return stack; } - private runCommand() { - switch (this.request!.type) { - case 'list': - return { - stacks: this.listStacks() - } as cxapi.ListStacksResponse; - - case 'synth': - return { - stacks: this.synthesizeStacks((this.request as cxapi.SynthesizeRequest).stacks), - runtime: this.collectRuntimeInformation() - } as cxapi.SynthesizeResponse; - - default: - throw new Error(`Invalid command: ${this.request!.type}`); - } - } - - private get usage() { - const progname = this.progname ? this.progname + ' ' : ''; - - return `${CX_VERSION} - -Usage: - ${progname}REQUEST - -REQUEST is a JSON-encoded request object. -`; - } - private loadContext() { - const context = (this.request && this.request.context) || {}; + const contextJson = process.env[cxapi.CONTEXT_ENV]; + const context = !contextJson ? { } : JSON.parse(contextJson); for (const key of Object.keys(context)) { this.setContext(key, context[key]); } } - - private parseRequest(req: string): cxapi.CXRequest { - // allow toolkit to send request in base64 if they begin with "base64:" - // this is in order to avoid shell escaping issues when defining "--app" - // in the toolkit. - if (req.startsWith(cxapi.BASE64_REQ_PREFIX)) { - req = jsBase64.Base64.fromBase64(req.slice(cxapi.BASE64_REQ_PREFIX.length)); - } - - // parse as JSON - return JSON.parse(req); - } -} - -export class Program extends App { - constructor(argv?: string[]) { - super(argv); - this.addWarning('"Program" is deprecated in favor of "App"'); - } } /** @@ -270,8 +185,8 @@ function findNpmPackage(fileName: string): { name: string, version: string, priv const paths = mod.paths.map(stripNodeModules); try { - const path = require.resolve('package.json', { paths }); - return require(path); + const packagePath = require.resolve('package.json', { paths }); + return require(packagePath); } catch (e) { return undefined; } diff --git a/packages/@aws-cdk/cdk/package-lock.json b/packages/@aws-cdk/cdk/package-lock.json index 5ed5a866ef50b..cc4469f49d054 100644 --- a/packages/@aws-cdk/cdk/package-lock.json +++ b/packages/@aws-cdk/cdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cdk", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cdk/test/test.app.ts b/packages/@aws-cdk/cdk/test/test.app.ts index 42dfda20a6725..969cb7f2ca58a 100644 --- a/packages/@aws-cdk/cdk/test/test.app.ts +++ b/packages/@aws-cdk/cdk/test/test.app.ts @@ -1,120 +1,94 @@ import cxapi = require('@aws-cdk/cx-api'); +import fs = require('fs'); import { Test } from 'nodeunit'; +import os = require('os'); +import path = require('path'); import { Construct, Resource, Stack, StackProps } from '../lib'; import { App } from '../lib/app'; -// -// this is the idiomatic way we want our apps to look like: +function withApp(context: { [key: string]: any } | undefined, block: (app: App) => void) { + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'cdk-app-test')); + process.env[cxapi.OUTDIR_ENV] = outdir; -function main(...argv: string[]): any { - const app = new App([ 'myprog', ...argv ]); - - // stacks are children of the program - - const stack1 = new Stack(app, 'stack1', { env: { account: '12345', region: 'us-east-1' } }); - new Resource(stack1, 's1c1', { type: 'DummyResource', properties: { Prop1: 'Prop1' } }); - const r2 = new Resource(stack1, 's1c2', { type: 'DummyResource', properties: { Foo: 123 } }); + if (context) { + process.env[cxapi.CONTEXT_ENV] = JSON.stringify(context); + } else { + delete process.env[cxapi.CONTEXT_ENV]; + } - const stack2 = new Stack(app, 'stack2'); - new Resource(stack2, 's2c1', { type: 'DummyResource', properties: { Prog2: 'Prog2' } }); - const c1 = new MyConstruct(stack2, 's1c2'); + const app = new App(); + block(app); - // add some metadata - stack1.addMetadata('meta', 111); - r2.addWarning('warning1'); - r2.addWarning('warning2'); - c1.addMetadata('meta', { key: 'value' }); - app.addMetadata('applevel', 123); // apps can also have metadata + app.run(); - return JSON.parse(app.run()); + const outfile = path.join(outdir, cxapi.OUTFILE_NAME); + const response = JSON.parse(fs.readFileSync(outfile).toString()); + fs.unlinkSync(outfile); + fs.rmdirSync(outdir); + return response; } -function runMain(object: cxapi.CXRequest) { - return main(JSON.stringify(object)); +function synth(context?: { [key: string]: any }): cxapi.SynthesizeResponse { + return withApp(context, app => { + const stack1 = new Stack(app, 'stack1', { env: { account: '12345', region: 'us-east-1' } }); + new Resource(stack1, 's1c1', { type: 'DummyResource', properties: { Prop1: 'Prop1' } }); + const r2 = new Resource(stack1, 's1c2', { type: 'DummyResource', properties: { Foo: 123 } }); + + const stack2 = new Stack(app, 'stack2'); + new Resource(stack2, 's2c1', { type: 'DummyResource', properties: { Prog2: 'Prog2' } }); + const c1 = new MyConstruct(stack2, 's1c2'); + + // add some metadata + stack1.addMetadata('meta', 111); + r2.addWarning('warning1'); + r2.addWarning('warning2'); + c1.addMetadata('meta', { key: 'value' }); + app.addMetadata('applevel', 123); // apps can also have metadata + }); } -function runList() { - return (main(JSON.stringify({type: 'list'})) as cxapi.ListStacksResponse).stacks; -} +function synthStack(name: string, includeMetadata: boolean = false, context?: any): cxapi.SynthesizedStack { + const response = synth(context); + const stack = response.stacks.find(s => s.name === name); + if (!stack) { + throw new Error(`Stack ${name} not found`); + } + + if (!includeMetadata) { + delete stack.metadata; + } -function runConsNoMeta1(stack: string, context?: any): cxapi.SynthesizedStack { - const response = main(JSON.stringify({ - type: 'synth', - stacks: [stack], - context - })); - delete response.stacks[0].metadata; - return response.stacks[0]; + return stack; } export = { - 'first line is the version of the cx interface'(test: Test) { - const prog = new App(); - test.ok((prog.run()).indexOf('CloudExecutable/1.0') === 0); - test.done(); - }, - - 'when executed without arguments, shows interface version and usage usage'(test: Test) { - const output = new App([ 'myprog' ]).run(); - - test.notEqual(output.indexOf('myprog'), -1, 'Output should contain program name'); - test.notEqual(output.indexOf('Usage'), -1, 'Output should contain usage'); - test.done(); - }, - - async 'unknown command will throw an error'(test: Test) { - test.throws( - () => { main('foo'); } - ); - test.done(); - }, - - '"list" with no stacks returns with an empty array'(test: Test) { - const output = new App([ 'myprog', JSON.stringify({type: 'list'}) ]).run(); - test.deepEqual(JSON.parse(output).stacks, []); - test.done(); - }, - - '"list" returns a list of all stacks, with region information if exists'(test: Test) { - // tslint:disable-next-line:max-line-length - test.deepEqual(runList(), [ { name: 'stack1', environment: { name: '12345/us-east-1', region: 'us-east-1', account: '12345' } }, { name: 'stack2' } ]); - test.done(); - }, - - 'list() can be used programmatically'(test: Test) { - const prog = new App(); - test.deepEqual(prog.listStacks(), []); - test.done(); - }, - - '"cons" throws if the stack do not exist'(test: Test) { - test.throws( - () => { runMain({type: 'synth', stacks: ['stack99'] }); } - ); - test.done(); - }, - - '"cons" will return region info for the required stack'(test: Test) { - const out = (runConsNoMeta1('stack1')); - test.equal('stack1', out.name); - test.equal('12345', out.environment!.account); - test.equal('us-east-1', out.environment!.region); - test.done(); - }, - - '"cons" will return the cloudformation template for the required stack'(test: Test) { - const out1 = (runConsNoMeta1('stack1')).template; - test.deepEqual(out1, { Resources: - { s1c1: { Type: 'DummyResource', Properties: { Prop1: 'Prop1' } }, - s1c2: { Type: 'DummyResource', Properties: { Foo: 123 } } } }); - - const out2 = (runConsNoMeta1('stack2')).template; - test.deepEqual(out2, - { Resources: - { s2c1: { Type: 'DummyResource', Properties: { Prog2: 'Prog2' } }, - s1c2r1D1791C01: { Type: 'ResourceType1' }, - s1c2r25F685FFF: { Type: 'ResourceType2' } } }); - + 'synthesizes all stacks and returns synthesis result'(test: Test) { + const response = synth(); + + // clean up metadata so assertion will be sane + response.stacks.forEach(s => delete s.metadata); + delete response.runtime; + + test.deepEqual(response, { stacks: + [ { name: 'stack1', + environment: + { name: '12345/us-east-1', + account: '12345', + region: 'us-east-1' }, + template: + { Resources: + { s1c1: { Type: 'DummyResource', Properties: { Prop1: 'Prop1' } }, + s1c2: { Type: 'DummyResource', Properties: { Foo: 123 } } } } }, + { name: 'stack2', + environment: + { name: 'unknown-account/unknown-region', + account: 'unknown-account', + region: 'unknown-region' }, + template: + { Resources: + { s2c1: { Type: 'DummyResource', Properties: { Prog2: 'Prog2' } }, + s1c2r1D1791C01: { Type: 'ResourceType1' }, + s1c2r25F685FFF: { Type: 'ResourceType2' } } } } ] }); test.done(); }, @@ -137,9 +111,9 @@ export = { }, 'synth(name) also collects metadata from all constructs in the stack'(test: Test) { - const response = runMain({type: 'synth', stacks: ['stack1']}) as cxapi.SynthesizeResponse; + const stack = synthStack('stack1', true); - const output = response.stacks[0].metadata; + const output = stack.metadata; stripStackTraces(output); test.ok(output['/'], 'app-level metadata is included under "."'); @@ -155,8 +129,8 @@ export = { test.equal(output['/stack1/s1c2'].length, 2, 'two entries'); test.equal(output['/stack1/s1c2'][0].data, 'warning1'); - const response2 = runMain({type: 'synth', stacks: ['stack2']}) as cxapi.SynthesizeResponse; - const output2 = response2.stacks[0].metadata; + const stack2 = synthStack('stack2', true); + const output2 = stack2.metadata; test.ok(output2['/stack2/s1c2']); test.equal(output2['/stack2/s1c2'][0].type, 'meta'); @@ -165,22 +139,19 @@ export = { test.done(); }, - 'context can be passed using the -c option'(test: Test) { - const prog = new App([ 'myprog', JSON.stringify({ - type: 'synth', - stackName: 'stack', - context: { - key1: 'val1', - key2: 'val2' - } - })]); + 'context can be passed through CDK_CONTEXT'(test: Test) { + process.env[cxapi.CONTEXT_ENV] = JSON.stringify({ + key1: 'val1', + key2: 'val2' + }); + const prog = new App(); test.deepEqual(prog.getContext('key1'), 'val1'); test.deepEqual(prog.getContext('key2'), 'val2'); test.done(); }, 'context from the command line can be used when creating the stack'(test: Test) { - const output = runConsNoMeta1('stack2', { ctx1: 'HELLO' }); + const output = synthStack('stack2', false, { ctx1: 'HELLO' }); test.deepEqual(output.template, { Resources: { @@ -244,11 +215,6 @@ export = { }, 'app.synthesizeStack(stack) will return a list of missing contextual information'(test: Test) { - const command: cxapi.CXRequest = { - type: 'synth', - stacks: ['MyStack'] - }; - class MyStack extends Stack { constructor(parent: App, name: string, props?: StackProps) { super(parent, name, props); @@ -267,11 +233,9 @@ export = { } } - const app = new App([ 'prog', JSON.stringify(command) ]); - - new MyStack(app, 'MyStack'); - - const response = JSON.parse(app.run()) as cxapi.SynthesizeResponse; + const response = withApp(undefined, app => { + new MyStack(app, 'MyStack'); + }); test.deepEqual(response.stacks[0].missing, { "missing-context-key": { @@ -300,35 +264,6 @@ export = { test.done(); }, - - 'requests can also be base64 encoded'(test: Test) { - const req = { - type: 'list' - }; - const resp = main('base64:' + new Buffer(JSON.stringify(req)).toString('base64')); - test.deepEqual(resp, { - stacks: [ - { - name: "stack1", - environment: { - name: "12345/us-east-1", - account: "12345", - region: "us-east-1" - } - }, - { - name: "stack2" - } - ] - }); - - test.done(); - }, - - 'fails when base64 cannot be encoded'(test: Test) { - test.throws(() => main('base64:'), /Unexpected end of JSON input/); - test.done(); - } }; class MyConstruct extends Construct { diff --git a/packages/@aws-cdk/cfnspec/package-lock.json b/packages/@aws-cdk/cfnspec/package-lock.json index 7b89af50602e4..9c259461ecc50 100644 --- a/packages/@aws-cdk/cfnspec/package-lock.json +++ b/packages/@aws-cdk/cfnspec/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cfnspec", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cloudformation-diff/package-lock.json b/packages/@aws-cdk/cloudformation-diff/package-lock.json index 2bd6553fb870e..293470adf07b2 100644 --- a/packages/@aws-cdk/cloudformation-diff/package-lock.json +++ b/packages/@aws-cdk/cloudformation-diff/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cloudformation-diff", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cx-api/lib/cxapi.ts b/packages/@aws-cdk/cx-api/lib/cxapi.ts index 118fa25c9e033..56a96d12855be 100644 --- a/packages/@aws-cdk/cx-api/lib/cxapi.ts +++ b/packages/@aws-cdk/cx-api/lib/cxapi.ts @@ -4,25 +4,12 @@ import { Environment } from './environment'; -export const VERSION = '1'; -export const BASE64_REQ_PREFIX = 'base64:'; - -export interface ListStacksRequest { - type: 'list', - context?: any -} - -export interface SynthesizeRequest { - type: 'synth', - stacks: string[], - context?: any, -} - -export type CXRequest = ListStacksRequest | SynthesizeRequest; +export const OUTFILE_NAME = 'cdk.out'; +export const OUTDIR_ENV = 'CDK_OUTDIR'; +export const CONTEXT_ENV = 'CDK_CONTEXT_JSON'; /** * Represents a missing piece of context. - * (should have been an interface, but jsii still doesn't have support for structs). */ export interface MissingContext { provider: string; @@ -30,33 +17,17 @@ export interface MissingContext { args: string[]; } -export interface ListStacksResponse { - stacks: StackInfo[] -} - export interface SynthesizeResponse { stacks: SynthesizedStack[]; runtime?: AppRuntime; } -/** - * Identifies a single stack - */ -export interface StackId { - name: string; -} - -/** - * Identifies and contains metadata about a stack - */ -export interface StackInfo extends StackId { - environment?: Environment; -} - /** * A complete synthesized stack */ -export interface SynthesizedStack extends StackInfo { +export interface SynthesizedStack { + name: string; + environment: Environment; missing?: { [key: string]: MissingContext }; metadata: StackMetadata; template: any; diff --git a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.ts b/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.ts index 77637cdc573eb..3144b6d32d42d 100644 --- a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.ts +++ b/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.ts @@ -33,8 +33,8 @@ class TestStack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new TestStack(app, 'aws-cdk-rtv-lambda'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/aws-cdk/bin/cdk.ts b/packages/aws-cdk/bin/cdk.ts index 82371c8734334..827aedb6e8ee0 100644 --- a/packages/aws-cdk/bin/cdk.ts +++ b/packages/aws-cdk/bin/cdk.ts @@ -6,6 +6,8 @@ import childProcess = require('child_process'); import colors = require('colors/safe'); import fs = require('fs-extra'); import minimatch = require('minimatch'); +import os = require('os'); +import path = require('path'); import util = require('util'); import YAML = require('yamljs'); import yargs = require('yargs'); @@ -30,6 +32,12 @@ const DEFAULT_TOOLKIT_STACK_NAME = 'CDKToolkit'; const DEFAULTS = 'cdk.json'; const PER_USER_DEFAULTS = '~/.cdk.json'; +/** + * Since app execution basically always synthesizes all the stacks, + * we can invoke it once and cache the response for subsequent calls. + */ +let cachedResponse: cxapi.SynthesizeResponse; + // tslint:disable:no-shadowed-variable max-line-length async function parseCommandLineArguments() { const initTemplateLanuages = await availableInitLanguages; @@ -167,7 +175,6 @@ async function initCommandLine() { async function main(command: string, args: any): Promise { const toolkitStackName: string = completeConfig().get(['toolkitStackName']) || DEFAULT_TOOLKIT_STACK_NAME; - const trackVersions: boolean = completeConfig().get(['versionReporting']); args.STACKS = args.STACKS || []; args.ENVIRONMENTS = args.ENVIRONMENTS || []; @@ -178,20 +185,20 @@ async function initCommandLine() { return await cliList({ long: args.long }); case 'diff': - return await diffStack(await findStack(args.STACK), trackVersions, args.template); + return await diffStack(await findStack(args.STACK), args.template); case 'bootstrap': return await cliBootstrap(args.ENVIRONMENTS, toolkitStackName); case 'deploy': - return await cliDeploy(args.STACKS, toolkitStackName, trackVersions); + return await cliDeploy(args.STACKS, toolkitStackName); case 'destroy': return await cliDestroy(args.STACKS, args.force); case 'synthesize': case 'synth': - return await cliSynthesize(args.STACKS, args.interactive, args.output, args.json, trackVersions); + return await cliSynthesize(args.STACKS, args.interactive, args.output, args.json); case 'metadata': return await cliMetadata(await findStack(args.STACK)); @@ -209,8 +216,8 @@ async function initCommandLine() { } } - async function cliMetadata(stack: cxapi.StackId) { - const s = await synthesizeStack(stack, false); + async function cliMetadata(stackName: string) { + const s = await synthesizeStack(stackName); return s.metadata; } @@ -273,14 +280,14 @@ async function initCommandLine() { throw new Error(`No environments were found when selecting across ${globs} (available: ${envList})`); } await Promise.all(environments.map(async (environment) => { - success(' ⏳ Bootstrapping environment %s...', colors.blue(environment!.name)); + success(' ⏳ Bootstrapping environment %s...', colors.blue(environment.name)); try { - const result = await bootstrapEnvironment(environment!, aws, toolkitStackName); + const result = await bootstrapEnvironment(environment, aws, toolkitStackName); const message = result.noOp ? ' ✅ Environment %s was already fully bootstrapped!' : ' ✅ Successfully bootstraped environment %s!'; - success(message, colors.blue(environment!.name)); + success(message, colors.blue(environment.name)); } catch (e) { - error(' ❌ Environment %s failed bootstrapping: %s', colors.blue(environment!.name), e); + error(' ❌ Environment %s failed bootstrapping: %s', colors.blue(environment.name), e); throw e; } })); @@ -316,8 +323,7 @@ async function initCommandLine() { async function cliSynthesize(stackNames: string[], doInteractive: boolean, outputDir: string|undefined, - json: boolean, - trackVersions: boolean): Promise { + json: boolean): Promise { const stackIds = await selectStacks(...stackNames); renames.validateSelectedStacks(stackIds); @@ -325,7 +331,7 @@ async function initCommandLine() { if (stackIds.length !== 1) { throw new Error(`When using interactive synthesis, must select exactly one stack. Got: ${listStackNames(stackIds)}`); } - return await interactive(stackIds[0], argv.verbose, (stack) => synthesizeStack(stack, trackVersions)); + return await interactive(stackIds[0], argv.verbose, (stack) => synthesizeStack(stack)); } if (stackIds.length > 1 && outputDir == null) { @@ -333,7 +339,8 @@ async function initCommandLine() { throw new Error(`Multiple stacks selected (${listStackNames(stackIds)}), but output is directed to stdout. Either select one stack, or use --output to send templates to a directory.`); } - const synthesizedStacks = await synthesizeStacks(stackIds, trackVersions); + const response = await synthesizeStacks(); + const synthesizedStacks = response.stacks; if (outputDir == null) { return synthesizedStacks[0].template; // Will be printed in main() @@ -354,19 +361,29 @@ async function initCommandLine() { /** * Synthesize a single stack */ - async function synthesizeStack(stack: cxapi.StackId, trackVersions: boolean): Promise { - const resp = await synthesizeStacks([stack], trackVersions); - return resp[0]; + async function synthesizeStack(stackName: string): Promise { + const resp = await synthesizeStacks(); + const stack = resp.stacks.find(s => s.name === stackName); + if (!stack) { + throw new Error(`Stack ${stackName} not found`); + } + return stack; } /** * Synthesize a set of stacks */ - async function synthesizeStacks(stacks: cxapi.StackId[], trackVersions: boolean): Promise { + async function synthesizeStacks(): Promise { + if (cachedResponse) { + return cachedResponse; + } + + let config = completeConfig(); + const trackVersions: boolean = completeConfig().get(['versionReporting']); + // We may need to run the cloud executable multiple times in order to satisfy all missing context while (true) { - debug(`Synthesizing ${listStackNames(stacks)}`); - const response: cxapi.SynthesizeResponse = await execProgram({ type: 'synth', stacks: stacks.map(s => s.name) }); + const response: cxapi.SynthesizeResponse = await execProgram(); const allMissing = cdkUtil.deepMerge(...response.stacks.map(s => s.missing)); if (!cdkUtil.isEmpty(allMissing)) { @@ -376,6 +393,8 @@ async function initCommandLine() { // Cache the new context to disk await projectConfig.save(DEFAULTS); + config = completeConfig(); + continue; } @@ -409,7 +428,8 @@ async function initCommandLine() { } // All good, return - return response.stacks; + cachedResponse = response; + return response; function formatModules(runtime: cxapi.AppRuntime): string { const modules = new Array(); @@ -419,6 +439,76 @@ async function initCommandLine() { return modules.join(','); } } + + /** Invokes the cloud executable and returns JSON output */ + async function execProgram(): Promise { + const env: { [key: string]: string } = { }; + + const context = config.get(['context']); + await populateDefaultEnvironmentIfNeeded(context); + + env[cxapi.CONTEXT_ENV] = JSON.stringify(context); + + const app = config.get(['app']); + if (!app) { + throw new Error(`--app is required either in command-line, in ${DEFAULTS} or in ${PER_USER_DEFAULTS}`); + } + + const commandLine = appToArray(app); + + const outdir = await fs.mkdtemp(path.join(os.tmpdir(), 'cdk')); + debug('outdir:', outdir); + env[cxapi.OUTDIR_ENV] = outdir; + + try { + const outfile = await exec(); + debug('outfile:', outfile); + if (!(await fs.pathExists(outfile))) { + throw new Error(`Unable to find output file ${outfile}`); + } + + const response = await fs.readJson(outfile); + debug(response); + return response; + } finally { + debug('Removing outdir', outdir); + await fs.remove(outdir); + } + + async function exec() { + return new Promise((ok, fail) => { + // We use a slightly lower-level interface to: + // + // - Pass arguments in an array instead of a string, to get around a + // number of quoting issues introduced by the intermediate shell layer + // (which would be different between Linux and Windows). + // + // - Inherit stderr from controlling terminal. We don't use the captured value + // anway, and if the subprocess is printing to it for debugging purposes the + // user gets to see it sooner. Plus, capturing doesn't interact nicely with some + // processes like Maven. + const proc = childProcess.spawn(commandLine[0], commandLine.slice(1), { + stdio: ['ignore', 'inherit', 'inherit'], + detached: false, + env: { + ...process.env, + ...env + } + }); + + proc.on('error', fail); + + proc.on('exit', code => { + if (code === 0) { + return ok(path.join(outdir, cxapi.OUTFILE_NAME)); + } else { + return fail(new Error('Subprocess exited with error ' + code.toString())); + } + }); + }); + } + } + } /** @@ -427,31 +517,37 @@ async function initCommandLine() { * It's an error if there are no stacks to select, or if one of the requested parameters * refers to a nonexistant stack. */ - async function selectStacks(...stackNames: string[]): Promise { - stackNames = stackNames.filter(s => s != null); // filter null/undefined + async function selectStacks(...selectors: string[]): Promise { + selectors = selectors.filter(s => s != null); // filter null/undefined - const stackIds: cxapi.StackInfo[] = await listStacks(); - if (stackIds.length === 0) { + const stacks: cxapi.SynthesizedStack[] = await listStacks(); + if (stacks.length === 0) { throw new Error('This app contains no stacks'); } - if (stackNames.length === 0) { - debug('Stack name not specified, so defaulting to all available stacks: ' + listStackNames(stackIds)); - return stackIds; + if (selectors.length === 0) { + debug('Stack name not specified, so defaulting to all available stacks: ' + listStackNames(stacks)); + return stacks; } - // For every selector argument, pick stacks from the list. Remove - // from the original list to make sure we never select the same stack twice. - const ret: cxapi.StackId[] = []; - for (const stackName of stackNames) { - const matched = cdkUtil.partition(stackIds, stackId => minimatch(stackId.name, stackName)); - if (matched.length === 0) { - throw new Error(`No stack found matching '${stackName}'. Use "list" to print manifest`); + // For every selector argument, pick stacks from the list. + const matched = new Set(); + for (const pattern of selectors) { + let found = false; + + for (const stack of stacks) { + if (minimatch(stack.name, pattern)) { + matched.add(stack.name); + found = true; + } + } + + if (!found) { + throw new Error(`No stack found matching '${pattern}'. Use "list" to print manifest`); } - ret.push(...matched); } - return ret; + return stacks.filter(s => matched.has(s.name)); } async function cliList(options: { long?: boolean } = { }) { @@ -459,7 +555,14 @@ async function initCommandLine() { // if we are in "long" mode, emit the array as-is (JSON/YAML) if (options.long) { - return stacks; // will be YAML formatted output + const long = []; + for (const stack of stacks) { + long.push({ + name: stack.name, + environment: stack.environment + }); + } + return long; // will be YAML formatted output } // just print stack names @@ -470,18 +573,18 @@ async function initCommandLine() { return 0; // exit-code } - async function listStacks(): Promise { - const response: cxapi.ListStacksResponse = await execProgram({ type: 'list' }); + async function listStacks(): Promise { + const response = await synthesizeStacks(); return response.stacks; } - async function cliDeploy(stackNames: string[], toolkitStackName: string, trackVersions: boolean) { + async function cliDeploy(stackNames: string[], toolkitStackName: string) { const stackIds = await selectStacks(...stackNames); renames.validateSelectedStacks(stackIds); - const synthesizedStacks = await synthesizeStacks(stackIds, trackVersions); + const response = await synthesizeStacks(); - for (const stack of synthesizedStacks) { + for (const stack of response.stacks) { if (stackIds.length !== 1) { highlight(stack.name); } if (!stack.environment) { // tslint:disable-next-line:max-line-length @@ -538,20 +641,17 @@ async function initCommandLine() { } } - async function diffStack(stack: cxapi.StackInfo, trackVersions: boolean, templatePath?: string): Promise { - if (!stack.environment) { - throw new Error(`Stack ${stack.name} has no environment`); - } - const s = await synthesizeStack(stack, trackVersions); + async function diffStack(stackName: string, templatePath?: string): Promise { + const stack = await synthesizeStack(stackName); const currentTemplate = await readCurrentTemplate(stack, templatePath); - if (printStackDiff(currentTemplate, s) === 0) { + if (printStackDiff(currentTemplate, stack) === 0) { return 0; } else { return 1; } } - async function readCurrentTemplate(stack: cxapi.StackInfo, templatePath?: string): Promise<{ [key: string]: any }> { + async function readCurrentTemplate(stack: cxapi.SynthesizedStack, templatePath?: string): Promise<{ [key: string]: any }> { if (templatePath) { if (!await fs.pathExists(templatePath)) { throw new Error(`There is no file at ${templatePath}`); @@ -559,7 +659,7 @@ async function initCommandLine() { const fileContent = await fs.readFile(templatePath, { encoding: 'UTF-8' }); return parseTemplate(fileContent); } else { - const cfn = await aws.cloudFormation(stack.environment!, Mode.ForReading); + const cfn = await aws.cloudFormation(stack.environment, Mode.ForReading); const stackName = renames.finalName(stack.name); try { const response = await cfn.getTemplate({ StackName: stackName }).promise(); @@ -586,80 +686,15 @@ async function initCommandLine() { /** * Match a single stack from the list of available stacks */ - async function findStack(name: string): Promise { + async function findStack(name: string): Promise { const stackIds = await selectStacks(name); // Could have been a glob so check that we evaluated to exactly one if (stackIds.length > 1) { - throw new Error(`This command requires exactly one stack, '${name}' matches more than one: `); + throw new Error(`This command requires exactly one stack and we matched more than one: ${stackIds.map(x => x.name)}`); } - return stackIds[0]; - } - - /** Invokes the cloud executable and returns JSON output */ - async function execProgram(request: cxapi.CXRequest): Promise { - const config = completeConfig(); - request.context = config.get(['context']); - - await populateDefaultEnvironmentIfNeeded(request.context); - - const app = config.get(['app']); - if (!app) { - throw new Error(`--app is required either in command-line, in ${DEFAULTS} or in ${PER_USER_DEFAULTS}`); - } - - const commandLine = appToArray(app); - - // encode in base64 to make it easier to pass through shell scripts without escaping-hell - const req = cxapi.BASE64_REQ_PREFIX + Buffer.from(JSON.stringify(request)).toString('base64'); - commandLine.push(req); - - debug(commandArrayToString(commandLine)); - - return new Promise((ok, fail) => { - // We use a slightly lower-level interface to: - // - // - Pass arguments in an array instead of a string, to get around a - // number of quoting issues introduced by the intermediate shell layer - // (which would be different between Linux and Windows). - // - // - Inherit stderr from controlling terminal. We don't use the captured value - // anway, and if the subprocess is printing to it for debugging purposes the - // user gets to see it sooner. Plus, capturing doesn't interact nicely with some - // processes like Maven. - const proc = childProcess.spawn(commandLine[0], commandLine.slice(1), { - stdio: ['ignore', 'pipe', 'inherit'], - detached: false - }); - - const buf: Buffer[] = []; - - proc.stdout.on('data', d => { - buf.push(d as Buffer); - }); - - proc.on('error', fail); - - proc.on('exit', code => { - const stdout = Buffer.concat(buf).toString(); - - if (code === 0) { - let parsed = null; - try { - parsed = JSON.parse(stdout); - } catch (e) { - error("Invalid CDK App output. Make sure you emit the result of app.exec() to STDOUT:"); - print(stdout); - return fail(new Error('Invalid CDK App output.')); - } - return ok(parsed); - } else { - error(stdout); - return fail(new Error('Subprocess exited with error ' + code.toString())); - } - }); - }); + return stackIds[0].name; } function logDefaults() { @@ -711,28 +746,6 @@ async function initCommandLine() { return typeof app === 'string' ? app.split(' ') : app; } - /** - * Return a properly shell-escaped version of the given command line array - * - * This is only used for debugging purposes, to show the user a command that they can - * pop into the shell to reproduce what we did. - */ - function commandArrayToString(command: string[]): string { - return command.map(shellEscape).join(' '); - } - - /** - * Escape a shell argument with the least amount of fuss - */ - function shellEscape(x: string): string { - // Don't quote if the string only consists of a known safe subset of characters. - // Blacklisting is actually sufficient for this particular case, but whitelisting feels safer. - if (x.search(/[^a-z0-9_\/:.-]/i) === -1) { return x; } - - // Quote with single quotes, and do '\'' to reproduce literal single quotes. - return `'${x.replace(/'/g, "'\\''")}'`; - } - /** * If we don't have region/account defined in context, we fall back to the default SDK behavior * where region is retreived from ~/.aws/config and account is based on default credentials provider @@ -760,7 +773,7 @@ async function initCommandLine() { /** * Combine the names of a set of stacks using a comma */ - function listStackNames(stacks: cxapi.StackId[]): string { + function listStackNames(stacks: cxapi.SynthesizedStack[]): string { return stacks.map(s => s.name).join(', '); } diff --git a/packages/aws-cdk/lib/api/deploy-stack.ts b/packages/aws-cdk/lib/api/deploy-stack.ts index 16e0b43d3c6aa..5400dd7e66f87 100644 --- a/packages/aws-cdk/lib/api/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deploy-stack.ts @@ -114,7 +114,7 @@ async function makeBodyParameter(stack: cxapi.SynthesizedStack, toolkitInfo?: To } } -export async function destroyStack(stack: cxapi.StackInfo, sdk: SDK, deployName?: string, quiet: boolean = false) { +export async function destroyStack(stack: cxapi.SynthesizedStack, sdk: SDK, deployName?: string, quiet: boolean = false) { if (!stack.environment) { throw new Error(`The stack ${stack.name} does not have an environment`); } diff --git a/packages/aws-cdk/lib/contextplugins.ts b/packages/aws-cdk/lib/contextplugins.ts index f8064433e2cb2..d490e0edc47c8 100644 --- a/packages/aws-cdk/lib/contextplugins.ts +++ b/packages/aws-cdk/lib/contextplugins.ts @@ -64,5 +64,6 @@ export async function provideContextValues(missingValues: { [key: string]: Missi const value = await provider.getValue(query.scope, query.args); projectConfig.set(['context', key], value); + debug(`Setting "${key}" context to ${JSON.stringify(value)}`); } } diff --git a/packages/aws-cdk/lib/init-templates/app/dotnet/src/HelloCdk/Program.cs b/packages/aws-cdk/lib/init-templates/app/dotnet/src/HelloCdk/Program.cs index 5fb47923f357d..7f65982c20c98 100644 --- a/packages/aws-cdk/lib/init-templates/app/dotnet/src/HelloCdk/Program.cs +++ b/packages/aws-cdk/lib/init-templates/app/dotnet/src/HelloCdk/Program.cs @@ -9,20 +9,14 @@ class Program { static void Main(string[] args) { - // Create a new app. The first argument is used to display a usage message for this app. - string[] appArgs = new [] { $"dotnet ${nameof(HelloCdk)}" } - .Concat(args) - .ToArray(); - var app = new App(appArgs); + var app = new App(); // A CDK app can contain multiple stacks. You can view a list of all the stacks in your // app by typing `cdk list`. new HelloStack(app, "hello-cdk-1", new StackProps()); new HelloStack(app, "hello-cdk-2", new StackProps()); - // Your app must write the return value of app.Run() to standard output. The `cdk init` - // and `cdk synth` commands require this output. - Console.WriteLine(app.Run()); + app.Run(); } } } diff --git a/packages/aws-cdk/lib/init-templates/app/java/src/main/java/com/myorg/HelloApp.java b/packages/aws-cdk/lib/init-templates/app/java/src/main/java/com/myorg/HelloApp.java index 4523de897b539..3a48d6c2057d6 100644 --- a/packages/aws-cdk/lib/init-templates/app/java/src/main/java/com/myorg/HelloApp.java +++ b/packages/aws-cdk/lib/init-templates/app/java/src/main/java/com/myorg/HelloApp.java @@ -6,11 +6,11 @@ public class HelloApp { public static void main(final String argv[]) { - App app = new App(Arrays.asList(argv)); + App app = new App(); new HelloStack(app, "hello-cdk-1"); new HelloStack(app, "hello-cdk-2"); - System.out.println(app.run()); + app.run(); } } diff --git a/packages/aws-cdk/lib/init-templates/app/typescript/bin/%name%.template.ts b/packages/aws-cdk/lib/init-templates/app/typescript/bin/%name%.template.ts index 79a577ecba14e..9034084dba024 100644 --- a/packages/aws-cdk/lib/init-templates/app/typescript/bin/%name%.template.ts +++ b/packages/aws-cdk/lib/init-templates/app/typescript/bin/%name%.template.ts @@ -17,8 +17,8 @@ class %name.PascalCased%Stack extends cdk.Stack { } } -const app = new cdk.App(process.argv); +const app = new cdk.App(); new %name.PascalCased%Stack(app, '%name.PascalCased%Stack'); -process.stdout.write(app.run()); +app.run(); diff --git a/packages/aws-cdk/lib/renames.ts b/packages/aws-cdk/lib/renames.ts index 3a13bf45a6609..7ef533e7b83cb 100644 --- a/packages/aws-cdk/lib/renames.ts +++ b/packages/aws-cdk/lib/renames.ts @@ -20,7 +20,7 @@ export class Renames { * We DO check that if there's a default rename (simple syntax) they * only selected one stack. */ - public validateSelectedStacks(stacks: cxapi.StackId[]) { + public validateSelectedStacks(stacks: cxapi.SynthesizedStack[]) { if (this.hasDefaultRename && stacks.length > 1) { throw new Error("When selecting multiple stacks, you must use the 'ORIGINALNAME:RENAME' pattern for renames."); } diff --git a/packages/aws-cdk/package-lock.json b/packages/aws-cdk/package-lock.json index 92446b34b3ba2..8064ee4ea6698 100644 --- a/packages/aws-cdk/package-lock.json +++ b/packages/aws-cdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "aws-cdk", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/aws-cdk/test/test.assets.ts b/packages/aws-cdk/test/test.assets.ts index b020377d6edf7..eb54d6463a5cf 100644 --- a/packages/aws-cdk/test/test.assets.ts +++ b/packages/aws-cdk/test/test.assets.ts @@ -1,46 +1,51 @@ -import { AssetMetadataEntry } from '@aws-cdk/cx-api'; +import { AssetMetadataEntry, SynthesizedStack } from '@aws-cdk/cx-api'; import { Test } from 'nodeunit'; import { Uploaded, UploadProps } from '../lib'; import { prepareAssets } from '../lib/assets'; export = { async 'prepare assets'(test: Test) { - // GIVEN - const stack = { - name: 'SomeStack', - metadata: { - '/SomeStack/SomeResource': [{ - type: 'aws:cdk:asset', - data: { - path: __filename, - id: 'SomeStackSomeResource4567', - packaging: 'file', - s3BucketParameter: 'BucketParameter', - s3KeyParameter: 'KeyParameter' - } as AssetMetadataEntry, - trace: [] - }] - }, - template: { - Resources: { - SomeResource: { - Type: 'AWS::Something::Something' + // GIVEN + const stack: SynthesizedStack = { + name: 'SomeStack', + environment: { + name: 'myenv', + account: 'myaccount', + region: 'myregion' + }, + metadata: { + '/SomeStack/SomeResource': [{ + type: 'aws:cdk:asset', + data: { + path: __filename, + id: 'SomeStackSomeResource4567', + packaging: 'file', + s3BucketParameter: 'BucketParameter', + s3KeyParameter: 'KeyParameter' + } as AssetMetadataEntry, + trace: [] + }] + }, + template: { + Resources: { + SomeResource: { + Type: 'AWS::Something::Something' + } } - } - } - }; - const toolkit = new FakeToolkit(); + } + }; + const toolkit = new FakeToolkit(); - // WHEN - const params = await prepareAssets(stack, toolkit as any); + // WHEN + const params = await prepareAssets(stack, toolkit as any); - // THEN - test.deepEqual(params, [ - { ParameterKey: 'BucketParameter', ParameterValue: 'bucket' }, - { ParameterKey: 'KeyParameter', ParameterValue: 'assets/SomeStackSomeResource4567/||12345.js' }, - ]); + // THEN + test.deepEqual(params, [ + { ParameterKey: 'BucketParameter', ParameterValue: 'bucket' }, + { ParameterKey: 'KeyParameter', ParameterValue: 'assets/SomeStackSomeResource4567/||12345.js' }, + ]); - test.done(); + test.done(); } }; @@ -49,11 +54,11 @@ class FakeToolkit { public bucketName: string = 'bucket'; public async uploadIfChanged(_data: any, props: UploadProps): Promise { - const filename = `12345${props.s3KeySuffix}`; - return { - filename, - changed: true, - key: `${props.s3KeyPrefix}${filename}` - }; + const filename = `12345${props.s3KeySuffix}`; + return { + filename, + changed: true, + key: `${props.s3KeyPrefix}${filename}` + }; } } diff --git a/packages/simple-resource-bundler/package-lock.json b/packages/simple-resource-bundler/package-lock.json index ab5a5b191fa0a..a74366c82729b 100644 --- a/packages/simple-resource-bundler/package-lock.json +++ b/packages/simple-resource-bundler/package-lock.json @@ -1,6 +1,6 @@ { "name": "simple-resource-bundler", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cdk-build-tools/package-lock.json b/tools/cdk-build-tools/package-lock.json index 0dfa4eeeea2b3..68e5e8e05f9ff 100644 --- a/tools/cdk-build-tools/package-lock.json +++ b/tools/cdk-build-tools/package-lock.json @@ -1,6 +1,6 @@ { "name": "cdk-build-tools", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cdk-integ-tools/package-lock.json b/tools/cdk-integ-tools/package-lock.json index bb00994f55d83..cdf36484fcbbe 100644 --- a/tools/cdk-integ-tools/package-lock.json +++ b/tools/cdk-integ-tools/package-lock.json @@ -1,6 +1,6 @@ { "name": "cdk-integ-tools", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cfn2ts/package-lock.json b/tools/cfn2ts/package-lock.json index ecc14b4d692ce..44f87f951db54 100644 --- a/tools/cfn2ts/package-lock.json +++ b/tools/cfn2ts/package-lock.json @@ -1,6 +1,6 @@ { "name": "cfn2ts", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/merkle-build/package-lock.json b/tools/merkle-build/package-lock.json index 4a16c78bbd7a6..a01f283b915a5 100644 --- a/tools/merkle-build/package-lock.json +++ b/tools/merkle-build/package-lock.json @@ -1,6 +1,6 @@ { "name": "merkle-build", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/pkglint/package-lock.json b/tools/pkglint/package-lock.json index 630a6a01eb6f4..a1861a500f5e8 100644 --- a/tools/pkglint/package-lock.json +++ b/tools/pkglint/package-lock.json @@ -1,6 +1,6 @@ { "name": "pkglint", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/pkgtools/package-lock.json b/tools/pkgtools/package-lock.json index 8e7664696b98a..f9d6db05a9d4a 100644 --- a/tools/pkgtools/package-lock.json +++ b/tools/pkgtools/package-lock.json @@ -1,6 +1,6 @@ { "name": "pkgtools", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/y-npm/package-lock.json b/tools/y-npm/package-lock.json index dcd806eb5627d..ea46c6b8f3938 100644 --- a/tools/y-npm/package-lock.json +++ b/tools/y-npm/package-lock.json @@ -1,6 +1,6 @@ { "name": "y-npm", - "version": "0.9.2", + "version": "0.10.0", "lockfileVersion": 1, "requires": true, "dependencies": {