Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 10 additions & 47 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"types.d.ts"
],
"dependencies": {
"fs-extra": "^9.1.0",
"js-beautify": "1.15.4",
"lodash": "^4.17.21",
"picocolors": "^1.1.1",
Expand Down
19 changes: 16 additions & 3 deletions src/helpers/asset-helper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import fs from 'fs-extra';
import fs from 'fs';
import path from 'path';

function copyRecursiveSync(src, dest) {
const stat = fs.statSync(src);

if (stat.isDirectory()) {
fs.mkdirSync(dest, { recursive: true });
for (const child of fs.readdirSync(src)) {
copyRecursiveSync(path.join(src, child), path.join(dest, child));
}
} else {
fs.copyFileSync(src, dest);
}
}

const assets = {
copy: (from, to) => {
fs.copySync(path.resolve(__dirname, '..', 'assets', from), to);
copyRecursiveSync(path.resolve(__dirname, '..', 'assets', from), to);
},

read: (assetPath) => {
Expand All @@ -26,7 +39,7 @@ const assets = {
},

mkdirp: (pathToCreate) => {
fs.mkdirpSync(pathToCreate);
fs.mkdirSync(pathToCreate, { recursive: true });
},
};

Expand Down
6 changes: 3 additions & 3 deletions test/support/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var support = require('./index');
var through = require('through2');
var expect = require('expect.js');
var path = require('path');
var fs = require('fs-extra');
var fs = require('fs');

module.exports = {
getTestConfig: function (mixin) {
Expand Down Expand Up @@ -95,7 +95,7 @@ module.exports = {

copyFile: function (from, to) {
return through.obj(function (file, encoding, callback) {
fs.copy(from, path.resolve(file.path, to), function (err) {
fs.copyFile(from, path.resolve(file.path, to), function (err) {
callback(err, file);
});
});
Expand Down Expand Up @@ -235,6 +235,6 @@ function logToFile(thing) {
var logPath = __dirname + '/../../logs';
var logFile = logPath + '/test.log';

fs.mkdirpSync(logPath);
fs.mkdirSync(logPath, { recursive: true });
fs.appendFileSync(logFile, '[' + new Date() + '] ' + text + '\n');
}
Loading