Skip to content

Commit

Permalink
fix(serverless): rename aws-serverless to aws-sam (#2074)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: renamed `aws-serverless` to `aws-sam`
  • Loading branch information
Sam Goodwin authored Mar 26, 2019
1 parent 0de2206 commit 4a82f13
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ec2 = require('@aws-cdk/aws-ec2');
import lambda = require('@aws-cdk/aws-lambda');
import serverless = require('@aws-cdk/aws-sam');
import secretsmanager = require('@aws-cdk/aws-secretsmanager');
import serverless = require('@aws-cdk/aws-serverless');
import cdk = require('@aws-cdk/cdk');

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-rds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@aws-cdk/aws-kms": "^0.26.0",
"@aws-cdk/aws-lambda": "^0.26.0",
"@aws-cdk/aws-secretsmanager": "^0.26.0",
"@aws-cdk/aws-serverless": "^0.26.0",
"@aws-cdk/aws-sam": "^0.26.0",
"@aws-cdk/cdk": "^0.26.0"
},
"homepage": "https://github.com/awslabs/aws-cdk",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-sam/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## AWS Serverless Application Model Construct Library

```ts
const sam = require('@aws-cdk/aws-sam');
```

Note: we recommended to use `@aws-cdk/aws-lambda`, `aws-cdk/aws-lambda-event-sources` and `@aws-cdk/aws-apigateway` packages to build 'serverless' applications with the CDK instead of the `AWS::Serverless` resources exposes by `@aws-cdk/aws-sam`.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// AWS::Serverless CloudFormation Resources:
export * from './serverless.generated';
export * from './sam.generated';
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"name": "@aws-cdk/aws-serverless",
"name": "@aws-cdk/aws-sam",
"version": "0.26.0",
"description": "The CDK Construct Library for AWS::Serverless",
"description": "The CDK Construct Library for the AWS Serverless Application Model (SAM) resources",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"jsii": {
"outdir": "dist",
"targets": {
"dotnet": {
"namespace": "Amazon.CDK.AWS.Serverless",
"packageId": "Amazon.CDK.AWS.Serverless",
"namespace": "Amazon.CDK.AWS.SAM",
"packageId": "Amazon.CDK.AWS.SAM",
"signAssembly": true,
"assemblyOriginatorKeyFile": "../../key.snk"
},
"java": {
"package": "software.amazon.awscdk.services.serverless",
"package": "software.amazon.awscdk.services.sam",
"maven": {
"groupId": "software.amazon.awscdk",
"artifactId": "serverless"
"artifactId": "sam"
}
},
"sphinx": {}
Expand Down Expand Up @@ -46,7 +46,7 @@
"aws",
"cdk",
"constructs",
"aws-serverless"
"aws-sam"
],
"author": {
"name": "Amazon Web Services",
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions packages/@aws-cdk/aws-serverless/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion packages/decdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@
"@aws-cdk/aws-s3": "^0.26.0",
"@aws-cdk/aws-s3-deployment": "^0.26.0",
"@aws-cdk/aws-s3-notifications": "^0.26.0",
"@aws-cdk/aws-sam": "^0.26.0",
"@aws-cdk/aws-sagemaker": "^0.26.0",
"@aws-cdk/aws-sdb": "^0.26.0",
"@aws-cdk/aws-secretsmanager": "^0.26.0",
"@aws-cdk/aws-serverless": "^0.26.0",
"@aws-cdk/aws-servicecatalog": "^0.26.0",
"@aws-cdk/aws-servicediscovery": "^0.26.0",
"@aws-cdk/aws-ses": "^0.26.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/decdk/test/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ beforeAll(async () => {
await typesys.load(path.dirname(require.resolve('@aws-cdk/cdk/.jsii')));
});

test('schemaForInterface: interface with primitives', () => {
test('schemaForInterface: interface with primitives', async () => {
// GIVEN
const defs = { };
const ctx = SchemaContext.root(defs);
Expand Down
12 changes: 11 additions & 1 deletion tools/awslint/lib/rules/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ moduleLinter.add( {
eval: e => {
if (!e.ctx.namespace) { return; }
if (!e.ctx.assembly) { return; }
const namespace = e.ctx.namespace.toLocaleLowerCase().replace('::', '-');
const namespace = overrideNamespace(e.ctx.namespace.toLocaleLowerCase().replace('::', '-'));
e.assertEquals(e.ctx.assembly.name, `@aws-cdk/${namespace}`, e.ctx.assembly.name);
}
});

/**
* Overrides special-case namespaces like aws-serverless=>aws-sam
*/
function overrideNamespace(namespace: string) {
if (namespace === 'aws-serverless') {
return 'aws-sam';
}
return namespace;
}
12 changes: 11 additions & 1 deletion tools/cfn2ts/lib/genspec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,17 @@ export function packageName(module: SpecName | string): string {
throw new Error(`Module component name must be "AWS::Xxx" or "Alexa::Xxx" (module: ${module})`);
}

return parts[parts.length - 1].toLowerCase();
return overridePackageName(parts[parts.length - 1].toLowerCase());
}

/**
* Overrides special-case namespaces like serverless=>sam
*/
function overridePackageName(name: string) {
if (name === 'serverless') {
return 'sam';
}
return name;
}

/**
Expand Down

0 comments on commit 4a82f13

Please sign in to comment.