requirejs-config-file
Advanced tools
Comparing version 3.1.1 to 3.1.2
22
index.js
'use strict'; | ||
const fs = require('fs-extra'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const makeDir = require('make-dir'); | ||
const esprima = require('esprima'); | ||
@@ -10,6 +12,14 @@ const util = require('util'); | ||
function outputFileSync (filePath, contents, fileSystem = fs) { | ||
const dir = path.dirname(filePath); | ||
makeDir.sync(dir, { | ||
fs: fileSystem | ||
}); | ||
fileSystem.writeFileSync(filePath, contents); | ||
} | ||
class ConfigFile { | ||
constructor(filePath, fileSystem = undefined) { | ||
constructor(filePath, fileSystem = fs) { | ||
this.filePath = filePath; | ||
this.fileSystem = fileSystem || fs; | ||
this.fileSystem = fileSystem; | ||
this.config = null; | ||
@@ -108,3 +118,3 @@ | ||
this.fileSystem.outputFileSync(this.filePath, contents); | ||
outputFileSync(this.filePath, contents, this.fileSystem); | ||
} | ||
@@ -117,4 +127,4 @@ | ||
*/ | ||
createIfNotExists(config) { | ||
this.config = config || {}; | ||
createIfNotExists(config = {}) { | ||
this.config = config; | ||
this.type = 'create-if-not-exists'; | ||
@@ -121,0 +131,0 @@ } |
{ | ||
"name": "requirejs-config-file", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "A small api to read and write your requirejs config file", | ||
@@ -23,6 +23,7 @@ "main": "index.js", | ||
"engines": { | ||
"node": ">=4.0.0" | ||
"node": ">=6.0.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"fs-extra": "^7.0.1", | ||
"grunt": "^1.0.1", | ||
@@ -32,10 +33,10 @@ "grunt-contrib-jshint": "^1.1.0", | ||
"matchdep": "^2.0.0", | ||
"unionfs": "^3.0.2", | ||
"memfs": "^2.14.1" | ||
"memfs": "^2.14.1", | ||
"unionfs": "^3.0.2" | ||
}, | ||
"dependencies": { | ||
"esprima": "^4.0.0", | ||
"fs-extra": "^5.0.0", | ||
"make-dir": "^2.1.0", | ||
"stringify-object": "^3.2.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40201
656
8
+ Addedmake-dir@^2.1.0
+ Addedmake-dir@2.1.0(transitive)
+ Addedpify@4.0.1(transitive)
+ Addedsemver@5.7.2(transitive)
- Removedfs-extra@^5.0.0
- Removedfs-extra@5.0.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removeduniversalify@0.1.2(transitive)