Comparing version 0.9.2 to 0.9.3
@@ -34,2 +34,3 @@ import { EngineMap } from "./engineMap"; | ||
private writeFile; | ||
ensureFilePath(path: string): Promise<void>; | ||
getEngineByFilePath(filePath: string): string; | ||
@@ -36,0 +37,0 @@ isValidEngine(engineName?: string): Boolean; |
@@ -109,6 +109,12 @@ "use strict"; | ||
if (filePath) { | ||
await fs.ensureFile(filePath); | ||
await this.ensureFilePath(filePath); | ||
await fs.writeFile(filePath, source); | ||
} | ||
} | ||
async ensureFilePath(path) { | ||
let pathList = path.split("/"); | ||
pathList.pop(); | ||
let dir = pathList.join("/"); | ||
await fs.ensureDir(dir); | ||
} | ||
getEngineByFilePath(filePath) { | ||
@@ -115,0 +121,0 @@ let result = this.__defaultEngine; |
@@ -140,2 +140,13 @@ "use strict"; | ||
}); | ||
test("write via ejs with long path", async () => { | ||
let ecto = new ecto_1.Ecto(); | ||
let filePath = testOutputDir + "/ejs/foo/wow/ecto-ejs-test.html"; | ||
if (await fs.pathExists(filePath)) { | ||
await fs.remove(filePath); | ||
} | ||
await ecto.render(ejsExampleSource, ejsExampleData, "ejs", undefined, filePath); | ||
let fileSource = await fs.readFile(filePath, "utf8"); | ||
expect(fileSource).toBe("<h2>bar</h2>"); | ||
await fs.remove(testOutputDir); | ||
}); | ||
test("Render from Template - EJS", async () => { | ||
@@ -142,0 +153,0 @@ let ecto = new ecto_1.Ecto(); |
{ | ||
"name": "ecto", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Modern Template Consolidation Engine for EJS, Markdown, Pug, Nunjucks, and Handlebars", | ||
@@ -5,0 +5,0 @@ "main": "./dist/ecto.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103561
1164