Skip to content

Commit f9910ec

Browse files
authored
docs: build with eleventy instead of jekyll (#9146)
1 parent c337978 commit f9910ec

138 files changed

Lines changed: 2059 additions & 711 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,5 @@ jobs:
2828
persist-credentials: false
2929
- uses: ./.github/actions/install-node-package
3030
with:
31-
node-version: 22
32-
- uses: ruby/setup-ruby@v1
33-
with:
34-
ruby-version: 2.7
35-
bundler-cache: true
36-
- run: sudo gem install bundler -v 2.1.4
37-
- run: npm run install-jekyll
31+
node-version: 24
3832
- run: BUILD=1 npm run build-site

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ tmp*
33
/node_modules
44
docs/_site
55
docs/static/css
6-
docs/.jekyll-cache
76
npm-debug.log
87
npm-debug.log.*
98
*~

CONTRIBUTING.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,7 @@ Now when you visit https://github.com/myfork/pouchdb there should be a button th
9797
Building PouchDB Documentation
9898
--------------------------------------
9999

100-
The source for the website http://pouchdb.com is stored inside the `docs` directory of the PouchDB repository, you can make changes and submit pull requests as with any other patch. To build and view the website locally you will need to have the Ruby development package installed.
101-
On Ubuntu this is done with:
102-
103-
$ sudo apt install -y ruby-dev
104-
105-
You then neet to install [jekyll](http://jekyllrb.com/) and a few other gems. Jekyll is installed using [bundler](http://bundler.io/) so you need to install that first.
106-
On Ubuntu you will need root permissions to do this so prefix the ```gem``` command with ```sudo```
107-
108-
$ [sudo] gem install bundler
109-
$ npm run install-jekyll
100+
The source for the website http://pouchdb.com is stored inside the `docs` directory of the PouchDB repository, you can make changes and submit pull requests as with any other patch.
110101

111102
If you haven't already done so, you'll also need to run `npm install` to pull in packages for the dev server:
112103

@@ -118,10 +109,6 @@ Now you can build the site and start the dev server with:
118109

119110
You should now find the documentation at http://127.0.0.1:4000
120111

121-
You can also build and run the documentation with docker:
122-
123-
$ npm run dev-site-with-docker
124-
125112
Writing a PouchDB Blog Post
126113
--------------------------------------
127114

@@ -166,7 +153,7 @@ Release Procedure
166153
* `npm run set-version -- $VERSION`
167154
* `npm run release`. Note that with 2FA in npm, it will request you an OTP for every package.
168155
* Copy the `dist/pouchdb*` files from the $VERSION tag on github, paste the release notes and add the distribution files to Github Releases, rename `pouchdb.min.js` to `pouchdb-$VERSION.min.js` (same with `pouchdb.js`) after you upload it.
169-
* Update docs/_config.yml to the current version
156+
* Update `docs/_data/site.js` to the current version
170157
* Push updated versions to master
171158
* `npm run publish-site`
172159

bin/build-site.js

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ const POUCHDB_LESS = resolvePath('docs/src/less/pouchdb/pouchdb.less');
1717

1818
process.chdir('docs');
1919

20-
async function checkJekyll() {
21-
try {
22-
await exec('bundle check');
23-
} catch (err) {
24-
throw new Error('Jekyll is not installed. You need to do: npm run install-jekyll');
25-
}
26-
}
27-
2820
async function buildCSS() {
2921
fs.mkdirSync(__dirname + '/../docs/static/css', { recursive:true });
3022
const cmd = [ resolvePath('node_modules/less/bin/lessc'), POUCHDB_LESS ].join(' ');
@@ -34,9 +26,10 @@ async function buildCSS() {
3426
console.log('Updated:', POUCHDB_CSS);
3527
}
3628

37-
async function buildJekyll() {
38-
await exec('bundle exec jekyll build');
39-
console.log('=> Rebuilt jekyll');
29+
async function buildEleventy() {
30+
await exec('npx @11ty/eleventy');
31+
await checkForUnprocessedCurlies();
32+
console.log('=> Rebuilt eleventy');
4033

4134
highlightEs6();
4235
console.log('=> Highlighted ES6');
@@ -62,6 +55,28 @@ async function buildJekyll() {
6255
}
6356
}
6457

58+
async function checkForUnprocessedCurlies() {
59+
// If unprocessed curlies are ever desired, add a way to ignore them.
60+
try {
61+
const res = await exec(`grep -Ern --include=\\*.html '\\{\\{|\\}\\}' ./_site/`);
62+
63+
console.log();
64+
console.log('!!! UNPROCESSED CURLIES FOUND IN OUTPUT HTML FILE(S):');
65+
console.log(res.stdout.trim());
66+
console.log('!!! CHECK TEMPLATES ARE BEING FULLY PROCESSED.');
67+
console.log();
68+
69+
if (process.env.BUILD) {
70+
process.exit(1);
71+
}
72+
} catch (err) {
73+
if (err.code === 1) {
74+
return; // no problems found
75+
}
76+
throw err;
77+
}
78+
}
79+
6580
function highlightEs6() {
6681
const path = resolvePath('docs/_site');
6782

@@ -83,9 +98,8 @@ function onError(err) {
8398

8499
function buildEverything() {
85100
return Promise.resolve()
86-
.then(checkJekyll)
87101
.then(buildCSS)
88-
.then(buildJekyll)
102+
.then(buildEleventy)
89103
.catch(onError);
90104
}
91105

@@ -95,24 +109,25 @@ function resolvePath(projectLocalPath) {
95109

96110
if (!process.env.BUILD) {
97111
const http_server = require('http-server');
98-
const watchGlob = require('glob-watcher');
112+
const globWatcher = require('glob-watcher');
113+
const watchGlob = (path, fn) => globWatcher(path, () => fn().catch(console.log));
99114

100115
// Simpler ways of blacklisting certain paths here would be very welcome.
101116
fs.readdirSync('.')
102117
.forEach(path => {
103-
if (path === '_site' || path.startsWith('Gemfile')) {
118+
if (path === '_site') {
104119
return;
105120
}
106121

107122
if (fs.statSync(path).isDirectory()) {
108-
watchGlob(`${path}/**`, buildJekyll);
123+
watchGlob(`${path}/**`, buildEleventy);
109124
} else {
110-
watchGlob(path, buildJekyll);
125+
watchGlob(path, buildEleventy);
111126
}
112127
});
113128

114129

115-
watchGlob('static/src/*/*.less', buildCSS);
130+
watchGlob('src/less/**', buildCSS);
116131

117132
http_server.createServer({root: '_site', cache: '-1'}).listen(4000);
118133
console.log('Server address: http://localhost:4000');

docs-dev.Dockerfile

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/.eleventyignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/asf.md

docs/Gemfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/Gemfile.lock

Lines changed: 0 additions & 69 deletions
This file was deleted.

docs/_config.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)