Skip to content

Commit

Permalink
support hybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshay committed Sep 15, 2023
1 parent 8765479 commit af4d86e
Show file tree
Hide file tree
Showing 39 changed files with 864 additions and 2,565 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
matrix:
node_version:
- 18
cmd:
- build
- test
- lint
- prettier
- synth
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -32,8 +38,4 @@ jobs:
aws-region: us-east-2
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: pnpm install
- run: pnpm run build
- run: pnpm run test
- run: pnpm run lint
- run: pnpm run prettier
- run: pnpm run synth
- run: pnpm run ${{ matrix.cmd }}
8 changes: 4 additions & 4 deletions apps/docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export default defineConfig({
starlight({
customCss: ["./src/styles/base.css"],
pagination: true,
social: {
github: "https://github.com/lukeshay/astro-aws",
},
sidebar: [
{
autogenerate: {
Expand All @@ -24,8 +21,11 @@ export default defineConfig({
label: "Reference",
},
],
title: "Astro AWS",
social: {
github: "https://github.com/lukeshay/astro-aws",
},
tagline: "AWS CDK constructs for Astro",
title: "Astro AWS",
}),
],
output: "static",
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"dependencies": {
"@astrojs/starlight": "^0.9.1",
"astro": "^3.0.6",
"astro": "^3.1.0",
"sharp": "^0.32.5"
},
"devDependencies": {
Expand Down
10 changes: 8 additions & 2 deletions apps/docs/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// eslint-disable-next-line import/no-unresolved
import { defineCollection } from "astro:content"
import { docsSchema, i18nSchema } from "@astrojs/starlight/schema"

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
i18n: defineCollection({ type: "data", schema: i18nSchema() }),
docs: defineCollection({
schema: docsSchema(),
}),
i18n: defineCollection({
schema: i18nSchema(),
type: "data",
}),
}
2 changes: 1 addition & 1 deletion apps/docs/src/content/docs/reference/packages/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: "@astro-aws/adapter"
description: "NPM package @astro-aws/adapter"
---


An [Astro](https://astro.build) adapter for building an SSR application and deploying it to AWS Lambda.

## Install
Expand Down Expand Up @@ -55,6 +54,7 @@ export default defineConfig({
## Example

See [the source code of this site](https://github.com/lukeshay/astro-aws/blob/main/apps/www/astro.config.ts)

## More

For more information, see the [documentation website](https://astro-aws.org/)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: "@astro-aws/constructs"
description: "NPM package @astro-aws/constructs"
---


Constructs for deploying your [Astro](https://astro.build/) project that is built using [@astro-aws/adapter](https://www.npmjs.com/package/@astro-aws/adapter).

## SSR Usage
Expand Down Expand Up @@ -158,6 +157,7 @@ export class MyAstroStack extends Stack {
## Example

See [the source code of this site](https://github.com/lukeshay/astro-aws/blob/main/apps/infra/src/lib/stacks/website-stack.ts)

## More

For more information, see the [documentation website](https://astro-aws.org/)
1 change: 1 addition & 0 deletions apps/docs/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
8 changes: 4 additions & 4 deletions apps/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
"@astro-aws/constructs": "workspace:^",
"@astro-aws/docs": "workspace:^",
"@astro-aws/www": "workspace:^",
"aws-cdk": "^2.94.0",
"aws-cdk-lib": "^2.94.0",
"constructs": "^10.1.253",
"aws-cdk": "^2.96.1",
"aws-cdk-lib": "^2.96.1",
"constructs": "^10.2.70",
"eslint": "^8.49.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"workspace-tools": "^0.35.2"
},
"devDependencies": {
"@astro-aws/scripts": "workspace:^",
"@types/node": "^18.14.0",
"@types/node": "^18.17.6",
"eslint-config-get-off-my-lawn": "^7.2.0"
},
"engines": {
Expand Down
18 changes: 9 additions & 9 deletions apps/infra/src/lib/constants/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const base = {

const Environments = {
DEV: "DEV",
SSR: "SSR",
EDGE: "EDGE",
PERSONAL: "PERSONAL",
PROD: "PROD",
SSR: "SSR",
} as const

type Environment = (typeof Environments)[keyof typeof Environments]
Expand All @@ -31,14 +31,6 @@ const ENVIRONMENT_PROPS: Record<Environment, AstroAWSStackProps> = {
output: "static",
package: "@astro-aws/docs",
},
[Environments.SSR]: {
...base,
alias: "ssr.dev",
environment: Environments.SSR,
hostedZoneName: "astro-aws.org",
output: "server",
package: "@astro-aws/examples-base",
},
[Environments.EDGE]: {
...base,
alias: "edge.dev",
Expand All @@ -64,6 +56,14 @@ const ENVIRONMENT_PROPS: Record<Environment, AstroAWSStackProps> = {
output: "static",
package: "@astro-aws/docs",
},
[Environments.SSR]: {
...base,
alias: "ssr.dev",
environment: Environments.SSR,
hostedZoneName: "astro-aws.org",
output: "server",
package: "@astro-aws/examples-base",
},
} as const

export { Environments, ENVIRONMENT_PROPS, type Environment }
2 changes: 1 addition & 1 deletion apps/infra/src/lib/stacks/github-users-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
Effect,
} from "aws-cdk-lib/aws-iam"
import { SecretValue, Stack } from "aws-cdk-lib/core"
import { Secret } from "aws-cdk-lib/aws-secretsmanager"

import type { AstroAWSStackProps } from "../types/astro-aws-stack-props"
import { Secret } from "aws-cdk-lib/aws-secretsmanager"

export type GitHubUsersStackProps = AstroAWSStackProps

Expand Down
4 changes: 2 additions & 2 deletions apps/infra/src/lib/stacks/website-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type WebsiteStackProps = AstroAWSStackProps & {
}

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

public constructor(scope: Construct, id: string, props: WebsiteStackProps) {
super(scope, id, props)
Expand Down Expand Up @@ -214,7 +214,7 @@ export class WebsiteStack extends Stack {

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

if (!workspace) {
Expand Down
28 changes: 14 additions & 14 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@
"root": false
},
"dependencies": {
"@astrojs/mdx": "^0.17.0",
"@astrojs/sitemap": "^1.0.1",
"astro": "^2.0.14",
"astro-icon": "^0.8.0",
"astro-link": "^1.1.4",
"astro-seo": "^0.7.0",
"autoprefixer": "^10.4.13",
"@astrojs/mdx": "^1.1.0",
"@astrojs/sitemap": "^3.0.0",
"astro": "^3.1.0",
"astro-icon": "^0.8.1",
"astro-link": "^1.2.1",
"astro-seo": "^0.8.0",
"autoprefixer": "^10.4.15",
"classnames": "^2.3.2",
"daisyui": "^2.50.1",
"postcss": "^8.4.21",
"daisyui": "^3.7.4",
"postcss": "^8.4.29",
"remark-toc": "^8.0.1",
"rimraf": "^4.1.2",
"rollup": "^3.16.0",
"sass": "^1.58.2",
"tailwindcss": "^3.2.7"
"rimraf": "^5.0.1",
"rollup": "^3.29.1",
"sass": "^1.67.0",
"tailwindcss": "^3.3.3"
},
"devDependencies": {
"@astro-aws/adapter": "workspace:^",
"@types/node": "^18.14.0",
"@types/node": "^18.17.6",
"eslint": "^8.49.0",
"prettier": "^3.0.3"
},
Expand Down
1 change: 1 addition & 0 deletions apps/www/src/pages/docs/packages/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default defineConfig({
## Example

See [the source code of this site](https://github.com/lukeshay/astro-aws/blob/main/apps/www/astro.config.ts)

## More

For more information, see the [documentation website](https://astro-aws.org/)
1 change: 1 addition & 0 deletions apps/www/src/pages/docs/packages/constructs.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export class MyAstroStack extends Stack {
## Example

See [the source code of this site](https://github.com/lukeshay/astro-aws/blob/main/apps/infra/src/lib/stacks/website-stack.ts)

## More

For more information, see the [documentation website](https://astro-aws.org/)
2 changes: 1 addition & 1 deletion apps/www/tailwind.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
"dracula",
{
"astro-aws": {
...require("daisyui/src/colors/themes")["[data-theme=dracula]"],
...require("daisyui/src/theming/themes")["[data-theme=dracula]"],
primary: "#9456e5",
"primary-content": "#290C4F",
"primary-focus": "#5C1BB0",
Expand Down
2 changes: 1 addition & 1 deletion examples/base/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default defineConfig({
logFnRequest: true,
logFnResponse: true,
}),
output: "server",
output: "hybrid",
})
2 changes: 1 addition & 1 deletion examples/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"start": "astro dev"
},
"dependencies": {
"astro": "^3.0.13"
"astro": "^3.1.0"
},
"devDependencies": {
"@astro-aws/adapter": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@lshay/eslint-config": "^0.3.5",
"@lshay/eslint-config": "^0.2.5",
"@lshay/prettier-config": "^0.6.0",
"@rushstack/eslint-patch": "^1.3.3",
"eslint": "^8.49.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@
"root": false
},
"dependencies": {
"@astrojs/webapi": "^2.0.1",
"esbuild": "^0.17.8",
"merge-anything": "^5.1.4"
"@astrojs/webapi": "^2.2.0",
"esbuild": "^0.19.3",
"merge-anything": "^5.1.7"
},
"devDependencies": {
"@astro-aws/scripts": "workspace:^",
"@faker-js/faker": "^7.6.0",
"@types/aws-lambda": "^8.10.110",
"@types/node": "^18.14.0",
"astro": "^2.0.14",
"@faker-js/faker": "^8.0.2",
"@types/aws-lambda": "^8.10.121",
"@types/node": "^18.17.6",
"astro": "^3.1.0",
"aws-lambda": "^1.0.7",
"eslint": "^8.49.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vitest": "^0.28.5"
"vitest": "^0.34.4"
},
"peerDependencies": {
"astro": ">=1"
Expand Down
Loading

0 comments on commit af4d86e

Please sign in to comment.