@putout/plugin-cloudcmd 5.0.0 → 5.2.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 +49 -10
- package/lib/apply-init-module/index.js +23 -0
- package/lib/convert-io-delete-to-io-remove/index.js +6 -0
- package/lib/index.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,30 +13,27 @@ npm i putout @putout/plugin-cloudcmd -D
|
|
|
13
13
|
|
|
14
14
|
## Rules
|
|
15
15
|
|
|
16
|
+
- ✅ [apply-init-module](#apply-init-module);
|
|
16
17
|
- ✅ [convert-io-mv-to-io-move](#convert-io-mv-to-io-move);
|
|
17
18
|
- ✅ [convert-io-cp-to-io-copy](#convert-io-cp-to-io-copy);
|
|
19
|
+
- ✅ [convert-io-delete-to-io-remove](#convert-io-delete-to-io-remove);
|
|
18
20
|
- ✅ [convert-load-dir-to-change-dir](#convert-load-dir-to-change-dir);
|
|
19
21
|
- ✅ [convert-arrow-to-declaration](#convert-arrow-to-declaration);
|
|
20
22
|
|
|
21
23
|
## Config
|
|
22
24
|
|
|
23
|
-
```json
|
|
24
|
-
{
|
|
25
|
-
"plugins": {
|
|
26
|
-
"cloudcmd": "on"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Rules
|
|
32
|
-
|
|
33
25
|
```json
|
|
34
26
|
{
|
|
35
27
|
"rules": {
|
|
28
|
+
"cloudcmd/apply-init-module": "on",
|
|
36
29
|
"cloudcmd/convert-io-mv-to-io-move": "on",
|
|
37
30
|
"cloudcmd/convert-io-cp-to-io-copy": "on",
|
|
31
|
+
"cloudcmd/convert-io-delete-to-io-remove": "on",
|
|
38
32
|
"cloudcmd/convert-load-dir-to-change-dir": "on",
|
|
39
33
|
"cloudcmd/convert-arrow-to-declaration": "on"
|
|
34
|
+
},
|
|
35
|
+
"plugins": {
|
|
36
|
+
"cloudcmd": "on"
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
```
|
|
@@ -59,6 +56,22 @@ await IO.mv({
|
|
|
59
56
|
await IO.move(dirPath, mp3Dir, mp3Names);
|
|
60
57
|
```
|
|
61
58
|
|
|
59
|
+
# convert-io-delete-to-io-remove
|
|
60
|
+
|
|
61
|
+
## ❌ Example of incorrect code
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
await IO.delete('/tmp', ['1.txt']);
|
|
65
|
+
await IO.delete('/tmp');
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## ✅ Example of correct code
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
await IO.remove('/tmp', ['1.txt']);
|
|
72
|
+
await IO.remove('/tmp');
|
|
73
|
+
```
|
|
74
|
+
|
|
62
75
|
# convert-io-cp-to-io-copy
|
|
63
76
|
|
|
64
77
|
## ❌ Example of incorrect code
|
|
@@ -112,6 +125,32 @@ await CloudCmd.changeDir('/', {
|
|
|
112
125
|
});
|
|
113
126
|
```
|
|
114
127
|
|
|
128
|
+
# apply-init-module
|
|
129
|
+
|
|
130
|
+
Check out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/c36edca65befaf11028c3f0863528a8a/e90bd5a9c6423c5e64c44f00bd6c204c695904a4).
|
|
131
|
+
|
|
132
|
+
## ❌ Example of incorrect code
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
CloudCmd.EditFileVim = exports;
|
|
136
|
+
CloudCmd[NAME] = exports;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## ✅ Example of correct code
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
CloudCmd.EditFileVim = {
|
|
143
|
+
init,
|
|
144
|
+
show,
|
|
145
|
+
hide,
|
|
146
|
+
};
|
|
147
|
+
CloudCmd.NAME = {
|
|
148
|
+
init,
|
|
149
|
+
show,
|
|
150
|
+
hide,
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
|
|
115
154
|
# convert-arrow-to-declaration
|
|
116
155
|
|
|
117
156
|
Because right now all exported methods saved to global variable on top of a file.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {operator} from 'putout';
|
|
2
|
+
|
|
3
|
+
const {isESM} = operator;
|
|
4
|
+
|
|
5
|
+
export const report = () => `Use 'init/show/hide' instead of 'exports'`;
|
|
6
|
+
|
|
7
|
+
export const match = () => ({
|
|
8
|
+
'CloudCmd.__a = exports': (vars, path) => isESM(path),
|
|
9
|
+
'CloudCmd[__a] = exports': (vars, path) => isESM(path),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const replace = () => ({
|
|
13
|
+
'CloudCmd.__a = exports': `CloudCmd.__a = {
|
|
14
|
+
init,
|
|
15
|
+
show,
|
|
16
|
+
hide,
|
|
17
|
+
}`,
|
|
18
|
+
'CloudCmd[__a] = exports': `CloudCmd.__a = {
|
|
19
|
+
init,
|
|
20
|
+
show,
|
|
21
|
+
hide,
|
|
22
|
+
}`,
|
|
23
|
+
});
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as convertIoDeleteToIoRemove from './convert-io-delete-to-io-remove/index.js';
|
|
2
|
+
import * as applyInitModule from './apply-init-module/index.js';
|
|
1
3
|
import * as convertArrowToDeclaration from './convert-arrow-to-declaration/index.js';
|
|
2
4
|
import * as convertIoMvToIoMove from './convert-io-mv-to-io-move/index.js';
|
|
3
5
|
import * as convertIoCpToIoCopy from './convert-io-cp-to-io-copy/index.js';
|
|
@@ -10,4 +12,6 @@ export const rules = {
|
|
|
10
12
|
'convert-io-write-to-io-create-directory': convertIoWriteToIoCreateDirectory,
|
|
11
13
|
'convert-load-dir-to-change-dir': convertLoadDirToChangeDir,
|
|
12
14
|
'convert-arrow-to-declaration': convertArrowToDeclaration,
|
|
15
|
+
'apply-init-module': applyInitModule,
|
|
16
|
+
'convert-io-delete-to-io-remove': convertIoDeleteToIoRemove,
|
|
13
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-cloudcmd",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds ability to transform code to new API of Cloud Commander",
|