Skip to content

Commit

Permalink
Remove mkdirp.
Browse files Browse the repository at this point in the history
Requires Node.js >= 10.12.0.
  • Loading branch information
XhmikosR authored and olegskl committed Jan 22, 2020
1 parent b3f155f commit bad36ee
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
@@ -1,4 +1,6 @@
language: node_js
node_js:
- 12
- 10
- "node"
- "12"
- "10.12.0"
cache: npm
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -29,15 +29,14 @@
},
"homepage": "https://github.com/olegskl/gulp-stylelint",
"engines": {
"node": ">=10"
"node": ">=10.12.0"
},
"peerDependencies": {
"stylelint": "^13.0.0"
},
"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",
Expand Down
3 changes: 1 addition & 2 deletions 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');

Expand All @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions test/writer.spec.js
Expand Up @@ -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(),
Expand All @@ -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);
});
});
Expand Down

0 comments on commit bad36ee

Please sign in to comment.