@putout/plugin-cloudcmd 2.0.0 → 3.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.
package/README.md CHANGED
@@ -75,7 +75,6 @@ await IO.copy(dirPath, mp3Dir, mp3Names);
75
75
 
76
76
  ```js
77
77
  await IO.write(`${mp3Dir}?dir`);
78
-
79
78
  ```
80
79
 
81
80
  ## ✅ Example of correct code
@@ -95,13 +94,12 @@ await CloudCmd.loadDir({
95
94
  path: '/',
96
95
  panel,
97
96
  });
98
-
99
97
  ```
100
98
 
101
99
  ## ✅ Example of correct code
102
100
 
103
101
  ```js
104
- await CloudCmd.changeDir(path, {
102
+ await CloudCmd.changeDir('/', {
105
103
  panel,
106
104
  });
107
105
  ```
@@ -22,4 +22,3 @@ module.exports.replace = () => ({
22
22
  return `IO.createDirectory('${value}')`;
23
23
  },
24
24
  });
25
-
@@ -1,11 +1,18 @@
1
1
  'use strict';
2
2
 
3
- const rename = (path) => path.scope.rename('loadDir', 'changeDir');
3
+ const {operator} = require('putout');
4
+ const {rename} = operator;
5
+
6
+ const renameAll = (path) => {
7
+ const program = path.scope.getProgramParent().path;
8
+ rename(program, 'loadDir', 'changeDir');
9
+ };
4
10
 
5
11
  module.exports.report = () => `Use 'CloudCmd.changeDir()' instead of 'CloudCmd.loadDir()'`;
6
12
 
7
13
  module.exports.replace = () => ({
8
14
  'CloudCmd.loadDir({path})': 'CloudCmd.changeDir(path)',
15
+ 'CloudCmd.loadDir({path: __a})': 'CloudCmd.changeDir(__a)',
9
16
  'CloudCmd.loadDir(__object)': (vars, path) => {
10
17
  convert(vars, path);
11
18
  path.node.callee.property.name = 'changeDir';
@@ -13,16 +20,16 @@ module.exports.replace = () => ({
13
20
  return path;
14
21
  },
15
22
  'loadDir({path: __a})': (vars, path) => {
16
- rename(path);
23
+ renameAll(path);
17
24
  return 'changeDir(__a)';
18
25
  },
19
26
  'loadDir({path})': (vars, path) => {
20
- rename(path);
27
+ renameAll(path);
21
28
  return 'changeDir(path)';
22
29
  },
23
30
  'loadDir(__object)': (vars, path) => {
24
31
  convert(vars, path);
25
- rename(path);
32
+ renameAll(path);
26
33
 
27
34
  return path;
28
35
  },
@@ -50,4 +57,3 @@ function convert(vars, path) {
50
57
  }
51
58
  }
52
59
  }
53
-
package/lib/index.js CHANGED
@@ -10,4 +10,3 @@ module.exports.rules = {
10
10
  ...getRule('convert-io-write-to-io-create-directory'),
11
11
  ...getRule('convert-load-dir-to-change-dir'),
12
12
  };
13
-
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@putout/plugin-cloudcmd",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "type": "commonjs",
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",
8
8
  "main": "lib/index.js",
9
- "commitType": "colon",
10
9
  "release": false,
11
10
  "tag": false,
12
11
  "changelog": false,
@@ -34,17 +33,17 @@
34
33
  "devDependencies": {
35
34
  "@putout/plugin-remove-unused-expressions": "*",
36
35
  "@putout/plugin-strict-mode": "*",
37
- "@putout/test": "^5.0.0",
36
+ "@putout/test": "^6.0.0",
38
37
  "c8": "^7.5.0",
39
38
  "eslint": "^8.0.1",
40
- "eslint-plugin-n": "^15.2.4",
41
- "eslint-plugin-putout": "^16.0.0",
39
+ "eslint-plugin-n": "^16.0.0",
40
+ "eslint-plugin-putout": "^17.0.0",
42
41
  "lerna": "^6.0.1",
43
42
  "madrun": "^9.0.0",
44
43
  "nodemon": "^2.0.1"
45
44
  },
46
45
  "peerDependencies": {
47
- "putout": ">=28"
46
+ "putout": ">=29"
48
47
  },
49
48
  "license": "MIT",
50
49
  "engines": {