Skip to content

Commit

Permalink
Move examples to their own folder (stack-auth#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
N2D4 authored Jun 16, 2024
1 parent 9502189 commit 5cf167b
Show file tree
Hide file tree
Showing 133 changed files with 2,968 additions and 3,981 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ dist

.xata*

# Development app
apps/dev/src/css
apps/dev/prisma/migrations
apps/dev/typeorm
apps/dev/nextjs-2

# VS
/.vs/slnx.sqlite-journal
/.vs/slnx.sqlite
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,20 @@ Then:
```sh
pnpm install

# Run code generation (repeat this after eg. changing the Prisma schema)
# Run build to build everything once
pnpm run build

# Run code generation (repeat this after eg. changing the Prisma schema). This is part of the build script, but faster
pnpm run codegen

# Push the most recent Prisma schema to the database
pnpm run prisma:server migrate reset
pnpm run prisma:server db push

# Start the dev server
pnpm run dev
```

You can now open the dashboard at [http://localhost:8101](http://localhost:8101), demo on port 8103, and docs on port 8104. Note for any project connecting to the local server (like the demo), you need to set `NEXT_PUBLIC_STACK_URL=http://localhost:8101` in the environment variables.
You can now open the dashboard at [http://localhost:8101](http://localhost:8101), demo on port 8103, and docs on port 8104.

Your IDE may show an error on all `@stackframe/XYZ` imports. To fix this, simply restart the TypeScript language server; for example, in VSCode you can open the command palette (Ctrl+Shift+P) and run `Developer: Reload Window` or `TypeScript: Restart TS server`.

Expand Down
5 changes: 0 additions & 5 deletions apps/custom-pages-example/next-env.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions apps/demo/next-env.d.ts

This file was deleted.

6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"keywords": [],
"author": "",
"dependencies": {
"fern-api": "^0.30.7"
"fern-api": "^0.30.7",
"@stackframe/stack-server": "workspace:*"
},
"devDependencies": {
"rimraf": "^5.0.7",
"@stackframe/stack-server": "workspace:*"
"rimraf": "^5.0.7"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions apps/demo/.gitignore → examples/demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ node_modules/
/playwright/.cache/
dbschema/edgeql-js

src/css
prisma/migrations
typeorm
nextjs-2

*.tsbuildinfo
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
ppr: true,
},
};
const nextConfig = {};

export default nextConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"next": "^14.3.0-canary.26",
"next": "^14.2",
"react": "^18",
"react-dom": "^18",
"@stackframe/stack": "workspace:*"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"next": "^14.3.0-canary.26",
"next": "14.3.0-canary.26",
"react": "^18",
"react-dom": "^18",
"@stackframe/stack": "workspace:*"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions packages/stack-sc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
"LICENSE"
],
"peerDependencies": {
"next": "^14.1",
"react": "^18.2"
"next": ">=14.1",
"react": ">=18.2"
},
"devDependencies": {
"rimraf": "^5.0.5",
"@types/react": "^18.2.66"
"@types/react": "^18.2.66",
"next": "^14.1.0",
"react": "^18.2.0"
}
}
15 changes: 8 additions & 7 deletions packages/stack-server/scripts/generate-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { parseOpenAPI } from '@/lib/openapi';
import yaml from 'yaml';
import fs from 'fs';
import { glob } from 'glob';
import { runAsynchronously } from '@stackframe/stack-shared/dist/utils/promises';
import { HTTP_METHODS, HttpMethod } from '@stackframe/stack-shared/dist/utils/http';
import { SmartRouteHandler, isSmartRouteHandler } from '@/route-handlers/smart-route-handler';
import { HTTP_METHODS } from '@stackframe/stack-shared/dist/utils/http';
import { isSmartRouteHandler } from '@/route-handlers/smart-route-handler';

async function main() {
for (const audience of ['client', 'server'] as const) {
Expand All @@ -20,7 +19,7 @@ async function main() {
const midfix = suffix.slice(0, suffix.lastIndexOf("/route."));
const importPath = `${importPathPrefix}${suffix}`;
const urlPath = midfix.replace("[", "{").replace("]", "}");
const module = await import(importPath);
const module = require(importPath);
const handlersByMethod = new Map(
HTTP_METHODS.map(method => [method, module[method]] as const)
.filter(([_, handler]) => isSmartRouteHandler(handler))
Expand All @@ -31,8 +30,10 @@ async function main() {
}));

fs.writeFileSync(`../../docs/fern/openapi/${audience}.yaml`, openAPISchema);

console.log("Successfully updated OpenAPI schema");
}
console.log("Successfully updated OpenAPI schemas");
}
runAsynchronously(main);
main().catch((...args) => {
console.error(`ERROR! Could not update OpenAPI schema`, ...args);
process.exit(1);
});
6 changes: 4 additions & 2 deletions packages/stack-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
},
"peerDependencies": {
"react": "^18.2",
"react": ">=18.2",
"yup": "^1.4.0"
},
"peerDependenciesMeta": {
Expand All @@ -49,6 +49,8 @@
"rimraf": "^5.0.5",
"@types/bcrypt": "^5.0.2",
"@types/react": "^18.2.66",
"@types/uuid": "^9.0.8"
"@types/uuid": "^9.0.8",
"next": "^14.1.0",
"react": "^18.2.0"
}
}
8 changes: 3 additions & 5 deletions packages/stack-shared/src/utils/promises.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { KnownError } from "..";
import { StackAssertionError, captureError } from "./errors";
import { Result } from "./results";
import { generateUuid } from "./uuids";
import type { RejectedThenable, FulfilledThenable, PendingThenable } from "react";

export type ReactPromise<T> = Promise<T> & (
| RejectedThenable<T>
| FulfilledThenable<T>
| PendingThenable<T>
| { status: "rejected", reason: unknown }
| { status: "fulfilled", value: T }
| { status: "pending" }
);

type Resolve<T> = (value: T) => void;
Expand Down
6 changes: 4 additions & 2 deletions packages/stack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"peerDependencies": {
"@mui/joy": "^5.0.0-beta.30",
"next": ">=14.1",
"react": "^18.2"
"react": ">=18.2"
},
"peerDependenciesMeta": {
"@mui/joy": {
Expand All @@ -75,6 +75,8 @@
"@types/js-cookie": "^3.0.6",
"@types/react": "^18.2.66",
"esbuild": "^0.20.2",
"tsup": "^8.0.2"
"tsup": "^8.0.2",
"next": "^14.1.0",
"react": "^18.2.0"
}
}
1 change: 1 addition & 0 deletions packages/stack/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import type {} from "react/canary";
Loading

0 comments on commit 5cf167b

Please sign in to comment.