Skip to content

Commit

Permalink
refactor: pnpm workspace & cleanup
Browse files Browse the repository at this point in the history
- Use pnpm workspace
- Fix prettier config
- Removed editorconfig
- Removed jest
  • Loading branch information
CrawlerCode committed Oct 30, 2024
1 parent e4a6282 commit 8ba1adf
Show file tree
Hide file tree
Showing 19 changed files with 704 additions and 896 deletions.
10 changes: 0 additions & 10 deletions .editorconfig

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- run: pnpm install --frozen-lockfile

- run: pnpm exec nx run-many -t build
- run: pnpm exec nx build

- run: pnpm exec nx report
shell: bash
Expand All @@ -37,4 +37,4 @@ jobs:
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NPM_CONFIG_PROVENANCE: true
NPM_CONFIG_PROVENANCE: true
9 changes: 0 additions & 9 deletions .prettierrc.cjs

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 100,
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"arrowParens": "avoid",
"endOfLine": "lf"
}
6 changes: 6 additions & 0 deletions dev/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { withPayload } from "@payloadcms/next/withPayload";
import type { NextConfig } from "next";

const nextConfig: NextConfig = {};

export default withPayload(nextConfig);
6 changes: 0 additions & 6 deletions dev/nodemon.json

This file was deleted.

37 changes: 37 additions & 0 deletions dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "payload-authjs-dev",
"description": "A test app for payload-authjs plugin",
"version": "1.0.0",
"license": "MIT",
"private": true,
"type": "module",
"scripts": {
"dev": "cross-env NODE_OPTIONS=--no-deprecation next dev -p 5000",
"build": "cross-env NODE_OPTIONS=--no-deprecation next build",
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
"payload": "payload",
"generate:types": "payload generate:types",
"generate:schema": "payload-graphql generate:schema",
"generate:importmap": "payload generate:importmap"
},
"dependencies": {
"@payloadcms/db-postgres": "3.0.0-beta.120",
"@payloadcms/next": "3.0.0-beta.120",
"@payloadcms/ui": "3.0.0-beta.120",
"jsonwebtoken": "^9.0.2",
"next": "15.0.2",
"next-auth": "5.0.0-beta.25",
"nodemailer": "^6.9.16",
"payload": "3.0.0-beta.120",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"sharp": "^0.33.5",
"payload-authjs": "workspace:*"
},
"devDependencies": {
"@types/jsonwebtoken": "^9.0.7",
"cross-env": "^7.0.3",
"dotenv": "^16.4.5",
"typescript": "^5.6.3"
}
}
2 changes: 1 addition & 1 deletion dev/src/app/(app)/_components/AuthOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { auth } from "@/auth";
import type { DataFromCollectionSlug } from "payload";
import { getPayloadUser } from "../../../../../src";
import { getPayloadUser } from "payload-authjs";
import { SignInButton } from "./SignInButton";
import { SignOutButtonAuthjs } from "./SignOutButtonAuthjs";
import { SignOutButtonPayload } from "./SignOutButtonPayload";
Expand Down
2 changes: 1 addition & 1 deletion dev/src/app/(app)/_components/ExampleList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import config from "@payload-config";
import { getPayloadHMR } from "@payloadcms/next/utilities";
import { getPayloadUser } from "../../../../../src";
import { getPayloadUser } from "payload-authjs";

const payload = await getPayloadHMR({ config });

Expand Down
2 changes: 1 addition & 1 deletion dev/src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import payloadConfig from "@payload-config";
import NextAuth from "next-auth";
import nodemailer from "next-auth/providers/nodemailer";
import { withPayload } from "../../src";
import { withPayload } from "payload-authjs";
import { authConfig } from "./auth.config";

