Skip to content
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

upgrade SvelteKit, next-auth -> auth.js #479

Merged
merged 38 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ac78c40
upgrade SvelteKit, next-auth -> auth.js
josefaidt Aug 26, 2023
cd0e625
only pass guild id to layout
josefaidt Aug 26, 2023
7931701
rm stale hooks
josefaidt Aug 26, 2023
0c93564
Merge remote-tracking branch 'upstream/main' into upgrade-sveltekit
josefaidt Aug 26, 2023
5c69de4
rm console.log
josefaidt Aug 26, 2023
fcd9fca
rm custom vite plugins
josefaidt Aug 26, 2023
96cd4b6
build custom SK server using esbuild
josefaidt Aug 26, 2023
17712d6
update lockfile
josefaidt Aug 26, 2023
ef44b7e
rm custom vite plugin import
josefaidt Aug 26, 2023
41e024b
disable github auth
josefaidt Aug 26, 2023
eb5cbe5
auth.js to use oauth creds from process.env
josefaidt Aug 26, 2023
1b2a280
Update src/lib/server/hooks/handle-saved-guild.ts
josefaidt Aug 26, 2023
8b41830
Update src/lib/server/hooks/handle-saved-guild.ts
josefaidt Aug 26, 2023
11c985c
disable signin page
josefaidt Aug 26, 2023
952952e
rm extra store set
josefaidt Aug 26, 2023
59e341e
rm extra comment
josefaidt Aug 26, 2023
3101900
rm unnecessary session.user check
josefaidt Aug 26, 2023
26a1c19
correct session type, may be undefined
josefaidt Aug 26, 2023
f2f76c6
rm old redirect comment
josefaidt Aug 26, 2023
017f8b1
Update src/lib/server/hooks/handle-api-auth.ts
josefaidt Aug 26, 2023
69274b2
Update src/lib/server/hooks/handle-auth.ts
josefaidt Aug 26, 2023
382395d
upgrade tooling
josefaidt Aug 27, 2023
2e2b18f
improve guild cookie handling, add tests
josefaidt Aug 27, 2023
e4648b2
improved layout load with saved guild info
josefaidt Aug 27, 2023
fa2f9b8
improve guild types
josefaidt Aug 27, 2023
6448607
port login/logout buttons to use official authjs client API
josefaidt Aug 27, 2023
7f34729
locals.guild -> locals.guildId
josefaidt Aug 27, 2023
31222a5
refactor session handling
josefaidt Aug 27, 2023
b6719d0
LoginButton to use provider prop
josefaidt Aug 27, 2023
9cab26e
appease the lint gods
josefaidt Aug 27, 2023
141249b
rm additional define value for server build
josefaidt Sep 7, 2023
94678e0
string template literal -> JSON.stringify
josefaidt Sep 7, 2023
f6a85e7
Merge branch 'main' into upgrade-sveltekit
josefaidt Sep 11, 2023
4826403
Merge branch 'main' into upgrade-sveltekit
josefaidt Sep 12, 2023
26f7237
port api route tests to playwright
josefaidt Sep 21, 2023
53d4039
remove import.meta.vitest
josefaidt Sep 21, 2023
a10ede4
run playwright install on postinstall
josefaidt Sep 21, 2023
219272c
Merge branch 'main' into upgrade-sveltekit
josefaidt Sep 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"svelte.svelte-vscode",
"Prisma.prisma",
"ZixuanChen.vitest-explorer"
"ZixuanChen.vitest-explorer",
"ms-playwright.playwright"
]
}
36 changes: 0 additions & 36 deletions cdk/src/components/hey-amplify-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ import { Construct } from 'constructs'
import { Port } from 'aws-cdk-lib/aws-ec2'
import * as cdk from 'aws-cdk-lib'
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'
import * as events from 'aws-cdk-lib/aws-events'
import * as targets from 'aws-cdk-lib/aws-events-targets'
import * as ecs from 'aws-cdk-lib/aws-ecs'
import * as ecs_patterns from 'aws-cdk-lib/aws-ecs-patterns'
import * as efs from 'aws-cdk-lib/aws-efs'
import * as elb from 'aws-cdk-lib/aws-elasticloadbalancingv2'
import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'
import * as route53 from 'aws-cdk-lib/aws-route53'
import * as route53Targets from 'aws-cdk-lib/aws-route53-targets'
import * as sns from 'aws-cdk-lib/aws-sns'
import * as ssm from 'aws-cdk-lib/aws-ssm'
import { v4 as uuid } from 'uuid'
import { WAF } from './waf'
Expand Down Expand Up @@ -255,39 +252,6 @@ export class HeyAmplifyApp extends Construct {
})
}

/**
* Set up alarms
*/
const restartTopic = new sns.Topic(this, 'ContainerRestarts', {
displayName: 'ContainerRestarts',
})

const restartRuleTarget = new targets.SnsTopic(restartTopic, {
message: events.RuleTargetInput.fromText(
`Container restarted in ${process.env.CDK_DEFAULT_REGION as string}`
),
})

/**
* Set up event rule for container restarts
*/
const restartRule = new events.Rule(this, 'RestartRule', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you notice with this?

Copy link
Contributor Author

@josefaidt josefaidt Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll revisit this at a later time. The rule is currently not working as expected and was causing lint errors (due to the unused variable) after upgrading linter tooling

eventPattern: {
source: ['aws.ecs'],
detailType: ['ECS Task State Change'],
region: [process.env.CDK_DEFAULT_REGION as string],
detail: {
lastStatus: ['STOPPED'],
desiredStatus: ['RUNNING'],
clusterArn: [cluster.clusterArn],
taskDefinitionArn: [
albFargateService.service.taskDefinition.taskDefinitionArn,
],
},
},
targets: [restartRuleTarget],
})

