Skip to content

Commit

Permalink
chore: huge code cleanup effort! (#6)
Browse files Browse the repository at this point in the history
* chore: huge code cleanup effort!

* chore: remove unused dependencies

* chore: remove .editorconfig in favor of prettier (sorry)

* chore: add links to readme

* chore: add github actions

* chore: fix run commands

* chore: fix action... hopefully

* chore: fix for real
  • Loading branch information
AriTheElk authored Dec 15, 2024
1 parent f4a0fb1 commit 7ec307a
Show file tree
Hide file tree
Showing 24 changed files with 3,237 additions and 1,198 deletions.
10 changes: 0 additions & 10 deletions .editorconfig

This file was deleted.

24 changes: 22 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
},
"plugins": [
"@typescript-eslint",
"import"
],
"ignorePatterns": [
"node_modules/",
"dist/"
],
"extends": [
"eslint:recommended",
Expand All @@ -19,13 +24,28 @@
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
"warn",
{
"args": "none"
}
],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "warn",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
"@typescript-eslint/no-empty-function": "off",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"newlines-between": "always"
}
]
}
}
30 changes: 30 additions & 0 deletions .github/workflows/lint.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Lint

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
30 changes: 30 additions & 0 deletions .github/workflows/typecheck.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Typecheck

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run typecheck
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Image Picker is a _blazingly_ fast way to browse and find media in your Obsidian

![Image Picker Preview](./preview.gif)

🐙 [GitHub](https://github.com/AriTheElk/obsidian-image-picker) | 📖 [Docs](https://ari.the.elk.wtf/obsidian/plugins/image-picker) | 💝 [Donate](https://ari.the.elk.wtf/donate)

# ⚙️ Settings

- **Image Folder**: The highest root folder that you want Image Picker to search for images in. If you store your attachments in a specific folder, please select it for better performance.
- **Animate Gifs**: Whether or not to animate gifs in the preview. Disabling this will improve performance if you have a lot of gifs in your vault.
- **Debug Mode**: Enable this to see helpful debug logs in the console. Please use this if you're experiencing issues and want to report them.
- **Reset Image Index**: Click this button to reset the image index and reload Obsidian. This will force Image Picker to re-index your vault, which is useful if you've changed your `Image Folder`.

# 🗺️ Roadmap

- [x] Performantly browse photos across your vault
Expand All @@ -15,6 +24,32 @@ Image Picker is a _blazingly_ fast way to browse and find media in your Obsidian
- [ ] Index and search for images by metadata, such as location, date, and more
- [ ] Support for video and audio files

# 🛠️ Contributing

Quick start:

```bash
# Clone the repository
git clone https://github.com/AriTheElk/obsidian-image-picker
cd obsidian-image-picker

# Install the dependencies
npm install

# To build the plugin
npm run build

# If you want to build the plugin directly into your vault
echo "/ABSOLUTE/PATH/TO/YOUR/VAULT" > .env
npm run build:vault
```

This will clone the repository, install the dependencies, and build the plugin. If you've set the path correctly, the plugin should be available in your Obsidian vault. It copies to `{vault}/.obsidian/plugins/obsidian-image-picker-dev` immediately after building.

If you'd like to help out, I'd recommend checking out the [help wanted](https://github.com/AriTheElk/obsidian-image-picker/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) tag 🫶🏻

I'm eternally grateful for any help I get :)

# 👩‍⚖️ License

Obsidian Image Picker is licensed under the MIT License. See [LICENSE](LICENSE.md) for more information.
22 changes: 8 additions & 14 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import esbuild from 'esbuild'
import process from 'process'
import { promises as fs } from 'fs'
import path from 'path'
import { readFileSync } from 'fs'

import esbuild from 'esbuild'
import builtins from 'builtin-modules'
import { copy } from 'esbuild-plugin-copy'
import { sassPlugin } from 'esbuild-sass-plugin'
import { config } from 'dotenv'
import { promises as fs } from 'fs'
import path from 'path'
import { readFileSync } from 'fs'

config() // Load .env file

Expand All @@ -21,6 +22,7 @@ if you want to view the source, please visit the github repository of this plugi
`

const prod = process.argv[2] === 'production'
const move = process.argv[3] === 'move'

const context = await esbuild.context({
banner: {
Expand Down Expand Up @@ -66,25 +68,17 @@ const context = await esbuild.context({
from: ['versions.json'],
to: ['./versions.json'],
},
{
from: ['dist/main.js'],
to: ['../main.js'],
},
{
from: ['dist/styles.css'],
to: ['../styles.css'],
},
],
}),
],
})

if (prod) {
await context.rebuild()
if (process.env.OBSIDIAN_VAULT_PATH) {
if (process.env.OBSIDIAN_VAULT_PATH && move) {
const destPath = path.join(
process.env.OBSIDIAN_VAULT_PATH,
`.obsidian/plugins/${packageName}`
`.obsidian/plugins/${packageName}-dev`
)
console.log(`Copying to ${destPath}`)
await fs.mkdir(destPath, { recursive: true })
Expand Down
107 changes: 0 additions & 107 deletions main.js

This file was deleted.

Loading

0 comments on commit 7ec307a

Please sign in to comment.