From a0be20856cf4305fe5273ab3dc5d62d4f22fb281 Mon Sep 17 00:00:00 2001 From: colbyfayock Date: Mon, 18 Oct 2021 21:25:01 -0400 Subject: [PATCH 1/6] removing export from build command and adding documentation for Netlify --- README.md | 14 +++++++++++++- package.json | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b2551d5..4c6673bd 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ WORDPRESS_GRAPHQL_ENDPOINT="http://wordpressite.com/graphql" ### What is this and what does it include? -The goal of this project is to take WordPress as a headless CMS and use Next.js to create a static experience without any 3rd party services that can be deployed anywhere. +The goal of this project is to take WordPress as a headless CMS and use Next.js to create a static experience without any 3rd party services that can be deployed anywhere. The hope is to build out as many features as we can to support what's typically expected from an out of the box theme on WordPress. Currently, those features include: * Blog (https://next-wordpress-starter.spacejelly.dev) @@ -106,6 +106,18 @@ To set up the [ESLint extension](https://marketplace.visualstudio.com/items?item With this file ESLint will automatically fix and validate syntax errors and format the code on save (based on Prettier configuration). +### Deployment + +#### Netlify + +There are two options as to how you can deploy this project to Netlify: +* [Essential Next.js Plugin](https://github.com/netlify/netlify-plugin-nextjs) (recommended) +* [Exporting the project](https://nextjs.org/docs/advanced-features/static-html-export) via `next export` + +**Essential Next.js Plugin** should be provided as an option when you're first importing a project based on this starter. If it's not, you can install this plugin using the Netlify Plugins directory. This will allow Netlify to take full advantage of the + +**Exporting the project** let's Next.js compile the project into static assets including HTML files. This allows you to deploy the project as a static site directly to Netlify just like any other site. You can do this by adding `next export` to the end of the `build` command inside `package.json` (ex: `next build && next export`). + ## 🛠 Configuring Your Project ### package.json diff --git a/package.json b/package.json index f42d8669..9d795656 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "MIT", "author": "Colby Fayock ", "scripts": { - "build": "next build && next export", + "build": "next build", "wpe-build": "npm run build", "dev": "next dev", "format": "yarn lint --fix", From c7db93d92ed1a737cb1b0ff990fd290b32cc6595 Mon Sep 17 00:00:00 2001 From: colbyfayock Date: Mon, 18 Oct 2021 21:33:37 -0400 Subject: [PATCH 2/6] adding export check for github workflow --- .github/workflows/checks.yml | 22 ++++++++++++++++++++++ package.json | 1 + 2 files changed, 23 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 31afb71d..68cca000 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -4,6 +4,7 @@ on: [push, pull_request] jobs: checks: + name: Linting runs-on: ubuntu-latest strategy: @@ -24,3 +25,24 @@ jobs: # Run linting with yarn - run: yarn lint + + name: Verify Static Compatability + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x, 14.x] + steps: + # Checkout repo + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + # install dependencies from yarn.lock + - name: Install dependencies with yarn + run: yarn install --frozen-lockfile + + # Run linting with yarn + - run: yarn build && yarn export diff --git a/package.json b/package.json index 9d795656..f7f5075b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build": "next build", "wpe-build": "npm run build", "dev": "next dev", + "export": "next export", "format": "yarn lint --fix", "format:no-path": "yarn lint:no-path --fix", "lint": "eslint .", From 567c5cfb4095d6897284a09e95a5b6b76fea0580 Mon Sep 17 00:00:00 2001 From: colbyfayock Date: Mon, 18 Oct 2021 21:35:27 -0400 Subject: [PATCH 3/6] fixing workflow --- .github/workflows/checks.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 68cca000..3c8f18b0 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -3,15 +3,13 @@ name: Checks on: [push, pull_request] jobs: - checks: - + linting: name: Linting runs-on: ubuntu-latest strategy: matrix: node-version: [12.x, 14.x] steps: - # Checkout repo - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -26,13 +24,13 @@ jobs: # Run linting with yarn - run: yarn lint - name: Verify Static Compatability + static-compat: + name: Static Compatability runs-on: ubuntu-latest strategy: matrix: node-version: [12.x, 14.x] steps: - # Checkout repo - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -44,5 +42,4 @@ jobs: - name: Install dependencies with yarn run: yarn install --frozen-lockfile - # Run linting with yarn - run: yarn build && yarn export From 0d82eb2d1102f3339a74ed33a28c09c39cf855cc Mon Sep 17 00:00:00 2001 From: colbyfayock Date: Mon, 18 Oct 2021 21:41:05 -0400 Subject: [PATCH 4/6] adding env to github flow --- .github/workflows/checks.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3c8f18b0..574d2c6c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -43,3 +43,5 @@ jobs: run: yarn install --frozen-lockfile - run: yarn build && yarn export + env: + WORDPRESS_GRAPHQL_ENDPOINT: ${{ secrets.WORDPRESS_GRAPHQL_ENDPOINT }} From d57efe9fe5b05199dfaa9420bc6fd2f4126fabae Mon Sep 17 00:00:00 2001 From: colbyfayock Date: Mon, 18 Oct 2021 21:58:33 -0400 Subject: [PATCH 5/6] adding nvmrc for node 12 to prevent issues with node-canvas --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..3cacc0b9 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +12 \ No newline at end of file From fb49ca273d62518171fd17b270e4151d01e8e189 Mon Sep 17 00:00:00 2001 From: colbyfayock Date: Tue, 19 Oct 2021 08:29:24 -0400 Subject: [PATCH 6/6] finishing readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c6673bd..b4f88724 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ There are two options as to how you can deploy this project to Netlify: * [Essential Next.js Plugin](https://github.com/netlify/netlify-plugin-nextjs) (recommended) * [Exporting the project](https://nextjs.org/docs/advanced-features/static-html-export) via `next export` -**Essential Next.js Plugin** should be provided as an option when you're first importing a project based on this starter. If it's not, you can install this plugin using the Netlify Plugins directory. This will allow Netlify to take full advantage of the +**Essential Next.js Plugin** should be provided as an option when you're first importing a project based on this starter. If it's not, you can install this plugin using the Netlify Plugins directory. This will allow the project to take full advantage of all native Next.js features that Netlify supports with this plugin. **Exporting the project** let's Next.js compile the project into static assets including HTML files. This allows you to deploy the project as a static site directly to Netlify just like any other site. You can do this by adding `next export` to the end of the `build` command inside `package.json` (ex: `next build && next export`).