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 2923e50 commit 74d37c4
Show file tree
Hide file tree
Showing 7 changed files with 57 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
60 changes: 24 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,37 @@
# deno_starter
# deno_data_local_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)
[![](https://img.shields.io/badge/deno-v1.3-green.svg)](https://github.com/denoland/deno)
[![tag](https://img.shields.io/github/release/justjavac/deno_data_local_dir)](https://github.com/justjavac/deno_data_local_dir/releases)
[![Build Status](https://github.com/justjavac/deno_data_local_dir/workflows/ci/badge.svg?branch=master)](https://github.com/justjavac/deno_data_local_dir/actions)
[![license](https://img.shields.io/github/license/justjavac/deno_data_local_dir)](https://github.com/justjavac/deno_data_local_dir/blob/master/LICENSE)

Quickly start a Deno module.
> _In v1.1.2(2020.06.26), Deno [Remove `Deno.dir` and dirs dependency #6385](https://github.com/denoland/deno/pull/6385)_
## 🧐 What's inside?
Returns the path to the user's local data directory.

A quick look at the files and directories you'll see in a Deno project.
The returned value depends on the operating system and is either a string,
containing a value from the following table, or `null`.

.
├─ .github
│ └─ workflows
│ └─ ci.yml
├─ .vscode
├─ .vscode
│ ├─ extensions.json
│ └─ settings.json
├─ .gitattributes
├─ .gitignore
├─ CHANGELOG.md
├─ LICENSE
├─ mod_test.ts
├─ mod.ts
└─ README.md
|Platform | Value | Example |
| ------- | ---------------------------------------- | -------------------------------------------- |
| Linux | `$XDG_DATA_HOME` or `$HOME`/.local/share | /home/justjavac/.local/share |
| macOS | `$HOME`/Library/Application Support | /Users/justjavac/Library/Application Support |
| Windows | `{FOLDERID_LocalAppData}` | C:\Users\justjavac\AppData\Local |

1. **`.github\workflows\ci.yml`**: GitHub Actions.
## Usage

1. **`.vscode\extensions.json`**: Workspace recommended extensions for Deno Developers.
Requires `allow-env` permission.

1. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
Returns `null` if there is no applicable directory or if any other error occurs.

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).
```ts
import dataLocalDir from "https://deno.land/x/data_local_dir/mod.ts";

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.
dataLocalDir();
// Lin: "/home/justjavac/.local/share"
// Mac: "/Users/justjavac/Library/Application Support"
// Win: "C:\Users\justjavac\AppData\Local"
```

## License

[deno_starter](https://github.com/justjavac/deno_starter) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details.
[deno_data_local_dir](https://github.com/justjavac/deno_data_local_dir) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details.
43 changes: 31 additions & 12 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
/**
* Every exported symbol ideally should have a documentation line.
/** Returns the path to the user's local data 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_DATA_HOME` or `$HOME`/.local/share | /home/justjavac/.local/share |
* | macOS | `$HOME`/Library/Application Support | /Users/justjavac/Library/Application Support |
* | Windows | `{FOLDERID_LocalAppData}` | C:\Users\justjavac\AppData\Local |
*/
export default function starter(foo: string): string {
return foo;
export default function dataLocalDir(): string | null {
switch (Deno.build.os) {
case "linux": {
const xdg = Deno.env.get("XDG_DATA_HOME");
if (xdg) return xdg;

const home = Deno.env.get("HOME");
if (home) return `${home}/.local/share`;
break;
}

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

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

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

This file was deleted.

0 comments on commit 74d37c4

Please sign in to comment.