From 16a9fdcab9092a0ff644b320502cce72b8974c64 Mon Sep 17 00:00:00 2001 From: Colin Regourd Date: Thu, 31 Oct 2024 16:26:25 +0100 Subject: [PATCH] Finish convert to pnpm --- CONTRIBUTING.md | 66 +++++++++++++++++++++++--------- apps/example/options.tsx | 1 - apps/example/package.json | 2 +- apps/example/tailwind.config.js | 4 +- package.json | 1 + packages/next-admin/package.json | 3 +- pnpm-lock.yaml | 18 ++++----- 7 files changed, 63 insertions(+), 32 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 71ce2fb8..059f45e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,6 +20,54 @@ This turborepo has some additional tools already setup for you: - [ESLint](https://eslint.org/) for code linting - [Prettier](https://prettier.io) for code formatting +### Setup + +To setup the project, run the following command: + +``` +pnpm install +``` + +Then you need to create a `.env` file in the root of the project with the following content: + +``` +DATABASE_URL="postgresql://user:password@localhost:5432/dbname" +``` + +And run the following command to setup the packages: + +``` +pnpm setup:packages +``` + +The `setup:packages` command will build packages, generate Prisma and then build `next-admin` package. + +### Prisma (first time setup) + +To setup the database, run the following command: + +``` +pnpm database +``` + +### Develop + +To develop all apps and packages, run the following command: + +``` +pnpm dev +docker-compose up +cd apps/example && pnpm database +``` + +### Build + +To build all apps and packages, run the following command: + +``` +pnpm build +``` + ### Workflow The project workflow uses GitHub Actions to run tests, build, deploy (prod - preview - docs) and publish packages. To handle versioning up and publishing, we use [Changesets](https://github.com/changesets/changesets) @@ -52,24 +100,6 @@ If you want to fix a previous major version, you can create a PR on the relative Once a fix has been released, you can cherry-pick the fix on the `develop` branch if that fix is still relevant. -### Build - -To build all apps and packages, run the following command: - -``` -pnpm build -``` - -### Develop - -To develop all apps and packages, run the following command: - -``` -pnpm dev -docker-compose up -cd apps/example && pnpm database -``` - ### E2E Tests are using Playwright to test directly with a browser. diff --git a/apps/example/options.tsx b/apps/example/options.tsx index 3138f5c5..9c427b72 100644 --- a/apps/example/options.tsx +++ b/apps/example/options.tsx @@ -7,7 +7,6 @@ import { prisma } from "./prisma"; export const options: NextAdminOptions = { title: "⚡️ My Admin", - model: { User: { toString: (user) => `${user.name} (${user.email})`, diff --git a/apps/example/package.json b/apps/example/package.json index 4408dd28..6d9237b2 100644 --- a/apps/example/package.json +++ b/apps/example/package.json @@ -21,6 +21,7 @@ "@heroicons/react": "^2.0.18", "@picocss/pico": "^1.5.7", "@premieroctet/next-admin": "workspace:*", + "@premieroctet/next-admin-generator-prisma": "workspace:*", "@prisma/client": "5.14.0", "@tremor/react": "^3.2.2", "next": "14.0.3", @@ -32,7 +33,6 @@ }, "devDependencies": { "@playwright/test": "^1.37.0", - "@premieroctet/next-admin-generator-prisma": "workspace:*", "@types/node": "^17.0.12", "@types/react": "^18.2.0", "@types/react-datepicker": "^4.19.3", diff --git a/apps/example/tailwind.config.js b/apps/example/tailwind.config.js index b9a273bc..b4f8507b 100644 --- a/apps/example/tailwind.config.js +++ b/apps/example/tailwind.config.js @@ -6,8 +6,8 @@ module.exports = { content: [ "./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}", - "./../../node_modules/@tremor/**/*.{js,ts,jsx,tsx}", - "./../../node_modules/@premieroctet/next-admin/dist/**/*.{js,ts,jsx,tsx}", + "./node_modules/@tremor/**/*.{js,ts,jsx,tsx}", + "./node_modules/@premieroctet/next-admin/dist/**/*.{js,ts,jsx,tsx}", "./app/**/*.{js,ts,jsx,tsx}", "./options.{js,ts,jsx,tsx}", "./pageRouterOptions.{js,ts,jsx,tsx}", diff --git a/package.json b/package.json index 5ce28278..37973220 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build:example": "turbo run build --filter=example", "build:next-admin": "turbo run build --filter=@premieroctet/next-admin", "build:packages": "turbo run build --filter=@premieroctet/next-admin --filter=@premieroctet/next-admin-cli --filter=@premieroctet/next-admin-generator-prisma --filter=@premieroctet/next-admin-json-schema", + "setup:packages": "turbo run build --filter=@premieroctet/next-admin-cli --filter=@premieroctet/next-admin-generator-prisma --filter=@premieroctet/next-admin-json-schema && pnpm --filter example exec -- prisma generate && pnpm build:next-admin", "dev": "turbo run dev", "dev:docs": "turbo run dev --filter=docs", "lint": "turbo run lint", diff --git a/packages/next-admin/package.json b/packages/next-admin/package.json index fe97f7d0..17ac58e4 100644 --- a/packages/next-admin/package.json +++ b/packages/next-admin/package.json @@ -79,7 +79,8 @@ "prisma": ">=5", "react": ">=17", "react-dom": ">=17", - "typescript": ">=4" + "typescript": ">=4", + "tailwindcss": ">=3" }, "dependencies": { "@dnd-kit/core": "^6.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8904b108..6be609ba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -115,6 +115,9 @@ importers: '@premieroctet/next-admin': specifier: workspace:* version: link:../../packages/next-admin + '@premieroctet/next-admin-generator-prisma': + specifier: workspace:* + version: link:../../packages/generator-prisma '@prisma/client': specifier: 5.14.0 version: 5.14.0(prisma@5.14.0) @@ -143,9 +146,6 @@ importers: '@playwright/test': specifier: ^1.37.0 version: 1.48.2 - '@premieroctet/next-admin-generator-prisma': - specifier: workspace:* - version: link:../../packages/generator-prisma '@types/node': specifier: ^17.0.12 version: 17.0.45 @@ -1805,7 +1805,7 @@ packages: '@radix-ui/react-context@1.1.1': resolution: {integrity: sha512-UASk9zi+crv9WteK/NU4PLvOoL3OuE6BWVKNF6hPRBtYBDXQ2u5iu3O59zUlJiTVvkyuycnqrztsHVJwcK9K+Q==} peerDependencies: - '@types/react': ^18.2.0 + '@types/react': '*' react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc peerDependenciesMeta: '@types/react': @@ -1928,7 +1928,7 @@ packages: '@radix-ui/react-id@1.0.1': resolution: {integrity: sha512-tI7sT/kqYp8p96yGWY1OAnLHrqDgzHefRBKQ2YAkBS5ja7QLcZ9Z/uY7bEjPUatf8RomoXM8/1sMj1IJaE5UzQ==} peerDependencies: - '@types/react': ^18.2.0 + '@types/react': '*' react: ^16.8 || ^17.0 || ^18.0 peerDependenciesMeta: '@types/react': @@ -1937,7 +1937,7 @@ packages: '@radix-ui/react-id@1.1.0': resolution: {integrity: sha512-EJUrI8yYh7WOjNOqpoJaf1jlFIH2LvtgAl+YcFqNCa+4hj64ZXmPkAKOFs/ukjz3byN6bdb/AVUqHkI8/uWWMA==} peerDependencies: - '@types/react': ^18.2.0 + '@types/react': '*' react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc peerDependenciesMeta: '@types/react': @@ -2011,8 +2011,8 @@ packages: '@radix-ui/react-presence@1.1.1': resolution: {integrity: sha512-IeFXVi4YS1K0wVZzXNrbaaUvIJ3qdY+/Ih4eHFhWA9SwGR9UDX7Ck8abvL57C4cv3wwMvUE0OG69Qc3NCcTe/A==} peerDependencies: - '@types/react': ^18.2.0 - '@types/react-dom': ^18.2.0 + '@types/react': '*' + '@types/react-dom': '*' react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc peerDependenciesMeta: @@ -2183,7 +2183,7 @@ packages: '@radix-ui/react-use-layout-effect@1.1.0': resolution: {integrity: sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w==} peerDependencies: - '@types/react': ^18.2.0 + '@types/react': '*' react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc peerDependenciesMeta: '@types/react':