Skip to content

Commit

Permalink
dev: update package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
David GABISON committed Jan 22, 2023
1 parent e66bfe8 commit 4d06de7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 22 deletions.
50 changes: 28 additions & 22 deletions package.json
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]"
}
16 changes: 16 additions & 0 deletions watch.js
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)});
}

0 comments on commit 4d06de7

Please sign in to comment.