@putout/plugin-cloudcmd 5.0.0 → 5.1.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 +31 -10
- package/lib/apply-init-module/index.js +23 -0
- package/lib/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ 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);
|
|
18
19
|
- ✅ [convert-load-dir-to-change-dir](#convert-load-dir-to-change-dir);
|
|
@@ -20,23 +21,17 @@ npm i putout @putout/plugin-cloudcmd -D
|
|
|
20
21
|
|
|
21
22
|
## Config
|
|
22
23
|
|
|
23
|
-
```json
|
|
24
|
-
{
|
|
25
|
-
"plugins": {
|
|
26
|
-
"cloudcmd": "on"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Rules
|
|
32
|
-
|
|
33
24
|
```json
|
|
34
25
|
{
|
|
35
26
|
"rules": {
|
|
27
|
+
"cloudcmd/apply-init-module": "on",
|
|
36
28
|
"cloudcmd/convert-io-mv-to-io-move": "on",
|
|
37
29
|
"cloudcmd/convert-io-cp-to-io-copy": "on",
|
|
38
30
|
"cloudcmd/convert-load-dir-to-change-dir": "on",
|
|
39
31
|
"cloudcmd/convert-arrow-to-declaration": "on"
|
|
32
|
+
},
|
|
33
|
+
"plugins": {
|
|
34
|
+
"cloudcmd": "on"
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
37
|
```
|
|
@@ -112,6 +107,32 @@ await CloudCmd.changeDir('/', {
|
|
|
112
107
|
});
|
|
113
108
|
```
|
|
114
109
|
|
|
110
|
+
# apply-init-module
|
|
111
|
+
|
|
112
|
+
Check out in 🐊[Putout Editor](https://putout.cloudcmd.io/#/gist/c36edca65befaf11028c3f0863528a8a/e90bd5a9c6423c5e64c44f00bd6c204c695904a4).
|
|
113
|
+
|
|
114
|
+
## ❌ Example of incorrect code
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
CloudCmd.EditFileVim = exports;
|
|
118
|
+
CloudCmd[NAME] = exports;
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## ✅ Example of correct code
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
CloudCmd.EditFileVim = {
|
|
125
|
+
init,
|
|
126
|
+
show,
|
|
127
|
+
hide,
|
|
128
|
+
};
|
|
129
|
+
CloudCmd.NAME = {
|
|
130
|
+
init,
|
|
131
|
+
show,
|
|
132
|
+
hide,
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
115
136
|
# convert-arrow-to-declaration
|
|
116
137
|
|
|
117
138
|
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,4 @@
|
|
|
1
|
+
import * as applyInitModule from './apply-init-module/index.js';
|
|
1
2
|
import * as convertArrowToDeclaration from './convert-arrow-to-declaration/index.js';
|
|
2
3
|
import * as convertIoMvToIoMove from './convert-io-mv-to-io-move/index.js';
|
|
3
4
|
import * as convertIoCpToIoCopy from './convert-io-cp-to-io-copy/index.js';
|
|
@@ -10,4 +11,5 @@ export const rules = {
|
|
|
10
11
|
'convert-io-write-to-io-create-directory': convertIoWriteToIoCreateDirectory,
|
|
11
12
|
'convert-load-dir-to-change-dir': convertLoadDirToChangeDir,
|
|
12
13
|
'convert-arrow-to-declaration': convertArrowToDeclaration,
|
|
14
|
+
'apply-init-module': applyInitModule,
|
|
13
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-cloudcmd",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.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",
|