parent
a9b5c24859
commit
05b85065d8
21
package.json
21
package.json
|
@ -1,11 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@uci-utils/read-lines",
|
"name": "@uci-utils/read-lines",
|
||||||
"version": "0.2.2",
|
"version": "0.3.0",
|
||||||
"description": "Functions to read and write lines from/to a file into/from an Array (asynchronously)",
|
"description": "Functions to read and write lines from/to a file into/from an Array (asynchronously)",
|
||||||
"main": "src/read-lines.js",
|
"main": "src/read-lines.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./node_modules/.bin/mocha -r esm --timeout 30000",
|
"test": "./node_modules/.bin/mocha --timeout 30000",
|
||||||
"testd": "UCI_ENV=dev ./node_modules/.bin/nodemon --exec './node_modules/.bin/mocha -r esm --timeout 30000' || exit 0",
|
"testd": "UCI_ENV=dev ./node_modules/.bin/nodemon --exec './node_modules/.bin/mocha --timeout 30000' || exit 0",
|
||||||
"testdd": "UCI_LOG_LEVEL='trace' npm run testd",
|
"testdd": "UCI_LOG_LEVEL='trace' npm run testd",
|
||||||
"testde": "UCI_LOG_LEVEL='warn' npm run testd",
|
"testde": "UCI_LOG_LEVEL='warn' npm run testd",
|
||||||
"testl": "UCI_ENV=pro UCI_LOG_PATH=./test/test.log 0 npm run test || exit 0"
|
"testl": "UCI_ENV=pro UCI_LOG_PATH=./test/test.log 0 npm run test || exit 0"
|
||||||
|
@ -28,14 +29,14 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/uCOMmandIt/uci-utils#readme",
|
"homepage": "https://github.com/uCOMmandIt/uci-utils#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uci-utils/logger": "^0.0.15",
|
"@uci-utils/logger": "^0.1.0",
|
||||||
"p-settle": "^3.1.0"
|
"p-settle": "^4.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.3.4",
|
||||||
"chai-arrays": "^2.0.0",
|
"chai-arrays": "^2.2.0",
|
||||||
"esm": "^3.2.25",
|
"dirname-filename-esm": "^1.0.2",
|
||||||
"mocha": "^6.2.0",
|
"mocha": "^8.3.2",
|
||||||
"nodemon": "^1.19.1"
|
"nodemon": "^2.0.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,13 @@ const read = promisify(readFile)
|
||||||
const write = promisify(writeFile)
|
const write = promisify(writeFile)
|
||||||
import settle from 'p-settle'
|
import settle from 'p-settle'
|
||||||
import logger from '@uci-utils/logger'
|
import logger from '@uci-utils/logger'
|
||||||
let log = logger({ package:'@cui/sync', file:'src/read-lines.js'})
|
let log = logger({ package:'@uci-utils/read-lines', file:'src/read-lines.js'})
|
||||||
|
|
||||||
// A promise helper function to return a list of paths to ignore from .npmignore, .gitignore, .rcignore
|
// read lines from one or more files
|
||||||
function readLines (files=[],dir) {
|
function readLines (files=[],dir) {
|
||||||
// console.log('additional files', files)
|
log.debug({files:files,dir:dir,msg:'additional files'})
|
||||||
let list = []
|
let list = []
|
||||||
if (!Array.isArray(files)) files=[files]
|
if (!Array.isArray(files)) files=[files]
|
||||||
|
|
||||||
// each set in an the array is new line delimited set of ignore patterns
|
// each set in an the array is new line delimited set of ignore patterns
|
||||||
// settle returns array of error,value pairs
|
// settle returns array of error,value pairs
|
||||||
return settle(files.map(file => {
|
return settle(files.map(file => {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
// let ignoreFiles = ['.npmignore','.gitignore']
|
// let ignoreFiles = ['.npmignore','.gitignore']
|
||||||
|
|
||||||
import { readLines, writeLines } from '../src/read-lines'
|
import { readLines, writeLines } from '../src/read-lines.js'
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import assertArrays from 'chai-arrays'
|
import assertArrays from 'chai-arrays'
|
||||||
import { it } from 'mocha'
|
import { it } from 'mocha'
|
||||||
|
import { dirname } from 'dirname-filename-esm';
|
||||||
|
const __dirname = dirname(import.meta);
|
||||||
|
|
||||||
chai.use(assertArrays)
|
chai.use(assertArrays)
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
Loading…
Reference in New Issue