diff --git a/bin/build-site.js b/bin/build-site.js index c4855c6052..a850d79bb8 100755 --- a/bin/build-site.js +++ b/bin/build-site.js @@ -3,16 +3,19 @@ 'use strict'; const Path = require('node:path'); +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'); const terser = require('terser'); -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'); @@ -23,8 +26,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); @@ -64,11 +67,11 @@ 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 - // in this blog post. + // in blog posts & documentation. replace({ regex: '(await|async|of)', replacement: '$1', diff --git a/package-lock.json b/package-lock.json index 3442c835d7..88be4f8acd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,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", @@ -1567,17 +1566,6 @@ "snake-case": "^3.0.1" } }, - "node_modules/child-process-promise": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/child-process-promise/-/child-process-promise-2.2.1.tgz", - "integrity": "sha512-Fi4aNdqBsr0mv+jgWxcZ/7rAIC2mgihrptyVI4foh/rrjY/3BNjfP9+oaiFx/fzim+1ZyCNBae0DlyfQhSugog==", - "dev": true, - "dependencies": { - "cross-spawn": "^4.0.2", - "node-version": "^1.0.0", - "promise-polyfill": "^6.0.1" - } - }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -2142,16 +2130,6 @@ "sha.js": "^2.4.8" } }, - "node_modules/cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==", - "dev": true, - "dependencies": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, "node_modules/crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -5822,16 +5800,6 @@ "tslib": "^2.0.3" } }, - "node_modules/lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, "node_modules/ltgt": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", @@ -6507,15 +6475,6 @@ "node-gyp-build-test": "build-test.js" } }, - "node_modules/node-version": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/node-version/-/node-version-1.2.0.tgz", - "integrity": "sha512-ma6oU4Sk0qOoKEAymVoTvk8EdXEobdS7m/mAGhDJ8Rouugho48crHBORAmy5BoOcv8wraPM6xumapQp5hl4iIQ==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/nodemon": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.2.1.tgz", @@ -7989,12 +7948,6 @@ "integrity": "sha512-j9RWp/40Ttja+wxiEjS5Ud5liHQxAA5K+STc9Vh09mF4zpNEuXTR35U6Uk5qVCsf6qp2v5UnLWa7SNmZ6M1ewQ==", "dev": true }, - "node_modules/promise-polyfill": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.1.0.tgz", - "integrity": "sha512-g0LWaH0gFsxovsU7R5LrrhHhWAWiHRnh1GPrhXnPgYsDkIqjRYUYSZEsej/wtleDrz5xVSIDbeKfidztp2XHFQ==", - "dev": true - }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -8022,12 +7975,6 @@ "event-stream": "~0.5" } }, - "node_modules/pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", - "dev": true - }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", @@ -10435,12 +10382,6 @@ "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, - "node_modules/yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", - "dev": true - }, "node_modules/yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", diff --git a/package.json b/package.json index 60bee79d5e..1000179386 100644 --- a/package.json +++ b/package.json @@ -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",