1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00
A modern runtime for JavaScript and TypeScript. https://deno.com/
Find a file
2019-01-11 21:56:35 -05:00
colors Reorg colors (denoland/deno_std#96) 2019-01-10 20:18:21 -05:00
datetime Define type for available date format (denoland/deno_std#88) 2019-01-11 00:19:42 -05:00
examples Add web socket module (denoland/deno_std#84) 2019-01-06 14:26:18 -05:00
flags Add testing module 2019-01-02 13:45:42 -05:00
fs refactor(path): reorg (denoland/deno_std#101) 2019-01-10 17:11:44 -05:00
logging Fix format globs (denoland/deno_std#87) 2019-01-06 14:19:15 -05:00
media_types Add media_types collection (denoland/deno_std#97) 2019-01-11 00:16:47 -05:00
mkdirp Add testing module 2019-01-02 13:45:42 -05:00
net style(net): format code (denoland/deno_std#104) 2019-01-11 21:56:35 -05:00
testing feat: print test status on the same line as test name (denoland/deno_std#100) 2019-01-09 10:32:37 -05:00
.editorconfig Create .editorconfig (denoland/deno_std#74) 2019-01-03 17:37:49 -05:00
azure-pipelines.yml Bump deno version to v0.2.6 2019-01-08 09:55:53 -05:00
format.ts Fix format globs (denoland/deno_std#87) 2019-01-06 14:19:15 -05:00
LICENSE Happy New Year (denoland/deno_std#58) 2019-01-02 09:56:17 -05:00
README.md Add media_types collection (denoland/deno_std#97) 2019-01-11 00:16:47 -05:00
test.ts Add media_types collection (denoland/deno_std#97) 2019-01-11 00:16:47 -05:00

Deno Standard Modules

Build Status

  • colors

    Modules that generate ANSI color codes for the console.

  • flags

    Command line arguments parser.

  • logging

    Command line logging

  • media_types

    A library for resolving media types (MIME types) and extensions.

  • mkdirp

    Make directory branches.

  • net

    A framework for creating HTTP/HTTPS servers inspired by GoLang.

  • path

    File path manipulation.

  • testing

    Testing

Style Guide

Use the term "module" instead of "library" or "package"

For clarity and consistency avoid the terms "library" and "package". Instead use "module" to refer to a single JS or TS file and also to refer to a directory of TS/JS code.

Use the filename "mod.ts" as the default entry point to a directory of code

index.ts comes with the wrong connotations - and main.ts should be reserved for executable programs. The filename mod.ts follows Rusts convention, is shorter than index.ts, and doesnt come with any preconceived notions about how it might work.

Within deno_std, do not depend on external code

deno_std is intended to be baseline functionality that all Deno programs can rely on. We want to guarantee to users that this code does not include potentially unreviewed third party code.

Within deno_std, minimize dependencies; do not make circular imports.

Although deno_std is a standalone codebase, we must still be careful to keep the internal dependencies simple and manageable. In particular, be careful to not to introduce circular imports.

For consistency, use underscores, not dashes in filenames.

Example: Instead of file-server.ts use file_server.ts.

Format code according using prettier.

More specifically, code should be wrapped at 80 columns and use 2-space indentation and use camel-case. Use //format.ts to invoke prettier.

Use JS Doc to document exported machinery

We strive for complete documentation. Every exported symbol ideally should have a documentation line.

If possible, use a single line for the JS Doc. Example:

/** foo does bar. */
export function foo() {
  // ...
}

See CONTRIBUTING.md for more details.

TODO Comments

TODO comments should be include an issue or the author's github username in parentheses. Example:

// TODO(ry) Add tests.
// TODO(#123) Support Windows.

Most files in deno_std should have the following copyright header:

// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.

If the code originates elsewhere, ensure that the file has the proper copyright headers. We only allow MIT, BSD, and Apache licensed code in deno_std.

Top level functions should not use arrow syntax

Top level functions should use the function keyword. Arrow syntax should be limited to closures.

Bad

export const foo(): string => {
  return "bar";
}

Good

export function foo(): string {
  return "bar";
}

When referencing Deno online, use the #denoland tag.

The name "deno" unfortunately is not especially unique on the internet. In order to centralize the community, please tag github project, tweet, and other content with #denoland.


Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.