md-processor 1.2.0 → 1.2.2

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.
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: daily
7
+ - package-ecosystem: npm
8
+ directory: /
9
+ schedule:
10
+ interval: daily
11
+ versioning-strategy: increase-if-necessary
@@ -4,18 +4,31 @@ on:
4
4
  - push
5
5
  jobs:
6
6
  test:
7
- runs-on: ubuntu-20.04
7
+ runs-on: ubuntu-24.04
8
8
  strategy:
9
9
  matrix:
10
10
  node:
11
- - '16'
12
11
  - '18'
13
12
  - '20'
13
+ - '22'
14
+ - '23'
14
15
  steps:
15
- - uses: actions/checkout@v3
16
- - uses: actions/setup-node@v3
16
+ - uses: actions/checkout@v7
17
+ - uses: actions/setup-node@v6
17
18
  with:
18
19
  node-version: ${{ matrix.node }}
19
20
  - run: npm install
20
21
  - run: npm test
21
- - uses: codecov/codecov-action@v3
22
+ - uses: coverallsapp/github-action@v2
23
+ with:
24
+ flag-name: run Node v${{ matrix.node }}
25
+ github-token: ${{ secrets.GITHUB_TOKEN }}
26
+ parallel: true
27
+ finally:
28
+ needs: test
29
+ runs-on: ubuntu-24.04
30
+ steps:
31
+ - uses: coverallsapp/github-action@v2
32
+ with:
33
+ github-token: ${{ secrets.GITHUB_TOKEN }}
34
+ parallel-finished: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md-processor",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "A preprocessor for markdown files",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/bergos/md-processor",
24
24
  "dependencies": {
25
- "commander": "^10.0.1"
25
+ "commander": "^15.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "c8": "^7.14.0",
29
- "mocha": "^10.2.0",
30
- "stricter-standard": "^0.2.0"
28
+ "c8": "^11.0.0",
29
+ "mocha": "^11.0.1",
30
+ "stricter-standard": "^0.3.1"
31
31
  }
32
32
  }
@@ -0,0 +1,53 @@
1
+ import { strictEqual } from 'node:assert'
2
+ import { spawn } from 'node:child_process'
3
+ import { describe, it } from 'mocha'
4
+ import * as examples from './support/examples.js'
5
+
6
+ function runCli (args) {
7
+ return new Promise((resolve, reject) => {
8
+ const child = spawn(process.execPath, ['./bin/md-processor.js', ...args])
9
+ const stdout = []
10
+ const stderr = []
11
+
12
+ child.stdout.on('data', chunk => stdout.push(chunk))
13
+ child.stderr.on('data', chunk => stderr.push(chunk))
14
+
15
+ child.on('close', code => {
16
+ resolve({
17
+ stdout: Buffer.concat(stdout).toString(),
18
+ stderr: Buffer.concat(stderr).toString(),
19
+ code
20
+ })
21
+ })
22
+
23
+ child.on('error', reject)
24
+ })
25
+ }
26
+
27
+ describe('cli', () => {
28
+ it('should process all imports', async () => {
29
+ const { code, stdout } = await runCli(['./test/support/multi-imports.md'])
30
+
31
+ strictEqual(code, 0)
32
+ strictEqual(stdout, examples.multiImports.content)
33
+ })
34
+
35
+ it('should process deep imports', async () => {
36
+ const { code, stdout } = await runCli(['./test/support/import-deep.md'])
37
+
38
+ strictEqual(code, 0)
39
+ strictEqual(stdout, examples.importDeep.content)
40
+ })
41
+
42
+ it('should exit with an error when no input is given', async () => {
43
+ const { code } = await runCli([])
44
+
45
+ strictEqual(code, 1)
46
+ })
47
+
48
+ it('should exit with an error when the input file does not exist', async () => {
49
+ const { code } = await runCli(['./test/support/does-not-exist.md'])
50
+
51
+ strictEqual(code !== 0, true)
52
+ })
53
+ })