@putout/plugin-cloudcmd 4.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 +86 -11
- package/lib/apply-init-module/index.js +23 -0
- package/lib/convert-arrow-to-declaration/index.js +17 -0
- package/lib/index.js +4 -0
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @putout/plugin-cloudcmd [![NPM version][NPMIMGURL]][NPMURL]
|
|
2
2
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-cloudcmd.svg?style=flat&longCache=true
|
|
4
|
-
[NPMURL]: https://npmjs.org/package/@putout/plugin-cloudcmd"npm"
|
|
4
|
+
[NPMURL]: https://npmjs.org/package/@putout/plugin-cloudcmd "npm"
|
|
5
5
|
|
|
6
6
|
π[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to transform to new [Cloud Commander](https://cloudcmd.io) API.
|
|
7
7
|
|
|
@@ -11,24 +11,27 @@
|
|
|
11
11
|
npm i putout @putout/plugin-cloudcmd -D
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## Rules
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
```
|
|
16
|
+
- β
[apply-init-module](#apply-init-module);
|
|
17
|
+
- β
[convert-io-mv-to-io-move](#convert-io-mv-to-io-move);
|
|
18
|
+
- β
[convert-io-cp-to-io-copy](#convert-io-cp-to-io-copy);
|
|
19
|
+
- β
[convert-load-dir-to-change-dir](#convert-load-dir-to-change-dir);
|
|
20
|
+
- β
[convert-arrow-to-declaration](#convert-arrow-to-declaration);
|
|
23
21
|
|
|
24
|
-
##
|
|
22
|
+
## Config
|
|
25
23
|
|
|
26
24
|
```json
|
|
27
25
|
{
|
|
28
26
|
"rules": {
|
|
27
|
+
"cloudcmd/apply-init-module": "on",
|
|
29
28
|
"cloudcmd/convert-io-mv-to-io-move": "on",
|
|
30
29
|
"cloudcmd/convert-io-cp-to-io-copy": "on",
|
|
31
|
-
"cloudcmd/convert-load-dir-to-change-dir": "on"
|
|
30
|
+
"cloudcmd/convert-load-dir-to-change-dir": "on",
|
|
31
|
+
"cloudcmd/convert-arrow-to-declaration": "on"
|
|
32
|
+
},
|
|
33
|
+
"plugins": {
|
|
34
|
+
"cloudcmd": "on"
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
```
|
|
@@ -104,6 +107,78 @@ await CloudCmd.changeDir('/', {
|
|
|
104
107
|
});
|
|
105
108
|
```
|
|
106
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
|
+
|
|
136
|
+
# convert-arrow-to-declaration
|
|
137
|
+
|
|
138
|
+
Because right now all exported methods saved to global variable on top of a file.
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
CloudCmd.EditNamesVim = {
|
|
142
|
+
init,
|
|
143
|
+
show,
|
|
144
|
+
hide,
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Check out in π[Putout Editor](https://putout.cloudcmd.io/#/gist/8c21c0599b5d4d7c5faf49f3da604c9e/04a71d323fe1b0c25c1f34635c6f15eff805eff7).
|
|
149
|
+
|
|
150
|
+
## β Example of incorrect code
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
export const init = async (hello) => {
|
|
154
|
+
await CloudCmd.EditNames();
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const show = () => {
|
|
158
|
+
Events.addKey(listener);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const hide = () => {
|
|
162
|
+
CloudCmd.Edit.hide();
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## β
Example of correct code
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
export async function init(hello) {
|
|
170
|
+
await CloudCmd.EditNames();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function show() {
|
|
174
|
+
Events.addKey(listener);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function hide() {
|
|
178
|
+
CloudCmd.Edit.hide();
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
107
182
|
## License
|
|
108
183
|
|
|
109
184
|
MIT
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const report = () => `Use 'declaration' instead 'arrow' for 'init/show/hide'`;
|
|
2
|
+
|
|
3
|
+
export const match = () => ({
|
|
4
|
+
'export const __a = async (__args) => __body': isClientModule,
|
|
5
|
+
'export const __a = (__args) => __body': isClientModule,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const replace = () => ({
|
|
9
|
+
'export const __a = async (__args) => __body': 'export async function __a(__args) {__body}',
|
|
10
|
+
'export const __a = (__args) => __body': 'export function __a(__args) {__body}',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const isClientModule = ({__a}) => {
|
|
14
|
+
const {name} = __a;
|
|
15
|
+
|
|
16
|
+
return /^(init|show|hide)$/.test(name);
|
|
17
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as applyInitModule from './apply-init-module/index.js';
|
|
2
|
+
import * as convertArrowToDeclaration from './convert-arrow-to-declaration/index.js';
|
|
1
3
|
import * as convertIoMvToIoMove from './convert-io-mv-to-io-move/index.js';
|
|
2
4
|
import * as convertIoCpToIoCopy from './convert-io-cp-to-io-copy/index.js';
|
|
3
5
|
import * as convertIoWriteToIoCreateDirectory from './convert-io-write-to-io-create-directory/index.js';
|
|
@@ -8,4 +10,6 @@ export const rules = {
|
|
|
8
10
|
'convert-io-cp-to-io-copy': convertIoCpToIoCopy,
|
|
9
11
|
'convert-io-write-to-io-create-directory': convertIoWriteToIoCreateDirectory,
|
|
10
12
|
'convert-load-dir-to-change-dir': convertLoadDirToChangeDir,
|
|
13
|
+
'convert-arrow-to-declaration': convertArrowToDeclaration,
|
|
14
|
+
'apply-init-module': applyInitModule,
|
|
11
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-cloudcmd",
|
|
3
|
-
"version": "
|
|
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",
|
|
@@ -31,23 +31,22 @@
|
|
|
31
31
|
"cloudcmd"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@putout/eslint-flat": "^
|
|
34
|
+
"@putout/eslint-flat": "^4.0.0",
|
|
35
35
|
"@putout/plugin-remove-unused-expressions": "*",
|
|
36
|
-
"@putout/
|
|
37
|
-
"@putout/test": "^13.0.0",
|
|
36
|
+
"@putout/test": "^15.0.0",
|
|
38
37
|
"c8": "^10.0.0",
|
|
39
|
-
"eslint": "^
|
|
38
|
+
"eslint": "^10.0.0-alpha.0",
|
|
40
39
|
"eslint-plugin-n": "^17.0.0",
|
|
41
|
-
"eslint-plugin-putout": "^
|
|
42
|
-
"madrun": "^
|
|
40
|
+
"eslint-plugin-putout": "^30.0.0",
|
|
41
|
+
"madrun": "^12.0.0",
|
|
43
42
|
"nodemon": "^3.0.1"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
|
-
"putout": ">=
|
|
45
|
+
"putout": ">=41"
|
|
47
46
|
},
|
|
48
47
|
"license": "MIT",
|
|
49
48
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
49
|
+
"node": ">=22"
|
|
51
50
|
},
|
|
52
51
|
"publishConfig": {
|
|
53
52
|
"access": "public"
|