Skip to content

Commit

Permalink
Release 0.10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
syumai committed Apr 29, 2022
1 parent fe96e3d commit 926d47d
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 28 deletions.
17 changes: 14 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
Copyright 2018-present [syumai](https://github.com/syumai/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

[![Build Status](https://github.com/syumai/dejs/workflows/test/badge.svg?branch=master)](https://github.com/syumai/dejs/actions)

- [ejs](https://ejs.co) template engine for [deno](https://github.com/denoland/deno).
- [ejs](https://ejs.co) template engine for
[deno](https://github.com/denoland/deno).

## Features

Expand All @@ -21,18 +22,18 @@
## Usage

```ts
import * as dejs from "https://deno.land/x/[email protected].2/mod.ts";
import * as dejs from "https://deno.land/x/[email protected].3/mod.ts";
```

- **`renderFile`**`(filePath: string, params: Params): Promise<Deno.Reader>`
- **`renderFile`** `(filePath: string, params: Params): Promise<Deno.Reader>`
- renders from file, outputs Deno.Reader
- **`render`**`(body: string, params: Params): Promise<Deno.Reader>`
- **`render`** `(body: string, params: Params): Promise<Deno.Reader>`
- renders from string, outputs Deno.Reader
- **`renderFileToString`**`(filePath: string, params: Params): Promise<string>`
- **`renderFileToString`** `(filePath: string, params: Params): Promise<string>`
- renders from file, outputs string
- **`renderToString`**`(body: string, params: Params): Promise<string>`
- **`renderToString`** `(body: string, params: Params): Promise<string>`
- renders from string, outputs string
- **`compile`**`(reader: Reader): Promise<Template>`
- **`compile`** `(reader: Reader): Promise<Template>`
- only compiles ejs and returns `Template(params: Params): string`
- use this to cache compiled result of ejs

Expand All @@ -56,7 +57,7 @@ import { renderFile } from "https://deno.land/x/dejs/mod.ts";

(async () => {
const output = await renderFile(`${cwd()}/template.ejs`, {
name: "world"
name: "world",
});
await copy(output, stdout);
})();
Expand Down Expand Up @@ -87,7 +88,7 @@ const template = `<body>

(async () => {
const output = await render(template, {
name: "world"
name: "world",
});
await copy(output, stdout);
})();
Expand All @@ -96,7 +97,8 @@ const template = `<body>
### Include partial ejs template

- To include template from other file, use `include` function in ejs.
- `include` resolves views from relative path from **executed ts / js file**. (not from ejs template file).
- `include` resolves views from relative path from **executed ts / js file**.
(not from ejs template file).
- This behavior may change in the future.

#### Usage
Expand Down
4 changes: 2 additions & 2 deletions dem.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"protocol": "https",
"path": "deno.land/std",
"version": "0.113.0",
"version": "0.137.0",
"files": [
"/io/buffer.ts",
"/io/bufio.ts",
Expand All @@ -21,4 +21,4 @@
}
],
"aliases": {}
}
}
12 changes: 6 additions & 6 deletions egg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "dejs",
"description": "ejs template engine for deno.",
"homepage": "https://github.com/syumai/dejs",
"files": [
"name": "dejs",
"description": "ejs template engine for deno.",
"homepage": "https://github.com/syumai/dejs",
"files": [
"./**/*.ts",
"README.md"
],
"entry": "./mod.ts"
],
"entry": "./mod.ts"
}
6 changes: 3 additions & 3 deletions mod_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { Buffer, copy, cwd } = Deno;
import {
assertEquals,
assertThrowsAsync,
assertRejects,
} from "./vendor/https/deno.land/std/testing/asserts.ts";
import { readAll } from "./vendor/https/deno.land/std/io/util.ts";
import * as dejs from "./mod.ts";
Expand Down Expand Up @@ -124,8 +124,8 @@ const decoder = new TextDecoder("utf-8");
fn: async () => {
const buf = new Buffer();
if (tc.error) {
assertThrowsAsync(
() => dejs.render(tc.body, { param: tc.param }),
assertRejects(
async () => await dejs.render(tc.body, { param: tc.param }),
tc.error,
tc.expected,
);
Expand Down
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/io/buffer.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@0.113.0/io/buffer.ts";
export * from "https://deno.land/std@0.137.0/io/buffer.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/io/bufio.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@0.113.0/io/bufio.ts";
export * from "https://deno.land/std@0.137.0/io/bufio.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/io/util.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@0.113.0/io/util.ts";
export * from "https://deno.land/std@0.137.0/io/util.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/testing/asserts.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@0.113.0/testing/asserts.ts";
export * from "https://deno.land/std@0.137.0/testing/asserts.ts";

0 comments on commit 926d47d

Please sign in to comment.