Skip to content

Commit

Permalink
release v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
justjavac committed Aug 19, 2020
1 parent 457c5df commit 310a10f
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 73 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,3 @@ jobs:

- name: Lint
run: deno lint --unstable

- name: Tests
run: deno test --unstable
3 changes: 0 additions & 3 deletions .vscode/extensions.json

This file was deleted.

3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changelog

## x.y.z - [yyy-mm-dd]
## 0.1.0 - [2020-08-19]

- xxxx
- first release
59 changes: 23 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,36 @@
# deno_starter
# deno_download_dir

[![tag](https://img.shields.io/github/release/justjavac/deno_starter)](https://github.com/justjavac/deno_starter/releases)
[![Build Status](https://github.com/justjavac/deno_starter/workflows/ci/badge.svg?branch=master)](https://github.com/justjavac/deno_starter/actions)
[![license](https://img.shields.io/github/license/justjavac/deno_starter)](https://github.com/justjavac/deno_starter/blob/master/LICENSE)
[![tag](https://img.shields.io/github/release/justjavac/deno_download_dir)](https://github.com/justjavac/deno_download_dir/releases)
[![Build Status](https://github.com/justjavac/deno_download_dir/workflows/ci/badge.svg?branch=master)](https://github.com/justjavac/deno_download_dir/actions)
[![license](https://img.shields.io/github/license/justjavac/deno_download_dir)](https://github.com/justjavac/deno_download_dir/blob/master/LICENSE)
[![](https://img.shields.io/badge/deno-v1.3-green.svg)](https://github.com/denoland/deno)

Quickly start a Deno module.
Returns the path to the user's download directory.

## 🧐 What's inside?
The returned value depends on the operating system and is either a string,
containing a value from the following table, or `null`.

A quick look at the files and directories you'll see in a Deno project.
|Platform | Value | Example |
| ------- | ---------------------- | ---------------------------- |
| Linux | `XDG_DOWNLOAD_DIR` | /home/justjavac/Downloads |
| macOS | `$HOME`/Downloads | /Users/justjavac/Downloads |
| Windows | `{FOLDERID_Downloads}` | C:\Users\justjavac\Downloads |

.
├─ .github
│ └─ workflows
│ └─ ci.yml
├─ .vscode
├─ .vscode
│ ├─ extensions.json
│ └─ settings.json
├─ .gitattributes
├─ .gitignore
├─ CHANGELOG.md
├─ LICENSE
├─ mod_test.ts
├─ mod.ts
└─ README.md
## Usage

1. **`.github\workflows\ci.yml`**: GitHub Actions.
Requires `allow-env` permission.

1. **`.vscode\extensions.json`**: Workspace recommended extensions for Deno Developers.
Returns `null` if there is no applicable directory or if any other error occurs.

1. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
```ts
import downloadDir from "https://deno.land/x/download_dir/mod.ts";

1. **`CHANGELOG.md`**: This file contains a curated, chronologically ordered list of notable changes for each version of a project. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

1. **`LICENSE`**: Deno is licensed under the MIT license.

1. **`mod.ts`**: Deno's default entry point. The filename mod.ts follows Rust’s convention, is shorter than index.ts, and doesn’t come with any preconceived notions about how it might work. Deno does not treat "index.js" or "index.ts" in a special way. By using these filenames, it suggests that they can be left out of the module specifier when they cannot. This is confusing.

1. **`mod_test.ts`**: Each module should come with its test as a sibling with the name `modulename_test.ts`. For example the module `foo.ts` should come with its sibling `foo_test.ts`.

1. **`README.md`**: A text file containing useful reference information about your project.
downloadDir();
// Lin: "/home/justjavac/Downloads"
// Mac: "/Users/justjavac/Downloads"
// Win: "C:\Users\justjavac\Downloads"
```

## License

[deno_starter](https://github.com/justjavac/deno_starter) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details.
[deno_download_dir](https://github.com/justjavac/deno_download_dir) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details.
38 changes: 26 additions & 12 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
/**
* Every exported symbol ideally should have a documentation line.
/** Returns the path to the user's download directory.
*
* It is important that documentation is easily human readable,
* but there is also a need to provide additional styling information to ensure
* generated documentation is more rich text.
* Therefore JSDoc should generally follow markdown markup to enrich the text.
*
* follow https://deno.land/std/style_guide.md
*
* @param foo - Description of non obvious parameter
* The returned value depends on the operating system and is either a string,
* containing a value from the following table, or `null`.
*
* |Platform | Value | Example |
* | ------- | ---------------------- | ---------------------------- |
* | Linux | `XDG_DOWNLOAD_DIR` | /home/justjavac/Downloads |
* | macOS | `$HOME`/Downloads | /Users/justjavac/Downloads |
* | Windows | `{FOLDERID_Downloads}` | C:\Users\justjavac\Downloads |
*/
export default function starter(foo: string): string {
return foo;
export default function configDir(): string | null {
switch (Deno.build.os) {
case "linux": {
return Deno.env.get("XDG_DOWNLOAD_DIR") ?? null;
}

case "darwin": {
const home = Deno.env.get("HOME");
if (home) return `${home}/Downloads`;
break;
}

case "windows":
return Deno.env.get("FOLDERID_Downloads") ?? null;
}

return null;
}
14 changes: 0 additions & 14 deletions mod_test.ts

This file was deleted.

0 comments on commit 310a10f

Please sign in to comment.