@antora/site-publisher 3.0.0-alpha.8 → 3.0.0-beta.3
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/README.md +1 -1
- package/lib/index.js +2 -2
- package/lib/providers/fs.js +1 -31
- package/lib/publish-site.js +1 -1
- package/lib/readable-output-file-array.js +8 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ More than one destination may be specified, and this component supports differen
|
|
|
5
5
|
Custom providers can be used to add support for additional destinations.
|
|
6
6
|
|
|
7
7
|
[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
|
|
8
|
-
Its site generator
|
|
8
|
+
Its site generator aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
|
|
9
9
|
|
|
10
10
|
## Copyright and License
|
|
11
11
|
|
package/lib/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Site Publisher component for Antora
|
|
5
5
|
*
|
|
6
|
-
* Publishes the files generated
|
|
7
|
-
*
|
|
6
|
+
* Publishes the files generated by the Antora generator to the destination(s)
|
|
7
|
+
* specified in the playbook.
|
|
8
8
|
*
|
|
9
9
|
* @namespace site-publisher
|
|
10
10
|
*/
|
package/lib/providers/fs.js
CHANGED
|
@@ -19,40 +19,10 @@ function publishToFs (config, files, playbook) {
|
|
|
19
19
|
fileUri: 'file://' + (posixify ? '/' + posixify(absDestDir) : absDestDir),
|
|
20
20
|
}
|
|
21
21
|
return config.clean
|
|
22
|
-
? rmdir(absDestDir)
|
|
22
|
+
? fsp['rm' in fsp ? 'rm' : 'rmdir'](absDestDir, { recursive: true, force: true })
|
|
23
23
|
.then(() => publishStream(vfsDest(absDestDir), files))
|
|
24
24
|
.then(() => report)
|
|
25
25
|
: publishStream(vfsDest(absDestDir), files).then(() => report)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Removes the specified directory (including all of its contents) or file.
|
|
30
|
-
* Equivalent to fs.promises.rmdir(dir, { recursive: true }) in Node 12.
|
|
31
|
-
*/
|
|
32
|
-
function rmdir (dir) {
|
|
33
|
-
return fsp
|
|
34
|
-
.readdir(dir, { withFileTypes: true })
|
|
35
|
-
.then((lst) =>
|
|
36
|
-
Promise.all(
|
|
37
|
-
lst.map((it) =>
|
|
38
|
-
it.isDirectory()
|
|
39
|
-
? rmdir(ospath.join(dir, it.name))
|
|
40
|
-
: fsp.unlink(ospath.join(dir, it.name)).catch((unlinkErr) => {
|
|
41
|
-
if (unlinkErr.code !== 'ENOENT') throw unlinkErr
|
|
42
|
-
})
|
|
43
|
-
)
|
|
44
|
-
)
|
|
45
|
-
)
|
|
46
|
-
.then(() => fsp.rmdir(dir))
|
|
47
|
-
.catch((err) => {
|
|
48
|
-
if (err.code === 'ENOENT') return
|
|
49
|
-
if (err.code === 'ENOTDIR') {
|
|
50
|
-
return fsp.unlink(dir).catch((unlinkErr) => {
|
|
51
|
-
if (unlinkErr.code !== 'ENOENT') throw unlinkErr
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
throw err
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
|
|
58
28
|
module.exports = publishToFs
|
package/lib/publish-site.js
CHANGED
|
@@ -56,7 +56,7 @@ async function publishSite (playbook, catalogs) {
|
|
|
56
56
|
return userRequire(provider, userRequireContext).bind(null, options)
|
|
57
57
|
} catch (err) {
|
|
58
58
|
const prettyErr = new Error('Unsupported destination provider: ' + provider)
|
|
59
|
-
prettyErr.stack
|
|
59
|
+
prettyErr.stack += `\nCaused by: ${err.stack || err}`
|
|
60
60
|
throw prettyErr
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -12,13 +12,17 @@ class File extends Vinyl {
|
|
|
12
12
|
class ReadableOutputFileArray extends Readable {
|
|
13
13
|
constructor (array) {
|
|
14
14
|
super({ objectMode: true })
|
|
15
|
-
this.
|
|
15
|
+
this._array = array.slice().reverse()
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
_read (size) {
|
|
19
|
-
const
|
|
20
|
-
while (
|
|
21
|
-
|
|
19
|
+
const array = this._array
|
|
20
|
+
while (size--) {
|
|
21
|
+
const next = array.pop()
|
|
22
|
+
if (next === undefined) break
|
|
23
|
+
this.push(toOutputFile(next))
|
|
24
|
+
}
|
|
25
|
+
if (size > -1) this.push(null)
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antora/site-publisher",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.3",
|
|
4
4
|
"description": "Publishes the files generated in an Antora documentation pipeline to the destination(s) specified in the playbook.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "OpenDevise Inc. (https://opendevise.com)",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"vinyl-fs": "~3.0"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
25
|
+
"node": ">=12.21.0"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"lib/"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"static site",
|
|
36
36
|
"web publishing"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "45da95a2e2dea538379d2d9f42013d2208fb86c3"
|
|
39
39
|
}
|