@putout/plugin-cloudcmd 3.1.0 → 4.0.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.
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
'
|
|
2
|
-
|
|
3
|
-
module.exports.report = () => 'IO.copy should be used instead of IO.cp';
|
|
1
|
+
export const report = () => 'IO.copy should be used instead of IO.cp';
|
|
4
2
|
|
|
5
3
|
const cpFrom = `
|
|
6
4
|
IO.cp({
|
|
@@ -12,6 +10,6 @@ const cpFrom = `
|
|
|
12
10
|
|
|
13
11
|
const cpTo = 'IO.copy(__a, __b, __c)';
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
export const replace = () => ({
|
|
16
14
|
[cpFrom]: cpTo,
|
|
17
15
|
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
'
|
|
2
|
-
|
|
3
|
-
module.exports.report = () => 'IO.move should be used instead of IO.mv';
|
|
1
|
+
export const report = () => 'IO.move should be used instead of IO.mv';
|
|
4
2
|
|
|
5
3
|
const mvFrom = `
|
|
6
4
|
IO.mv({
|
|
@@ -12,6 +10,6 @@ const mvFrom = `
|
|
|
12
10
|
|
|
13
11
|
const mvTo = 'IO.move(__a, __b, __c)';
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
export const replace = () => ({
|
|
16
14
|
[mvFrom]: mvTo,
|
|
17
15
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
'
|
|
1
|
+
export const report = () => 'IO.createDirectory should be used instead of IO.write';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports.match = () => ({
|
|
3
|
+
export const match = () => ({
|
|
6
4
|
'IO.write("__a")': ({__a}) => {
|
|
7
5
|
return __a.value.endsWith('?dir');
|
|
8
6
|
},
|
|
@@ -11,7 +9,7 @@ module.exports.match = () => ({
|
|
|
11
9
|
},
|
|
12
10
|
});
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
export const replace = () => ({
|
|
15
13
|
'IO.write(`${__a}?dir`)': 'IO.createDirectory(__a)',
|
|
16
14
|
'IO.write("__a")': ({__a}) => {
|
|
17
15
|
const value = __a.value.replace(/\?dir$/, '');
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
const {rename} = operator;
|
|
3
|
+
const {rename, remove} = operator;
|
|
5
4
|
|
|
6
5
|
const renameAll = (path) => {
|
|
7
|
-
debugger;
|
|
8
6
|
rename(path, 'loadDir', 'changeDir');
|
|
9
7
|
};
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
export const report = () => `Use 'CloudCmd.changeDir()' instead of 'CloudCmd.loadDir()'`;
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
export const replace = () => ({
|
|
14
12
|
'CloudCmd.loadDir({path})': 'CloudCmd.changeDir(path)',
|
|
15
13
|
'CloudCmd.loadDir({path: __a})': 'CloudCmd.changeDir(__a)',
|
|
16
14
|
'CloudCmd.loadDir(__object)': (vars, path) => {
|
|
17
|
-
convert(
|
|
15
|
+
convert(path);
|
|
18
16
|
path.node.callee.property.name = 'changeDir';
|
|
19
17
|
|
|
20
18
|
return path;
|
|
@@ -28,7 +26,7 @@ module.exports.replace = () => ({
|
|
|
28
26
|
return 'changeDir(path)';
|
|
29
27
|
},
|
|
30
28
|
'loadDir(__object)': (vars, path) => {
|
|
31
|
-
convert(
|
|
29
|
+
convert(path);
|
|
32
30
|
renameAll(path);
|
|
33
31
|
|
|
34
32
|
return path;
|
|
@@ -36,13 +34,13 @@ module.exports.replace = () => ({
|
|
|
36
34
|
'changeDir({path: __a})': 'changeDir(__a)',
|
|
37
35
|
'changeDir({path})': 'changeDir(path)',
|
|
38
36
|
'changeDir(__object)': (vars, path) => {
|
|
39
|
-
convert(
|
|
37
|
+
convert(path);
|
|
40
38
|
|
|
41
39
|
return path;
|
|
42
40
|
},
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
function convert(
|
|
43
|
+
function convert(path) {
|
|
46
44
|
const args = path.node.arguments;
|
|
47
45
|
const [obj] = path.get('arguments');
|
|
48
46
|
const properties = obj.get('properties');
|
|
@@ -52,7 +50,7 @@ function convert(vars, path) {
|
|
|
52
50
|
|
|
53
51
|
if (keyPath.isIdentifier({name: 'path'})) {
|
|
54
52
|
args.unshift(property.node.value);
|
|
55
|
-
|
|
53
|
+
remove(property);
|
|
56
54
|
break;
|
|
57
55
|
}
|
|
58
56
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as convertIoMvToIoMove from './convert-io-mv-to-io-move/index.js';
|
|
2
|
+
import * as convertIoCpToIoCopy from './convert-io-cp-to-io-copy/index.js';
|
|
3
|
+
import * as convertIoWriteToIoCreateDirectory from './convert-io-write-to-io-create-directory/index.js';
|
|
4
|
+
import * as convertLoadDirToChangeDir from './convert-load-dir-to-change-dir/index.js';
|
|
2
5
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
...getRule('convert-io-mv-to-io-move'),
|
|
9
|
-
...getRule('convert-io-cp-to-io-copy'),
|
|
10
|
-
...getRule('convert-io-write-to-io-create-directory'),
|
|
11
|
-
...getRule('convert-load-dir-to-change-dir'),
|
|
6
|
+
export const rules = {
|
|
7
|
+
'convert-io-mv-to-io-move': convertIoMvToIoMove,
|
|
8
|
+
'convert-io-cp-to-io-copy': convertIoCpToIoCopy,
|
|
9
|
+
'convert-io-write-to-io-create-directory': convertIoWriteToIoCreateDirectory,
|
|
10
|
+
'convert-load-dir-to-change-dir': convertLoadDirToChangeDir,
|
|
12
11
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-cloudcmd",
|
|
3
|
-
"version": "
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "4.0.0",
|
|
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",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-cloudcmd#readme",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"changelog": false,
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git://github.com/coderaiser/putout.git"
|
|
14
|
+
"url": "git+https://github.com/coderaiser/putout.git"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "madrun test",
|
|
@@ -31,23 +31,23 @@
|
|
|
31
31
|
"cloudcmd"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
+
"@putout/eslint-flat": "^3.0.0",
|
|
34
35
|
"@putout/plugin-remove-unused-expressions": "*",
|
|
35
36
|
"@putout/plugin-strict-mode": "*",
|
|
36
|
-
"@putout/test": "^
|
|
37
|
-
"c8": "^
|
|
38
|
-
"eslint": "^
|
|
39
|
-
"eslint-plugin-n": "^
|
|
40
|
-
"eslint-plugin-putout": "^
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"nodemon": "^2.0.1"
|
|
37
|
+
"@putout/test": "^13.0.0",
|
|
38
|
+
"c8": "^10.0.0",
|
|
39
|
+
"eslint": "^9.0.0",
|
|
40
|
+
"eslint-plugin-n": "^17.0.0",
|
|
41
|
+
"eslint-plugin-putout": "^26.0.0",
|
|
42
|
+
"madrun": "^11.0.0",
|
|
43
|
+
"nodemon": "^3.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"putout": ">=
|
|
46
|
+
"putout": ">=39"
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">=20"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|