generated from justjavac/deno_starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
51 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,3 @@ jobs: | |
|
||
- name: Lint | ||
run: deno lint --unstable | ||
|
||
- name: Tests | ||
run: deno test --unstable |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,36 @@ | ||
# deno_starter | ||
# deno_picture_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_picture_dir)](https://github.com/justjavac/deno_picture_dir/releases) | ||
[![Build Status](https://github.com/justjavac/deno_picture_dir/workflows/ci/badge.svg?branch=master)](https://github.com/justjavac/deno_picture_dir/actions) | ||
[![license](https://img.shields.io/github/license/justjavac/deno_picture_dir)](https://github.com/justjavac/deno_picture_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 picture 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_PICTURES_DIR` | /home/justjavac/Pictures | | ||
| macOS | `$HOME`/Pictures | /Users/justjavac/Pictures | | ||
| Windows | `{FOLDERID_Pictures}` | C:\Users\justjavac\Pictures | | ||
|
||
. | ||
├─ .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 pictureDir from "https://deno.land/x/picture_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. | ||
pictureDir(); | ||
// Lin: "/home/justjavac/Pictures" | ||
// Mac: "/Users/justjavac/Pictures" | ||
// Win: "C:\Users\justjavac\Pictures" | ||
``` | ||
|
||
## License | ||
|
||
[deno_starter](https://github.com/justjavac/deno_starter) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details. | ||
[deno_picture_dir](https://github.com/justjavac/deno_picture_dir) is released under the MIT License. See the bundled [LICENSE](./LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 picture 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_PICTURES_DIR` | /home/justjavac/Pictures | | ||
* | macOS | `$HOME`/Pictures | /Users/justjavac/Pictures | | ||
* | Windows | `{FOLDERID_Pictures}` | C:\Users\justjavac\Pictures | | ||
*/ | ||
export default function starter(foo: string): string { | ||
return foo; | ||
export default function pictureDir(): string | null { | ||
switch (Deno.build.os) { | ||
case "linux": { | ||
return Deno.env.get("XDG_PICTURES_DIR") ?? null; | ||
} | ||
|
||
case "darwin": { | ||
const home = Deno.env.get("HOME"); | ||
if (home) return `${home}/Pictures`; | ||
break; | ||
} | ||
|
||
case "windows": | ||
return Deno.env.get("FOLDERID_Pictures") ?? null; | ||
} | ||
|
||
return null; | ||
} |
This file was deleted.
Oops, something went wrong.