Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump deno std #117

Merged
merged 9 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deno_dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ To be added
## Projects using `eta`

- [Docusaurus v2](https://v2.docusaurus.io): open-source documentation framework that uses Eta to generate a SSR build
- [swagger-typescript-api](https://github.com/acacode/swagger-typescript-api): Open source typescript api codegenerator from Swagger. Uses Eta as codegenerator by templates
- [Add yours!](https://github.com/eta-dev/eta/edit/master/README.md)

## Contributors
Expand Down
4 changes: 2 additions & 2 deletions deno_dist/file-methods.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * as fs from "https://deno.land/std@0.66.0/fs/mod.ts";
export * as path from "https://deno.land/std@0.66.0/path/mod.ts";
export { existsSync } from "https://deno.land/std@0.97.0/fs/exists.ts";
export * as path from "https://deno.land/std@0.97.0/path/mod.ts";

export const readFileSync = Deno.readTextFileSync;
8 changes: 4 additions & 4 deletions deno_dist/file-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fs, path, readFileSync } from "./file-methods.ts";
import { existsSync, path, readFileSync } from "./file-methods.ts";
const _BOM = /^\uFEFF/;

// express is set like: app.engine('html', require('eta').renderFile)
Expand Down Expand Up @@ -106,7 +106,7 @@ function getPath(path: string, options: EtaConfig): string {

addPathToSearched(filePath);

return fs.existsSync(filePath);
return existsSync(filePath);
})
) {
// If the above returned true, we know that the filePath was just set to a path
Expand All @@ -118,7 +118,7 @@ function getPath(path: string, options: EtaConfig): string {

addPathToSearched(filePath);

if (fs.existsSync(filePath)) {
if (existsSync(filePath)) {
return filePath;
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ function getPath(path: string, options: EtaConfig): string {

addPathToSearched(filePath);

if (fs.existsSync(filePath)) {
if (existsSync(filePath)) {
includePath = filePath;
}
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"size": "size-limit",
"start": "rollup -c rollup.config.ts -w",
"test": "jest --coverage && npm run test:deno && npm run size",
"test:deno": "deno test test/deno/*.spec.ts --allow-read",
"test:deno": "deno test test/deno/*.spec.ts --allow-read --unstable",
"test:prod": "npm run lint && npm run test -- --no-cache",
"test:watch": "jest --coverage --watch",
"travis-deploy-once": "travis-deploy-once --pro"
Expand Down Expand Up @@ -156,13 +156,13 @@
"travis-deploy-once": "^5.0.11",
"ts-jest": "^26.3.0",
"ts-node": "^9.0.0",
"tslib": "^2.2.0",
"typedoc": "^0.19.1",
"typescript": "^4.0.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"dependencies": {}
}
}
4 changes: 2 additions & 2 deletions src/file-methods.deno.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { existsSync } from "https://deno.land/std@0.66.0/fs/exists.ts"
export * as path from "https://deno.land/std@0.66.0/path/mod.ts"
export { existsSync } from "https://deno.land/std@0.97.0/fs/exists.ts"
export * as path from "https://deno.land/std@0.97.0/path/mod.ts"

export const readFileSync = Deno.readTextFileSync
2 changes: 1 addition & 1 deletion test/deno/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'https://deno.land/std@0.67.0/testing/asserts.ts'
import { assertEquals } from 'https://deno.land/std@0.97.0/testing/asserts.ts'
import * as eta from '../../deno_dist/mod.ts'

Deno.test('simple render', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/deno/config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'https://deno.land/std@0.67.0/testing/asserts.ts'
import { assertEquals } from 'https://deno.land/std@0.97.0/testing/asserts.ts'
import * as eta from '../../deno_dist/mod.ts'

Deno.test('Renders a simple template with default env', () => {
Expand Down
14 changes: 7 additions & 7 deletions test/deno/file-helpers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { assertEquals, assertThrows } from 'https://deno.land/std@0.67.0/testing/asserts.ts'
import * as path from 'https://deno.land/std@0.66.0/path/mod.ts'
import { assertEquals, assertThrows } from 'https://deno.land/std@0.97.0/testing/asserts.ts'
import * as path from 'https://deno.land/std@0.97.0/path/mod.ts'
const __dirname = new URL('.', import.meta.url).pathname

import { render, templates, compile } from '../../deno_dist/mod.ts'

templates.define('test-template', compile('Saluton <%=it.name%>'))

Deno.test('include works', async () => {
Deno.test('include works', () => {
const renderedTemplate = render('<%~ include("test-template", it) %>', { name: 'Ada' })

assertEquals(renderedTemplate, 'Saluton Ada')
})

Deno.test('includeFile works w/ filename prop', async () => {
Deno.test('includeFile works w/ filename prop', () => {
const renderedTemplate = render(
'<%~ includeFile("simple", it) %>',
{ name: 'Ada' },
Expand All @@ -22,7 +22,7 @@ Deno.test('includeFile works w/ filename prop', async () => {
assertEquals(renderedTemplate, 'Hi Ada')
})

Deno.test('"E.includeFile" works with "views" array', async () => {
Deno.test('"E.includeFile" works with "views" array', () => {
const renderedTemplate = render(
'<%~ E.includeFile("randomtemplate", it) %>',
{ user: 'Ben' },
Expand All @@ -32,7 +32,7 @@ Deno.test('"E.includeFile" works with "views" array', async () => {
assertEquals(renderedTemplate, 'This is a random template. Hey Ben')
})

Deno.test('"includeFile" works with "views" array', async () => {
Deno.test('"includeFile" works with "views" array', () => {
const renderedTemplate = render(
'<%~ includeFile("randomtemplate", it) %>',
{ user: 'Ben' },
Expand All @@ -42,7 +42,7 @@ Deno.test('"includeFile" works with "views" array', async () => {
assertEquals(renderedTemplate, 'This is a random template. Hey Ben')
})

Deno.test('"includeFile" works with "views" string', async () => {
Deno.test('"includeFile" works with "views" string', () => {
const renderedTemplate = render(
'<%~ includeFile("randomtemplate", it) %>',
{ user: 'Ben' },
Expand Down
2 changes: 1 addition & 1 deletion test/deno/helpers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals, assertThrows } from 'https://deno.land/std@0.67.0/testing/asserts.ts'
import { assertEquals, assertThrows } from 'https://deno.land/std@0.97.0/testing/asserts.ts'
import { render } from '../../deno_dist/mod.ts'

// SHOULD TEST COMMON ETA USAGE PATTERNS HERE
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10373,6 +10373,11 @@ tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==

tslib@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==

tsutils@^3.17.1:
version "3.17.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
Expand Down