-
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.
feat: added install and prune commands
- Loading branch information
Showing
26 changed files
with
9,176 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: test | ||
on: | ||
push: | ||
branches-ignore: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-tests: | ||
strategy: | ||
matrix: | ||
os: ['ubuntu-latest', 'windows-latest'] | ||
node_version: [lts/-1, lts/*, latest] | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9.5.0 | ||
run_install: true | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
cache: 'pnpm' | ||
- run: pnpm run build | ||
- run: pnpm run test |
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ package-lock.json | |
.vscode | ||
coverage | ||
tsconfig.tsbuildinfo | ||
cache |
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,11 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/mocharc.json", | ||
"import": ["tsx"], | ||
"reporter": "spec", | ||
"timeout": 5000, | ||
"forbidOnly": true, | ||
"watch-files": ["src"], | ||
"watch-extensions": ["ts"], | ||
"ui": "bdd", | ||
"spec": ["src/**/*.test.ts", "src/**/*.spec.ts"] | ||
} |
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,7 @@ | ||
{ | ||
"extends": "@istanbuljs/nyc-config-typescript", | ||
"all": true, | ||
"check-coverage": true, | ||
"extensions": [".ts"], | ||
"reporter": ["text", "html", "lcov"] | ||
} |
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 @@ | ||
"@oclif/prettier-config" |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Masoud Ghorbani | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,114 @@ | ||
# ovm - an Obsidian vaults manager | ||
|
||
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/msudgh/ovm/test) | ||
|
||
## Table of Contents | ||
|
||
- [ovm - an Obsidian vaults manager](#ovm---an-obsidian-vaults-manager) | ||
- [Table of Contents](#table-of-contents) | ||
- [Usage](#usage) | ||
- [Commands](#commands) | ||
- [`ovm ip`](#ovm-ip) | ||
- [`ovm pp`](#ovm-pp) | ||
- [`ovm help [COMMAND]`](#ovm-help-command) | ||
- [License](#license) | ||
|
||
## Usage | ||
|
||
```sh-session | ||
$ npm install -g ovm | ||
$ ovm version | ||
ovm/0.1.0 darwin-x64 node-v20.11.0 # Output may vary | ||
$ ovm COMMAND | ||
running command... | ||
$ ovm --help [COMMAND] | ||
USAGE | ||
$ ovm COMMAND | ||
... | ||
``` | ||
|
||
## Commands | ||
|
||
### `ovm ip` | ||
|
||
Install plugins for Obsidian vaults. | ||
|
||
``` | ||
USAGE | ||
$ ovm ip [-d] [-p <value>] | ||
FLAGS | ||
-d, --debug Enable debugging mode | ||
-p, --path=<value> Path or Glob pattern of vaults to install plugins. Default: reads from Obsidian | ||
config per environment. | ||
DESCRIPTION | ||
Install plugins for Obsidian vaults. | ||
ALIASES | ||
$ ovm ip | ||
$ ovm install-plugins | ||
EXAMPLES | ||
$ ovm ip --path=/path/to/vaults | ||
$ ovm ip --path=/path/to/vaults/*/.obsidian | ||
$ ovm ip --path=/path/to/vaults/**/.obsidian | ||
``` | ||
|
||
_See code: [src/commands/plugins/install.ts](src/commands/plugins/install.ts)_ | ||
|
||
### `ovm pp` | ||
|
||
Prune plugins for Obsidian **vaults**. | ||
|
||
``` | ||
USAGE | ||
$ ovm pp [-d] [-p <value>] | ||
FLAGS | ||
-d, --debug Enable debugging mode | ||
-p, --path=<value> Path or Glob pattern of vaults to prune plugins. Default: reads from Obsidian | ||
config per environment. | ||
DESCRIPTION | ||
Prune plugins for Obsidian vaults. | ||
ALIASES | ||
$ ovm pp | ||
$ ovm prune-plugins | ||
EXAMPLES | ||
$ ovm pp --path=/path/to/vaults | ||
$ ovm pp --path=/path/to/vaults/*/.obsidian | ||
$ ovm pp --path=/path/to/vaults/**/.obsidian | ||
``` | ||
|
||
_See code: [src/commands/plugins/prune.ts](src/commands/plugins/prune.ts)_ | ||
|
||
### `ovm help [COMMAND]` | ||
|
||
Display help for ovm commands. | ||
|
||
``` | ||
USAGE | ||
$ ovm help [COMMAND...] [-n] | ||
ARGUMENTS | ||
COMMAND... Command to show help for. | ||
FLAGS | ||
-n, --nested-commands Include all nested commands in the output. | ||
DESCRIPTION | ||
Display help for ovm. | ||
``` | ||
|
||
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.4/src/commands/help.ts)_ | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](LICENSE). |
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,3 @@ | ||
@echo off | ||
|
||
node "%~dp0\dev" %* |
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,6 @@ | ||
#!/usr/bin/env node_modules/.bin/ts-node | ||
// eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await | ||
;(async () => { | ||
const oclif = await import('@oclif/core') | ||
await oclif.execute({development: true, dir: __dirname}) | ||
})() |
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,3 @@ | ||
@echo off | ||
|
||
node "%~dp0\run" %* |
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,7 @@ | ||
#!/usr/bin/env node | ||
|
||
// eslint-disable-next-line unicorn/prefer-top-level-await | ||
(async () => { | ||
const oclif = await import('@oclif/core') | ||
await oclif.execute({dir: __dirname}) | ||
})() |
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,34 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const pluginJs = require('@eslint/js') | ||
const globals = require('globals') | ||
const tsEslint = require('typescript-eslint') | ||
|
||
const rulesConfig = [ | ||
{ | ||
rules: { | ||
'no-unused-vars': 'warn', | ||
'no-undef': 'warn', | ||
'prefer-arrow-callback': ['error', {allowNamedFunctions: false}], | ||
'func-style': ['error', 'expression', {allowArrowFunctions: true}], | ||
}, | ||
}, | ||
] | ||
|
||
const ignoresConfig = [{ignores: ['dist', 'bin']}] | ||
|
||
module.exports = [ | ||
{files: ['**/*.{ts}', '**/*.test.ts', '**/*.spec.ts']}, | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
...globals.mocha, | ||
}, | ||
}, | ||
}, | ||
pluginJs.configs.recommended, | ||
...tsEslint.configs.recommended, | ||
...rulesConfig, | ||
...ignoresConfig, | ||
] |
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,104 @@ | ||
{ | ||
"name": "ovm", | ||
"description": "An Obsidian vaults manager", | ||
"version": "0.1.0", | ||
"author": "Masoud Ghorbani", | ||
"bin": { | ||
"ovm": "./bin/run.js" | ||
}, | ||
"bugs": "https://github.com/w/ovm/issues", | ||
"dependencies": { | ||
"@inquirer/core": "^9.0.2", | ||
"@inquirer/prompts": "^5.1.2", | ||
"@inquirer/type": "^1.4.0", | ||
"@oclif/core": "^4.0.12", | ||
"@oclif/plugin-help": "^6.2.6", | ||
"@oclif/plugin-not-found": "^3.2.11", | ||
"@oclif/plugin-plugins": "^5.3.7", | ||
"ansi-escapes": "^7.0.0", | ||
"async": "^3.2.5", | ||
"glob": "^11.0.0", | ||
"inquirer": "^10.0.1", | ||
"node-fetch-cache": "^4.1.2", | ||
"obsidian-utils": "^0.10.2", | ||
"winston": "^3.13.1", | ||
"yoctocolors-cjs": "^2.1.2", | ||
"zod": "^3.23.8" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^1.0.2", | ||
"@oclif/prettier-config": "^0.2.1", | ||
"@oclif/test": "^4.0.4", | ||
"@total-typescript/ts-reset": "^0.5.1", | ||
"@types/async": "^3.2.24", | ||
"@types/chai": "^4.3.16", | ||
"@types/inquirer": "^9.0.7", | ||
"@types/mocha": "^10.0.7", | ||
"@types/mock-fs": "^4.13.4", | ||
"@types/node": "^20.14.10", | ||
"@types/sinon": "^17.0.3", | ||
"@types/validator": "^13.12.0", | ||
"chai": "^5.1.1", | ||
"eslint": "^9.7.0", | ||
"eslint-config-oclif": "^5.2.0", | ||
"eslint-config-oclif-typescript": "^3.1.8", | ||
"eslint-config-prettier": "^9.1.0", | ||
"globals": "^15.8.0", | ||
"mocha": "^10.6.0", | ||
"mock-fs": "^5.2.0", | ||
"nyc": "^17.0.0", | ||
"obsidian": "1.6.6", | ||
"oclif": "^4.14.5", | ||
"prettier": "^3.3.3", | ||
"shx": "^0.3.4", | ||
"sinon": "^18.0.0", | ||
"ts-node": "^10.9.2", | ||
"tsx": "^4.16.2", | ||
"typescript": "^5.5.3", | ||
"typescript-eslint": "^7.16.1" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"files": [ | ||
"/bin", | ||
"/dist", | ||
"/oclif.manifest.json" | ||
], | ||
"homepage": "https://github.com/msudgh/ovm", | ||
"keywords": [ | ||
"oclif" | ||
], | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"oclif": { | ||
"bin": "ovm", | ||
"dirname": "ovm", | ||
"commands": "./dist/commands", | ||
"plugins": [ | ||
"@oclif/plugin-help", | ||
"@oclif/plugin-plugins", | ||
"@oclif/plugin-not-found" | ||
], | ||
"topicSeparator": " ", | ||
"topics": { | ||
"plugins": { | ||
"description": "Manage plugins for Obsidian vaults" | ||
} | ||
} | ||
}, | ||
"repository": "https://github.com/musdgh/ovm", | ||
"scripts": { | ||
"build": "shx rm -rf dist && tsc -b", | ||
"build:watch": "shx rm -rf dist && tsc -b -w", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"format": "prettier --write \"**/*.{ts,json}\"", | ||
"postpack": "shx rm -f oclif.manifest.json", | ||
"posttest": "pnpm run lint", | ||
"prepack": "oclif manifest && oclif readme", | ||
"test": "mocha", | ||
"coverage": "nyc --reporter=lcov npm run test" | ||
}, | ||
"types": "dist/index.d.ts" | ||
} |
Oops, something went wrong.