mirror of
https://github.com/stracker-phil/obsidian-mention-things.git
synced 2026-07-22 05:43:27 +00:00
🔧 Improve dev setup
This commit is contained in:
parent
023000536f
commit
83b1460439
5 changed files with 3665 additions and 175 deletions
81
DEVELOPMENT.md
Normal file
81
DEVELOPMENT.md
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
# Development
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
1. `npm ci`
|
||||||
|
2. `npm run dev`
|
||||||
|
|
||||||
|
### Symlink to Sandbox
|
||||||
|
|
||||||
|
Create a symlink from the dist folder to the Sandbox vault:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd /Users/philipp/Obsidian/Sandbox/.obsidian/plugins
|
||||||
|
ln -s /Users/philipp/Coding/Obsidian/journal-reflection/dist ./journal-reflection
|
||||||
|
```
|
||||||
|
|
||||||
|
## NPM Scripts
|
||||||
|
|
||||||
|
### `npm run dev`
|
||||||
|
|
||||||
|
Starts a development server and watches for changes.
|
||||||
|
|
||||||
|
Output of the dev plugin is in `dist/` folder.
|
||||||
|
|
||||||
|
**Testing the changes**
|
||||||
|
|
||||||
|
- Open the Sandbox vault in Obsidian (make sure the symlink is set up - see above)
|
||||||
|
- After every change, disable and re-enable the plugin in Obsidian settings to apply changes
|
||||||
|
|
||||||
|
### `npm run version`
|
||||||
|
|
||||||
|
Important: Before calling this script, update the `version` attribute in the `package.json` file.
|
||||||
|
|
||||||
|
Bumps the plugin version. Must run before an official plugin release can happen.
|
||||||
|
|
||||||
|
Expected updates:
|
||||||
|
- `manifest.json`
|
||||||
|
- `versions.json`
|
||||||
|
|
||||||
|
### `npm run build`
|
||||||
|
|
||||||
|
Packages the plugin for release.
|
||||||
|
|
||||||
|
Output of the full plugin is in `dist/` folder.
|
||||||
|
|
||||||
|
### `npm test`
|
||||||
|
|
||||||
|
Runs the test suite once using Jest.
|
||||||
|
|
||||||
|
All tests are located next to their corresponding source files with the `.test.ts` extension.
|
||||||
|
|
||||||
|
### `npm run test:watch`
|
||||||
|
|
||||||
|
Runs the test suite in watch mode. Tests automatically re-run when files change.
|
||||||
|
|
||||||
|
Useful during development to get instant feedback on code changes.
|
||||||
|
|
||||||
|
### `npm run test:coverage`
|
||||||
|
|
||||||
|
Runs the test suite and generates a coverage report.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
The plugin uses Jest for unit testing. Tests are colocated with source files.
|
||||||
|
|
||||||
|
### Running Tests During Development
|
||||||
|
|
||||||
|
1. **One-time run**: `npm test` - Quick check before commits
|
||||||
|
2. **Watch mode**: `npm run test:watch` - Continuous testing during development
|
||||||
|
3. **Coverage check**: `npm run test:coverage` - Verify test coverage
|
||||||
|
|
||||||
|
## Create a New Release
|
||||||
|
|
||||||
|
1. Commit all changes
|
||||||
|
2. Bump version in `package.json`
|
||||||
|
3. Run `npm run version`
|
||||||
|
4. Run `npm run build`
|
||||||
|
5. Add a version tag in git (`git tag vX.Y.Z`)
|
||||||
|
6. Push to GitHub (`git push --tags`)
|
||||||
|
|
||||||
|
The GitHub workflow will automatically create a new release in the git repo.
|
||||||
|
|
@ -25,8 +25,8 @@ const copyFilesToDist = {
|
||||||
|
|
||||||
await fs.copy('manifest.json', path.join(distDir, 'manifest.json'));
|
await fs.copy('manifest.json', path.join(distDir, 'manifest.json'));
|
||||||
|
|
||||||
if (await fs.pathExists('styles.css')) {
|
if (await fs.pathExists('src/styles.css')) {
|
||||||
await fs.copy('styles.css', path.join(distDir, 'styles.css'));
|
await fs.copy('src/styles.css', path.join(distDir, 'styles.css'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await fs.pathExists('resources')) {
|
if (await fs.pathExists('resources')) {
|
||||||
|
|
|
||||||
3739
package-lock.json
generated
3739
package-lock.json
generated
File diff suppressed because it is too large
Load diff
13
package.json
13
package.json
|
|
@ -6,14 +6,18 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node esbuild.config.mjs",
|
"dev": "node esbuild.config.mjs",
|
||||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
"version": "node version-bump.mjs && git add manifest.json versions.json",
|
||||||
|
"test": "jest",
|
||||||
|
"test:watch": "jest --watch",
|
||||||
|
"test:coverage": "jest --coverage"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
"author": "Philipp Stracker",
|
||||||
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/stracker-phil/obsidian-mention-things.git"
|
"url": "git+https://github.com/stracker-phil/obsidian-mention-things.git"
|
||||||
},
|
},
|
||||||
"author": "Philipp Stracker",
|
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
"name": "Tobias Davis",
|
"name": "Tobias Davis",
|
||||||
|
|
@ -25,13 +29,16 @@
|
||||||
"url": "https://github.com/stracker-phil/obsidian-mention-things/issues"
|
"url": "https://github.com/stracker-phil/obsidian-mention-things/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/jest": "^29.5.14",
|
||||||
"@types/node": "^16.11.6",
|
"@types/node": "^16.11.6",
|
||||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
"@typescript-eslint/eslint-plugin": "5.29.0",
|
||||||
"@typescript-eslint/parser": "5.29.0",
|
"@typescript-eslint/parser": "5.29.0",
|
||||||
"builtin-modules": "3.3.0",
|
"builtin-modules": "3.3.0",
|
||||||
"esbuild": "0.17.3",
|
"esbuild": "0.25",
|
||||||
"fs-extra": "^11.3.0",
|
"fs-extra": "^11.3.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
"obsidian": "latest",
|
"obsidian": "latest",
|
||||||
|
"ts-jest": "^29.4.6",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.4.0",
|
||||||
"typescript": "4.7.4"
|
"typescript": "4.7.4"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
src/styles.css
Normal file
3
src/styles.css
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
.mention-type-row .type-label {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue