swaggie 0.7.0-alpha.3 → 0.7.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.
@@ -2,20 +2,18 @@
2
2
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
3
3
  var _eta = require('eta'); var Eta = _interopRequireWildcard(_eta);
4
4
 
5
- let templatesDir = null;
6
-
7
5
  function loadAllTemplateFiles(templateName) {
8
6
  if (!templateName) {
9
7
  throw new Error(`No template name was provided`);
10
8
  }
11
9
 
12
- templatesDir = _fs2.default.existsSync(templateName)
10
+ const templatesDir = _fs2.default.existsSync(templateName)
13
11
  ? templateName
14
12
  : _path2.default.join(__dirname, '..', '..', 'templates', templateName);
15
13
 
16
14
  if (!_fs2.default.existsSync(templatesDir)) {
17
15
  throw new Error(
18
- `Could not found directory with the template (we tried ${templatesDir}). Template name is correct?`,
16
+ `Could not found directory with the template (we tried ${templatesDir}). Template name is correct?`
19
17
  );
20
18
  }
21
19
  const templates = _fs2.default.readdirSync(templatesDir);
@@ -28,6 +26,6 @@ let templatesDir = null;
28
26
  } exports.loadAllTemplateFiles = loadAllTemplateFiles;
29
27
 
30
28
  function renderFile(templateFile, data = {}) {
31
- const filePath = _path2.default.join(templatesDir, templateFile);
32
- return Eta.renderFile(filePath, data);
29
+ const template = Eta.templates.get(templateFile);
30
+ return Eta.render(template, data);
33
31
  } exports.renderFile = renderFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swaggie",
3
- "version": "0.7.0-alpha.3",
3
+ "version": "0.7.0",
4
4
  "description": "Generate ES6 or TypeScript service integration code from an OpenAPI spec",
5
5
  "author": {
6
6
  "name": "Piotr Dabrowski",