Skip to content

Commit

Permalink
Merge branch 'master' into docs-copy-code-snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Jan 9, 2025
2 parents e4ed078 + 17a3b3b commit a289a14
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 66 deletions.
20 changes: 14 additions & 6 deletions bin/build-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

'use strict';

const { promisify } = require('node:util');
const exec = promisify(require('node:child_process').exec);

var fs = require('fs');
const Path = require('node:path');

var replace = require('replace');
var exec = require('child-process-promise').exec;
var mkdirp = require('mkdirp');
var cssmin = require('cssmin');

var POUCHDB_CSS = __dirname + '/../docs/static/css/pouchdb.css';
var POUCHDB_LESS = __dirname + '/../docs/static/less/pouchdb/pouchdb.less';
const POUCHDB_CSS = resolvePath('docs/static/css/pouchdb.css');
const POUCHDB_LESS = resolvePath('docs/static/less/pouchdb/pouchdb.less');

process.chdir('docs');

Expand All @@ -20,8 +24,8 @@ function checkJekyll() {
}

function buildCSS() {
mkdirp.sync(__dirname + '/../docs/static/css');
var cmd = __dirname + '/../node_modules/less/bin/lessc ' + POUCHDB_LESS;
mkdirp.sync(resolvePath('docs/static/css'));
const cmd = [ resolvePath('node_modules/less/bin/lessc'), POUCHDB_LESS ].join(' ');
return exec(cmd).then(function (child) {
var minifiedCss = cssmin(child.stdout);
fs.writeFileSync(POUCHDB_CSS, minifiedCss);
Expand All @@ -43,7 +47,7 @@ function buildJekyll(path) {
}

function highlightEs6() {
var path = require('path').resolve(__dirname, '../docs/_site');
const path = resolvePath('docs/_site');

// TODO: this is a fragile and hacky way to get
// 'async' and 'await' to highlight correctly
Expand All @@ -69,6 +73,10 @@ function buildEverything() {
.catch(onError);
}

function resolvePath(projectLocalPath) {
return Path.resolve(__dirname, '..', projectLocalPath);
}

if (!process.env.BUILD) {
const http_server = require('http-server');
const watchGlob = require('glob-watcher');
Expand Down
59 changes: 0 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"chai": "3.5.0",
"chai-as-promised": "5.3.0",
"change-case": "4.0.1",
"child-process-promise": "2.2.1",
"cssmin": "0.4.3",
"denodeify": "1.2.1",
"derequire": "2.1.1",
Expand Down

0 comments on commit a289a14

Please sign in to comment.