@putout/operator-filesystem 3.6.0 → 3.7.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/README.md +19 -0
- package/lib/filesystem.js +2 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -64,6 +64,25 @@ const {findFile} = operator;
|
|
|
64
64
|
const coupleFiles = findFile(ast, ['/home/coderaiser', '/home/coderaiser/putout']);
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
### `getParentDirectory(filePath: FilePath): FilePath|null`
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
const {operator} = require('putout');
|
|
71
|
+
const {
|
|
72
|
+
createDirectory,
|
|
73
|
+
findFile,
|
|
74
|
+
getParentDirectory,
|
|
75
|
+
} = operator;
|
|
76
|
+
|
|
77
|
+
const [dirPath] = findFile(ast, 'hello');
|
|
78
|
+
|
|
79
|
+
const newDirectoryPath = createDirectory(dirPath, 'world');
|
|
80
|
+
|
|
81
|
+
dirPath === getParentDirectory(newDirectoryPath);
|
|
82
|
+
// returns
|
|
83
|
+
true;
|
|
84
|
+
```
|
|
85
|
+
|
|
67
86
|
### `getFilename(path: FilePath): string`
|
|
68
87
|
|
|
69
88
|
```js
|
package/lib/filesystem.js
CHANGED
|
@@ -287,7 +287,8 @@ module.exports.readFileContent = (filePath) => {
|
|
|
287
287
|
|
|
288
288
|
const filename = getFilename(filePath);
|
|
289
289
|
const fileContent = maybeFS.readFileContent(filename);
|
|
290
|
-
|
|
290
|
+
|
|
291
|
+
const property = createContentProperty(toBase64(fileContent));
|
|
291
292
|
|
|
292
293
|
filePath.node.properties.push(property);
|
|
293
294
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/operator-filesystem",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.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",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@putout/engine-parser": "^10.0.2",
|
|
40
40
|
"@putout/operator-json": "^1.3.0",
|
|
41
41
|
"@putout/test": "^8.0.0",
|
|
42
|
-
"c8": "^
|
|
43
|
-
"eslint": "^
|
|
44
|
-
"eslint-plugin-n": "^
|
|
42
|
+
"c8": "^9.0.0",
|
|
43
|
+
"eslint": "^9.0.0-alpha.0",
|
|
44
|
+
"eslint-plugin-n": "^17.0.0-0",
|
|
45
45
|
"eslint-plugin-putout": "^22.0.0",
|
|
46
46
|
"lerna": "^6.0.1",
|
|
47
47
|
"madrun": "^10.0.0",
|