Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #24 from kuitos/master
Browse files Browse the repository at this point in the history
fix: use fs.mkdir to instead of mkpath as it was not maintained
  • Loading branch information
Poluektov Dmitriy authored Oct 8, 2019
2 parents 38d7beb + 5b55b32 commit 3974d44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"homepage": "https://github.com/Swatinem/rollup-plugin-url#readme",
"dependencies": {
"mime": "^2.4.4",
"mkpath": "^1.0.0",
"rollup-pluginutils": "^2.8.1"
},
"peerDependencies": {
Expand Down
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import mime from "mime"
import crypto from "crypto"
import path from "path"
import fs from "fs"
import mkpath from "mkpath"

const defaultInclude = [
"**/*.svg",
Expand Down Expand Up @@ -48,7 +47,7 @@ export default function url(options = {}) {
const relativeDir = options.sourceDir
? path.relative(options.sourceDir, path.dirname(id))
: path.dirname(id).split(path.sep).pop()

// Generate the output file name based on some string
// replacement parameters
const outputFileName = fileName
Expand Down Expand Up @@ -120,3 +119,8 @@ function encodeSVG(buffer) {
// encode brackets
.replace(/\(/g, "%28").replace(/\)/g, "%29")
}

// use fs.mkdir to instead of mkpath package, see https://github.com/jrajav/mkpath/issues/6
function mkpath(path, err) {
return fs.mkdir(path, { recursive: true }, err);
}

0 comments on commit 3974d44

Please sign in to comment.