GitXplorerGitXplorer
O

spo-headless-cms

public
16 stars
3 forks
5 issues

Commits

List of commits on branch master.
Unverified
24d4ac96f65b203a42e0a61a4748e0ed3f3bf535

Bump minimist from 1.2.5 to 1.2.6

ddependabot[bot] committed 3 years ago
Unverified
8cbb65872a283a45f256d78331c708b641d50113

Bump ssri from 6.0.1 to 6.0.2

ddependabot[bot] committed 4 years ago
Unverified
ee572ed46949003e02c58bfa3e106067e13c84b1

Bump y18n from 4.0.0 to 4.0.1

ddependabot[bot] committed 4 years ago
Unverified
f4932064cf8b9f5318f02451007166483cf326f4

Bump path-parse from 1.0.6 to 1.0.7

ddependabot[bot] committed 3 years ago
Unverified
d9daf58b3f6f048c3afac72469b4c75b8d87b5bd

Bump lodash from 4.17.19 to 4.17.21

ddependabot[bot] committed 4 years ago
Unverified
39e14fd83ab025ea2818f5ac2d7d113251dd8d5d

Bump elliptic from 6.5.3 to 6.5.4

ddependabot[bot] committed 4 years ago

README

The README file for this repository.

SharePoint Online as a Headless CMS for Next.js

It had to be done by someone.

SPO CMS

Features

  • A front page with a list of all Articles from a SharePoint Online site
  • An SSG page that generates static pages for all articles
  • WebParts supported:
    • rte

Building

Create a file called tenant.json with the following properties (and never deploy this to production):

{
    "tenantId": "YOUR_TENANT_ID",
    "clientID": "YOUR_CLIENT_ID",
    "clientSecret": "YOUR_CLIENT_SECRET"
}

Obviously you'll need to create an application for this in Azure AD. It's pretty simple, just create a bare minimum app and create an API token. Then make Sites.Read.All the only API permission for the app.

First you need to figure out the ID of your site. It's a bit tricky to find, but there is a tool for that

node util/find-site.js My site

Copy the id somewhere, we are going to need it later as a value for the SITE_ID environment variable.

Next up, the actual build:

The manual way

Run get-id.js to get a temporary authentication token:

$ node util/get-id.js

Copy the access_token printed as we'll need it next.

Now you can run the build:

$ ACCESS_TOKEN='YOU_KNOW_THIS' SITE_ID='YOUR_SITE_ID' yarn build

The more automated way

Just run:

./build.sh

Finally the result will be in the newly created out directory that can be deployed to production.

If you have jq installed and you are using Linux, then things will be a bit easier for you.

Summary

Find a site ID:

node ./util/find-site.js My site

To start dev mode:

SITE_ID='YOUR_SITE_ID' ./dev.sh

To run the build:

SITE_ID='YOUR_SITE_ID' ./build.sh