swagger-typescript-api 11.0.1 → 11.0.2

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/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # next release
2
2
 
3
- # 11.0.1
3
+ # 11.0.2
4
4
 
5
5
  - fix: problems with --http-client option in `generate-templates` command
6
- - fix: rewrite file content in `generate-templates` command
6
+ - fix: rewrite file content in `generate-templates` command (`--rewrite` flag)
7
7
 
8
8
  # 11.0.0
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-typescript-api",
3
- "version": "11.0.1",
3
+ "version": "11.0.2",
4
4
  "description": "Generate typescript/javascript api from swagger schema",
5
5
  "scripts": {
6
6
  "cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts",
@@ -62,27 +62,31 @@ class TemplatesGenProcess {
62
62
  const templateEjsPathExist = this.fileSystem.pathIsExist(templateEjsPath);
63
63
  const templateEtaPathExist = this.fileSystem.pathIsExist(templateEtaPath);
64
64
 
65
- if (this.config.rewrite || (!templateEjsPathExist && !templateEtaPathExist)) {
65
+ const templateNotExist = !templateEjsPathExist && !templateEtaPathExist;
66
+
67
+ if (templateNotExist) {
66
68
  this.fileSystem.createFile({
67
69
  path: outputPath,
68
70
  fileName: template.name,
69
71
  content: template.content,
70
72
  withPrefix: false,
71
73
  });
72
- } else if (templateEjsPathExist) {
73
- this.fileSystem.createFile({
74
- path: outputPath,
75
- fileName: `${templateName}.ejs`,
76
- content: template.content,
77
- withPrefix: false,
78
- });
79
- } else if (templateEtaPathExist) {
80
- this.fileSystem.createFile({
81
- path: outputPath,
82
- fileName: `${templateName}.eta`,
83
- content: template.content,
84
- withPrefix: false,
85
- });
74
+ } else if (this.config.rewrite) {
75
+ if (templateEjsPathExist) {
76
+ this.fileSystem.createFile({
77
+ path: outputPath,
78
+ fileName: `${templateName}.ejs`,
79
+ content: template.content,
80
+ withPrefix: false,
81
+ });
82
+ } else if (templateEtaPathExist) {
83
+ this.fileSystem.createFile({
84
+ path: outputPath,
85
+ fileName: `${templateName}.eta`,
86
+ content: template.content,
87
+ withPrefix: false,
88
+ });
89
+ }
86
90
  }
87
91
  });
88
92