Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
See current README for description and instructions.
  • Loading branch information
schemar committed Apr 12, 2021
0 parents commit 1477835
Show file tree
Hide file tree
Showing 38 changed files with 6,542 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main.js
48 changes: 48 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = {
env: {
es6: true,
node: true,
browser: true,
},
extends: [
'plugin:prettier/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:import/typescript',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
modules: true,
},
},
plugins: ['@typescript-eslint', 'import'],
rules: {
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single', { avoidEscape: true }],
'@typescript-eslint/no-unused-vars': 0, // Configured in tsconfig instead.
'no-unused-vars': 0, // Configured in tsconfig instead.
'prettier/prettier': [
'error',
{
singleQuote: true,
tabWidth: 4,
trailingComma: 'all',
},
],
semi: ['error', 'always'],
'import/order': 'error',
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],
},
};
67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '35 18 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release Obsidian Plugin
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching any tag format, i.e. 1.0, 20.15.10
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14.x' # You might need to adjust this value to your own version
# Get the version number and put it in a variable
- name: Get Version
id: version
run: |
echo "::set-output name=tag::$(git describe --abbrev=0)"
# Build the plugin
- name: Build
id: build
run: |
yarn
yarn run build
# Package the required files into a zip
- name: Package
run: |
mkdir ${{ github.event.repository.name }}
cp main.js manifest.json styles.css README.md ${{ github.event.repository.name }}
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
# Create the release on github
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
# Upload the packaged release file
- name: Upload zip file
id: upload-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}-${{ steps.version.outputs.tag }}.zip
asset_content_type: application/zip
# Upload the main.js
- name: Upload main.js
id: upload-main
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main.js
asset_name: main.js
asset_content_type: text/javascript
# Upload the manifest.json
- name: Upload manifest.json
id: upload-manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./manifest.json
asset_name: manifest.json
asset_content_type: application/json
# Upload the style.css
- name: Upload styles.css
id: upload-css
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./styles.css
asset_name: styles.css
asset_content_type: text/css
24 changes: 24 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Verify Commit
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
validate:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Install modules
run: yarn

- name: Run build
run: yarn run build

- name: Run TypeScript compiler ESLint
run: yarn run lint

- name: Run Jest
run: yarn run test
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Intellij
*.iml
.idea

# npm
node_modules
yarn-error.log

# build
main.js
*.js.map
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
trailingComma: 'all',
singleQuote: true,
tabWidth: 4,
};
113 changes: 113 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Obsidian Tasks

Task management for the [Obsidian](https://obsidian.md/) knowledge base.

Track tasks across your entire vault. List them and mark them as done wherever you want.

## Screenshots

*You can toggle the task status in any view/query and it will update the source file.*

![ACME Tasks](./resources/screenshots/acme.png)
The `ACME` note has some tasks.

![Important Project Tasks](./resources/screenshots/important_project.png)
The `Important Project` note also has some tasks.

![Tasks Queries](./resources/screenshots/tasks_queries.png)
The `Tasks` note gathers all tasks from the vault and displays them.

## Installation

Tasks is not yet available in the repository of Obsidian community plugins.
You have to download, install, and activate the plugin manually.
Follow the steps below to install Tasks.

1. Go to the latest [release](https://github.com/schemar/obsidian-tasks/releases).
2. Download:
- `main.js`
- `styles.css`
- `manifest.json`
3. Copy the files into your vault under `<VaultFolder>/.obsidian/plugins/obsidian-tasks/`.
4. Enable the plugin in your Obsidian settings (find "Tasks" under "Community plugins").

## Usage

You track tasks by creating list items that start with the keyword `TODO`.

Example:

```
- TODO take out the trash
```

There are two ways to mark a task done:

1. In preview mode, click the checkbox at the beginning of the task to toggle the status between `TODO` and `DONE`.
2. In edit mode, use the command `Tasks: Toggle done`.
- The command will only be available if the cursor is on a line of a task.
- You can map he command to a hotkey in order to quickly toggle statuses in the editor view.

When a task is marked as done, the keyword will automatically change from `TODO` to `DONE` and vice versa.
A `DONE` task will have the date it was done appended to the end of its line.
For example: `✅ 2021-04-09` means the task was done on the 9th of April, 2021.

### Due dates

Tasks can have due dates.
In order to specify the due date of a task, you must append the "due date signifier" followed by the date it is due to the end of the task.
The date must be in the format `YYYY-MM-DD`, meaning `Year-Month-Day` with leading zeros.
For example: `📅 2021-04-09` means the task is due on the 9th of April, 2021.

```
- TODO take out the trash 📅 2021-04-09
```

### Querying and listing tasks

You can list tasks from your entire vault by querying them using a `tasks` code block.
Tasks are sorted by due date and then path.

The simplest way is this:

```tasks
```

In preview mode, this will list all tasks from you vault, regardless of their status.
This is probably not what you want. Therefore, Tasks allows you to filter the tasks that you want to show.
All date filters must be in the format `YYYY-MM-DD`, meaning `Year-Month-Day` with leading zeros.

The following filters exist:

- `done`
- `not done`
- `done (before|after|on) <date>`
- `no due date`
- `due (before|after|on) <date>`
- `path (includes|does not include) <path>`

#### Examples

Show all tasks that aren't done, are due on the 9th of April 2021, and where the path includes `GitHub`:

```tasks
not done
due on 2021-04-09
path includes GitHub
````

Show all tasks that were done before the 1st of December 2020:

```tasks
done before 2020-12-01
```

### Caveats

When you toggle a task in its file, it will identify the task based on its description.
This means that when you have multiple tasks with the exact same description, due date, and done date, it will toggle the first of those tasks and not necessarily the one you actually clicked.
**This only applies to tasks within the file in preview mode.**
**If you have many tasks with the same description and you want to be on the safer side, use a query instead.**

The reason for this is that I can currently not reliably identify the line number in the file from a click on the checkbox in preview mode.
This might change/improve in the future.
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
verbose: true,
preset: 'ts-jest',
transform: {
'^.+\\.ts$': 'ts-jest',
},
moduleFileExtensions: ['js', 'ts'],
modulePathIgnorePatterns: ['yarn-cache'],
};

10 changes: 10 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "obsidian-tasks-plugin",
"name": "Tasks",
"version": "0.1.0",
"minAppVersion": "0.11.13",
"description": "Task management for Obsidian",
"author": "Martin Schenck",
"authorUrl": "https://github.com/schemar",
"isDesktopOnly": false
}
Loading

0 comments on commit 1477835

Please sign in to comment.