2.0.1 • Published 1 year ago

@ernstwi/days v2.0.1

Weekly downloads
51
License
MIT
Repository
github
Last release
1 year ago

days

This is a tool for keeping a personal journal in the form of a directory of markdown files. There are two main commands: new for writing posts, and server to browse the journal as a webpage.

Journaling on iOS is supported via iMessage import (see days merge).

Status

⚠️ Note: Version 2.0.0 contains a security fix. Please do not use previous versions.

Please be mindful that this is a small project and that further security issues should be expected.

Directory structure

├── content
│   └── 2020 ....................... year
│       └── 04 ..................... month
│           └── 01 ................. day
│               ├── 12-00-00.md .... hh-mm-ss
│               └── allday.md ...... you can have one untimed post per day,
│                                    written for example when looking back at
│                                    some later point in time
├── assets ......................... files in this dir are served from root
│   └── image.jpeg ................. ![an image](/image.jpeg)
│
└── config.json .................... optional configuration file

Install

Install using npm or Homebrew.

$ npm install --global @ernstwi/days
$ brew install ernstwi/tap/days

Usage

All commands assume your current directory is the journal root.

new

Create a new post.

$ days new [--no-edit] [--allday] [<year> <month> <day> [<hour> [<minute> [<second>]]]]
  • If no date is given, the current time is used. With --allday, an all day post is created.
  • If a date is given, but no time, an all day post is created.
  • Without --no-edit, the post opens in $EDITOR.
  • With --no-edit, the filename is printed to stdout.

server

Start the web server.

$ days server [--port <number>] [--theme <name>]

merge

Import content from another journal, or from iMessage.

$ days merge [--resolve] (<path> | --imessage <ID>)
  • Merge posts from a days journal at <path>, or from an iMessage conversation with user <ID> (macOS only).
  • With --resolve, filename collisions on assets are resolved by renaming.

Tip: Set up a dummy Apple ID for the purpose of journaling.

prune

Clean up the content directory, removing empty subdirectories.

$ days prune

Configuration

The root directory may contain a file config.json with the following keys.

SettingDefault value
titledays
port3004
themefruchtig

Themes

NameScreenshotAdapted from
fruchtignpm.ioschickele/vim-fruchtig
nachtlebennpm.ioschickele/vim-nachtleben
monochromenpm.iofxn/vim-monochrome

Adding themes

You can create your own theme by adding a file static/theme/<theme-name>.css containing definitions for a subset of the following CSS variables.

NameTypeFallback value
--uicolorgray
--contentcolorblack
--backgroundcolorwhite
--post-footer-favcolorgold
--linkcolorblue
--link-hovercolormagenta
NameTypeFallback value
--blockquote-bordercolor--content
--day-headercolor--ui
--day-header-backgroundcolor--background
--day-header-bordercolor--ui
--figure-bordercolor--content
--footer-diamondcolor--ui
--link-disabledcolor--ui
--no-postscolor--ui
--no-posts-bordercolor--ui
--post-bodycolor--content
--post-body-hrcolor--content
--post-edit-bgcolor--background
--post-edit-bordercolor--ui
--post-edit-fgcolor--content
--post-edit-submit-backgroundcolor--background
--post-edit-submit-bordercolor--ui
--post-footercolor--ui
--post-footer-hrcolor--ui
--sidebar-dividercolor--ui
--sidebar-monthcolor--ui
--sidebar-yearcolor--ui
--start-index-bordercolor--ui
--start-index-bordercolor--ui
--start-yearcolor--ui

Testing

npm run test: Compile TypeScript and test the resulting JavaScript using Mocha.

To test iMessage merge functionality, you must define the environment variable DAYS_TEST_IMESSAGE. This value will be used as the recipient of a test message sent using Applescript on each run of the test suite. Note that this means automatically opening the Messages app and sending a message from your logged in user.

If DAYS_TEST_IMESSAGE is not defined, iMessage merge testing is skipped and no test message is sent.

2.0.1

1 year ago

2.0.0

1 year ago

1.9.5

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.9.1

3 years ago

1.9.0

4 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago