diff --git a/.travis.yml b/.travis.yml index c66a67b..0dce11f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: node_js node_js: - - 12 - - 10 + - "node" + - "12" + - "10.12.0" +cache: npm diff --git a/package-lock.json b/package-lock.json index 2d0b56e..31e97d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4961,7 +4961,8 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true }, "minimist-options": { "version": "4.0.2", @@ -4987,6 +4988,7 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, "requires": { "minimist": "0.0.8" } diff --git a/package.json b/package.json index 5ffdd10..afa4a5d 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/olegskl/gulp-stylelint", "engines": { - "node": ">=10" + "node": ">=10.12.0" }, "peerDependencies": { "stylelint": "^13.0.0" @@ -37,7 +37,6 @@ "dependencies": { "chalk": "^3.0.0", "fancy-log": "^1.3.3", - "mkdirp": "^0.5.1", "plugin-error": "^1.0.1", "source-map": "^0.7.3", "strip-ansi": "^6.0.0", diff --git a/src/writer.js b/src/writer.js index 84a75c2..6d6f9e3 100644 --- a/src/writer.js +++ b/src/writer.js @@ -1,7 +1,6 @@ 'use strict'; const fs = require('fs'); -const mkdirp = require('mkdirp'); const path = require('path'); const stripAnsi = require('strip-ansi'); @@ -16,7 +15,7 @@ module.exports = function writer(text, dest, destRoot = process.cwd()) { const fullpath = path.resolve(destRoot, dest); return new Promise((resolve, reject) => { - mkdirp(path.dirname(fullpath), mkdirpError => { + fs.mkdir(path.dirname(fullpath), { recursive: true }, mkdirpError => { if (mkdirpError) { reject(mkdirpError); } else { diff --git a/test/writer.spec.js b/test/writer.spec.js index 6b64db2..e2e8d55 100644 --- a/test/writer.spec.js +++ b/test/writer.spec.js @@ -38,11 +38,12 @@ test('writer should write to cwd if base dir is not specified', t => { test('writer should write to a base folder if it is specified', t => { stub(process, 'cwd').returns(tmpDir); const reportDirPath = path.join(process.cwd(), 'foodir'); - const reportFilePath = path.join(reportDirPath, 'foo.txt'); + const reportSubdirPath = path.join(reportDirPath, '/subdir'); + const reportFilePath = path.join(reportSubdirPath, 'foo.txt'); t.plan(2); - writer('footext', 'foo.txt', 'foodir') + writer('footext', 'foo.txt', 'foodir/subdir') .then(() => { t.true( fs.statSync(reportFilePath).isFile(), @@ -58,6 +59,7 @@ test('writer should write to a base folder if it is specified', t => { .then(() => { process.cwd.restore(); fs.unlinkSync(reportFilePath); + fs.rmdirSync(reportSubdirPath); fs.rmdirSync(reportDirPath); }); });