Skip to content

Commit

Permalink
ref(changelog): Duplicate changelog into workspace package (#10818)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored Jul 24, 2024
1 parent aa4c323 commit 22dadd1
Show file tree
Hide file tree
Showing 69 changed files with 3,888 additions and 30 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.babelrc.js
apps/changelog
2 changes: 2 additions & 0 deletions app/changelog/feed.xml/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export async function GET() {
allChangelogs.map(changelog => {
return feed.item({
title: changelog.title,
// @ts-expect-error TODO(lforst): This is broken for some reason
description: changelog.summary,
url: `https://sentry.io/changelog/${changelog.slug}`,
categories:
changelog.categories.map(category => {
return category.name;
}) || [],
// @ts-expect-error TODO(lforst): This is broken for some reason
date: changelog.publishedAt,
});
});
Expand Down
8 changes: 8 additions & 0 deletions apps/changelog/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# rename this file to .env and supply the values listed below
# also make sure they are available to the build tool (e.g. Vercel/Netlify)
# warning: variables prefixed with NEXT_PUBLIC_ will be made available to client-side code
# be careful not to expose sensitive data

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/changelog
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=secret
41 changes: 41 additions & 0 deletions apps/changelog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# dotenv environment variables file
.env
.env.development
36 changes: 36 additions & 0 deletions apps/changelog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
16 changes: 16 additions & 0 deletions apps/changelog/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.7'
services:
postgres:
container_name: changelog_postgres
image: postgres:latest
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- '5432:5432'
volumes:
- postgres_data:/var/lib/postgresql/data/
volumes:
postgres_data:
11 changes: 11 additions & 0 deletions apps/changelog/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {withSentryConfig} from '@sentry/nextjs';

const nextConfig = {
trailingSlash: true,
eslint: {
ignoreDuringBuilds: true,
},
transpilePackages: ['next-mdx-remote'],
};

export default withSentryConfig(nextConfig);
58 changes: 58 additions & 0 deletions apps/changelog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "sentry-changelog",
"version": "1.0.0",
"description": "The Sentry changelog application",
"main": "index.js",
"repository": "https://github.com/getsentry/sentry-docs",
"author": "getsentry",
"license": "FSL-1.1-Apache-2.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"migrate:dev": "dotenv -e .env.development -- yarn prisma migrate reset"
},
"dependencies": {
"rehype-prism-plus": "^1.6.3",
"rehype-slug": "^6.0.0",
"@auth/prisma-adapter": "^1.2.0",
"nextjs-toploader": "^1.6.6",
"prism-sentry": "^1.0.2",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-toolbar": "^1.0.4",
"@radix-ui/themes": "^2.0.3",
"@sentry/nextjs": "^8.8.0",
"@google-cloud/storage": "^7.7.0",
"@prisma/client": "^5.8.1",
"next": "^14.2.5",
"next-auth": "^4.24.5",
"next-mdx-remote": "^4.4.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-select": "^5.7.3",
"sass": "^1.69.5",
"react-textarea-autosize": "^8.5.3",
"rss": "^1.2.2",
"textarea-markdown-editor": "^1.0.4"
},
"devDependencies": {
"autoprefixer": "^10.4.17",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18.3.0",
"prisma": "^5.8.1",
"@types/rss": "^0.0.32",
"eslint": "^8",
"eslint-config-next": "^14.2.5",
"postcss": "^8.4.33",
"@tailwindcss/forms": "^0.5.7",
"tailwindcss": "^3.4.1",
"@tailwindcss/typography": "^0.5.10",
"typescript": "^5"
},
"volta": {
"extends": "../../package.json"
}
}
11 changes: 11 additions & 0 deletions apps/changelog/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
"postcss-import": {},
"tailwindcss/nesting": {},
tailwindcss: {},
autoprefixer: {},
},
};

export default config;
121 changes: 121 additions & 0 deletions apps/changelog/prisma/migrations/0_init/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
-- CreateTable
CREATE TABLE "Account" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"type" TEXT NOT NULL,
"provider" TEXT NOT NULL,
"providerAccountId" TEXT NOT NULL,
"refresh_token" TEXT,
"access_token" TEXT,
"expires_at" INTEGER,
"token_type" TEXT,
"scope" TEXT,
"id_token" TEXT,
"session_state" TEXT,

CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Session" (
"id" TEXT NOT NULL,
"sessionToken" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,

CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"name" TEXT,
"email" TEXT,
"emailVerified" TIMESTAMP(3),
"image" TEXT,
"admin" BOOLEAN NOT NULL DEFAULT false,

CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "VerificationToken" (
"identifier" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL
);

-- CreateTable
CREATE TABLE "Changelog" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"publishedAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"title" VARCHAR(255) NOT NULL,
"slug" VARCHAR(255) NOT NULL,
"image" TEXT,
"content" TEXT,
"summary" TEXT,
"published" BOOLEAN NOT NULL DEFAULT false,
"deleted" BOOLEAN NOT NULL DEFAULT false,
"authorId" TEXT,

CONSTRAINT "Changelog_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Category" (
"id" TEXT NOT NULL,
"name" VARCHAR(255) NOT NULL,
"deleted" BOOLEAN NOT NULL DEFAULT false,

CONSTRAINT "Category_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "_CategoryToChangelog" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL
);

-- CreateIndex
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");

-- CreateIndex
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");

-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");

-- CreateIndex
CREATE UNIQUE INDEX "Changelog_slug_key" ON "Changelog"("slug");

-- CreateIndex
CREATE UNIQUE INDEX "Category_name_key" ON "Category"("name");

-- CreateIndex
CREATE UNIQUE INDEX "_CategoryToChangelog_AB_unique" ON "_CategoryToChangelog"("A", "B");

-- CreateIndex
CREATE INDEX "_CategoryToChangelog_B_index" ON "_CategoryToChangelog"("B");

-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Changelog" ADD CONSTRAINT "Changelog_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "_CategoryToChangelog" ADD CONSTRAINT "_CategoryToChangelog_A_fkey" FOREIGN KEY ("A") REFERENCES "Category"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "_CategoryToChangelog" ADD CONSTRAINT "_CategoryToChangelog_B_fkey" FOREIGN KEY ("B") REFERENCES "Changelog"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Loading

0 comments on commit 22dadd1

Please sign in to comment.