diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b12f05..f6aa653 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,6 +26,8 @@ jobs: run: | make mod.ts git diff --exit-code + - name: Check license + run: deno --allow-read tools/license_checker.ts - name: Run Tests run: | make test diff --git a/.licenserc.json b/.licenserc.json index f25e2be..ec432a7 100644 --- a/.licenserc.json +++ b/.licenserc.json @@ -1,4 +1,4 @@ { - "**/*.ts": "// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license.", - "ignore": ["tests.ts", "vendor/", "fixtures/", "types/"] + "**/*.ts": "// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license.", + "ignore": ["mod.ts", "vendor/", "tools/", "fixtures/", "types/"] } diff --git a/Makefile b/Makefile index 23ea1dc..ac11fe0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,4 @@ _: deno.d.ts tsconfig.json -check: - deno --allow-read --allow-run --allow-write https://denopkg.com/kt3k/deno_license_checker@v2.0.0/main.ts --inject deno.d.ts: deno --types > deno.d.ts tsconfig.json: diff --git a/agent.ts b/agent.ts index a1e69a7..67ba0e1 100644 --- a/agent.ts +++ b/agent.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { ClientResponse } from "./server.ts"; import { assert } from "./vendor/https/deno.land/std/testing/asserts.ts"; import { readResponse, writeRequest } from "./serveio.ts"; diff --git a/agent_test.ts b/agent_test.ts index 6a6614f..49388c7 100644 --- a/agent_test.ts +++ b/agent_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { encode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; import { createAgent } from "./agent.ts"; import { createApp } from "./app.ts"; diff --git a/app.ts b/app.ts index 236a193..962922c 100644 --- a/app.ts +++ b/app.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { listenAndServe, listenAndServeTLS, diff --git a/app_test.ts b/app_test.ts index 707762f..f521c13 100644 --- a/app_test.ts +++ b/app_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, App } from "./app.ts"; import { assertEquals, diff --git a/benchmark/listen_bench.ts b/benchmark/listen_bench.ts index 55b9e96..9d7422d 100755 --- a/benchmark/listen_bench.ts +++ b/benchmark/listen_bench.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { listenAndServe } from "../server.ts"; const addr = Deno.args[1] || "127.0.0.1:4500"; diff --git a/benchmark/listen_file_bench.ts b/benchmark/listen_file_bench.ts index 3bb0630..e6f6e84 100644 --- a/benchmark/listen_file_bench.ts +++ b/benchmark/listen_file_bench.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { listenAndServe } from "../server.ts"; const addr = Deno.args[1] || "127.0.0.1:4500"; diff --git a/benchmark/main.ts b/benchmark/main.ts index 893fc9f..ee6ad8e 100644 --- a/benchmark/main.ts +++ b/benchmark/main.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. export async function main() { const tgt = Deno.env()["TARGET"]; console.log("start benching for " + tgt); diff --git a/benchmark/router_bench.ts b/benchmark/router_bench.ts index acbf157..bfc7ea3 100755 --- a/benchmark/router_bench.ts +++ b/benchmark/router_bench.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { createRouter } from "../router.ts"; diff --git a/benchmark/std_bench.ts b/benchmark/std_bench.ts index 0a7a174..d68fe79 100644 --- a/benchmark/std_bench.ts +++ b/benchmark/std_bench.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { serve } from "https://deno.land/std@v0.32.0/http/server.ts"; const body = new TextEncoder().encode("Hello World"); const it = serve(":4500"); diff --git a/benchmark/std_file_bench.ts b/benchmark/std_file_bench.ts index 777b604..daa6572 100644 --- a/benchmark/std_file_bench.ts +++ b/benchmark/std_file_bench.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { serve } from "https://deno.land/std@v0.32.0/http/server.ts"; const it = serve(":4500"); async function main() { diff --git a/body_parser.ts b/body_parser.ts index 0c7dabe..d26bd24 100644 --- a/body_parser.ts +++ b/body_parser.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { FormFile, isFormFile, diff --git a/body_parser_test.ts b/body_parser_test.ts index 6678f4e..31b884b 100644 --- a/body_parser_test.ts +++ b/body_parser_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { MultipartWriter, } from "./vendor/https/deno.land/std/mime/multipart.ts"; diff --git a/cookie.ts b/cookie.ts index 4e74e31..b9ef4e9 100644 --- a/cookie.ts +++ b/cookie.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { toIMF } from "./vendor/https/deno.land/std/datetime/mod.ts"; export type SetCookieOpts = { diff --git a/cookie_test.ts b/cookie_test.ts index 674771c..fc5b4f6 100644 --- a/cookie_test.ts +++ b/cookie_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { assert, assertEquals, diff --git a/error.ts b/error.ts index caa02ae..5997b82 100644 --- a/error.ts +++ b/error.ts @@ -1,6 +1,5 @@ +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { kHttpStatusMessages } from "./serveio.ts"; - -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. export class RoutingError extends Error { constructor(readonly status: number, msg?: string) { super(msg ?? kHttpStatusMessages[status]); diff --git a/fixtures/gen.ts b/fixtures/gen.ts index 2e88014..863f1f1 100644 --- a/fixtures/gen.ts +++ b/fixtures/gen.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { writeRequest, writeResponse, writeTrailers } from "../serveio.ts"; import { encode } from "../vendor/https/deno.land/std/strings/encode.ts"; import { StringReader } from "../vendor/https/deno.land/std/io/readers.ts"; diff --git a/jsx.ts b/jsx.ts index caf7687..0a23247 100644 --- a/jsx.ts +++ b/jsx.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { FC } from "./types/react/index.d.ts"; export type DFC

