generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 15
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
14 changed files
with
640 additions
and
674 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 |
---|---|---|
@@ -1,17 +1,15 @@ | ||
# Update time on edit plugin | ||
|
||
This plugins update on save the metadata of the file with the time it was updated, and the time of creation if there is none (useful for new files). | ||
The keys can be configured (by default `updated` and `created`). | ||
This plugin update on save the metadata of the file with the time it was updated, and the time of creation if there is none (useful for new files). | ||
|
||
**This is still an early version of the plugin, here is the current limitations :** | ||
Here is a list of feature this plugin provides : | ||
- Keep in sync the `mtime` (last modified time) in a property key (default to `updated`) | ||
- Keep in sync the `ctime` (file creation time) in a property key (default to `created`) | ||
- Customize the date format, default to obsidian date format for property display | ||
- Ignore folder for all update, useful for template files | ||
- Ignore folder for the creation property | ||
- Works on mobile & desktop | ||
|
||
The supported input date format are : | ||
* timestamp number (ex: 628021800000) | ||
* year only (ex: "2010") | ||
* year and month only (ex: "2010-06") | ||
* year, month and day (ex: "2010-06-09") | ||
* ISO RFC 2822 format (ex : "2010-06-09T15:20:00Z", "2010-06-09T15:20:00-07:00") | ||
* Non iso format (ex: "June 9, 2010", "2010 June 9", "6/9/2010 3:20 pm") | ||
|
||
The only supported output is the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (ex : "2019-09-18T19:00:52Z") | ||
This plugin will read the `ctime` and `mtime` from obsidian, and thus, the file system. **If file change from an external source, the header keys will be updated**. | ||
|
||
Remember to backup your vault since this plugin will modify files. |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import esbuild from 'esbuild'; | ||
import process from 'process'; | ||
import builtins from 'builtin-modules'; | ||
import copy from 'esbuild-plugin-copy'; | ||
import { replace } from 'esbuild-plugin-replace'; | ||
|
||
const banner = `/* | ||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD | ||
if you want to view the source, please visit the github repository of this plugin | ||
*/ | ||
`; | ||
|
||
const prod = process.argv[2] === 'production'; | ||
|
||
const context = await esbuild.context({ | ||
banner: { | ||
js: banner, | ||
}, | ||
entryPoints: ['src/main.ts'], | ||
bundle: true, | ||
external: [ | ||
'obsidian', | ||
'electron', | ||
'@codemirror/autocomplete', | ||
'@codemirror/collab', | ||
'@codemirror/commands', | ||
'@codemirror/language', | ||
'@codemirror/lint', | ||
'@codemirror/search', | ||
'@codemirror/state', | ||
'@codemirror/view', | ||
'@lezer/common', | ||
'@lezer/highlight', | ||
'@lezer/lr', | ||
...builtins, | ||
], | ||
format: 'cjs', | ||
target: 'es2018', | ||
logLevel: 'info', | ||
sourcemap: prod ? false : 'inline', | ||
treeShaking: true, | ||
outfile: 'dist/main.js', | ||
plugins: [ | ||
replace({ | ||
values: { | ||
__DEV_MODE__: !prod, | ||
}, | ||
exclude: /.*utils.ts/, | ||
}), | ||
copy({ | ||
resolveFrom: 'cwd', | ||
assets: [ | ||
{ | ||
from: ['./manifest.json'], | ||
to: ['./dist/manifest.json'], | ||
}, | ||
{ | ||
from: ['./styles.css'], | ||
to: ['./dist/styles.css'], | ||
}, | ||
], | ||
watch: true, | ||
}), | ||
], | ||
}); | ||
|
||
if (prod) { | ||
await context.rebuild(); | ||
process.exit(0); | ||
} else { | ||
await context.watch(); | ||
} |
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,10 +1,10 @@ | ||
{ | ||
"id": "update-time-on-edit", | ||
"name": "Update time on edit", | ||
"version": "1.1.2", | ||
"minAppVersion": "0.10.11", | ||
"description": "Keep front matter in sync with the last edit time", | ||
"author": "@beaussan", | ||
"authorUrl": "https://github.com/beaussan", | ||
"isDesktopOnly": false | ||
} | ||
"id": "update-time-on-edit", | ||
"name": "Update time on edit", | ||
"version": "2.0.0", | ||
"minAppVersion": "1.1.0", | ||
"description": "Keep front matter in sync with the last edit time", | ||
"author": "@beaussan", | ||
"authorUrl": "https://github.com/beaussan", | ||
"isDesktopOnly": false | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.