Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

Commit 040d301

Browse files
authored
feat(netlify): publish contented-example to netlify (#6)
1 parent c37b640 commit 040d301

File tree

7 files changed

+65
-41
lines changed

7 files changed

+65
-41
lines changed

netlify.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
publish = "packages/contented-example/out/"
3+
command = "npm run generate --workspace=@birthdayresearch/contented-example"

package-lock.json

+36-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contented-example/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Publish this into npm registry
2+
dist
3+
4+
# Publish this into Vercel or Netlify (with https://www.npmjs.com/package/@netlify/plugin-nextjs)
5+
.next
6+
7+
# Otherwise publish this into any static site capable website
8+
out
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# Contented ABC
1+
## [@birthdayresearch/contented](https://contented.dev)
2+
3+
[![Netlify Status](https://api.netlify.com/api/v1/badges/de626542-ae6c-4204-bb85-334ae50fbb75/deploy-status)](https://app.netlify.com/sites/contented/deploys)

packages/contented-preview/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
public/robots.txt
33
public/sitemap.xml
44
public/sitemap-*.xml
5-
contented.js
5+
contented.js
6+
out

packages/contented-preview/cli.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env node
22
const { symlinkSync, existsSync, rmSync, cpSync } = require('node:fs');
3-
const { spawn } = require('node:child_process');
3+
const { spawnSync } = require('node:child_process');
44
const commandLineArgs = require('command-line-args');
55

66
const mainDefinitions = [{ name: 'command', defaultOption: true }];
@@ -15,7 +15,7 @@ if (existsSync(path)) {
1515
}
1616
symlinkSync(target, path, 'file');
1717

18-
spawn(`npm`, ['run', command, '--prefix', __dirname], {
18+
spawnSync(`npm`, ['run', command, '--prefix', __dirname], {
1919
stdio: 'inherit',
2020
cwd: __dirname,
2121
env: {
@@ -29,3 +29,13 @@ if (command === 'build') {
2929
recursive: true,
3030
});
3131
}
32+
33+
if (command === 'generate') {
34+
cpSync(`${__dirname}/.next`, `${process.cwd()}/.next`, {
35+
recursive: true,
36+
});
37+
38+
cpSync(`${__dirname}/out`, `${process.cwd()}/out`, {
39+
recursive: true,
40+
});
41+
}

packages/contented-preview/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"scripts": {
99
"write": "next dev",
10-
"generate": "next build && next-sitemap",
10+
"generate": "next build && next-sitemap && next export",
1111
"build": "contentlayer build"
1212
},
1313
"dependencies": {

0 commit comments

Comments
 (0)