barnard59-base 1.2.2 → 2.0.1
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/CHANGELOG.md +18 -0
- package/glob.js +6 -1
- package/manifest.ttl +1 -1
- package/package.json +7 -2
- package/test/glob.test.js +40 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# v1.0.0
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 67504df: Remove redundant dependency on `rdf-utils-fs`
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 6be7cd8: Literals loaded as step arguments will be converted to matching JS type (closes #116)
|
|
14
|
+
- 72648c5: Change the operation URLs to be HTTPS (re zazuko/barnard59-website#4).
|
|
15
|
+
This will only be a breaking change to those using the [shorthand step syntax](https://data-centric.zazuko.com/docs/workflows/explanations/simplified-syntax).
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 64b50ac: glob: added a warning message when nothing was matched
|
|
20
|
+
|
|
3
21
|
## 1.2.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/glob.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Readable } from 'readable-stream'
|
|
|
6
6
|
import tracer from './lib/tracer.js'
|
|
7
7
|
|
|
8
8
|
function glob({ pattern, ...options }) {
|
|
9
|
+
const { logger } = this
|
|
9
10
|
let filenames = null
|
|
10
11
|
|
|
11
12
|
const span = tracer.startSpan('glob')
|
|
@@ -13,15 +14,19 @@ function glob({ pattern, ...options }) {
|
|
|
13
14
|
const init = onetime(async () => {
|
|
14
15
|
span.addEvent('init')
|
|
15
16
|
filenames = await promisify(globFn)(pattern, options)
|
|
17
|
+
return filenames.length === 0
|
|
16
18
|
})
|
|
17
19
|
|
|
18
20
|
const stream = new Readable({
|
|
19
21
|
objectMode: true,
|
|
20
22
|
read: async () => {
|
|
21
23
|
try {
|
|
22
|
-
await init()
|
|
24
|
+
const noneMatched = await init()
|
|
23
25
|
|
|
24
26
|
if (filenames.length === 0) {
|
|
27
|
+
if (noneMatched) {
|
|
28
|
+
logger.warn(`No files matched by glob '${pattern}'`)
|
|
29
|
+
}
|
|
25
30
|
return stream.push(null)
|
|
26
31
|
}
|
|
27
32
|
|
package/manifest.ttl
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "barnard59-base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Linked Data pipelines",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -30,13 +30,18 @@
|
|
|
30
30
|
"through2": "^4.0.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"barnard59-core": "^5.0.0",
|
|
34
|
+
"chai": "^4.3.10",
|
|
33
35
|
"get-stream": "^6.0.1",
|
|
34
36
|
"into-stream": "^7.0.0",
|
|
35
37
|
"isstream": "^0.1.2",
|
|
36
38
|
"mocha": "^9.0.1",
|
|
37
|
-
"
|
|
39
|
+
"sinon": "^17.0.0"
|
|
38
40
|
},
|
|
39
41
|
"engines": {
|
|
40
42
|
"node": ">= 14.0.0"
|
|
43
|
+
},
|
|
44
|
+
"mocha": {
|
|
45
|
+
"require": "../../test/mocha-setup.cjs"
|
|
41
46
|
}
|
|
42
47
|
}
|
package/test/glob.test.js
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
import { deepStrictEqual, strictEqual } from 'assert'
|
|
2
2
|
import { array } from 'get-stream'
|
|
3
3
|
import { isReadable, isWritable } from 'isstream'
|
|
4
|
+
import sinon from 'sinon'
|
|
5
|
+
import { expect } from 'chai'
|
|
4
6
|
import glob from '../glob.js'
|
|
5
7
|
|
|
6
8
|
describe('glob', () => {
|
|
9
|
+
let logger
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
logger = {
|
|
13
|
+
debug: sinon.spy(),
|
|
14
|
+
info: sinon.spy(),
|
|
15
|
+
error: sinon.spy(),
|
|
16
|
+
trace: sinon.spy(),
|
|
17
|
+
warn: sinon.spy(),
|
|
18
|
+
verbose: sinon.spy(),
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
|
|
7
22
|
it('should be a function', () => {
|
|
8
23
|
strictEqual(typeof glob, 'function')
|
|
9
24
|
})
|
|
10
25
|
|
|
11
26
|
it('should return a Readable stream', () => {
|
|
12
|
-
const s = glob({ pattern: 'test/support/*' })
|
|
27
|
+
const s = glob.call({ logger }, { pattern: 'test/support/*' })
|
|
13
28
|
|
|
14
29
|
strictEqual(isReadable(s), true)
|
|
15
30
|
strictEqual(isWritable(s), false)
|
|
16
31
|
})
|
|
17
32
|
|
|
18
33
|
it('should emit each file name as a chunk', async () => {
|
|
19
|
-
const s = glob({ pattern: '../../test/e2e/definitions/foreach/*' })
|
|
34
|
+
const s = glob.call({ logger }, { pattern: '../../test/e2e/definitions/foreach/*' })
|
|
20
35
|
|
|
21
36
|
const filenames = await array(s)
|
|
22
37
|
|
|
@@ -28,7 +43,7 @@ describe('glob', () => {
|
|
|
28
43
|
})
|
|
29
44
|
|
|
30
45
|
it('should forward additional options', async () => {
|
|
31
|
-
const s = glob({
|
|
46
|
+
const s = glob.call({ logger }, {
|
|
32
47
|
cwd: '../../test/e2e/definitions/foreach',
|
|
33
48
|
pattern: '*',
|
|
34
49
|
})
|
|
@@ -41,4 +56,26 @@ describe('glob', () => {
|
|
|
41
56
|
'with-variable.ttl',
|
|
42
57
|
])
|
|
43
58
|
})
|
|
59
|
+
|
|
60
|
+
it('should warn when no files are matched', async () => {
|
|
61
|
+
const s = glob.call({ logger }, {
|
|
62
|
+
cwd: '../../test/e2e/definitions/foreach',
|
|
63
|
+
pattern: 'foobar',
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
await array(s)
|
|
67
|
+
|
|
68
|
+
expect(logger.warn).to.have.been.called
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('should not warn files have been matched', async () => {
|
|
72
|
+
const s = glob.call({ logger }, {
|
|
73
|
+
cwd: '../../test/e2e/definitions/foreach',
|
|
74
|
+
pattern: '*',
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
await array(s)
|
|
78
|
+
|
|
79
|
+
expect(logger.warn).not.to.have.been.called
|
|
80
|
+
})
|
|
44
81
|
})
|