-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BREAKING] Move @aws-cdk/resources
classes into L2 packages
#264
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dcd89bc
[BREAKING] Move `@aws-cdk/resources` classes into L2 packages
RomainMuller bb7c332
PR Feedback incorporation:
RomainMuller 1ba5f7f
Modelling dependency from @aws-cdk/assert on aws-cdk
RomainMuller 27dad9a
Add comment
RomainMuller e46f5f8
Make @aws-cdk/assert resolve the cdk command correctly
RomainMuller 826dc09
Change import patterns to use per-class import instead of wild-card f…
RomainMuller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
export PATH=node_modules/.bin:$PATH | ||
|
||
# Making sure the bare minimum packages allowing be able to test-build the generated packages is available: | ||
lerna exec --scope=cfn2ts \ | ||
--scope=pkglint \ | ||
--scope=@aws-cdk/cdk-cfnspec \ | ||
--scope=@aws-cdk/assert \ | ||
--scope=@aws-cdk/cloudformation-diff \ | ||
--scope=@aws-cdk/core \ | ||
--scope=@aws-cdk/cx-api \ | ||
--stream \ | ||
npm run build | ||
|
||
VERSION=$(node -e 'console.log(require("./lerna.json").version);') | ||
|
||
for S in $(node -e 'console.log(require("./packages/@aws-cdk/cdk-cfnspec").namespaces.join("\n"));'); do | ||
P=$(tr 'A-Z' 'a-z' <<< "${S/AWS::/@aws-cdk/}") | ||
PB=$(basename ${P}) | ||
if [ ! -d packages/${P} ]; then | ||
echo "⏳ Creating package ${P} for scope ${S}..." | ||
mkdir -p packages/${P}/test | ||
mkdir -p packages/${P}/lib | ||
cat <<EOM > packages/${P}/.gitignore | ||
*.js | ||
*.js.map | ||
*.d.ts | ||
*.generated.ts | ||
tsconfig.json | ||
tslint.json | ||
node_modules | ||
dist | ||
EOM | ||
|
||
cat <<EOM > packages/${P}/.npmignore | ||
# Don't include original .ts files when doing \`npm pack\` | ||
*.ts | ||
!*.d.ts | ||
coverage | ||
.nyc_output | ||
*.tgz | ||
EOM | ||
|
||
cat <<EOM > packages/${P}/package.json | ||
{ | ||
"name": "${P}", | ||
"version": "${VERSION}", | ||
"description": "The CDK Construct Library for ${S}", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"jsii": { | ||
"outdir": "dist", | ||
"bundledDependencies": [], | ||
"names": { | ||
"java": "com.amazonaws.cdk.${PB}", | ||
"dotnet": "${S/AWS::/Aws.Cdk.}" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/awslabs/aws-cdk" | ||
}, | ||
"scripts": { | ||
"build": "cfn2ts --scope=${S} && jsii && tslint -p . && pkglint", | ||
"watch": "jsii -w", | ||
"lint": "jsii && tslint -p . --force", | ||
"test": "nodeunit test/test.*.js && cdk-integ-assert", | ||
"integ": "cdk-integ", | ||
"pkglint": "pkglint -f" | ||
}, | ||
"keywords": [ | ||
"aws", | ||
"cdk", | ||
"constructs", | ||
"${PB}" | ||
], | ||
"author": { | ||
"name": "Amazon Web Services", | ||
"url": "https://aws.amazon.com" | ||
}, | ||
"license": "LicenseRef-LICENSE", | ||
"devDependencies": { | ||
"@aws-cdk/assert": "^${VERSION}", | ||
"cfn2ts": "^${VERSION}", | ||
"pkglint": "^${VERSION}" | ||
}, | ||
"dependencies": { | ||
"@aws-cdk/core": "^${VERSION}" | ||
} | ||
} | ||
EOM | ||
|
||
cat <<EOM > packages/${P}/lib/index.ts | ||
// ${S} CloudFormation Resources: | ||
export * from './${PB}.generated'; | ||
EOM | ||
|
||
cat <<EOM > packages/${P}/test/test.${PB}.ts | ||
import { Test, testCase } from 'nodeunit'; | ||
import {} from '../lib'; | ||
|
||
exports = testCase({ | ||
notTested(test: Test) { | ||
test.ok(true, 'No tests are specified for this package.'); | ||
test.done(); | ||
} | ||
}); | ||
EOM | ||
|
||
echo "⌛️ Bootstrapping & building ${P}" | ||
lerna bootstrap --scope=${P} | ||
lerna run build --scope=${P} | ||
|
||
git add packages/${P} | ||
|
||
echo "✅ Have fun with your new package ${P} (⚠️ don't forget to add it to 'aws-cdk-all')" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
examples/cdk-examples-typescript/chat-app/DynamodbPostsTable.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
examples/cdk-examples-typescript/chat-app/dynamodb-posts-table.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Construct } from '@aws-cdk/core'; | ||
import { KeyAttributeType, Table } from '@aws-cdk/dynamodb'; | ||
|
||
export class DynamoPostsTable extends Construct { | ||
constructor(parent: Construct, name: string) { | ||
super(parent, name); | ||
|
||
const table = new Table(this, 'Table', { | ||
readCapacity: 5, writeCapacity: 5 | ||
}); | ||
|
||
table.addPartitionKey('Alias', KeyAttributeType.String); | ||
table.addSortKey('Timestamp', KeyAttributeType.String); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this build symlinks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope,
lerna bootstrap
will have done that at theinstall.sh
step. I can duplicate the bootstrap command, though if you feel it's better... It's incredibly cheap to run.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should automatically run
./install.sh
isnode_modules
doesn't exist.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already do (L4-6 in
build.sh
).