@antora/content-aggregator 3.0.0-beta.3 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/aggregate-content.js
CHANGED
|
@@ -18,13 +18,13 @@ const { NotFoundError, ObjectTypeError, UnknownTransportError, UrlParseError } =
|
|
|
18
18
|
const globStream = require('glob-stream')
|
|
19
19
|
const invariably = require('./invariably')
|
|
20
20
|
const { makeMatcherRx, versionMatcherOpts: VERSION_MATCHER_OPTS } = require('./matcher')
|
|
21
|
-
const MultiProgress = require('multi-progress')
|
|
21
|
+
const MultiProgress = require('multi-progress') // calls require('progress') as a peer dependencies
|
|
22
22
|
const ospath = require('path')
|
|
23
23
|
const { posix: path } = ospath
|
|
24
24
|
const posixify = ospath.sep === '\\' ? (p) => p.replace(/\\/g, '/') : undefined
|
|
25
25
|
const { fs: resolvePathGlobsFs, git: resolvePathGlobsGit } = require('./resolve-path-globs')
|
|
26
|
-
const { pipeline,
|
|
27
|
-
const
|
|
26
|
+
const { pipeline, Writable } = require('stream')
|
|
27
|
+
const forEach = (write) => new Writable({ objectMode: true, write })
|
|
28
28
|
const userRequire = require('@antora/user-require-helper')
|
|
29
29
|
const yaml = require('js-yaml')
|
|
30
30
|
|
|
@@ -227,9 +227,8 @@ async function loadRepository (url, opts) {
|
|
|
227
227
|
try {
|
|
228
228
|
await git.resolveRef(Object.assign({ ref: 'HEAD', depth: 1 }, repo))
|
|
229
229
|
} catch {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
)
|
|
230
|
+
const msg = `Local content source must be a git repository: ${dir}${url !== dir ? ' (url: ' + url + ')' : ''}`
|
|
231
|
+
throw new Error(msg)
|
|
233
232
|
}
|
|
234
233
|
} else {
|
|
235
234
|
throw new Error(`Local content source does not exist: ${dir}${url !== dir ? ' (url: ' + url + ')' : ''}`)
|
|
@@ -436,7 +435,7 @@ function collectFilesFromStartPath (startPath, repo, authStatus, ref, worktreePa
|
|
|
436
435
|
}
|
|
437
436
|
|
|
438
437
|
function readFilesFromWorktree (worktreePath, startPath) {
|
|
439
|
-
const cwd = ospath.join(worktreePath, startPath)
|
|
438
|
+
const cwd = ospath.join(worktreePath, startPath, '.') // . shaves off trailing slash
|
|
440
439
|
return fsp.stat(cwd).then(
|
|
441
440
|
(startPathStat) => {
|
|
442
441
|
if (!startPathStat.isDirectory()) throw new Error(`the start path '${startPath}' is not a directory`)
|
|
@@ -449,23 +448,24 @@ function readFilesFromWorktree (worktreePath, startPath) {
|
|
|
449
448
|
}
|
|
450
449
|
|
|
451
450
|
function srcFs (cwd) {
|
|
452
|
-
|
|
451
|
+
const relpathStart = cwd.length + 1
|
|
452
|
+
return new Promise((resolve, reject, cache = Object.create(null), files = []) =>
|
|
453
453
|
pipeline(
|
|
454
454
|
globStream(CONTENT_SRC_GLOB, Object.assign({ cache, cwd }, CONTENT_SRC_OPTS)),
|
|
455
|
-
|
|
456
|
-
if (Array.isArray(cache[abspathPosix])) return
|
|
455
|
+
forEach(({ path: abspathPosix }, _, done) => {
|
|
456
|
+
if (Array.isArray(cache[abspathPosix])) return done() // detects some directories, but not all
|
|
457
457
|
const abspath = posixify ? ospath.normalize(abspathPosix) : abspathPosix
|
|
458
|
-
const relpath = abspath.substr(
|
|
458
|
+
const relpath = abspath.substr(relpathStart)
|
|
459
459
|
symlinkAwareStat(abspath).then(
|
|
460
460
|
(stat) => {
|
|
461
|
-
if (stat.isDirectory()) return
|
|
461
|
+
if (stat.isDirectory()) return done() // detects remaining directories
|
|
462
462
|
fsp.readFile(abspath).then(
|
|
463
463
|
(contents) => {
|
|
464
464
|
files.push(new File({ path: posixify ? posixify(relpath) : relpath, contents, stat, src: { abspath } }))
|
|
465
|
-
|
|
465
|
+
done()
|
|
466
466
|
},
|
|
467
467
|
(readErr) => {
|
|
468
|
-
|
|
468
|
+
done(Object.assign(readErr, { message: readErr.message.replace(`'${abspath}'`, relpath) }))
|
|
469
469
|
}
|
|
470
470
|
)
|
|
471
471
|
},
|
|
@@ -478,7 +478,7 @@ function srcFs (cwd) {
|
|
|
478
478
|
} else {
|
|
479
479
|
statErr.message = statErr.message.replace(`'${abspath}'`, relpath)
|
|
480
480
|
}
|
|
481
|
-
|
|
481
|
+
done(statErr)
|
|
482
482
|
}
|
|
483
483
|
)
|
|
484
484
|
}),
|
|
@@ -9,10 +9,9 @@ const ospath = require('path')
|
|
|
9
9
|
class GitCredentialManagerStore {
|
|
10
10
|
configure ({ config, startDir }) {
|
|
11
11
|
this.entries = undefined
|
|
12
|
+
this.path = undefined
|
|
12
13
|
this.urls = {}
|
|
13
|
-
if ((this.contents = (config = config || {}).contents)
|
|
14
|
-
this.path = undefined
|
|
15
|
-
} else {
|
|
14
|
+
if (!(this.contents = (config = config || {}).contents) && config.path) {
|
|
16
15
|
this.path = expandPath(config.path, { dot: startDir })
|
|
17
16
|
}
|
|
18
17
|
return this
|
|
@@ -35,14 +34,13 @@ class GitCredentialManagerStore {
|
|
|
35
34
|
'git',
|
|
36
35
|
'credentials'
|
|
37
36
|
)
|
|
38
|
-
contentsPromise = fsp
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
.catch(() =>
|
|
37
|
+
contentsPromise = fsp.access(homeGitCredentialsPath).then(
|
|
38
|
+
() => fsp.readFile(homeGitCredentialsPath, 'utf8'),
|
|
39
|
+
() =>
|
|
42
40
|
fsp
|
|
43
41
|
.access(xdgConfigGitCredentialsPath)
|
|
44
42
|
.then(() => fsp.readFile(xdgConfigGitCredentialsPath, 'utf8'), invariably.void)
|
|
45
|
-
|
|
43
|
+
)
|
|
46
44
|
}
|
|
47
45
|
contentsPromise.then((contents) => {
|
|
48
46
|
if (contents) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antora/content-aggregator",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"description": "Fetches and aggregates content from distributed sources for use in an Antora documentation pipeline.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "OpenDevise Inc. (https://opendevise.com)",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"braces": "~3.0",
|
|
23
23
|
"cache-directory": "~2.0",
|
|
24
24
|
"camelcase-keys": "~7.0",
|
|
25
|
+
"glob-stream": "~7.0",
|
|
25
26
|
"hpagent": "~0.1.0",
|
|
26
27
|
"isomorphic-git": "~1.10",
|
|
27
28
|
"js-yaml": "~4.1",
|
|
@@ -32,6 +33,9 @@
|
|
|
32
33
|
"simple-get": "~4.0",
|
|
33
34
|
"vinyl": "~2.2"
|
|
34
35
|
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"node-git-server": "~0.6"
|
|
38
|
+
},
|
|
35
39
|
"engines": {
|
|
36
40
|
"node": ">=12.21.0"
|
|
37
41
|
},
|
|
@@ -48,5 +52,6 @@
|
|
|
48
52
|
"static site",
|
|
49
53
|
"web publishing"
|
|
50
54
|
],
|
|
51
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "8a142499e9f1a9e0631777796e06dd6c010d3a90",
|
|
56
|
+
"readmeFilename": "README.md"
|
|
52
57
|
}
|