Skip to content

Commit 9a9b5fa

Browse files
refactor: remove prettier from package
1 parent ae47626 commit 9a9b5fa

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Convert swagger json api to js (with types fo typescript)
55
## Install
66

77
```sh
8-
npm install -g swagger-to-js
8+
npm install swagger-to-js
99
# or
10-
yarn global add swagger-to-js
10+
yarn add swagger-to-js
1111
```
1212

1313
## Usage CLI
1414

1515
```sh
16-
swagger-to-js [options]
16+
yarn swagger-to-js [options]
1717

1818
Options:
1919
--file <path> Path swagger JSON file with api

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@
2828
"swagger-to-js": "./src/run.js"
2929
},
3030
"dependencies": {
31-
"@babel/parser": "^7.9.6",
32-
"commander": "^5.1.0",
33-
"prettier": "^2.0.5"
31+
"commander": "^5.1.0"
3432
},
3533
"devDependencies": {
3634
"eslint": "^6.8.0",
3735
"eslint-plugin-prettier": "^3.1.3",
38-
"jest": "^25.5.3"
36+
"jest": "^25.5.3",
37+
"prettier": "^2.0.5"
3938
},
4039
"swagger-to-js": {
4140
"file": "./src/mocks/mock-v1.json"

src/index.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const prettier = require("prettier");
21
const { readFileSync } = require("fs");
32
const path = require("path");
43

@@ -25,14 +24,8 @@ function swaggerToJs(apiJson, config = {}) {
2524
const pathRequestCode = path.resolve(path.dirname(__filename), "request.js");
2625
const requestCode = readFileSync(pathRequestCode);
2726

28-
const code = prettier.format(`${requestCode}\n\n${paths.code}`, {
29-
...prettierOptions,
30-
parser: "babel",
31-
});
32-
const types = prettier.format(`${definitions}\n\n${paths.types}`, {
33-
...prettierOptions,
34-
parser: "typescript",
35-
});
27+
const code = `${requestCode}\n\n${paths.code}`;
28+
const types = `${definitions}\n\n${paths.types}`;
3629

3730
console.timeEnd("✨ swaggerapi");
3831

@@ -121,9 +114,9 @@ function printPathCode(scope, config) {
121114
const addedParamsString = addedParams ? `, ${addedParams}` : "";
122115

123116
return `export function ${name}(${params}) {
124-
${deprecatedWarning}
125-
return request("${method}", \`${url}\`${addedParamsString})(${params});
126-
}\n\n`;
117+
${deprecatedWarning}
118+
return request("${method}", \`${url}\`${addedParamsString})(${params});
119+
}\n\n`;
127120
}
128121

129122
function printPathCodeAddedParams(scope) {

0 commit comments

Comments
 (0)