Skip to content

Commit

Permalink
updated dependencies and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshay committed Mar 7, 2024
1 parent c68b7d8 commit ddb86d1
Show file tree
Hide file tree
Showing 30 changed files with 167 additions and 15,629 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@ jobs:
- synth
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: "8.7.6"
- uses: oven-sh/setup-bun@v1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: "pnpm"
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::738697399292:role/GitHubOIDCReadOnlyRole
aws-region: us-west-2
- run: pnpm install
- run: pnpm run ${{ matrix.cmd }}
- run: bun install
- run: bun run ${{ matrix.cmd }}
14 changes: 3 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ on:
required: false
type: string
default: "20"
pnpm_version:
description: The version of PNPM to use
required: false
type: string
default: "8.7.6"
stack_environment:
description: The stack environment to deploy
required: true
Expand Down Expand Up @@ -81,15 +76,12 @@ jobs:
with:
aws-region: ${{ inputs.aws_region }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
- uses: pnpm/action-setup@v2
with:
version: ${{ inputs.pnpm_version }}
- uses: oven-sh/setup-bun@v1
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: "pnpm"
- run: pnpm install
- run: pnpm run deploy:one infra -- ${{ inputs.stack_environment }}
- run: bun install
- run: bun run deploy:one infra -- ${{ inputs.stack_environment }}
env:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
# - run: |
Expand Down
91 changes: 46 additions & 45 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
{
"name": "@astro-aws/docs",
"version": "0.0.0",
"private": true,
"homepage": "https://astro-aws.org/",
"repository": {
"type": "git",
"url": "ssh://[email protected]/lukeshay/astro-aws.git",
"directory": "apps/www"
},
"license": "MIT",
"type": "module",
"files": [
"dist"
],
"eslintConfig": {
"extends": [
"../../.eslintrc.cjs"
],
"root": false
},
"scripts": {
"astro": "astro",
"build": "pnpm run clean && ./scripts/copy-package-readmes.sh && astro build",
"check": "astro check && tsc",
"clean": "rimraf dist",
"dev": "astro dev",
"preview": "astro preview",
"release": "pnpm run build && pnpm run package",
"start": "astro dev"
},
"dependencies": {
"@astrojs/starlight": "^0.17.1",
"astro": "^4.2.6",
"sharp": "^0.33.2"
},
"devDependencies": {
"@astro-aws/adapter": "workspace:^",
"@types/node": "^18.18.0",
"eslint": "^8.56.0",
"prettier": "^3.2.4",
"rimraf": "^5.0.5"
},
"engines": {
"node": "18.x || 20.x"
}
"name": "@astro-aws/docs",
"version": "0.0.0",
"private": true,
"homepage": "https://astro-aws.org/",
"repository": {
"type": "git",
"url": "ssh://[email protected]/lukeshay/astro-aws.git",
"directory": "apps/www"
},
"license": "MIT",
"type": "module",
"files": [
"dist"
],
"eslintConfig": {
"extends": [
"../../.eslintrc.cjs"
],
"root": false
},
"scripts": {
"astro": "astro",
"build": "pnpm run clean && ./scripts/copy-package-readmes.sh && astro build",
"check": "astro check && tsc",
"clean": "rimraf dist",
"dev": "astro dev",
"preview": "astro preview",
"release": "pnpm run build && pnpm run package",
"start": "astro dev"
},
"dependencies": {
"@astrojs/starlight": "^0.21.1",
"astro": "^4.4.13",
"sharp": "^0.33.2"
},
"devDependencies": {
"@astro-aws/adapter": "workspace:^",
"@types/node": "^18.18.0",
"eslint": "^8.57.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"starlight-links-validator": "^0.6.0"
},
"engines": {
"node": "18.x || 20.x"
}
}
Binary file removed apps/docs/src/assets/ClaimId_864280113200.pdf
Binary file not shown.
Binary file removed apps/docs/src/assets/ClaimId_864496019100.pdf
Binary file not shown.
3 changes: 2 additions & 1 deletion apps/docs/src/content/docs/guides/01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ pnpm i @astro-aws/constructs

### Modify `lib/hello-cdk-stack.ts` to contain the following

```ts
```ts ins={4, 10-14}
// lib/hello-cdk-stack.ts
import { Stack } from "aws-cdk-lib/core"
import type { StackProps } from "aws-cdk-lib/core"
import { AstroAWS } from "@astro-aws/constructs"
Expand Down
5 changes: 2 additions & 3 deletions apps/docs/src/content/docs/guides/02-query-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ Follow the [getting started guide](./getting-started) to create a new Astro proj

In order to allow query parameters to be passed to your application, you must create a custom `CachePolicy` for the CloudFront distribution. The following example based on the getting started guide will allow all query parameters to be passed to your application.

`lib/hello-cdk-stack.ts`:

```ts
```ts ins={16-18,21-31}
// lib/hello-cdk-stack.ts
import { Stack } from "aws-cdk-lib/core"
import type { StackProps } from "aws-cdk-lib/core"
import { AstroAWS } from "@astro-aws/constructs"
Expand Down
9 changes: 2 additions & 7 deletions apps/docs/src/content/docs/guides/03-cookies.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ Follow the [getting started guide](./getting-started) to create a new Astro proj

In order to allow cookies to be passed to your application, you must create a custom `CachePolicy` for the CloudFront distribution. The following example based on the getting started guide will allow all cookies to be passed to your application.

`lib/hello-cdk-stack.ts`:

```ts
```ts ins={13-15,18-28}
// lib/hello-cdk-stack.ts
import { Stack } from "aws-cdk-lib/core"
import type { StackProps } from "aws-cdk-lib/core"
import { AstroAWS } from "@astro-aws/constructs"
Expand Down Expand Up @@ -45,7 +44,3 @@ export class HelloCdkStack extends Stack {
}
}
```

```
```
2 changes: 1 addition & 1 deletion apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "astro/tsconfigs/strictest",
"extends": "astro/tsconfigs/strictest"
}
14 changes: 7 additions & 7 deletions apps/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
"dependencies": {
"@astro-aws/constructs": "workspace:^",
"@astro-aws/docs": "workspace:^",
"@aws-sdk/client-acm": "^3.502.0",
"aws-cdk": "^2.124.0",
"aws-cdk-lib": "^2.124.0",
"@aws-sdk/client-acm": "^3.525.0",
"aws-cdk": "^2.131.0",
"aws-cdk-lib": "^2.131.0",
"constructs": "^10.3.0",
"eslint": "^8.56.0",
"prettier": "^3.2.4",
"typescript": "^5.3.3",
"eslint": "^8.57.0",
"prettier": "^3.2.5",
"typescript": "^5.4.2",
"workspace-tools": "^0.36.4"
},
"devDependencies": {
"@astro-aws/scripts": "workspace:^",
"@types/aws-lambda": "^8.10.133",
"@types/aws-lambda": "^8.10.136",
"@types/node": "^18.18.4",
"eslint-config-get-off-my-lawn": "^7.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/infra/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
ENVIRONMENT="${1:-DEV}"
AWS_ARGS="${@:2}"

pnpm exec -- cdk deploy --asset-parallelism --concurrency 4 --require-approval never "AstroAWS-${ENVIRONMENT}-*" ${AWS_ARGS}
bun run cdk deploy --asset-parallelism --concurrency 4 --require-approval never "AstroAWS-${ENVIRONMENT}-*" ${AWS_ARGS}
22 changes: 11 additions & 11 deletions apps/infra/src/lib/constants/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ const ENVIRONMENT_PROPS: Record<Environment, EnvironmentProps> = {
aliases: ["www.static.dev", "static.dev"],
hostedZoneName: "astro-aws.org",
mode: "static",
package: "@astro-aws/docs",
app: "apps/docs",
runtime: "nodejs20",
},
{
aliases: ["www.ssr.nodejs18.dev", "ssr.nodejs18.dev"],
hostedZoneName: "astro-aws.org",
mode: "ssr",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs18",
},
{
aliases: ["www.stream.nodejs18.dev", "stream.nodejs18.dev"],
hostedZoneName: "astro-aws.org",
mode: "ssr-stream",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs18",
},
{
Expand All @@ -62,21 +62,21 @@ const ENVIRONMENT_PROPS: Record<Environment, EnvironmentProps> = {
},
hostedZoneName: "astro-aws.org",
mode: "edge",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs18",
},
{
aliases: ["www.ssr.nodejs20.dev", "ssr.nodejs20.dev"],
hostedZoneName: "astro-aws.org",
mode: "ssr",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs20",
},
{
aliases: ["www.stream.nodejs20.dev", "stream.nodejs20.dev"],
hostedZoneName: "astro-aws.org",
mode: "ssr-stream",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs20",
},
{
Expand All @@ -87,7 +87,7 @@ const ENVIRONMENT_PROPS: Record<Environment, EnvironmentProps> = {
},
hostedZoneName: "astro-aws.org",
mode: "edge",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs20",
},
],
Expand All @@ -100,7 +100,7 @@ const ENVIRONMENT_PROPS: Record<Environment, EnvironmentProps> = {
aliases: ["www.docs"],
hostedZoneName: "astro-aws.org",
mode: "static",
package: "@astro-aws/docs",
app: "apps/docs",
redirectAliases: ["", "www", "docs"],
runtime: "nodejs20",
},
Expand All @@ -112,17 +112,17 @@ const ENVIRONMENT_PROPS: Record<Environment, EnvironmentProps> = {
websites: [
{
mode: "static",
package: "@astro-aws/docs",
app: "apps/docs",
runtime: "nodejs20",
},
{
mode: "ssr",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs20",
},
{
mode: "ssr-stream",
package: "@astro-aws/examples-base",
app: "examples/base",
runtime: "nodejs20",
},
],
Expand Down
22 changes: 4 additions & 18 deletions apps/infra/src/lib/stacks/website-stack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { cwd, env } from "node:process"

import { getPnpmWorkspaces } from "workspace-tools"
import { CfnOutput, Duration, Stack } from "aws-cdk-lib/core"
import type { ICertificate } from "aws-cdk-lib/aws-certificatemanager"
import {
Expand Down Expand Up @@ -33,12 +32,13 @@ import { BasicGraphWidget } from "../constructs/basic-graph-widget.js"
import { Environments } from "../constants/environments.js"
import type { AstroAWSStackProps } from "../types/astro-aws-stack-props.js"
import { CrossRegionCertificate } from "../constructs/cross-region-certificate.js"
import { resolve } from "node:path"

type StaticWebsiteStackProps = {
aliases?: readonly [string, ...string[]]
mode: string
hostedZoneName?: string
package: string
app: string
runtime: string
}

Expand All @@ -48,8 +48,6 @@ type WebsiteStackProps = AstroAWSStackProps &
}

class WebsiteStack extends Stack {
private static readonly WORKSPACE_INFO = getPnpmWorkspaces(cwd())

public constructor(scope: Construct, id: string, props: WebsiteStackProps) {
super(scope, id, props)

Expand Down Expand Up @@ -112,7 +110,7 @@ class WebsiteStack extends Stack {
viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
},
certificate,
comment: environment,
comment: `${environment} - ${mode}`,
defaultBehavior: {
cachePolicy,
responseHeadersPolicy: new ResponseHeadersPolicy(
Expand Down Expand Up @@ -161,7 +159,7 @@ class WebsiteStack extends Stack {
serverAccessLogsPrefix: "s3/",
},
},
outDir: [this.#getWorkspacePath(props.package), distDir].join("/"),
outDir: resolve(cwd(), "..", "..", props.app, distDir),
})

if (hostedZone && domainNames?.length) {
Expand Down Expand Up @@ -265,18 +263,6 @@ class WebsiteStack extends Stack {
astroAwsConstruct.cdk.cloudfrontDistribution.distributionDomainName,
})
}

#getWorkspacePath(pkg: string): string {
const workspace = WebsiteStack.WORKSPACE_INFO.find(
(workspaceInfo) => workspaceInfo.name === pkg,
)

if (!workspace) {
throw new Error(`Unable to find workspace for ${pkg}`)
}

return workspace.path
}
}

export { type StaticWebsiteStackProps, type WebsiteStackProps, WebsiteStack }
2 changes: 1 addition & 1 deletion apps/infra/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.base.json"
}
Binary file added bun.lockb
Binary file not shown.
Loading

0 comments on commit ddb86d1

Please sign in to comment.