export const { handlers, signIn, signOut, auth } = NextAuth(
Expand Down
2 changes: 1 addition & 1 deletion dev/src/payload.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { postgresAdapter } from "@payloadcms/db-postgres";
import path from "path";
import { buildConfig } from "payload";
import { authjsPlugin } from "payload-authjs";
import sharp from "sharp";
import { fileURLToPath } from "url";
import { authjsPlugin } from "../../src/index";
import { authConfig } from "./auth.config";
import Examples from "./payload/collections/examples";
import Users from "./payload/collections/users";
Expand Down
54 changes: 18 additions & 36 deletions dev/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,31 @@
{
"compilerOptions": {
"paths": {
"payload/generated-types": [
"./src/payload-types.ts"
],
"@payload-config": [
"./src/payload.config.ts"
],
"@/*": ["./src/*"],
},
"baseUrl": ".",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"skipLibCheck": true,
"outDir": "./dist",
"rootDir": ".",
"jsx": "preserve",
"paths": {
"@payload-config": ["./src/payload.config.ts"],
"payload/generated-types": ["./src/payload-types.ts"],
"@/*": ["./src/*"]
},
"noEmit": true,
"incremental": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"plugins": [
{
"name": "next"
}
],
"target": "ES2017"
]
},
"include": [
"src",
".next/types/**/*.ts"
],
"exclude": [
"node_modules",
"dist",
"build"
],
"ts-node": {
"transpileOnly": true,
"swc": true
}
"include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "dist", "build"]
}
22 changes: 3 additions & 19 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {
"dev": {
"outputs": [
"{projectRoot}/dev/.next"
],
"outputs": ["{projectRoot}/dev/.next"],
"cache": true
},
"build": {
"outputs": [
"{projectRoot}/dist"
],
"cache": true
},
"test": {
"outputs": ["{projectRoot}/dist"],
"cache": true
},
"lint": {
"cache": true
},
"dev:lint": {
"cache": true
},
"lint:fix": {
"cache": false
}
Expand All @@ -34,12 +24,6 @@
"targetName": "eslint:lint"
}
},
{
"plugin": "@nx/jest/plugin",
"options": {
"targetName": "test"
}
},
{
"plugin": "@nx/next/plugin",
"options": {
Expand Down Expand Up @@ -71,4 +55,4 @@
}
},
"nxCloudId": "66da0f239e5a57722ba2e595"
}
}
41 changes: 10 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"name": "payload-authjs",
"version": "0.3.2",
"type": "module",
"repository": "[email protected]:CrawlerCode/payload-authjs.git",
"description": "A Payload CMS 3 plugin for Auth.js 5",
"repository": "[email protected]:CrawlerCode/payload-authjs.git",
"author": "[email protected]",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
Expand Down Expand Up @@ -37,18 +39,11 @@
"next-auth"
],
"scripts": {
"dev": "cd dev && cross-env NODE_OPTIONS=--no-deprecation next dev -p 5000",
"build": "tsc",
"test": "cd test && jest --config=./jest.config.js",
"dev": "pnpm -C dev run dev",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"dev:lint": "cd dev && cross-env NODE_OPTIONS=--no-deprecation next lint",
"payload": "cd dev && cross-env NODE_OPTIONS=--no-deprecation payload",
"generate:types": "cd dev && cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
"generate:importmap": "cd dev && cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap"
"lint:fix": "eslint . --fix"
},
"author": "[email protected]",
"license": "MIT",
"peerDependencies": {
"@payloadcms/next": "^3.0.0-beta.120",
"@payloadcms/ui": "^3.0.0-beta.120",
Expand All @@ -57,34 +52,18 @@
"payload": "^3.0.0-beta.120"
},
"devDependencies": {
"@nx/eslint": "19.7.2",
"@nx/jest": "19.7.2",
"@nx/js": "19.7.2",
"@nx/next": "19.7.2",
"@payloadcms/db-postgres": "3.0.0-beta.120",
"@nx/eslint": "20.0.6",
"@nx/js": "20.0.6",
"@nx/next": "20.0.6",
"@payloadcms/eslint-config": "3.0.0-beta.112",
"@payloadcms/next": "3.0.0-beta.120",
"@payloadcms/ui": "3.0.0-beta.120",
"@swc-node/register": "~1.10.9",
"@swc/core": "~1.7.40",
"@swc/helpers": "~0.5.13",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.14",
"@types/jsonwebtoken": "^9.0.7",
"@types/react": "npm:[email protected]",
"cross-env": "^7.0.3",
"dotenv": "^16.4.5",
"jest": "^29.7.0",
"jsonwebtoken": "^9.0.2",
"next": "15.0.2",
"next-auth": "5.0.0-beta.25",
"nodemailer": "^6.9.16",
"nx": "19.7.2",
"nx": "20.0.6",
"payload": "3.0.0-beta.120",
"prettier": "^3.3.3",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"sharp": "^0.33.5",
"typescript": "^5.6.3"
},
"nx": {},
Expand All @@ -97,4 +76,4 @@
"@types/react": "npm:[email protected]"
}
}
}
}
Loading

0 comments on commit 8ba1adf

Please sign in to comment.