@putout/operator-filesystem 2.9.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/filesystem.js +5 -2
- package/package.json +1 -1
package/lib/filesystem.js
CHANGED
|
@@ -104,6 +104,9 @@ module.exports.removeFile = (filePath) => {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
module.exports.moveFile = (filePath, dirPath) => {
|
|
107
|
+
if (filePath === dirPath)
|
|
108
|
+
return;
|
|
109
|
+
|
|
107
110
|
const dirname = getFilename(dirPath);
|
|
108
111
|
const filename = getFilename(filePath);
|
|
109
112
|
const dirPathFiles = getProperty(dirPath, 'files');
|
|
@@ -169,7 +172,7 @@ module.exports.createFile = (dirPath, name, content = '') => {
|
|
|
169
172
|
|
|
170
173
|
const dirPathFiles = getFiles(dirPath);
|
|
171
174
|
const parentFilename = getFilename(dirPath);
|
|
172
|
-
const filename =
|
|
175
|
+
const filename = join(parentFilename, name);
|
|
173
176
|
|
|
174
177
|
const typeProperty = createType('file');
|
|
175
178
|
const filenameProperty = createFilename(filename);
|
|
@@ -192,7 +195,7 @@ function getFiles(dirPath) {
|
|
|
192
195
|
module.exports.createDirectory = (dirPath, name) => {
|
|
193
196
|
const dirPathFiles = getFiles(dirPath);
|
|
194
197
|
const parentFilename = getFilename(dirPath);
|
|
195
|
-
const filename =
|
|
198
|
+
const filename = join(parentFilename, name);
|
|
196
199
|
|
|
197
200
|
const typeProperty = createType('directory');
|
|
198
201
|
const filesProperty = createFiles([]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-filesystem",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout operator adds ability to filesystem referenced variables that was not defined",
|