generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
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
David GABISON
committed
Jan 22, 2023
1 parent
e66bfe8
commit 4d06de7
Showing
2 changed files
with
44 additions
and
22 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,24 +1,30 @@ | ||
{ | ||
"name": "obsidian-sample-plugin", | ||
"version": "1.0.1", | ||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)", | ||
"main": "main.js", | ||
"scripts": { | ||
"dev": "node esbuild.config.mjs", | ||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", | ||
"version": "node version-bump.mjs && git add manifest.json versions.json" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^16.11.6", | ||
"@typescript-eslint/eslint-plugin": "^5.2.0", | ||
"@typescript-eslint/parser": "^5.2.0", | ||
"builtin-modules": "^3.2.0", | ||
"esbuild": "0.13.12", | ||
"obsidian": "latest", | ||
"tslib": "2.3.1", | ||
"typescript": "4.4.4" | ||
} | ||
"name": "obsidian-sample-plugin", | ||
"version": "1.0.0", | ||
"description": "This plugin manage aliases of notes in Obsidian.", | ||
"main": "main.js", | ||
"scripts": { | ||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", | ||
"dev": "node esbuild.config.mjs", | ||
"start": "run-p watch dev", | ||
"version": "node version-bump.mjs && git add manifest.json versions.json", | ||
"watch": "node ./watch.js" | ||
}, | ||
"keywords": [], | ||
"author": "pulsovi", | ||
"license": "GNU AGPLv3", | ||
"devDependencies": { | ||
"@types/node": "^16.11.6", | ||
"@typescript-eslint/eslint-plugin": "^5.2.0", | ||
"@typescript-eslint/parser": "^5.48.2", | ||
"builtin-modules": "^3.2.0", | ||
"esbuild": "0.13.12", | ||
"eslint": "^8.32.0", | ||
"eslint-config-pulsovi-typescript": "^0.4.0", | ||
"npm-run-all": "^4.1.5", | ||
"obsidian": "latest", | ||
"tslib": "2.3.1", | ||
"typescript": "^4.9.4" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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,16 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
let timeoutId = null; | ||
const watcher = fs.watch('./main.js', { persistent: true }, (event, filename) => { | ||
clearTimeout(timeoutId); | ||
timeoutId = setTimeout(() => handleEvent(event, filename), 200); | ||
}); | ||
|
||
function handleEvent (event, filename) { | ||
console.log(event, filename); | ||
const src = path.resolve('./main.js'); | ||
const dest = `${process.argv[2]}/main.js`; | ||
console.log('copy file', src, 'to', dest); | ||
fs.copyFile(src, dest, (err) => {console.log(err)}); | ||
} |