= FC

& { diff --git a/logger.ts b/logger.ts index 3896c9a..7347e68 100644 --- a/logger.ts +++ b/logger.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { red, yellow, diff --git a/matcher.ts b/matcher.ts index 41e11d8..139ea8f 100644 --- a/matcher.ts +++ b/matcher.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import * as path from "./vendor/https/deno.land/std/path/mod.ts"; /** * Find the match that appeared in the nearest position to the beginning of word. diff --git a/matcher_test.ts b/matcher_test.ts index 09fc0ad..cc46fb3 100644 --- a/matcher_test.ts +++ b/matcher_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { findLongestAndNearestMatches, resolveIndexPath, diff --git a/media_types.ts b/media_types.ts index cda1577..502ec7c 100644 --- a/media_types.ts +++ b/media_types.ts @@ -1,3 +1,4 @@ +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. const kBasicContentTypes: [string, string][] = [ [".html", "text/html"], [".md", "text/markdown"], diff --git a/middleware.ts b/middleware.ts index 81074bc..f22d5db 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { RoutingError } from "./error.ts"; import { Sha1 } from "./vendor/https/deno.land/std/ws/sha1.ts"; import { assert } from "./vendor/https/deno.land/std/testing/asserts.ts"; diff --git a/middleware_test.ts b/middleware_test.ts index 76c2a8b..3c5889e 100644 --- a/middleware_test.ts +++ b/middleware_test.ts @@ -1,3 +1,4 @@ +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { basicAuth } from "./middleware.ts"; import { group } from "./test_util.ts"; import { diff --git a/mod.ts b/mod.ts index 8555531..12fd793 100644 --- a/mod.ts +++ b/mod.ts @@ -9,7 +9,6 @@ export * from "./logger.ts"; export * from "./matcher.ts"; export * from "./media_types.ts"; export * from "./middleware.ts"; -export * from "./mod.ts"; export * from "./promises.ts"; export * from "./readers.ts"; export * from "./responder.ts"; diff --git a/promises.ts b/promises.ts index 0f8cd27..0c5602a 100644 --- a/promises.ts +++ b/promises.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. export class TimeoutError extends Error {} diff --git a/readers.ts b/readers.ts index 7d0f3d0..f05ea7b 100644 --- a/readers.ts +++ b/readers.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { BufReader } from "./vendor/https/deno.land/std/io/bufio.ts"; import { TextProtoReader, diff --git a/readers_test.ts b/readers_test.ts index c58b32c..e37be22 100644 --- a/readers_test.ts +++ b/readers_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { bodyReader, chunkedBodyReader } from "./readers.ts"; import { assertEquals, diff --git a/responder.ts b/responder.ts index 04f66b9..978bceb 100644 --- a/responder.ts +++ b/responder.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import Writer = Deno.Writer; import { ServerResponse } from "./server.ts"; import { cookieSetter, CookieSetter } from "./cookie.ts"; diff --git a/responder_test.ts b/responder_test.ts index e0607f4..c14433a 100644 --- a/responder_test.ts +++ b/responder_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createResponder } from "./responder.ts"; import { assert, diff --git a/router.ts b/router.ts index 5f70b22..1a5a2b5 100644 --- a/router.ts +++ b/router.ts @@ -1,3 +1,4 @@ +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { findLongestAndNearestMatches, } from "./matcher.ts"; diff --git a/router_test.ts b/router_test.ts index f2f62ff..8cdb61c 100644 --- a/router_test.ts +++ b/router_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { assertEquals, assertThrowsAsync, diff --git a/serve_jsx.ts b/serve_jsx.ts index 02e8cf1..a68409b 100644 --- a/serve_jsx.ts +++ b/serve_jsx.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import React from "./vendor/https/dev.jspm.io/react/index.js"; import ReactDOMServer from "./vendor/https/dev.jspm.io/react-dom/server.js"; import { ServeHandler } from "./server.ts"; diff --git a/serve_jsx_test.ts b/serve_jsx_test.ts index e006893..b58dda1 100644 --- a/serve_jsx_test.ts +++ b/serve_jsx_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createRecorder } from "./testing.ts"; import { assertEquals, diff --git a/serve_static.ts b/serve_static.ts index c6c95db..2882959 100644 --- a/serve_static.ts +++ b/serve_static.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import * as path from "./vendor/https/deno.land/std/path/mod.ts"; import { resolveIndexPath } from "./matcher.ts"; import { ServeHandler } from "./server.ts"; diff --git a/serve_static_test.ts b/serve_static_test.ts index 67a5269..b9c45c0 100644 --- a/serve_static_test.ts +++ b/serve_static_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { assertEquals, assertMatch, diff --git a/serveio.ts b/serveio.ts index 4466658..c9e906a 100644 --- a/serveio.ts +++ b/serveio.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { BufReader, BufWriter, diff --git a/serveio_test.ts b/serveio_test.ts index 4a9dde5..9e0ac8e 100644 --- a/serveio_test.ts +++ b/serveio_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { parseKeepAlive, diff --git a/server.ts b/server.ts index d440e04..082c318 100644 --- a/server.ts +++ b/server.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import Conn = Deno.Conn; import Reader = Deno.Reader; import { diff --git a/server_test.ts b/server_test.ts index ca02fde..c0bc7f4 100644 --- a/server_test.ts +++ b/server_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { handleKeepAliveConn, listenAndServe, diff --git a/site/content.ts b/site/content.ts index d18527e..344bb9c 100644 --- a/site/content.ts +++ b/site/content.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { pathResolver } from "../util.ts"; import * as path from "../vendor/https/deno.land/std/path/mod.ts"; diff --git a/site/index.ts b/site/index.ts index 202ac46..8f1e61d 100755 --- a/site/index.ts +++ b/site/index.ts @@ -1,5 +1,5 @@ #!/usr/bin/env deno --allow-net --allow-read --allow-env -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { serveStatic } from "../serve_static.ts"; import { Loglevel } from "../logger.ts"; import { Layout } from "./components/layout.tsx"; diff --git a/site/public/example/app_server.ts b/site/public/example/app_server.ts index a577c33..9b582d3 100644 --- a/site/public/example/app_server.ts +++ b/site/public/example/app_server.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp } from "../../../mod.ts"; const app = createApp(); // Define route with string pattern. diff --git a/site/public/example/basic_auth.ts b/site/public/example/basic_auth.ts index 7b02860..f00065b 100644 --- a/site/public/example/basic_auth.ts +++ b/site/public/example/basic_auth.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, basicAuth } from "../../../mod.ts"; const app = createApp(); // Add global auth middleware diff --git a/site/public/example/create_agent.ts b/site/public/example/create_agent.ts index 119b045..44add5f 100644 --- a/site/public/example/create_agent.ts +++ b/site/public/example/create_agent.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createAgent } from "../../../mod.ts"; async function main() { diff --git a/site/public/example/get_started.ts b/site/public/example/get_started.ts index 91c31d7..0587b59 100644 --- a/site/public/example/get_started.ts +++ b/site/public/example/get_started.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp } from "../../../mod.ts"; const app = createApp(); app.handle("/", async (req) => { diff --git a/site/public/example/handle_errors.ts b/site/public/example/handle_errors.ts index 65b6cd2..1424182 100644 --- a/site/public/example/handle_errors.ts +++ b/site/public/example/handle_errors.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, RoutingError } from "../../../mod.ts"; const app = createApp(); diff --git a/site/public/example/handle_ws.ts b/site/public/example/handle_ws.ts index 07bb0fb..bdc2b1c 100644 --- a/site/public/example/handle_ws.ts +++ b/site/public/example/handle_ws.ts @@ -1,3 +1,4 @@ +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp } from "../../../mod.ts"; import { WebSocket } from "https://deno.land/std/ws/mod.ts"; diff --git a/site/public/example/manage_cookie.ts b/site/public/example/manage_cookie.ts index ad3790a..4a67707 100644 --- a/site/public/example/manage_cookie.ts +++ b/site/public/example/manage_cookie.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { RouteHandler } from "../../../mod.ts"; const handle: RouteHandler = (req) => { diff --git a/site/public/example/manage_session.ts b/site/public/example/manage_session.ts index 14f28c0..396fd2b 100644 --- a/site/public/example/manage_session.ts +++ b/site/public/example/manage_session.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, ServerRequest } from "../../../mod.ts"; const app = createApp(); type User = { diff --git a/site/public/example/reading_body.ts b/site/public/example/reading_body.ts index b4e3148..e1c8375 100644 --- a/site/public/example/reading_body.ts +++ b/site/public/example/reading_body.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, contentTypeFilter } from "../../../mod.ts"; const app = createApp(); app.post("/json", contentTypeFilter("application/json"), async (req) => { diff --git a/site/public/example/simple_server.ts b/site/public/example/simple_server.ts index d01c4ec..ca40556 100644 --- a/site/public/example/simple_server.ts +++ b/site/public/example/simple_server.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { listenAndServe } from "../../../mod.ts"; const listener = listenAndServe({ port: 8899 }, async (req) => { await req.respond({ diff --git a/site/public/example/testing_handler.ts b/site/public/example/testing_handler.ts index ceedf55..8ccd9ab 100644 --- a/site/public/example/testing_handler.ts +++ b/site/public/example/testing_handler.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; import { createRecorder, ServeHandler } from "../../../mod.ts"; diff --git a/site/public/example/use_middleware.ts b/site/public/example/use_middleware.ts index 167a2af..c2def45 100644 --- a/site/public/example/use_middleware.ts +++ b/site/public/example/use_middleware.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp } from "../../../mod.ts"; const app = createApp(); // Called for every request diff --git a/site/public/example/use_router.ts b/site/public/example/use_router.ts index 12c91aa..3d50d76 100644 --- a/site/public/example/use_router.ts +++ b/site/public/example/use_router.ts @@ -1,3 +1,4 @@ +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, createRouter } from "../../../mod.ts"; const app = createApp(); diff --git a/site/public/example/use_serve_jsx.ts b/site/public/example/use_serve_jsx.ts index ccb37b9..9a30de9 100644 --- a/site/public/example/use_serve_jsx.ts +++ b/site/public/example/use_serve_jsx.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, serveJsx } from "../../../mod.ts"; const app = createApp(); // .jsx/.tsx files in ./pages directory will be dynamically imported diff --git a/site/public/example/use_serve_static.ts b/site/public/example/use_serve_static.ts index 0603ec7..385afcf 100644 --- a/site/public/example/use_serve_static.ts +++ b/site/public/example/use_serve_static.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { createApp, serveStatic } from "../../../mod.ts"; const app = createApp(); // All requests will be processed and matched files in "public" directory diff --git a/test_util.ts b/test_util.ts index f2b5404..3fefcd7 100644 --- a/test_util.ts +++ b/test_util.ts @@ -1,9 +1,8 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { Router } from "./router.ts"; import { assertThrowsAsync, AssertionError, - assertEquals, } from "./vendor/https/deno.land/std/testing/asserts.ts"; import { RoutingError } from "./error.ts"; import { kHttpStatusMessages } from "./serveio.ts"; @@ -90,14 +89,8 @@ export async function group( await Deno.writeAll(Deno.stdout, encode("\n")); for (const { fn, name } of tests) { await Deno.writeAll(Deno.stdout, encode(` ${name} ... `)); - const beforeRes = Deno.resources(); - const beforeOps = Deno.metrics(); try { await fn(); - const afterRes = Deno.resources(); - const afterOps = Deno.metrics(); - if (!opts.disableOpSanitizer) { - } await Deno.writeAll(Deno.stdout, encode(green("ok") + "\n")); } catch (e) { if (e instanceof AssertionError) { diff --git a/testing.ts b/testing.ts index 389c7cd..feea69b 100644 --- a/testing.ts +++ b/testing.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { BufReader, BufWriter, diff --git a/tools/gen_types.ts b/tools/gen_types.ts index 19a303e..5350b77 100755 --- a/tools/gen_types.ts +++ b/tools/gen_types.ts @@ -1,5 +1,5 @@ #!/usr/bin/env deno --allow-net --allow-write -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. function resolvePath(p: string): string { const u = new URL(p, import.meta.url); return u.pathname; diff --git a/tools/license_checker.ts b/tools/license_checker.ts new file mode 100755 index 0000000..6b00b23 --- /dev/null +++ b/tools/license_checker.ts @@ -0,0 +1,43 @@ +#!/usr/bin/env deno --allow-read +import * as fs from "../vendor/https/deno.land/std/fs/mod.ts"; +import * as path from "../vendor/https/deno.land/std/path/mod.ts"; +import * as tp from "../vendor/https/deno.land/std/textproto/mod.ts"; +import { BufReader } from "../vendor/https/deno.land/std/io/bufio.ts"; +const dec = new TextDecoder(); +const opts = JSON.parse(dec.decode(Deno.readFileSync(".licenserc.json"))); +const ignore: string[] = opts["ignore"]; +delete opts["ignore"]; +async function readLine(f: Deno.Reader): Promise { + const bufr = BufReader.create(f); + const tpr = new tp.TextProtoReader(bufr); + let line = await tpr.readLine(); + if (line === Deno.EOF) { + return line; + } + line = line.trimStart(); + if (line.startsWith("#!")) { + return readLine(bufr); + } + return line; +} +let code = 0; +for (const [key, val] of Object.entries(opts)) { + const files = [...fs.expandGlobSync(key)] + .map((v) => path.relative(".", v.filename)) + .filter((v) => !ignore.some((i) => v.startsWith(i))); + for (const file of files) { + const f = Deno.openSync(file); + const line = await readLine(f); + if (line == Deno.EOF) { + throw new Error("unexpected EOF: " + file); + } + if (line !== val) { + console.error(`ERR: ${file}`); + code = 1; + } + } +} +if (code === 0) { + console.log("OK"); +} +Deno.exit(code); diff --git a/tools/make_mod.ts b/tools/make_mod.ts index e093e1e..a1dbc76 100755 --- a/tools/make_mod.ts +++ b/tools/make_mod.ts @@ -2,7 +2,7 @@ const files = Deno.readdirSync(".").filter((f) => { const name = f.name; - if (!name) return false; + if (!name || name === "mod.ts") return false; return name.endsWith(".ts") && !name.endsWith("_test.ts") && !name.endsWith(".d.ts"); }).map((f) => f.name).sort(); diff --git a/util.ts b/util.ts index 0a401aa..62c4f1f 100644 --- a/util.ts +++ b/util.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { deferred, Deferred, diff --git a/util_test.ts b/util_test.ts index 3835e6f..91d0b4d 100644 --- a/util_test.ts +++ b/util_test.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license. +// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts"; import { pathResolver } from "./util.ts"; import { group } from "./test_util.ts";