@mnaoumov/create-obsidian-plugin 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -334
- package/dist/main.js +6 -2
- package/package.json +13 -4
- package/src/main.ts +2 -1
package/README.md
CHANGED
|
@@ -4,354 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
A scaffolding CLI that generates [Obsidian](https://obsidian.md/) plugin projects from modern templates. Supports creating new plugins and updating existing ones.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| Package manager | Runner | Command |
|
|
10
|
-
|-----------------|--------|---------------------------------------------|
|
|
11
|
-
| npm | create | `npm create @mnaoumov/obsidian-plugin` |
|
|
12
|
-
| npm | npx | `npx @mnaoumov/create-obsidian-plugin` |
|
|
13
|
-
| pnpm | create | `pnpm create @mnaoumov/obsidian-plugin` |
|
|
14
|
-
| pnpm | dlx | `pnpm dlx @mnaoumov/create-obsidian-plugin` |
|
|
15
|
-
| yarn | create | `yarn create @mnaoumov/obsidian-plugin` |
|
|
16
|
-
| yarn | dlx | `yarn dlx @mnaoumov/create-obsidian-plugin` |
|
|
17
|
-
| bun | create | `bun create @mnaoumov/obsidian-plugin` |
|
|
18
|
-
| bun | bunx | `bunx @mnaoumov/create-obsidian-plugin` |
|
|
19
|
-
|
|
20
|
-
This walks you through an interactive wizard to scaffold a new Obsidian plugin project with optional post-scaffold actions (npm install, git init, GitHub repo creation).
|
|
21
|
-
|
|
22
|
-
The wizard first asks for the project's own details — plugin id, name and description, your name and GitHub username, the default branch (`main` unless you say otherwise; `git init` creates it and the CI workflow triggers on it), where people can support you (a funding platform and your username on it, or any URL), and the path to a test vault's config folder — then the feature options below.
|
|
23
|
-
|
|
24
|
-
The id, name and description are checked against what the Obsidian Community directory's automated review enforces, and a rejection says which rule you hit. That matters most for the id: the directory re-reads your `manifest.json` when you submit, and an id can never be changed once your plugin is published.
|
|
25
|
-
|
|
26
|
-
## Update an existing plugin
|
|
7
|
+
**Documentation: <https://mnaoumov.dev/create-obsidian-plugin/>** — every option and prompt, the generated project, updating, custom templates and more.
|
|
27
8
|
|
|
28
|
-
|
|
9
|
+
## Create a new plugin
|
|
29
10
|
|
|
30
11
|
```bash
|
|
31
12
|
npm create @mnaoumov/obsidian-plugin
|
|
32
13
|
```
|
|
33
14
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- Detect the existing project via `.create-obsidian-plugin.json`
|
|
37
|
-
- Compare file hashes to detect local modifications
|
|
38
|
-
- Update unmodified files to the latest template version
|
|
39
|
-
- Skip files you've customized (with a warning)
|
|
40
|
-
- Create any new files added to the template
|
|
41
|
-
|
|
42
|
-
## Non-interactive use
|
|
15
|
+
This walks you through an interactive wizard, then scaffolds the project into a new `obsidian-<plugin id>` folder. pnpm, yarn and bun work too: see [Getting started](https://mnaoumov.dev/create-obsidian-plugin/guides/getting-started/).
|
|
43
16
|
|
|
44
|
-
|
|
17
|
+
Run the same command inside a project it created to [update it](https://mnaoumov.dev/create-obsidian-plugin/guides/updating/) to the latest templates, keeping the files you changed.
|
|
45
18
|
|
|
46
|
-
|
|
47
|
-
|--------|--------------|
|
|
48
|
-
| `-y`, `--yes` | Take the default for every unanswered question, and skip the post-scaffold prompts, so nothing is installed, formatted or committed. The closing `Next steps` line lists what is left, including `format` on prettier and biome, which the project's own `format:check` fails until it has run once. It never asks anything: a question no flag answers stops the run with an error naming the flag |
|
|
49
|
-
| `--mode=create\|update` | Create a new plugin, or update the project in the current directory, without being asked which. Under `--yes` it is required when the current directory holds a `.create-obsidian-plugin.json` |
|
|
50
|
-
| `--force` | Scaffold into an `obsidian-<pluginId>` directory that already exists, instead of being asked. Under `--yes` it is required when that directory exists |
|
|
51
|
-
| `-h`, `--help` | List every option, including the accepted values for each answer |
|
|
52
|
-
| `--answersFile=<path>` | Read answers from a JSON file |
|
|
53
|
-
| `--customTemplate=<dir>` | Layer your own templates over the built-in ones — see [Your own templates](#your-own-templates) |
|
|
54
|
-
| `--latest` | With `--preset=official-sample`: copy the official sample plugin as it is upstream today, rather than the snapshot this release ships — see [Official sample plugin](#official-sample-plugin) |
|
|
55
|
-
| `--<answer>=<value>` | Set one answer, e.g. `--packageManager=yarn` |
|
|
19
|
+
## Example
|
|
56
20
|
|
|
57
|
-
|
|
21
|
+
Answer every question up front and skip the prompts:
|
|
58
22
|
|
|
59
23
|
```bash
|
|
60
|
-
npm create @mnaoumov/obsidian-plugin -- --yes --pluginId=my-tool --packageManager=
|
|
61
|
-
pnpm create @mnaoumov/obsidian-plugin --yes --pluginId=my-tool --packageManager=pnpm
|
|
24
|
+
npm create @mnaoumov/obsidian-plugin "--" --yes --pluginId=my-tool --packageManager=npm
|
|
62
25
|
```
|
|
63
26
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
The answers file is a JSON object using the same names. It also accepts a whole `.create-obsidian-plugin.json`, so you can point it at an existing project to scaffold another one like it:
|
|
67
|
-
|
|
68
|
-
```json
|
|
69
|
-
{
|
|
70
|
-
"preset": "all-in-one",
|
|
71
|
-
"bundler": "esbuild",
|
|
72
|
-
"packageManager": "npm",
|
|
73
|
-
"pluginId": "my-tool"
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Invalid input is refused rather than quietly ignored: an unknown answer, a value outside what a question accepts, a plugin id the wizard itself would reject, or `--currentYear` and `--pluginShortName`, which the generator computes rather than asks for.
|
|
78
|
-
|
|
79
|
-
### Saving the answers from an interactive run
|
|
80
|
-
|
|
81
|
-
At the end of the wizard, before scaffolding, you can save what you just answered as either form — a runnable script (`.cmd` on Windows, `.sh` elsewhere) or an answers file. You can save both and then generate; saving does not end the run. Every answer is written, not only the ones that differ from a default, so the recipe keeps producing the same project after a release changes a default.
|
|
82
|
-
|
|
83
|
-
## Your own templates
|
|
84
|
-
|
|
85
|
-
When the answers cannot express what every plugin of yours needs, keep it in a directory of your own and pass `--customTemplate=<dir>`. The directory mirrors the generator's `templates/default` and is searched ahead of it, so it uses the same EJS templates and the same partials:
|
|
86
|
-
|
|
87
|
-
```text
|
|
88
|
-
my-obsidian-template/
|
|
89
|
-
overlay.json
|
|
90
|
-
README.md@support_mine.ejs # adds a section at an existing render('support') seam
|
|
91
|
-
LICENSE.ejs # replaces the built-in LICENSE
|
|
92
|
-
docs/NOTES.md.ejs # a file the built-ins do not have
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
```json
|
|
96
|
-
{
|
|
97
|
-
"partials": ["mine"],
|
|
98
|
-
"files": ["docs/NOTES.md"],
|
|
99
|
-
"packages": ["type-fest"],
|
|
100
|
-
"badges": ["[](https://example.com)"]
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
- A template at a built-in's path replaces it, but only when your answers emit that file: a `vite.config.ts.ejs` does nothing on an esbuild project.
|
|
105
|
-
- A folder whose name is in parentheses, such as the built-ins' `scripts/(build)/`, only groups templates and is not part of their path. So `scripts/build.ts.ejs` and `scripts/(build)/build.ts.ejs` are the same template, and you may group your own files the same way or not at all.
|
|
106
|
-
- `partials` names what your partial files contribute. The names share one namespace with the built-in partials, so a name the generator already uses is refused. Your partials render after the built-in ones at every seam.
|
|
107
|
-
- `files` lists the paths you add, without `.ejs`. A built-in path is refused there; to replace one, just place its template.
|
|
108
|
-
- `packages` are added to `devDependencies`, and their versions are resolved when you generate, as the built-in ones are.
|
|
109
|
-
- `badges` go after the built-in badges, on the same README line.
|
|
110
|
-
|
|
111
|
-
The directory is checked before any question is asked. A template that nothing would ever emit, a partial nobody declared, a section no template renders, or any other file (except `overlay.json` and a `README.md` of its own) stops the run with the reason.
|
|
112
|
-
|
|
113
|
-
The directory is recorded in `.create-obsidian-plugin.json`, relative to the project, and an update applies it again. That keeps the files it produced updating cleanly rather than looking hand-edited. Pass `--customTemplate=<dir>` on an update to point at a moved directory, or `--customTemplate=` to stop using one. A recorded directory that is missing stops the update instead of quietly reverting your files to the built-ins.
|
|
114
|
-
|
|
115
|
-
## Feature options
|
|
116
|
-
|
|
117
|
-
The wizard lets you pick and choose from the following categories:
|
|
118
|
-
|
|
119
|
-
### Preset
|
|
120
|
-
|
|
121
|
-
| Option | Description |
|
|
122
|
-
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
123
|
-
| All-in-one Framework | Recommended. The author's framework: [@mnaoumov/obsidian-lib](https://github.com/mnaoumov/obsidian-lib), a library of ready-made helpers for settings, commands, modals, notices, file and link handling, and more, plus the @mnaoumov toolkits for building, linting, testing and releases. `"preset": "enhanced"` still works as a deprecated alias |
|
|
124
|
-
| Demo | All features enabled for demonstration |
|
|
125
|
-
| Developer docs showcase | The All-in-one Framework project, plus every code block of the [Obsidian developer docs](https://docs.obsidian.md) as a command you can run. See [Developer docs showcase](#developer-docs-showcase) |
|
|
126
|
-
| Standalone | Standalone plugin without the @mnaoumov library dependencies |
|
|
127
|
-
| Official sample plugin | Exactly [obsidianmd/obsidian-sample-plugin](https://github.com/obsidianmd/obsidian-sample-plugin), with your plugin's id, name, author and description filled in. See [Official sample plugin](#official-sample-plugin) |
|
|
128
|
-
|
|
129
|
-
#### Official sample plugin
|
|
130
|
-
|
|
131
|
-
`"preset": "official-sample"` gives you Obsidian's own sample plugin as it is, rather than a project built from this tool's templates. No other question is asked: upstream has already chosen its tooling (esbuild, ESLint with `eslint-plugin-obsidianmd`, npm), and a tooling flag beside this preset is refused.
|
|
132
|
-
|
|
133
|
-
Only the plugin's identity changes:
|
|
134
|
-
|
|
135
|
-
- `manifest.json`: `id`, `name`, `description`, `author`, `authorUrl` (your GitHub profile) and `fundingUrl`, which is removed if you choose no funding platform
|
|
136
|
-
- `package.json` and `package-lock.json`: the package name, `obsidian-<id>`
|
|
137
|
-
- `README.md`: the title
|
|
138
|
-
|
|
139
|
-
Every other file is upstream's, byte for byte, including its 0BSD `LICENSE` and its `AGENTS.md`. The generator adds only its own `.create-obsidian-plugin.json`, which is what lets an update work the way it does for every preset.
|
|
140
|
-
|
|
141
|
-
The files come from a snapshot this release ships, pinned to an upstream commit in `upstreams.json`, so generating works offline and gives the same result every time. Pass `--latest` to copy upstream as it is today instead; if upstream cannot be reached, the shipped snapshot is used with a warning.
|
|
142
|
-
|
|
143
|
-
Upstream's `npm run lint` fails on a fresh copy, and on upstream itself, until you rename the sample classes and remove the sample code: `eslint-plugin-obsidianmd` checks for exactly that. `npm run build` passes.
|
|
144
|
-
|
|
145
|
-
#### Developer docs showcase
|
|
146
|
-
|
|
147
|
-
`"preset": "docs-showcase"` generates the All-in-one Framework project and adds `src/docs/`: every code block of [obsidianmd/obsidian-developer-docs](https://github.com/obsidianmd/obsidian-developer-docs), each one a command. Open the command palette, type `Docs:`, and run `Docs: Vault > Modify files` to see that block of the Vault page work against a scratch note.
|
|
148
|
-
|
|
149
|
-
Each block is kept as the docs show it. The generator adds only what the docs leave to the reader: the imports a block leaves out, and a host that gives the block a plugin to register things on, a note to work with, an editor, or an element to draw into. A block that declares a plugin class is loaded as a child plugin, and running its command again unloads it. A stylesheet is applied and removed the same way.
|
|
150
|
-
|
|
151
|
-
`src/docs/README.md` lists every block of the docs. A block that does not compile against the `obsidian` API, or that is not plugin code (shell commands, JSON samples, diagrams), is listed there with the reason rather than left out silently.
|
|
152
|
-
|
|
153
|
-
The blocks are type-checked by `src/docs/tsconfig.json`, which carries the official sample plugin's compiler options, so the project's own stricter `tsconfig.json`, linter, formatter and spell checker leave the folder alone. With the vitest answer, `npm run test:integration:desktop` runs every `Docs:` command in a real Obsidian and fails on any that throws.
|
|
154
|
-
|
|
155
|
-
The blocks come from a snapshot this release ships, pinned to an upstream commit in `upstreams.json`. Maintainers refresh it with `npm run sync:docs-showcase`.
|
|
156
|
-
|
|
157
|
-
### Bundler
|
|
158
|
-
|
|
159
|
-
| Option | Description |
|
|
160
|
-
|---------|------------------------------------------|
|
|
161
|
-
| esbuild | Fast and simple (recommended) |
|
|
162
|
-
| Parcel | Zero-config bundler |
|
|
163
|
-
| Rollup | Flexible with plugin ecosystem |
|
|
164
|
-
| Vite | Modern dev server with HMR |
|
|
165
|
-
| Webpack | Mature bundler with broad plugin support |
|
|
166
|
-
|
|
167
|
-
### UI framework
|
|
168
|
-
|
|
169
|
-
| Option | Description |
|
|
170
|
-
|--------|-------------------------------------------|
|
|
171
|
-
| (none) | Plain TypeScript, no UI framework |
|
|
172
|
-
| Lit | Web Components with declarative templates |
|
|
173
|
-
| Preact | Lightweight React alternative (3kB) |
|
|
174
|
-
| React | Component-based UI with JSX |
|
|
175
|
-
| Solid | Fine-grained reactivity, no virtual DOM |
|
|
176
|
-
| Svelte | Lightweight reactive components |
|
|
177
|
-
| Vue | Progressive framework with SFC |
|
|
178
|
-
|
|
179
|
-
### Linter
|
|
180
|
-
|
|
181
|
-
| Option | Description |
|
|
182
|
-
|--------|---------------------------------------------|
|
|
183
|
-
| (none) | No linting |
|
|
184
|
-
| Biome | Fast linter and formatter |
|
|
185
|
-
| ESLint | Industry standard for JavaScript/TypeScript |
|
|
186
|
-
|
|
187
|
-
### Formatter
|
|
188
|
-
|
|
189
|
-
| Option | Description |
|
|
190
|
-
|----------|------------------------------------------|
|
|
191
|
-
| (none) | No formatting |
|
|
192
|
-
| Biome | Fast formatter (pairs with Biome linter) |
|
|
193
|
-
| dprint | Fast, pluggable, written in Rust |
|
|
194
|
-
| Prettier | Opinionated, widely adopted |
|
|
195
|
-
|
|
196
|
-
### Spell checker
|
|
197
|
-
|
|
198
|
-
| Option | Description |
|
|
199
|
-
|--------|-------------------------------------|
|
|
200
|
-
| (none) | No spell checking |
|
|
201
|
-
| cspell | Configurable spell checker for code |
|
|
202
|
-
|
|
203
|
-
### Markdown linter
|
|
204
|
-
|
|
205
|
-
| Option | Description |
|
|
206
|
-
|--------------|-----------------------------------------------|
|
|
207
|
-
| (none) | No Markdown linting |
|
|
208
|
-
| markdownlint | Lint Markdown files for style and consistency |
|
|
209
|
-
|
|
210
|
-
### Unit testing
|
|
211
|
-
|
|
212
|
-
| Option | Description |
|
|
213
|
-
|--------|------------------------------|
|
|
214
|
-
| (none) | No unit testing |
|
|
215
|
-
| Jest | Feature-rich, widely adopted |
|
|
216
|
-
| Vitest | Fast, Vite-native, ESM-first |
|
|
217
|
-
|
|
218
|
-
### E2E testing
|
|
219
|
-
|
|
220
|
-
| Option | Description |
|
|
221
|
-
|---------------|-----------------------------------------------------------|
|
|
222
|
-
| (none) | No E2E testing |
|
|
223
|
-
| obsidian-test | Tests run inside Obsidian with real app APIs |
|
|
224
|
-
| wdio-obsidian | WebdriverIO service for Obsidian, multi-version and CI/CD |
|
|
225
|
-
|
|
226
|
-
### Editor extensions
|
|
227
|
-
|
|
228
|
-
| Option | Description |
|
|
229
|
-
|------------|------------------------------------------------------|
|
|
230
|
-
| (none) | No editor extensions |
|
|
231
|
-
| CodeMirror | CodeMirror 6 state fields, view plugins, decorations |
|
|
232
|
-
|
|
233
|
-
### Styling
|
|
234
|
-
|
|
235
|
-
| Option | Description |
|
|
236
|
-
|--------------|------------------------------------------|
|
|
237
|
-
| (none) | No custom styles |
|
|
238
|
-
| CSS | Plain CSS styles |
|
|
239
|
-
| CSS Modules | Scoped CSS with .module.css files |
|
|
240
|
-
| PostCSS | CSS with plugins (autoprefixer, nesting) |
|
|
241
|
-
| SCSS | Sass/SCSS preprocessor |
|
|
242
|
-
| Tailwind CSS | Utility-first CSS framework |
|
|
243
|
-
|
|
244
|
-
### WebAssembly support
|
|
245
|
-
|
|
246
|
-
| Option | Description |
|
|
247
|
-
|--------|------------------------------|
|
|
248
|
-
| (none) | No WASM |
|
|
249
|
-
| WASM | Import and use .wasm modules |
|
|
250
|
-
|
|
251
|
-
### Commit linting
|
|
252
|
-
|
|
253
|
-
| Option | Description |
|
|
254
|
-
|----------------------|----------------------------------|
|
|
255
|
-
| (none) | No commit linting |
|
|
256
|
-
| Conventional Commits | commitlint + husky + lint-staged |
|
|
257
|
-
|
|
258
|
-
### Hot reload
|
|
259
|
-
|
|
260
|
-
| Option | Description |
|
|
261
|
-
|-------------------|-----------------------------------------------------------------------------------------|
|
|
262
|
-
| (none) | No hot reload support |
|
|
263
|
-
| Hot Reload Plugin | Creates `.hotreload` marker for [Hot Reload](https://community.obsidian.md/plugins/hot-reload) |
|
|
264
|
-
| Obsidian CLI | Reloads via `obsidian plugin:reload` CLI command |
|
|
265
|
-
|
|
266
|
-
### Internationalization
|
|
267
|
-
|
|
268
|
-
| Option | Description |
|
|
269
|
-
|---------------|-----------------------------------------------|
|
|
270
|
-
| (none) | No internationalization |
|
|
271
|
-
| i18next | Popular i18n framework with JSON translations |
|
|
272
|
-
| typesafe-i18n | Type-safe i18n with auto-generated types |
|
|
273
|
-
|
|
274
|
-
### GitHub Actions
|
|
275
|
-
|
|
276
|
-
| Option | Description |
|
|
277
|
-
|--------------|--------------------------------------|
|
|
278
|
-
| (none) | No GitHub Actions workflows |
|
|
279
|
-
| CI + Release | CI + automated release on tag push |
|
|
280
|
-
| CI | CI workflow only (lint, test, build) |
|
|
281
|
-
|
|
282
|
-
### GitHub issue templates
|
|
283
|
-
|
|
284
|
-
| Option | Description |
|
|
285
|
-
|---------------|------------------------------------------|
|
|
286
|
-
| (none) | No issue templates |
|
|
287
|
-
| Bug & Feature | Bug report and feature request templates |
|
|
288
|
-
|
|
289
|
-
### Coverage badge
|
|
290
|
-
|
|
291
|
-
| Option | Description |
|
|
292
|
-
|----------------|----------------------------------------------------------------|
|
|
293
|
-
| (none) | No coverage badge |
|
|
294
|
-
| Coverage badge | A `coverage: 100%` badge at the end of the README's badge line |
|
|
295
|
-
|
|
296
|
-
### Funding
|
|
297
|
-
|
|
298
|
-
Asked with the project details, not under Customize. The platform and your username on it produce the `fundingUrl` in `manifest.json`, the README's badge and `## Support` link, and a `.github/FUNDING.yml` with that one platform's line. `(none)` emits none of them.
|
|
299
|
-
|
|
300
|
-
| Option | Description |
|
|
301
|
-
|-----------------|------------------------------------------------------------|
|
|
302
|
-
| (none) | No funding link, FUNDING.yml or badge |
|
|
303
|
-
| Buy Me a Coffee | buymeacoffee.com/<username> |
|
|
304
|
-
| GitHub Sponsors | github.com/sponsors/<username> |
|
|
305
|
-
| Ko-fi | ko-fi.com/<username> |
|
|
306
|
-
| Liberapay | liberapay.com/<username> |
|
|
307
|
-
| Open Collective | opencollective.com/<username> |
|
|
308
|
-
| Patreon | patreon.com/<username> |
|
|
309
|
-
| Polar | polar.sh/<username> |
|
|
310
|
-
| thanks.dev | thanks.dev/<username>, e.g. `u/gh/<GitHub username>` |
|
|
311
|
-
| Custom URL | Any other URL, asked for as a URL rather than a username |
|
|
312
|
-
|
|
313
|
-
### Obsidian API subset
|
|
314
|
-
|
|
315
|
-
| Option | Description |
|
|
316
|
-
|-----------------------|------------------------------------------------------------|
|
|
317
|
-
| Official API | Stable, documented API only |
|
|
318
|
-
| Official + Unofficial | Includes internal undocumented APIs (for experienced devs) |
|
|
319
|
-
|
|
320
|
-
### Package manager
|
|
321
|
-
|
|
322
|
-
| Option | Description |
|
|
323
|
-
|--------|-------------------------------------|
|
|
324
|
-
| Bun | Fast all-in-one JavaScript toolkit |
|
|
325
|
-
| npm | Default, comes with Node.js |
|
|
326
|
-
| pnpm | Fast, efficient disk space |
|
|
327
|
-
| Yarn | Classic alternative with workspaces |
|
|
328
|
-
|
|
329
|
-
### Platform support
|
|
330
|
-
|
|
331
|
-
| Option | Description |
|
|
332
|
-
|--------------------|------------------------------------|
|
|
333
|
-
| Desktop and mobile | Plugin works on desktop and mobile |
|
|
334
|
-
| Desktop only | Plugin works only on desktop |
|
|
335
|
-
|
|
336
|
-
## Configuration file
|
|
337
|
-
|
|
338
|
-
The `.create-obsidian-plugin.json` file stores:
|
|
339
|
-
|
|
340
|
-
- `generatorVersion` — version of the generator that created the project
|
|
341
|
-
- `fileHashes` — SHA-256 hashes of generated files for update detection
|
|
342
|
-
- `answers` — every answer, which an update reuses
|
|
343
|
-
- `customTemplate` — the [custom template](#your-own-templates) directory, if one was used
|
|
344
|
-
|
|
345
|
-
## Architecture
|
|
346
|
-
|
|
347
|
-
- **EJS templates** with a partial-based composition system
|
|
348
|
-
- **Logicless templates** — no `<% if %>` conditionals; conditional content via partials
|
|
349
|
-
- **Two-tier scripts** — standalone has full inline scripts; All-in-one Framework wraps `@mnaoumov/obsidian-dev-toolkit` and `@mnaoumov/typescript-dev-toolkit`
|
|
350
|
-
- **Root configs are thin wrappers** — actual logic lives in `scripts/`
|
|
351
|
-
|
|
352
|
-
## Sample output
|
|
27
|
+
Keep the quotes around `"--"`: in PowerShell a bare `--` is swallowed before npm sees it. See [The -- separator in PowerShell](https://mnaoumov.dev/create-obsidian-plugin/guides/powershell-separator/). Every option is listed in [Command-line options](https://mnaoumov.dev/create-obsidian-plugin/guides/command-line/).
|
|
353
28
|
|
|
354
|
-
|
|
29
|
+
[Sample Plugin Extended](https://github.com/mnaoumov/obsidian-sample-plugin-extended) is a plugin generated with this tool.
|
|
355
30
|
|
|
356
31
|
## Contributing
|
|
357
32
|
|
package/dist/main.js
CHANGED
|
@@ -2612,7 +2612,11 @@ function getAnswerableKeys() {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
function getHelpText() {
|
|
2614
2614
|
const lines = [
|
|
2615
|
-
|
|
2615
|
+
'Usage: npm create @mnaoumov/obsidian-plugin ["--" <options>]',
|
|
2616
|
+
"",
|
|
2617
|
+
'npm needs the "--" before the options; pnpm, yarn and bun do not. Keep its quotes: PowerShell',
|
|
2618
|
+
"swallows a bare --. See https://mnaoumov.dev/create-obsidian-plugin/guides/powershell-separator/",
|
|
2619
|
+
"Full documentation: https://mnaoumov.dev/create-obsidian-plugin/",
|
|
2616
2620
|
"",
|
|
2617
2621
|
"Options:",
|
|
2618
2622
|
" -y, --yes Take every default and skip the post-scaffold prompts. Never asks:",
|
|
@@ -4757,7 +4761,7 @@ async function offerAnswersExport(answers, customTemplate) {
|
|
|
4757
4761
|
writeFileSync2(join9(process.cwd(), answersFileName), formatAnswersJson(answers));
|
|
4758
4762
|
log5.success(`Wrote ${answersFileName}`);
|
|
4759
4763
|
const overlayFlag = customTemplate ? ` --customTemplate=${customTemplate}` : "";
|
|
4760
|
-
note(`npm create @mnaoumov/obsidian-plugin -- --yes --mode=create --answersFile=${answersFileName}${overlayFlag}`, "Non-interactive command");
|
|
4764
|
+
note(`npm create @mnaoumov/obsidian-plugin "--" --yes --mode=create --answersFile=${answersFileName}${overlayFlag}`, "Non-interactive command");
|
|
4761
4765
|
}
|
|
4762
4766
|
choice = await ask();
|
|
4763
4767
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnaoumov/create-obsidian-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Create Obsidian plugin from modern templates.",
|
|
5
|
-
"homepage": "https://
|
|
5
|
+
"homepage": "https://mnaoumov.dev/create-obsidian-plugin/",
|
|
6
6
|
"bugs": "https://github.com/mnaoumov/create-obsidian-plugin/issues",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "jiti scripts/build.ts",
|
|
29
29
|
"commit": "jiti scripts/commit.ts",
|
|
30
|
+
"docs:build": "jiti scripts/docs-build.ts",
|
|
31
|
+
"docs:dev": "jiti scripts/docs-dev.ts",
|
|
32
|
+
"docs:preview": "jiti scripts/docs-preview.ts",
|
|
30
33
|
"format": "jiti scripts/format.ts",
|
|
31
34
|
"format:check": "jiti scripts/format-check.ts",
|
|
32
35
|
"gate:case": "jiti scripts/gate-one-case.ts",
|
|
@@ -57,24 +60,28 @@
|
|
|
57
60
|
"typescript": "$typescript"
|
|
58
61
|
},
|
|
59
62
|
"dependencies": {
|
|
60
|
-
"@clack/core": "^1.
|
|
61
|
-
"@clack/prompts": "^1.
|
|
63
|
+
"@clack/core": "^1.5.1",
|
|
64
|
+
"@clack/prompts": "^1.8.1",
|
|
62
65
|
"ejs": "^6.0.1",
|
|
63
66
|
"semver": "^7.8.5"
|
|
64
67
|
},
|
|
65
68
|
"devDependencies": {
|
|
69
|
+
"@astrojs/markdown-satteri": "^0.4.6",
|
|
70
|
+
"@astrojs/starlight": "^0.42.8",
|
|
66
71
|
"@commitlint/cli": "^21.2.2",
|
|
67
72
|
"@commitlint/config-conventional": "^21.2.2",
|
|
68
73
|
"@commitlint/types": "^21.2.0",
|
|
69
74
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
70
75
|
"@eslint/js": "^10.0.1",
|
|
71
76
|
"@mnaoumov/typescript-dev-toolkit": "^5.2.0",
|
|
77
|
+
"@resvg/resvg-js": "^2.6.2",
|
|
72
78
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
73
79
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
74
80
|
"@tsconfig/strictest": "^2.0.8",
|
|
75
81
|
"@types/ejs": "^3.1.5",
|
|
76
82
|
"@types/semver": "^7.8.0",
|
|
77
83
|
"@vitest/coverage-v8": "^5.0.5",
|
|
84
|
+
"astro": "^7.4.4",
|
|
78
85
|
"better-typescript-lib": "^2.12.0",
|
|
79
86
|
"cspell": "^10.1.1",
|
|
80
87
|
"czg": "^1.14.0",
|
|
@@ -88,6 +95,8 @@
|
|
|
88
95
|
"husky": "^9.1.7",
|
|
89
96
|
"ignore": "^7.0.12",
|
|
90
97
|
"jiti": "^2.7.0",
|
|
98
|
+
"satori": "^0.33.5",
|
|
99
|
+
"satteri": "^0.10.5",
|
|
91
100
|
"typescript": "6.0.3",
|
|
92
101
|
"typescript-eslint": "^8.68.0",
|
|
93
102
|
"vitest": "^5.0.5",
|
package/src/main.ts
CHANGED
|
@@ -417,7 +417,8 @@ async function offerAnswersExport(answers: Answers, customTemplate: string | und
|
|
|
417
417
|
writeFileSync(join(process.cwd(), answersFileName), formatAnswersJson(answers));
|
|
418
418
|
log.success(`Wrote ${answersFileName}`);
|
|
419
419
|
const overlayFlag = customTemplate ? ` --customTemplate=${customTemplate}` : '';
|
|
420
|
-
|
|
420
|
+
// `"--"` is quoted so the command works pasted into PowerShell, which swallows a bare `--`, as well as cmd and sh.
|
|
421
|
+
note(`npm create @mnaoumov/obsidian-plugin "--" --yes --mode=create --answersFile=${answersFileName}${overlayFlag}`, 'Non-interactive command');
|
|
421
422
|
}
|
|
422
423
|
|
|
423
424
|
choice = await ask();
|