# @agreatfool/obsidian-utils

> obsidian utility tool, help to generate frontmatter, etc

Latest version **0.3.0** (published 2024-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @agreatfool/obsidian-utils
pnpm add @agreatfool/obsidian-utils
yarn add @agreatfool/obsidian-utils
bun add @agreatfool/obsidian-utils
```

Provides the command `obsidian-utils`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2024-07-03 |
| First published | 2021-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 467.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jonathan Dai |
| Maintainers | agreatfool |
| Keywords | Obsidian |

## Links

- npm: https://www.npmjs.com/package/@agreatfool/obsidian-utils
- Repository: https://github.com/agreatfool/obsidian-utils
- Homepage: https://github.com/agreatfool/obsidian-utils#readme
- Issues: https://github.com/agreatfool/obsidian-utils/issues
- npm.io page: https://npm.io/package/@agreatfool/obsidian-utils

## Dependencies (11)

- [cors](https://npm.io/package/cors.md) ^2.8.5
- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [yaml](https://npm.io/package/yaml.md) ^1.10.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.5
- [mkdirp](https://npm.io/package/mkdirp.md) ^1.0.4
- [morgan](https://npm.io/package/morgan.md) ^1.10.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.4
- [commander](https://npm.io/package/commander.md) ^8.2.0
- [puppeteer](https://npm.io/package/puppeteer.md) ^10.4.0
- [http-server](https://npm.io/package/http-server.md) ^13.0.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2024-07-03
- 0.2.1 — 2024-03-18
- 0.2.0 — 2024-03-18
- 0.1.5 — 2024-02-14
- 0.1.4 — 2022-10-03
- 0.1.3 — 2022-01-06
- 0.1.2 — 2022-01-06
- 0.1.1 — 2021-11-03
- 0.1.0 — 2021-10-13
- 0.0.6 — 2021-09-28
- 0.0.5 — 2021-09-26
- 0.0.4 — 2021-09-25
- 0.0.3 — 2021-09-23
- 0.0.2 — 2021-09-23
- 0.0.1 — 2021-09-23

## README

# obsidian-utils

Command line tools to help obsidian stuff

## Working steps

1. Select location point
2. Select date & edit time
3. Fetch weather data
4. Edit the title & slug
5. Confirm the frontmatter generated
6. Submit the data, then you can see the dir & md file generated

## Preparation

Need to install [LocateMe](https://github.com/netj/LocateMe) first:

```bash
$ brew update --verbose && brew install locateme
```

Use it once: `$ locateme`, and you will get the error:

```bash
2021-08-31 10:47:01.299 locateme[32912:640457] [error code] != kCLErrorLocationUnknown: Error Domain=kCLErrorDomain Code=1 "(null)"
2021-08-31 10:47:01.299 locateme[32912:640457] Error: Error Domain=kCLErrorDomain Code=1 "(null)"
```

Go to security setting panel, give the location access to locateme, then it should be working correctly:

```bash
$ locateme -f "{\"lat\":\"{LAT}\",\"lon\":\"{LON}\"}"

{"lat":"XX.234463","lon":"XXX.482957"}
```

This tool is using:

- [amap 高德地图](https://lbs.amap.com/) as the location service
- [nowapi](https://www.nowapi.com/api/weather.today) as the weather service

You will need to prepare:

- Go to the console of amap 高德地图 to generate two keys:
    - amapWebKey: Web服务 ; used to call restful apis
    - amapJsKey: Web端（JS API）; used to fetch location in embedded web component
- Go to the console of nowapi to get:
    - nowapiAppKey: appkey ; used to call api
    - nowapiSign: sign ; used to call api

## How to use

Write a config file `obsidian_utils_config.yaml`, it's recommended to be put in your obsidian vault dir. It's content:

```yaml
amapJsKey: "..."
amapWebKey: "..."
nowapiAppKey: "..."
nowapiSign: "..."
```

```bash
$ obsidian-utils -d ~/Downloads/your/vault -c ~/Downloads/your/vault/obsidian_utils_config.yaml -a util
$ # OR
$ obsidian-utils -d ~/Downloads/your/vault -a index
```

## Others

obsidian-utils help:

```bash
$ obsidian-utils -h
Usage: obsidian-utils [options]

Obsidian utility, help to generate frontmatter, etc

Options:
  -V, --version            output the version number
  -a, --action <string>    which action will be executed: util | diary | index
  -t, --datetime <string>  the datetime of the document to be created, format:
                           'YYYY-MM-DD HH:mm:ss'
  -d, --dest <dir>         directory of output destination
  -c, --config <path>      file path of the config yaml, example could be find at:
                           ${source_root}/config.example.yaml; required if action is
                           "util | diray"
  -h, --help               display help for command
```

---
_Source: https://npm.io/package/@agreatfool/obsidian-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
