@putout/operator-filesystem 2.9.0 → 2.9.2

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 CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const {join} = require('node:path');
3
4
  const tryCatch = require('try-catch');
4
5
  const {types} = require('putout');
5
6
 
@@ -112,7 +113,7 @@ module.exports.moveFile = (filePath, dirPath) => {
112
113
  .split('/')
113
114
  .pop();
114
115
 
115
- const newFilename = `${dirname}/${basename}`;
116
+ const newFilename = join(dirname, basename);
116
117
 
117
118
  maybeRemoveFile(dirPath, newFilename);
118
119
 
@@ -131,7 +132,7 @@ module.exports.copyFile = (filePath, dirPath) => {
131
132
  .split('/')
132
133
  .pop();
133
134
 
134
- const newFilename = `${dirname}/${basename}`;
135
+ const newFilename = join(dirname, basename);
135
136
  const [hasContent, content] = getFileContent(filePath);
136
137
 
137
138
  const copiedFile = ObjectExpression([
@@ -168,7 +169,7 @@ module.exports.createFile = (dirPath, name, content = '') => {
168
169
 
169
170
  const dirPathFiles = getFiles(dirPath);
170
171
  const parentFilename = getFilename(dirPath);
171
- const filename = `${parentFilename}/${name}`;
172
+ const filename = join(parentFilename, name);
172
173
 
173
174
  const typeProperty = createType('file');
174
175
  const filenameProperty = createFilename(filename);
@@ -191,7 +192,7 @@ function getFiles(dirPath) {
191
192
  module.exports.createDirectory = (dirPath, name) => {
192
193
  const dirPathFiles = getFiles(dirPath);
193
194
  const parentFilename = getFilename(dirPath);
194
- const filename = `${parentFilename}/${name}`;
195
+ const filename = join(parentFilename, name);
195
196
 
196
197
  const typeProperty = createType('directory');
197
198
  const filesProperty = createFiles([]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/operator-filesystem",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
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",