Skip to content

Commit

Permalink
local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrobertbrooks committed Oct 13, 2023
1 parent c4b20dc commit da45e9c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"local": "pnpm run --filter ./packages/nextjs --filter ./packages/sanity --parallel dev",
"dev:nextjs": "pnpm run --filter ./packages/nextjs dev",
"next:dev": "pnpm run --filter ./packages/nextjs next:dev",
"next:dev:mock": "pnpm run --filter ./packages/nextjs next:dev:mock",
"build:nextjs": "pnpm run --filter ./packages/nextjs build",
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"author": "Formidable",
"license": "MIT",
"scripts": {
"dev": "concurrently \"yarn next:dev\"",
"next:dev": "next dev",
"next:dev:mock": "NEXT_PUBLIC_API_MOCKING=enabled next dev",
"build": "next build",
"start": "next start",
"test:unit": "jest",
"test:unit:watch": "jest --watch",
"lint": "next lint --quiet",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"seed-sanity": "sanity dataset import sanity-studio/production.tar.gz production"
},
"dependencies": {
"@headlessui/react": "^1.7.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/pages/products/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const getServerSideProps = (async ({ query, res, resolvedUrl }) => {
// Pagination data.
const pagination = getPaginationFromQuery(query);
const result = await getAllFilteredVariants(filters, order, pagination);

console.log({ result });
const { variants, itemCount } = result;
const { currentPage, pageSize } = pagination;
const pageCount = Math.ceil(itemCount / pageSize);
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/sanity-studio/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import schemaTypes from "./schemas/schema";
import { customStructure } from "./deskStructure";

export default defineConfig({
projectId: "5bsv02jj",
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
dataset: "production",
basePath: "/studio",
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/sanity.cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineCliConfig } from "sanity/cli";

export default defineCliConfig({
api: {
projectId: "5bsv02jj",
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
dataset: "production",
},
});
9 changes: 3 additions & 6 deletions setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ Use the default dataset configuration? **Yes**

Sanity cli will detect the project files in the repository and deploy automatically. Once Sanity has completed initialization, we need to use the newly created project id and place that in our `.env` file. To do this, go to the `sanity.json` file and grab the `projectId` (Sanity cli should have modified the value automatically). Put the new projectId into your `.env` file.

You should now be able to run `pnpm local` which will run:
You should now be able to run `pnpm next:dev` which will run:

- Next.js on `http://localhost:3000`
- Sanity Studio on `http://localhost:3333/desk`
- Sanity Studio on `http://localhost:3000/studio`

If you load up Sanity Studio, you will notice the schema is there, but there's no data. No worries, we have a script which can add the same data we run on the Formidable Bread site!

Expand Down Expand Up @@ -113,10 +113,7 @@ There is an `./packages/nextjs/.env.sample` committed to the repo which contains

:bulb: To get a list of scripts available, you can run `pnpm run` and it will output a list of available commands.

- `local` - Runs Sanity Studio, Next.js app
- `dev:nextjs` - Runs NextJs app
- `next:dev` - Runs NextJs app & Sanity Studio locally
- `build:nextjs` - Builds NextJS app
- `start:nextjs` - Starts the built out NextJs app
- `dev:sanity` - Runs Sanity Studio locally
- `build:sanity` - Builds Sanity Studio
- `deploy-sanity-studio` - Deploys Sanity Studio to Sanity

0 comments on commit da45e9c

Please sign in to comment.