Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "export" option from build #262

Merged
merged 7 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +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 }}
Expand All @@ -24,3 +23,25 @@ jobs:

# Run linting with yarn
- run: yarn lint

static-compat:
name: Static Compatability
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- 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: yarn build && yarn export
env:
WORDPRESS_GRAPHQL_ENDPOINT: ${{ secrets.WORDPRESS_GRAPHQL_ENDPOINT }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
12
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 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`).

## 🛠 Configuring Your Project

### package.json
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"license": "MIT",
"author": "Colby Fayock <[email protected]>",
"scripts": {
"build": "next build && next export",
"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 .",
Expand Down