Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Aug 30, 2024
1 parent b891451 commit 769c23c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Node.js CI

on:
push:
branches: [ master ]
branches: [ master, next ]
pull_request:
branches: [ master ]

Expand All @@ -15,8 +15,10 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [12, 14, 16, 18, 20, 22]
# os: [ubuntu-latest, windows-latest]
# node-version: [12, 14, 16, 18, 20, 22]
os: [windows-latest]
node-version: [22]

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@ async function generate (templateData, options) {
})
templateData.options = options
const output = compiled(templateData)
dmd.cache.writeSync([inputData, inputOptions, dmdVersion], output)
return output

const adjOutput = output
// const lines = output.split(/\r?\n/)
// const adjOutput = lines.join(options.EOL)
// console.log(JSON.stringify(adjOutput))

dmd.cache.writeSync([inputData, inputOptions, dmdVersion], adjOutput)
return adjOutput
}

/* always skip the cache when custom plugins, partials or helpers are used */
Expand Down
13 changes: 9 additions & 4 deletions lib/dmd-options.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @typicalname options
*/
function DmdOptions (options) {
function DmdOptions (options = {}) {
const arrayify = require('array-back')
options = options || {}
const os = require('os')

/**
* The template the supplied documentation will be rendered into. Use the default or supply your own template for full control over the output.
Expand Down Expand Up @@ -81,14 +81,14 @@ function DmdOptions (options) {
this['member-index-format'] = 'grouped'

/**
* If true, \{@link XXX} tags are rendered in normal text if XXX is a URL and monospace (code) format otherwise.
* By default, all {@link} tags are rendered in plain text. If `--clever-links` is set, URL {@link} tags are rendered in plain text, otherwise monospace.
* @type {boolean}
* @dafult
*/
this['clever-links'] = false

/**
* If true, all \{@link} tags are rendered in monospace (code) format. This setting is ignored in `clever-links` is true.
* By default, all {@link} tags are rendered in plain text. If `--monospace-links` is set, all links are rendered in monospace format. This setting is ignored if `--clever-links` is set.
* @type {boolean}
* @default
*/
Expand Down Expand Up @@ -130,6 +130,11 @@ function DmdOptions (options) {
* @type {array}
*/
this.partial = arrayify(options.partial)

/**
* Specify the EOL to be used in dmd output. Defaults to `os.EOL` (your local system default).
*/
this.EOL = options.EOL || os.EOL
}

module.exports = DmdOptions
8 changes: 8 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ test.set('dmd.async() again to exercise the cache', async function () {
test.set('dmd.async({ noCache }) returns correct data', async function () {
const options = { noCache: true }
const result = await dmd(fixture, options)
console.log(JSON.stringify(result))
a.ok(/is a class/.test(result))
})

Expand Down Expand Up @@ -53,4 +54,11 @@ test.set('Dmd issue #89 - Max callstack size exceeded bug', async function () {
a.doesNotReject(() => dmd(templateData, options))
})

skip.set('dmd.async({ noCache }) with custom line endings', async function () {
const options = { noCache: true, EOL: "++" }
const result = await dmd(fixture, options)
a.equal(result, '<a name="someclass"></a>++++## someclass++is a class++++')
})


module.exports = { test, only, skip }

0 comments on commit 769c23c

Please sign in to comment.