You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: use npx projen commands in examples and clarify pdk vs projen (#753)
To help clarify PDK vs Projen, use projen commands in examples instead of PDK cli, and reword parts
of the documentation. Also remove the migration banner from the README.
Fixes#678
Copy file name to clipboardexpand all lines: docs/content/faqs/index.md
+10
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,15 @@
1
1
# Frequently Asked Questions
2
2
3
+
## What's the difference between PDK and Projen?
4
+
5
+
[Projen](https://projen.io/) is a framework which allows you to define and maintain complex project configuration through code. PDK uses this framework, and vends several Projen projects. PDK is not a replacement or alternative to Projen, but rather builds on Projen to define opinionated projects which work synergistically with one another.
6
+
7
+
## What's the difference between PDK and CDK?
8
+
9
+
[CDK](https://aws.amazon.com/cdk/) is a framework for defining AWS infrastructure as code. PDK vends several CDK constructs which can be used in traditional CDK projects, but are more powerful when used within the context of a PDK project. For example, the `StaticWebsite` CDK construct vended by PDK can be used in any CDK project to deploy the infrastructure to host a static website on AWS, however when the Infrastructure and CloudscapeReactTsWebsite PDK projects are used, the `StaticWebsite` CDK construct is automatically configured to deploy your Cloudscape website, and deploy the necessary runtime configuration to set up Cognito login for your website.
10
+
11
+
While many of the PDK projects generate CDK code, PDK is not considered an abstraction over CDK. You still work with CDK to define your AWS infrastructure, but you may use these generated CDK constructs to supplement your CDK code.
12
+
3
13
## I want to change a “pre-defined” task (e.g.: add --verbose to a tsc compile task)
Copy file name to clipboardexpand all lines: docs/content/getting_started/index.md
+6-7
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This topic introduces you to important AWS PDK concepts and describes how to ins
7
7
The AWS PDK lets you define your project structure as code in one of its supported programming languages. At its core, the AWS PDK is built on [Projen](https://github.com/projen/projen) and is a piece of software you should become familiar with if you want to become proficient with the PDK. In addition, alot of the constructs provided by the PDK generate CDK code which is used to deploy relevant infrastructure. The following expandable sections provide a quick primer on how these two key pieces of technology work.
8
8
9
9
??? "CDK Primer"
10
-
10
+
11
11
AWS Construct Development Kit (AWS CDK) allows you to model AWS infrastructure as code (IaC) in a variety of supported languages. By allowing you to define Infastructure programatically, you can create higher level abstractions which can be re-used in a variety of applications. The deployment mechanism used at AWS is Cloudformation and as such all CDK code 'synthesizes' into Cloudformation. You can think of this like code that compiles to some native format (i.e: Java -> ByteCode).
12
12
13
13
To ground this in an example, let's create an S3 Bucket using the CDK:
@@ -143,7 +143,7 @@ The distributables for each language can be used directly as follows:
143
143
```
144
144
145
145
!!!tip
146
-
Whilst the AWS PDK can be used directly via these package managers, we recommend bootstrapping via the `pdk new` command which negates the need to interact directly with these package managers. The package managers will still need to be installed however, refer to [prerequisites](index.md#prerequisites) for more information.
146
+
Whilst the AWS PDK can be used directly via these package managers, we recommend bootstrapping via the `npx projen new` command which negates the need to interact directly with these package managers. The package managers will still need to be installed however, refer to [prerequisites](index.md#prerequisites) for more information.
147
147
148
148
## Prerequisites
149
149
@@ -156,9 +156,11 @@ All AWS PDK developers, even those working in Python or Java, need Node.js 16 or
156
156
!!!tip
157
157
We recommend installing [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating) and configuring it to use Node 18.
158
158
159
-
### PDK CLI
159
+
### (Optional) PDK CLI
160
+
161
+
The PDK CLI is a wrapper command which delegates to either a package manager or a projen command depending on the context. As a rule of thumb, this replaces the use of `npx projen` for commands shown in the documentation.
160
162
161
-
Once your NodeJs runtime is set up, run the following command to install the pdk CLI:
163
+
Once your NodeJS runtime is set up, run the following command to install the pdk CLI:
162
164
163
165
```bash
164
166
npm install -g @aws/pdk
@@ -168,9 +170,6 @@ Run the following command to verify correct installation and print the version n
168
170
169
171
`pdk --version`
170
172
171
-
!!!warning
172
-
The `pdk` command is a wrapper command which delegates to either a package manager or a projen command depending on the context. As such it may be possible that certain arguments may not operate as expected.
173
-
174
173
### Git
175
174
176
175
[Git](https://git-scm.com/) is also required to be installed and configured when bootstrapping new applications unless the `--no-git` flag is specified when executing the `pdk new` command.
@@ -210,7 +214,7 @@ The final step is the ensure our operations are exposed as part of the API by li
210
214
211
215
### Build the API
212
216
213
-
Now that we have our API defined, the final step is to build our code which will generate all of our type-safe bindings. To do so, run `pdk build` from the root of your PDK project.
217
+
Now that we have our API defined, the final step is to build our code which will generate all of our type-safe bindings. To do so, run `npx projen build` from the root of your PDK project.
214
218
215
219
Take some time now to inspect the code that was generated for you in the following locations:
216
220
@@ -335,7 +339,7 @@ Once you have saved your `.projenrc.ts` file, run `pdk` from the root to synthes
335
339
336
340
### Implement the handlers
337
341
338
-
We now have everything we need to start implementing our handlers.
342
+
We now have everything we need to start implementing our handlers.
339
343
340
344
Let's first by creating a shared file called `dynamo-client.ts` within the handlers `src` directory as follows:
341
345
@@ -564,7 +568,7 @@ Fantastic! We now have all of our API business logic implemented. Let's also upd
564
568
expect(response.statusCode).toBe(200);
565
569
expect((response.body as PutShoppingListResponseContent).shoppingListId).toBeDefined();
566
570
});
567
-
});
571
+
});
568
572
```
569
573
570
574
=== "delete-shopping-list.test.ts"
@@ -864,9 +868,9 @@ export class ApplicationStack extends Stack {
864
868
We are now ready to deploy our API. To do so, run the following steps:
865
869
866
870
```bash
867
-
pdk build
871
+
npx projen build
868
872
cd packages/infra
869
-
pdk deploy:dev
873
+
npx projen deploy:dev
870
874
```
871
875
872
876
Once the deployment completes, we can test our API by navigating the the website (either via Cloudfront or locally) and trying out the API Explorer.
@@ -1334,7 +1338,7 @@ We can now test our UI locally by running the following command:
1334
1338
1335
1339
```bash
1336
1340
cd packages/website
1337
-
pdk dev
1341
+
npx projen dev
1338
1342
```
1339
1343
1340
1344
This will load a local server and open a browser showing your new application.
@@ -1348,9 +1352,9 @@ Have a play around with your website to ensure it is working as expected.
1348
1352
If you are happy with your website locally, you can go ahead and deploy it to AWS Cloudfront by performing the following steps from the root directory:
1349
1353
1350
1354
```bash
1351
-
pdk build
1355
+
npx projen build
1352
1356
cd packages/infra
1353
-
pdk deploy:dev
1357
+
npx projen deploy:dev
1354
1358
```
1355
1359
1356
1360
Once the deployment completes, navigate to your cloudfront URL to play around with your deployed website.
0 commit comments