// enable access logging for load balancer
albFargateService.loadBalancer.logAccessLogs(bucket, 'alb-access')

Expand Down
40 changes: 23 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,26 @@
"dev": "vite dev --port 3000",
"dev:lib": "pnpm -r run build -w",
"docker": "PNPM_STORE=$(pnpm store path) docker compose up --build",
"build": "vite build",
"build": "pnpm run build:app && pnpm run build:server",
"build:app": "vite build",
"build:lib": "pnpm packages run build",
"build:server": "node scripts/build-server.cjs",
"check": "prettier --check .",
"lint": "eslint .",
"postinstall": "prisma generate",
"preview": "vite preview --port 3000",
"seed": "vite-node ./scripts/seed.ts",
"setup-dev": "pnpm install && prisma db push && svelte-kit sync && pnpm build:lib",
"setup-docker": "echo \"\nPNPM_STORE\"=$(pnpm store path) >> .env && docker -v",
"setup-test": "DATABASE_URL=\"file:data/test.db\" prisma db push && vite build",
"test": "vitest",
"test": "pnpm test:unit && pnpm test:integration",
"test:integration": "playwright test",
"test:unit": "vitest",
"coverage": "vitest run --coverage"
},
"dependencies": {
"@auth/core": "^0.12.0",
"@auth/sveltekit": "^0.3.6",
"@aws-crypto/sha256-js": "^2.0.1",
"@carbon/styles": "^1.11.0",
"@discordjs/builders": "^1.1.0",
Expand All @@ -38,9 +45,8 @@
"discord.js": "^14.8.0",
"express": "^4.18.1",
"fast-glob": "^3.2.11",
"next-auth": "^4.10.3",
"prisma": "^4.5.0",
"svelte": "3.49.0",
"svelte": "4.2.0",
"uuid": "^8.3.2",
"zod": "^3.19.1"
},
Expand All @@ -53,36 +59,36 @@
"@hey-amplify/scripts": "workspace:*",
"@hey-amplify/support": "workspace:*",
"@hey-amplify/tsconfig": "workspace:*",
"@hey-amplify/vite-plugin-server": "workspace:*",
"@sveltejs/adapter-node": "1.0.0-next.87",
"@sveltejs/kit": "1.0.0-next.447",
"@playwright/test": "^1.37.1",
"@sveltejs/adapter-node": "^1.3.1",
"@sveltejs/kit": "^1.23.0",
"@types/cookie": "^0.5.1",
"@types/express": "^4.17.13",
"@types/node": "^18.7.13",
"@types/prettier": "^2.7.0",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"@vitest/ui": "^0.22.1",
"carbon-components-svelte": "^0.70.1",
"carbon-icons-svelte": "^11.2.0",
"carbon-preprocess-svelte": "^0.9.1",
"d3": "^7.6.1",
"eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0",
"esbuild": "^0.19.2",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte3": "^4.0.0",
"jsdom": "^20.0.0",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.7.0",
"supertest": "^6.2.4",
"svelte-check": "^2.8.1",
"svelte-preprocess": "^4.10.7",
"svelte-check": "^3.5.0",
"tasuku": "^2.0.1",
"tslib": "^2.4.0",
"typescript": "^4.7.4",
"vite": "^3.0.9",
"vite-node": "^0.22.1",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-node": "^0.34.3",
"vitest": "^0.22.1"
},
"prettier": {
Expand Down
1 change: 0 additions & 1 deletion packages/support/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { access, readFile } from 'node:fs/promises'
import { resolve } from 'node:path'

export async function exists(path) {
try {
Expand Down
2 changes: 0 additions & 2 deletions packages/support/src/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import type { PutParameterCommandInput } from '@aws-sdk/client-ssm'
const REGION = process.env.REGION || 'us-east-1'
const PROJECT_NAME = 'hey-amplify'
const PROJECT_ENV = 'local'
// TODO: interpolate environment name in place of 'env'
const PREFIX = `/app/${PROJECT_NAME}/${PROJECT_ENV}/secret/`

export interface CreateSSMParameterKeyPrefixProps {
appName: string
Expand Down
25 changes: 0 additions & 25 deletions packages/vite-plugin-copy-file/package.json

This file was deleted.

3 changes: 0 additions & 3 deletions packages/vite-plugin-copy-file/readme.md

This file was deleted.

35 changes: 0 additions & 35 deletions packages/vite-plugin-copy-file/src/vite-plugin-copy-file.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/vite-plugin-copy-file/tsconfig.json

This file was deleted.

10 changes: 0 additions & 10 deletions packages/vite-plugin-copy-file/vite.config.ts

This file was deleted.

38 changes: 0 additions & 38 deletions packages/vite-plugin-lib/package.json

This file was deleted.

3 changes: 0 additions & 3 deletions packages/vite-plugin-lib/readme.md

This file was deleted.

85 changes: 0 additions & 85 deletions packages/vite-plugin-lib/src/vite-plugin-lib.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/vite-plugin-lib/tsconfig.json

This file was deleted.

10 changes: 0 additions & 10 deletions packages/vite-plugin-lib/vite.config.ts

This file was deleted.

Loading