move to native esm
This commit is contained in:
Kebler Network System Administrator 2021-04-24 09:33:19 -07:00
parent a9b5c24859
commit 05b85065d8
3 changed files with 17 additions and 15 deletions

View file

@ -1,11 +1,12 @@
{
"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)",
"main": "src/read-lines.js",
"type": "module",
"scripts": {
"test": "./node_modules/.bin/mocha -r esm --timeout 30000",
"testd": "UCI_ENV=dev ./node_modules/.bin/nodemon --exec './node_modules/.bin/mocha -r esm --timeout 30000' || exit 0",
"test": "./node_modules/.bin/mocha --timeout 30000",
"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",
"testde": "UCI_LOG_LEVEL='warn' npm run testd",
"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",
"dependencies": {
"@uci-utils/logger": "^0.0.15",
"p-settle": "^3.1.0"
"@uci-utils/logger": "^0.1.0",
"p-settle": "^4.1.1"
},
"devDependencies": {
"chai": "^4.2.0",
"chai-arrays": "^2.0.0",
"esm": "^3.2.25",
"mocha": "^6.2.0",
"nodemon": "^1.19.1"
"chai": "^4.3.4",
"chai-arrays": "^2.2.0",
"dirname-filename-esm": "^1.0.2",
"mocha": "^8.3.2",
"nodemon": "^2.0.7"
}
}

View file

@ -5,14 +5,13 @@ const read = promisify(readFile)
const write = promisify(writeFile)
import settle from 'p-settle'
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) {
// console.log('additional files', files)
log.debug({files:files,dir:dir,msg:'additional files'})
let list = []
if (!Array.isArray(files)) files=[files]
// each set in an the array is new line delimited set of ignore patterns
// settle returns array of error,value pairs
return settle(files.map(file => {

View file

@ -1,9 +1,11 @@
// let ignoreFiles = ['.npmignore','.gitignore']
import { readLines, writeLines } from '../src/read-lines'
import { readLines, writeLines } from '../src/read-lines.js'
import chai from 'chai'
import assertArrays from 'chai-arrays'
import { it } from 'mocha'
import { dirname } from 'dirname-filename-esm';
const __dirname = dirname(import.meta);
chai.use(assertArrays)
const expect = chai.expect