@mnaoumov/create-obsidian-plugin 0.0.0-stage → 1.0.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.
Files changed (470) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +341 -2
  3. package/dist/main.js +4184 -0
  4. package/package.json +78 -4
  5. package/src/main.ts +650 -0
  6. package/templates/default/.depcheckrc.json.ejs +19 -0
  7. package/templates/default/.editorconfig.ejs +11 -0
  8. package/templates/default/.env.ejs +1 -0
  9. package/templates/default/.env@vault_has-vault-false.ejs +2 -0
  10. package/templates/default/.env@vault_has-vault-true.ejs +1 -0
  11. package/templates/default/.gitattributes.ejs +7 -0
  12. package/templates/default/.github/FUNDING.yml.ejs +3 -0
  13. package/templates/default/.github/ISSUE_TEMPLATE/bug_report.yml.ejs +71 -0
  14. package/templates/default/.github/ISSUE_TEMPLATE/config.yml.ejs +1 -0
  15. package/templates/default/.github/ISSUE_TEMPLATE/feature_request.yml.ejs +61 -0
  16. package/templates/default/.github/workflows/attest-release-assets.yml.ejs +24 -0
  17. package/templates/default/.github/workflows/ci.yml.ejs +20 -0
  18. package/templates/default/.github/workflows/ci.yml@steps_biome-linter.ejs +1 -0
  19. package/templates/default/.github/workflows/ci.yml@steps_cspell.ejs +1 -0
  20. package/templates/default/.github/workflows/ci.yml@steps_dprint.ejs +1 -0
  21. package/templates/default/.github/workflows/ci.yml@steps_eslint.ejs +1 -0
  22. package/templates/default/.github/workflows/ci.yml@steps_jest.ejs +1 -0
  23. package/templates/default/.github/workflows/ci.yml@steps_markdownlint.ejs +1 -0
  24. package/templates/default/.github/workflows/ci.yml@steps_prettier.ejs +1 -0
  25. package/templates/default/.github/workflows/ci.yml@steps_vitest.ejs +1 -0
  26. package/templates/default/.github/workflows/release.yml.ejs +27 -0
  27. package/templates/default/.github/workflows/update-license-year.yml.ejs +38 -0
  28. package/templates/default/.gitignore_common.ejs +27 -0
  29. package/templates/default/.gitignore_scss.ejs +1 -0
  30. package/templates/default/.gitignore_tailwind.ejs +3 -0
  31. package/templates/default/.husky/commit-msg.ejs +1 -0
  32. package/templates/default/.husky/pre-commit.ejs +1 -0
  33. package/templates/default/.markdownlint-cli2.mjs.ejs +4 -0
  34. package/templates/default/.nano-staged.mjs.ejs +5 -0
  35. package/templates/default/.npmrc.ejs +1 -0
  36. package/templates/default/.parcelrc.ejs +9 -0
  37. package/templates/default/.parcelrc@transformers_svelte.ejs +1 -0
  38. package/templates/default/.prettierignore.ejs +10 -0
  39. package/templates/default/.typesafe-i18n.json.ejs +5 -0
  40. package/templates/default/CONTRIBUTING.md.ejs +49 -0
  41. package/templates/default/CONTRIBUTING.md@demo-vault_dev-utils.ejs +15 -0
  42. package/templates/default/CONTRIBUTING.md@scripts_biome-formatter.ejs +1 -0
  43. package/templates/default/CONTRIBUTING.md@scripts_biome-linter.ejs +1 -0
  44. package/templates/default/CONTRIBUTING.md@scripts_conventional-commits.ejs +1 -0
  45. package/templates/default/CONTRIBUTING.md@scripts_cspell.ejs +1 -0
  46. package/templates/default/CONTRIBUTING.md@scripts_dev-utils.ejs +1 -0
  47. package/templates/default/CONTRIBUTING.md@scripts_dprint.ejs +1 -0
  48. package/templates/default/CONTRIBUTING.md@scripts_eslint.ejs +1 -0
  49. package/templates/default/CONTRIBUTING.md@scripts_jest.ejs +1 -0
  50. package/templates/default/CONTRIBUTING.md@scripts_markdownlint.ejs +1 -0
  51. package/templates/default/CONTRIBUTING.md@scripts_prettier.ejs +1 -0
  52. package/templates/default/CONTRIBUTING.md@scripts_vitest.ejs +1 -0
  53. package/templates/default/LICENSE.ejs +21 -0
  54. package/templates/default/README.md.ejs +28 -0
  55. package/templates/default/README.md@demo-vault_dev-utils.ejs +12 -0
  56. package/templates/default/README.md@preset_dev-utils.ejs +12 -0
  57. package/templates/default/README.md@support_has-funding.ejs +8 -0
  58. package/templates/default/babel.config.json.ejs +8 -0
  59. package/templates/default/babel.config.mjs.ejs +5 -0
  60. package/templates/default/biome.jsonc.ejs +47 -0
  61. package/templates/default/commitlint.config.ts.ejs +1 -0
  62. package/templates/default/cspell.json.ejs +67 -0
  63. package/templates/default/demo-vault/.gitignore.ejs +15 -0
  64. package/templates/default/demo-vault/.obsidian/app.json.ejs +4 -0
  65. package/templates/default/demo-vault/.obsidian/community-plugins.json.ejs +4 -0
  66. package/templates/default/demo-vault/00 Start.md.ejs +32 -0
  67. package/templates/default/demo-vault/00 Start.md@features_wasm.ejs +1 -0
  68. package/templates/default/demo-vault/01 Sample commands.md.ejs +38 -0
  69. package/templates/default/demo-vault/01 Sample commands.md@commands_wasm.ejs +4 -0
  70. package/templates/default/demo-vault/02 Settings.md.ejs +40 -0
  71. package/templates/default/demo-vault/03 WebAssembly.md.ejs +34 -0
  72. package/templates/default/demo-vault/Materials/01 Sample commands/Scratch note.md.ejs +5 -0
  73. package/templates/default/demo-vault/README.md.ejs +10 -0
  74. package/templates/default/demo-vault/_assets/CodeScriptToolkit/demoSetup.ts.ejs +88 -0
  75. package/templates/default/demo-vault/_assets/CodeScriptToolkit/demoSetup.ts@commands_wasm.ejs +10 -0
  76. package/templates/default/demo-vault/_assets/CodeScriptToolkit/startup.ts.ejs +17 -0
  77. package/templates/default/dprint.json_dev-utils.ejs +10 -0
  78. package/templates/default/dprint.json_standalone.ejs +26 -0
  79. package/templates/default/e2e/sample.spec.ts_obsidian-test.ejs +16 -0
  80. package/templates/default/e2e/sample.spec.ts_obsidian-test@lint-no-void-disable_dev-utils.ejs +3 -0
  81. package/templates/default/e2e/sample.spec.ts_obsidian-test@lint-no-void-enable_dev-utils.ejs +1 -0
  82. package/templates/default/e2e/sample.spec.ts_obsidian-test@unofficial_with-unofficial.ejs +13 -0
  83. package/templates/default/e2e/sample.spec.ts_wdio-obsidian.ejs +7 -0
  84. package/templates/default/e2e/sample.spec.ts_wdio-obsidian@unofficial_with-unofficial.ejs +15 -0
  85. package/templates/default/eslint.config.mts_dev-utils.ejs +1 -0
  86. package/templates/default/eslint.config.mts_standalone.ejs +119 -0
  87. package/templates/default/eslint.config.mts_standalone@extra-files_has-e2e.ejs +2 -0
  88. package/templates/default/jest.config.ts.ejs +57 -0
  89. package/templates/default/jest.config.ts@lint-root-dir_dev-utils.ejs +1 -0
  90. package/templates/default/jest.config.ts@ts-jest-tsconfig_solid.ejs +8 -0
  91. package/templates/default/linkinator.config.json.ejs +11 -0
  92. package/templates/default/manifest.json.ejs +11 -0
  93. package/templates/default/manifest.json@funding_has-funding.ejs +1 -0
  94. package/templates/default/manifest.json@platform_desktop-and-mobile.ejs +1 -0
  95. package/templates/default/manifest.json@platform_desktop-only.ejs +1 -0
  96. package/templates/default/package.json.ejs +32 -0
  97. package/templates/default/package.json@targets_parcel.ejs +36 -0
  98. package/templates/default/parcel-namer-obsidian.cjs.ejs +26 -0
  99. package/templates/default/parcel-resolver-obsidian.cjs.ejs +37 -0
  100. package/templates/default/parcel-transformer-inline-imports.cjs.ejs +39 -0
  101. package/templates/default/parcel-transformer-svelte.cjs.ejs +67 -0
  102. package/templates/default/pinned-versions.json.ejs +1 -0
  103. package/templates/default/pnpm-workspace.yaml.ejs +19 -0
  104. package/templates/default/postcss.config.cjs.ejs +12 -0
  105. package/templates/default/prettier.config.mjs.ejs +5 -0
  106. package/templates/default/rollup.config.mjs.ejs +7 -0
  107. package/templates/default/scripts/babel.config.ts_rollup.ejs +16 -0
  108. package/templates/default/scripts/babel.config.ts_rollup@babel-plugin_preact.ejs +1 -0
  109. package/templates/default/scripts/babel.config.ts_rollup@babel-preset_react.ejs +1 -0
  110. package/templates/default/scripts/babel.config.ts_rollup@babel-preset_solid.ejs +1 -0
  111. package/templates/default/scripts/build-clean.ts.ejs +4 -0
  112. package/templates/default/scripts/build-compile.ts.ejs +4 -0
  113. package/templates/default/scripts/build-styles.ts.ejs +12 -0
  114. package/templates/default/scripts/build.ts.ejs +6 -0
  115. package/templates/default/scripts/build.ts@bundler_cli-bundler.ejs +63 -0
  116. package/templates/default/scripts/build.ts@bundler_cli-bundler@compile_svelte.ejs +4 -0
  117. package/templates/default/scripts/build.ts@bundler_cli-bundler@fs-import_hot-reload-plugin.ejs +2 -0
  118. package/templates/default/scripts/build.ts@bundler_cli-bundler@hot-reload_hot-reload-plugin.ejs +3 -0
  119. package/templates/default/scripts/build.ts@bundler_cli-bundler@import_tailwind.ejs +2 -0
  120. package/templates/default/scripts/build.ts@bundler_cli-bundler@lint-build-styles_dev-utils.ejs +1 -0
  121. package/templates/default/scripts/build.ts@bundler_cli-bundler@reload_obsidian-cli.ejs +5 -0
  122. package/templates/default/scripts/build.ts@bundler_cli-bundler@run_parcel.ejs +1 -0
  123. package/templates/default/scripts/build.ts@bundler_cli-bundler@run_rollup.ejs +1 -0
  124. package/templates/default/scripts/build.ts@bundler_cli-bundler@run_vite.ejs +1 -0
  125. package/templates/default/scripts/build.ts@bundler_cli-bundler@run_webpack.ejs +1 -0
  126. package/templates/default/scripts/build.ts@bundler_esbuild.ejs +3 -0
  127. package/templates/default/scripts/build.ts@bundler_esbuild@compile_svelte.ejs +4 -0
  128. package/templates/default/scripts/build.ts@bundler_esbuild@dev-utils-pre-build_tailwind.ejs +2 -0
  129. package/templates/default/scripts/build.ts@bundler_esbuild@fs-import_hot-reload-plugin.ejs +2 -0
  130. package/templates/default/scripts/build.ts@bundler_esbuild@hot-reload_hot-reload-plugin.ejs +4 -0
  131. package/templates/default/scripts/build.ts@bundler_esbuild@import_postcss.ejs +1 -0
  132. package/templates/default/scripts/build.ts@bundler_esbuild@import_scss.ejs +1 -0
  133. package/templates/default/scripts/build.ts@bundler_esbuild@import_solid.ejs +1 -0
  134. package/templates/default/scripts/build.ts@bundler_esbuild@import_svelte.ejs +10 -0
  135. package/templates/default/scripts/build.ts@bundler_esbuild@import_tailwind.ejs +1 -0
  136. package/templates/default/scripts/build.ts@bundler_esbuild@import_vue.ejs +1 -0
  137. package/templates/default/scripts/build.ts@bundler_esbuild@lint-build-styles_dev-utils.ejs +1 -0
  138. package/templates/default/scripts/build.ts@bundler_esbuild@options_preact.ejs +2 -0
  139. package/templates/default/scripts/build.ts@bundler_esbuild@options_react.ejs +1 -0
  140. package/templates/default/scripts/build.ts@bundler_esbuild@options_wasm.ejs +5 -0
  141. package/templates/default/scripts/build.ts@bundler_esbuild@plugin_postcss.ejs +1 -0
  142. package/templates/default/scripts/build.ts@bundler_esbuild@plugin_scss.ejs +1 -0
  143. package/templates/default/scripts/build.ts@bundler_esbuild@plugin_solid.ejs +1 -0
  144. package/templates/default/scripts/build.ts@bundler_esbuild@plugin_svelte.ejs +5 -0
  145. package/templates/default/scripts/build.ts@bundler_esbuild@plugin_vue.ejs +1 -0
  146. package/templates/default/scripts/build.ts@bundler_esbuild@preset_dev-utils.ejs +7 -0
  147. package/templates/default/scripts/build.ts@bundler_esbuild@preset_standalone.ejs +138 -0
  148. package/templates/default/scripts/build.ts@bundler_esbuild@reload_obsidian-cli.ejs +6 -0
  149. package/templates/default/scripts/commit.ts_dev-utils.ejs +3 -0
  150. package/templates/default/scripts/commit.ts_standalone.ejs +3 -0
  151. package/templates/default/scripts/commitlint-config.ts.ejs +5 -0
  152. package/templates/default/scripts/demo-vault-global-setup.ts.ejs +43 -0
  153. package/templates/default/scripts/dev.ts.ejs +6 -0
  154. package/templates/default/scripts/dev.ts@bundler_cli-bundler.ejs +8 -0
  155. package/templates/default/scripts/dev.ts@bundler_esbuild.ejs +3 -0
  156. package/templates/default/scripts/dev.ts@bundler_esbuild@dev-utils-pre-build_tailwind.ejs +2 -0
  157. package/templates/default/scripts/dev.ts@bundler_esbuild@lint-build-styles_dev-utils.ejs +1 -0
  158. package/templates/default/scripts/dev.ts@bundler_esbuild@preset_dev-utils.ejs +7 -0
  159. package/templates/default/scripts/dev.ts@bundler_esbuild@preset_standalone.ejs +3 -0
  160. package/templates/default/scripts/esbuild-plugins.ts.ejs +20 -0
  161. package/templates/default/scripts/esbuild-plugins.ts@dev-utils-import_vue.ejs +2 -0
  162. package/templates/default/scripts/esbuild-plugins.ts@dev-utils-plugin_vue.ejs +1 -0
  163. package/templates/default/scripts/esbuild-plugins.ts@dev-utils-plugin_wasm.ejs +13 -0
  164. package/templates/default/scripts/eslint-config.ts.ejs +113 -0
  165. package/templates/default/scripts/eslint-config.ts@extra-files_has-e2e.ejs +7 -0
  166. package/templates/default/scripts/find-overexposed-fix.ts.ejs +26 -0
  167. package/templates/default/scripts/find-overexposed.ts.ejs +15 -0
  168. package/templates/default/scripts/format-check.ts.ejs +4 -0
  169. package/templates/default/scripts/format-check.ts@tool_biome-formatter.ejs +8 -0
  170. package/templates/default/scripts/format-check.ts@tool_dprint.ejs +3 -0
  171. package/templates/default/scripts/format-check.ts@tool_dprint@preset_dev-utils.ejs +7 -0
  172. package/templates/default/scripts/format-check.ts@tool_dprint@preset_standalone.ejs +8 -0
  173. package/templates/default/scripts/format-check.ts@tool_prettier.ejs +8 -0
  174. package/templates/default/scripts/format.ts.ejs +4 -0
  175. package/templates/default/scripts/format.ts@tool_biome-formatter.ejs +8 -0
  176. package/templates/default/scripts/format.ts@tool_dprint.ejs +3 -0
  177. package/templates/default/scripts/format.ts@tool_dprint@preset_dev-utils.ejs +7 -0
  178. package/templates/default/scripts/format.ts@tool_dprint@preset_standalone.ejs +8 -0
  179. package/templates/default/scripts/format.ts@tool_prettier.ejs +8 -0
  180. package/templates/default/scripts/framework-component-stub.ts.ejs +46 -0
  181. package/templates/default/scripts/gate.ts.ejs +10 -0
  182. package/templates/default/scripts/lint-fix.ts.ejs +6 -0
  183. package/templates/default/scripts/lint-fix.ts@tool_biome-linter.ejs +8 -0
  184. package/templates/default/scripts/lint-fix.ts@tool_eslint.ejs +3 -0
  185. package/templates/default/scripts/lint-fix.ts@tool_eslint@preset_dev-utils.ejs +7 -0
  186. package/templates/default/scripts/lint-fix.ts@tool_eslint@preset_standalone.ejs +8 -0
  187. package/templates/default/scripts/lint-md-fix.ts_dev-utils.ejs +7 -0
  188. package/templates/default/scripts/lint-md-fix.ts_standalone.ejs +37 -0
  189. package/templates/default/scripts/lint-md.ts_dev-utils.ejs +7 -0
  190. package/templates/default/scripts/lint-md.ts_standalone.ejs +37 -0
  191. package/templates/default/scripts/lint.ts.ejs +6 -0
  192. package/templates/default/scripts/lint.ts@tool_biome-linter.ejs +8 -0
  193. package/templates/default/scripts/lint.ts@tool_eslint.ejs +3 -0
  194. package/templates/default/scripts/lint.ts@tool_eslint@preset_dev-utils.ejs +7 -0
  195. package/templates/default/scripts/lint.ts@tool_eslint@preset_standalone.ejs +8 -0
  196. package/templates/default/scripts/markdownlint-cli2-config.ts_dev-utils.ejs +14 -0
  197. package/templates/default/scripts/markdownlint-cli2-config.ts_standalone.ejs +36 -0
  198. package/templates/default/scripts/nano-staged-config.ts.ejs +9 -0
  199. package/templates/default/scripts/postcss.config.ts.ejs +1 -0
  200. package/templates/default/scripts/postcss.config.ts@plugins_postcss.ejs +7 -0
  201. package/templates/default/scripts/prepare.ts_dev-utils.ejs +3 -0
  202. package/templates/default/scripts/prepare.ts_standalone.ejs +3 -0
  203. package/templates/default/scripts/prettier.config.ts.ejs +12 -0
  204. package/templates/default/scripts/rollup.config.ts.ejs +129 -0
  205. package/templates/default/scripts/rollup.config.ts@import_rollup-babel.ejs +5 -0
  206. package/templates/default/scripts/rollup.config.ts@import_rollup-json.ejs +1 -0
  207. package/templates/default/scripts/rollup.config.ts@import_rollup-postcss.ejs +4 -0
  208. package/templates/default/scripts/rollup.config.ts@import_scss.ejs +1 -0
  209. package/templates/default/scripts/rollup.config.ts@import_svelte.ejs +2 -0
  210. package/templates/default/scripts/rollup.config.ts@import_vue.ejs +1 -0
  211. package/templates/default/scripts/rollup.config.ts@import_wasm.ejs +1 -0
  212. package/templates/default/scripts/rollup.config.ts@lint-out-dir_dev-utils.ejs +1 -0
  213. package/templates/default/scripts/rollup.config.ts@post-plugin_preact.ejs +4 -0
  214. package/templates/default/scripts/rollup.config.ts@post-plugin_react.ejs +5 -0
  215. package/templates/default/scripts/rollup.config.ts@post-plugin_rollup-json.ejs +1 -0
  216. package/templates/default/scripts/rollup.config.ts@post-plugin_rollup-postcss.ejs +4 -0
  217. package/templates/default/scripts/rollup.config.ts@post-plugin_scss.ejs +4 -0
  218. package/templates/default/scripts/rollup.config.ts@post-plugin_solid.ejs +4 -0
  219. package/templates/default/scripts/rollup.config.ts@post-plugin_wasm.ejs +4 -0
  220. package/templates/default/scripts/rollup.config.ts@pre-plugin_svelte.ejs +4 -0
  221. package/templates/default/scripts/rollup.config.ts@pre-plugin_vue.ejs +13 -0
  222. package/templates/default/scripts/rollup.config.ts@unwrap_rollup-babel.ejs +1 -0
  223. package/templates/default/scripts/rollup.config.ts@unwrap_rollup-json.ejs +1 -0
  224. package/templates/default/scripts/rollup.config.ts@unwrap_rollup-postcss.ejs +1 -0
  225. package/templates/default/scripts/rollup.config.ts@unwrap_scss.ejs +1 -0
  226. package/templates/default/scripts/rollup.config.ts@unwrap_svelte.ejs +1 -0
  227. package/templates/default/scripts/rollup.config.ts@unwrap_vue.ejs +1 -0
  228. package/templates/default/scripts/rollup.config.ts@unwrap_wasm.ejs +1 -0
  229. package/templates/default/scripts/spellcheck.ts_dev-utils.ejs +7 -0
  230. package/templates/default/scripts/spellcheck.ts_standalone.ejs +8 -0
  231. package/templates/default/scripts/stylesheet-stub.ts.ejs +17 -0
  232. package/templates/default/scripts/test-coverage.ts.ejs +8 -0
  233. package/templates/default/scripts/test-e2e.ts.ejs +1 -0
  234. package/templates/default/scripts/test-e2e.ts@tool_obsidian-test.ejs +8 -0
  235. package/templates/default/scripts/test-e2e.ts@tool_wdio-obsidian.ejs +8 -0
  236. package/templates/default/scripts/test-integration-android.ts.ejs +8 -0
  237. package/templates/default/scripts/test-integration-demo-vault.ts.ejs +8 -0
  238. package/templates/default/scripts/test-integration-desktop-performance.ts.ejs +8 -0
  239. package/templates/default/scripts/test-integration-desktop.ts.ejs +8 -0
  240. package/templates/default/scripts/test-integration-no-app.ts.ejs +8 -0
  241. package/templates/default/scripts/test-integration.ts.ejs +22 -0
  242. package/templates/default/scripts/test-watch.ts_dev-utils.ejs +1 -0
  243. package/templates/default/scripts/test-watch.ts_dev-utils@tool_jest.ejs +13 -0
  244. package/templates/default/scripts/test-watch.ts_dev-utils@tool_vitest.ejs +8 -0
  245. package/templates/default/scripts/test-watch.ts_standalone.ejs +1 -0
  246. package/templates/default/scripts/test-watch.ts_standalone@tool_jest.ejs +13 -0
  247. package/templates/default/scripts/test-watch.ts_standalone@tool_vitest.ejs +8 -0
  248. package/templates/default/scripts/test.ts_dev-utils.ejs +1 -0
  249. package/templates/default/scripts/test.ts_dev-utils@tool_jest.ejs +13 -0
  250. package/templates/default/scripts/test.ts_dev-utils@tool_vitest.ejs +8 -0
  251. package/templates/default/scripts/test.ts_standalone.ejs +1 -0
  252. package/templates/default/scripts/test.ts_standalone@tool_jest.ejs +13 -0
  253. package/templates/default/scripts/test.ts_standalone@tool_vitest.ejs +8 -0
  254. package/templates/default/scripts/version.ts_dev-utils.ejs +10 -0
  255. package/templates/default/scripts/version.ts_standalone.ejs +317 -0
  256. package/templates/default/scripts/vite.config.ts.ejs +76 -0
  257. package/templates/default/scripts/vite.config.ts@import_preact.ejs +1 -0
  258. package/templates/default/scripts/vite.config.ts@import_react.ejs +1 -0
  259. package/templates/default/scripts/vite.config.ts@import_solid.ejs +1 -0
  260. package/templates/default/scripts/vite.config.ts@import_svelte.ejs +1 -0
  261. package/templates/default/scripts/vite.config.ts@import_vue.ejs +1 -0
  262. package/templates/default/scripts/vite.config.ts@lint-empty-out-dir_dev-utils.ejs +1 -0
  263. package/templates/default/scripts/vite.config.ts@lint-out-dir_dev-utils.ejs +1 -0
  264. package/templates/default/scripts/vite.config.ts@plugin_preact.ejs +1 -0
  265. package/templates/default/scripts/vite.config.ts@plugin_react.ejs +1 -0
  266. package/templates/default/scripts/vite.config.ts@plugin_solid.ejs +1 -0
  267. package/templates/default/scripts/vite.config.ts@plugin_svelte.ejs +1 -0
  268. package/templates/default/scripts/vite.config.ts@plugin_vue.ejs +1 -0
  269. package/templates/default/scripts/vitest-config.ts.ejs +75 -0
  270. package/templates/default/scripts/vitest-config.ts@post-config_solid.ejs +67 -0
  271. package/templates/default/scripts/wasm-module-stub.ts.ejs +21 -0
  272. package/templates/default/scripts/webpack.config.ts.ejs +124 -0
  273. package/templates/default/scripts/webpack.config.ts@import_svelte.ejs +1 -0
  274. package/templates/default/scripts/webpack.config.ts@import_vue.ejs +1 -0
  275. package/templates/default/scripts/webpack.config.ts@import_webpack-css-extract.ejs +4 -0
  276. package/templates/default/scripts/webpack.config.ts@lint-webpack-default_dev-utils.ejs +1 -0
  277. package/templates/default/scripts/webpack.config.ts@plugin_vue.ejs +1 -0
  278. package/templates/default/scripts/webpack.config.ts@plugin_webpack-css-extract.ejs +4 -0
  279. package/templates/default/scripts/webpack.config.ts@rule_css-modules.ejs +7 -0
  280. package/templates/default/scripts/webpack.config.ts@rule_css.ejs +4 -0
  281. package/templates/default/scripts/webpack.config.ts@rule_postcss.ejs +4 -0
  282. package/templates/default/scripts/webpack.config.ts@rule_scss.ejs +4 -0
  283. package/templates/default/scripts/webpack.config.ts@rule_solid.ejs +17 -0
  284. package/templates/default/scripts/webpack.config.ts@rule_svelte.ejs +7 -0
  285. package/templates/default/scripts/webpack.config.ts@rule_tailwind.ejs +4 -0
  286. package/templates/default/scripts/webpack.config.ts@rule_vue.ejs +4 -0
  287. package/templates/default/scripts/webpack.config.ts@rule_wasm.ejs +8 -0
  288. package/templates/default/scripts/webpack.config.ts@ts-loader-compiler-options_vue.ejs +5 -0
  289. package/templates/default/scripts/webpack.config.ts@ts-loader-options_vue.ejs +5 -0
  290. package/templates/default/src/demo-vault-buttons.demo-vault.integration.test.ts.ejs +12 -0
  291. package/templates/default/src/demo-vault.no-app.integration.test.ts.ejs +18 -0
  292. package/templates/default/src/editor-extensions/sample-state-field.ts_dev-utils.ejs +56 -0
  293. package/templates/default/src/editor-extensions/sample-state-field.ts_standalone.ejs +60 -0
  294. package/templates/default/src/editor-extensions/sample-view-plugin.ts.ejs +66 -0
  295. package/templates/default/src/editor-extensions/sample-widget.ts.ejs +22 -0
  296. package/templates/default/src/editor-suggests/sample-editor-suggest.ts.ejs +42 -0
  297. package/templates/default/src/i18n/en/index.ts.ejs +10 -0
  298. package/templates/default/src/i18n/index.ts_i18next.ejs +21 -0
  299. package/templates/default/src/i18n/index.ts_typesafe-i18n.ejs +14 -0
  300. package/templates/default/src/i18n/locales/en.json.ejs +3 -0
  301. package/templates/default/src/lit-elements/sample-lit-element.ts.ejs +54 -0
  302. package/templates/default/src/main.test.ts.ejs +11 -0
  303. package/templates/default/src/main.test.ts@test-imports_vitest.ejs +6 -0
  304. package/templates/default/src/main.ts.ejs +4 -0
  305. package/templates/default/src/main.ts@import_css-modules.ejs +1 -0
  306. package/templates/default/src/main.ts@import_css.ejs +1 -0
  307. package/templates/default/src/main.ts@import_postcss.ejs +1 -0
  308. package/templates/default/src/main.ts@import_scss.ejs +1 -0
  309. package/templates/default/src/main.ts@import_tailwind.ejs +1 -0
  310. package/templates/default/src/modals/sample-form-modal.ts.ejs +35 -0
  311. package/templates/default/src/modals/sample-suggest-modal.ts.ejs +37 -0
  312. package/templates/default/src/plugin-settings-component.test.ts_demo.ejs +49 -0
  313. package/templates/default/src/plugin-settings-component.test.ts_demo@test-imports_vitest.ejs +5 -0
  314. package/templates/default/src/plugin-settings-component.test.ts_enhanced.ejs +41 -0
  315. package/templates/default/src/plugin-settings-component.test.ts_enhanced@test-imports_vitest.ejs +5 -0
  316. package/templates/default/src/plugin-settings-component.ts_demo.ejs +87 -0
  317. package/templates/default/src/plugin-settings-component.ts_enhanced.ejs +27 -0
  318. package/templates/default/src/plugin-settings-tab.ts_demo.ejs +286 -0
  319. package/templates/default/src/plugin-settings-tab.ts_enhanced.ejs +26 -0
  320. package/templates/default/src/plugin-settings.test.ts_demo.ejs +14 -0
  321. package/templates/default/src/plugin-settings.test.ts_demo@test-imports_vitest.ejs +6 -0
  322. package/templates/default/src/plugin-settings.ts_demo.ejs +64 -0
  323. package/templates/default/src/plugin-settings.ts_enhanced.ejs +3 -0
  324. package/templates/default/src/plugin.test.ts_jest.ejs +9 -0
  325. package/templates/default/src/plugin.test.ts_vitest.ejs +14 -0
  326. package/templates/default/src/plugin.ts_demo.ejs +316 -0
  327. package/templates/default/src/plugin.ts_demo@import_i18next.ejs +1 -0
  328. package/templates/default/src/plugin.ts_demo@import_lit.ejs +4 -0
  329. package/templates/default/src/plugin.ts_demo@import_preact.ejs +4 -0
  330. package/templates/default/src/plugin.ts_demo@import_react.ejs +4 -0
  331. package/templates/default/src/plugin.ts_demo@import_solid.ejs +4 -0
  332. package/templates/default/src/plugin.ts_demo@import_svelte.ejs +4 -0
  333. package/templates/default/src/plugin.ts_demo@import_typesafe-i18n.ejs +1 -0
  334. package/templates/default/src/plugin.ts_demo@import_vue.ejs +4 -0
  335. package/templates/default/src/plugin.ts_demo@import_wasm.ejs +1 -0
  336. package/templates/default/src/plugin.ts_demo@method_ui-view.ejs +7 -0
  337. package/templates/default/src/plugin.ts_demo@onload_i18next.ejs +2 -0
  338. package/templates/default/src/plugin.ts_demo@onload_lit.ejs +4 -0
  339. package/templates/default/src/plugin.ts_demo@onload_preact.ejs +4 -0
  340. package/templates/default/src/plugin.ts_demo@onload_react.ejs +4 -0
  341. package/templates/default/src/plugin.ts_demo@onload_solid.ejs +4 -0
  342. package/templates/default/src/plugin.ts_demo@onload_svelte.ejs +4 -0
  343. package/templates/default/src/plugin.ts_demo@onload_typesafe-i18n.ejs +8 -0
  344. package/templates/default/src/plugin.ts_demo@onload_vue.ejs +4 -0
  345. package/templates/default/src/plugin.ts_demo@onload_wasm.ejs +2 -0
  346. package/templates/default/src/plugin.ts_enhanced.ejs +72 -0
  347. package/templates/default/src/plugin.ts_enhanced@import2_codemirror.ejs +3 -0
  348. package/templates/default/src/plugin.ts_enhanced@import2_i18next.ejs +2 -0
  349. package/templates/default/src/plugin.ts_enhanced@import2_lit.ejs +4 -0
  350. package/templates/default/src/plugin.ts_enhanced@import2_preact.ejs +4 -0
  351. package/templates/default/src/plugin.ts_enhanced@import2_react.ejs +4 -0
  352. package/templates/default/src/plugin.ts_enhanced@import2_solid.ejs +4 -0
  353. package/templates/default/src/plugin.ts_enhanced@import2_svelte.ejs +4 -0
  354. package/templates/default/src/plugin.ts_enhanced@import2_typesafe-i18n.ejs +2 -0
  355. package/templates/default/src/plugin.ts_enhanced@import2_vue.ejs +4 -0
  356. package/templates/default/src/plugin.ts_enhanced@import2_wasm.ejs +1 -0
  357. package/templates/default/src/plugin.ts_enhanced@method_ui-view.ejs +7 -0
  358. package/templates/default/src/plugin.ts_enhanced@onload_codemirror.ejs +4 -0
  359. package/templates/default/src/plugin.ts_enhanced@onload_i18next.ejs +2 -0
  360. package/templates/default/src/plugin.ts_enhanced@onload_lit.ejs +4 -0
  361. package/templates/default/src/plugin.ts_enhanced@onload_preact.ejs +4 -0
  362. package/templates/default/src/plugin.ts_enhanced@onload_react.ejs +4 -0
  363. package/templates/default/src/plugin.ts_enhanced@onload_solid.ejs +4 -0
  364. package/templates/default/src/plugin.ts_enhanced@onload_svelte.ejs +4 -0
  365. package/templates/default/src/plugin.ts_enhanced@onload_typesafe-i18n.ejs +8 -0
  366. package/templates/default/src/plugin.ts_enhanced@onload_vue.ejs +4 -0
  367. package/templates/default/src/plugin.ts_enhanced@onload_wasm.ejs +2 -0
  368. package/templates/default/src/plugin.ts_standalone.ejs +56 -0
  369. package/templates/default/src/plugin.ts_standalone@import_codemirror.ejs +3 -0
  370. package/templates/default/src/plugin.ts_standalone@import_i18next.ejs +1 -0
  371. package/templates/default/src/plugin.ts_standalone@import_lit.ejs +4 -0
  372. package/templates/default/src/plugin.ts_standalone@import_preact.ejs +4 -0
  373. package/templates/default/src/plugin.ts_standalone@import_react.ejs +4 -0
  374. package/templates/default/src/plugin.ts_standalone@import_solid.ejs +4 -0
  375. package/templates/default/src/plugin.ts_standalone@import_svelte.ejs +4 -0
  376. package/templates/default/src/plugin.ts_standalone@import_typesafe-i18n.ejs +1 -0
  377. package/templates/default/src/plugin.ts_standalone@import_vue.ejs +4 -0
  378. package/templates/default/src/plugin.ts_standalone@import_wasm.ejs +1 -0
  379. package/templates/default/src/plugin.ts_standalone@method_ui-view.ejs +7 -0
  380. package/templates/default/src/plugin.ts_standalone@onload_codemirror.ejs +4 -0
  381. package/templates/default/src/plugin.ts_standalone@onload_i18next.ejs +2 -0
  382. package/templates/default/src/plugin.ts_standalone@onload_lit.ejs +4 -0
  383. package/templates/default/src/plugin.ts_standalone@onload_preact.ejs +4 -0
  384. package/templates/default/src/plugin.ts_standalone@onload_react.ejs +4 -0
  385. package/templates/default/src/plugin.ts_standalone@onload_solid.ejs +4 -0
  386. package/templates/default/src/plugin.ts_standalone@onload_svelte.ejs +4 -0
  387. package/templates/default/src/plugin.ts_standalone@onload_typesafe-i18n.ejs +8 -0
  388. package/templates/default/src/plugin.ts_standalone@onload_vue.ejs +4 -0
  389. package/templates/default/src/plugin.ts_standalone@onload_wasm.ejs +2 -0
  390. package/templates/default/src/preact-components/sample-preact-component.tsx_dev-utils.ejs +47 -0
  391. package/templates/default/src/preact-components/sample-preact-component.tsx_standalone.ejs +47 -0
  392. package/templates/default/src/react-components/sample-react-component.tsx_dev-utils.ejs +35 -0
  393. package/templates/default/src/react-components/sample-react-component.tsx_standalone.ejs +47 -0
  394. package/templates/default/src/settings.ts.ejs +32 -0
  395. package/templates/default/src/solid-components/sample-solid-component.tsx_dev-utils.ejs +47 -0
  396. package/templates/default/src/solid-components/sample-solid-component.tsx_standalone.ejs +47 -0
  397. package/templates/default/src/styles/css-modules.d.ts.ejs +4 -0
  398. package/templates/default/src/styles/main.css_dev-utils.ejs +17 -0
  399. package/templates/default/src/styles/main.css_dev-utils@content_tailwind.ejs +1 -0
  400. package/templates/default/src/styles/main.css_standalone.ejs +11 -0
  401. package/templates/default/src/styles/main.css_standalone@content_tailwind.ejs +1 -0
  402. package/templates/default/src/styles/main.module.css.ejs +3 -0
  403. package/templates/default/src/styles/main.scss_dev-utils.ejs +16 -0
  404. package/templates/default/src/styles/main.scss_standalone.ejs +10 -0
  405. package/templates/default/src/styles/styles.d.ts.ejs +4 -0
  406. package/templates/default/src/svelte-components/sample-svelte-component.d.ts.ejs +7 -0
  407. package/templates/default/src/svelte-components/sample-svelte-component.svelte.ejs +24 -0
  408. package/templates/default/src/views/sample-lit-view.ts.ejs +30 -0
  409. package/templates/default/src/views/sample-lit-view.ts@lint-register-element_dev-utils.ejs +1 -0
  410. package/templates/default/src/views/sample-preact-view.tsx_dev-utils.ejs +45 -0
  411. package/templates/default/src/views/sample-preact-view.tsx_standalone.ejs +42 -0
  412. package/templates/default/src/views/sample-react-view.tsx_dev-utils.ejs +47 -0
  413. package/templates/default/src/views/sample-react-view.tsx_standalone.ejs +49 -0
  414. package/templates/default/src/views/sample-solid-view.tsx_dev-utils.ejs +46 -0
  415. package/templates/default/src/views/sample-solid-view.tsx_standalone.ejs +46 -0
  416. package/templates/default/src/views/sample-svelte-view.ts.ejs +47 -0
  417. package/templates/default/src/views/sample-view.ts.ejs +37 -0
  418. package/templates/default/src/views/sample-vue-view.ts.ejs +34 -0
  419. package/templates/default/src/vue-components/sample-vue-component.d.ts.ejs +6 -0
  420. package/templates/default/src/vue-components/sample-vue-component.vue.ejs +25 -0
  421. package/templates/default/src/wasm/README.md.ejs +29 -0
  422. package/templates/default/src/wasm/answer.ts_esbuild.ejs +23 -0
  423. package/templates/default/src/wasm/answer.ts_parcel.ejs +29 -0
  424. package/templates/default/src/wasm/answer.ts_rollup.ejs +19 -0
  425. package/templates/default/src/wasm/answer.ts_vite.ejs +29 -0
  426. package/templates/default/src/wasm/answer.ts_webpack.ejs +29 -0
  427. package/templates/default/src/wasm/module.wasm +0 -0
  428. package/templates/default/src/wasm/module.wat.ejs +12 -0
  429. package/templates/default/src/wasm/sample-command.ts.ejs +33 -0
  430. package/templates/default/src/wasm.d.ts_esbuild.ejs +12 -0
  431. package/templates/default/src/wasm.d.ts_parcel.ejs +7 -0
  432. package/templates/default/src/wasm.d.ts_rollup.ejs +8 -0
  433. package/templates/default/src/wasm.d.ts_vite.ejs +8 -0
  434. package/templates/default/src/wasm.d.ts_webpack.ejs +7 -0
  435. package/templates/default/tsconfig.json_dev-utils.ejs +34 -0
  436. package/templates/default/tsconfig.json_dev-utils@compiler-options_i18next.ejs +1 -0
  437. package/templates/default/tsconfig.json_dev-utils@compiler-options_lit.ejs +2 -0
  438. package/templates/default/tsconfig.json_dev-utils@compiler-options_preact.ejs +2 -0
  439. package/templates/default/tsconfig.json_dev-utils@compiler-options_react.ejs +1 -0
  440. package/templates/default/tsconfig.json_dev-utils@compiler-options_solid.ejs +2 -0
  441. package/templates/default/tsconfig.json_dev-utils@include_has-e2e.ejs +1 -0
  442. package/templates/default/tsconfig.json_dev-utils@include_svelte.ejs +1 -0
  443. package/templates/default/tsconfig.json_dev-utils@include_vue.ejs +1 -0
  444. package/templates/default/tsconfig.json_dev-utils@types_jest.ejs +2 -0
  445. package/templates/default/tsconfig.json_dev-utils@types_svelte.ejs +2 -0
  446. package/templates/default/tsconfig.json_dev-utils@types_wdio-obsidian.ejs +5 -0
  447. package/templates/default/tsconfig.json_dev-utils@types_with-unofficial.ejs +2 -0
  448. package/templates/default/tsconfig.json_standalone.ejs +47 -0
  449. package/templates/default/tsconfig.json_standalone@compiler-options_i18next.ejs +1 -0
  450. package/templates/default/tsconfig.json_standalone@compiler-options_lit.ejs +2 -0
  451. package/templates/default/tsconfig.json_standalone@compiler-options_preact.ejs +2 -0
  452. package/templates/default/tsconfig.json_standalone@compiler-options_react.ejs +1 -0
  453. package/templates/default/tsconfig.json_standalone@compiler-options_solid.ejs +2 -0
  454. package/templates/default/tsconfig.json_standalone@include-extra_preact.ejs +2 -0
  455. package/templates/default/tsconfig.json_standalone@include-extra_react.ejs +2 -0
  456. package/templates/default/tsconfig.json_standalone@include-extra_solid.ejs +2 -0
  457. package/templates/default/tsconfig.json_standalone@include_has-e2e.ejs +1 -0
  458. package/templates/default/tsconfig.json_standalone@include_svelte.ejs +1 -0
  459. package/templates/default/tsconfig.json_standalone@include_vue.ejs +1 -0
  460. package/templates/default/tsconfig.json_standalone@types_jest.ejs +2 -0
  461. package/templates/default/tsconfig.json_standalone@types_svelte.ejs +2 -0
  462. package/templates/default/tsconfig.json_standalone@types_wdio-obsidian.ejs +5 -0
  463. package/templates/default/tsconfig.json_standalone@types_with-unofficial.ejs +2 -0
  464. package/templates/default/versions.json.ejs +3 -0
  465. package/templates/default/vite.config.ts.ejs +3 -0
  466. package/templates/default/vitest.config.ts_dev-utils.ejs +1 -0
  467. package/templates/default/vitest.config.ts_standalone.ejs +55 -0
  468. package/templates/default/vitest.config.ts_standalone@jsx_solid.ejs +11 -0
  469. package/templates/default/wdio.conf.ts.ejs +21 -0
  470. package/templates/default/webpack.config.ts.ejs +3 -0
@@ -0,0 +1,46 @@
1
+ const MESSAGE = 'Single-file components are not compiled in unit tests. Render this component in an integration test instead.';
2
+
3
+ /**
4
+ * The unit runner's stand-in for a `.svelte` / `.vue` single-file component.
5
+ *
6
+ * Compiling one is the bundler's job. The plugin that does it -- `esbuild-svelte`,
7
+ * `@vitejs/plugin-vue`, `svelte-loader` and the rest -- is a dependency only of the bundler that was
8
+ * chosen, and no unit test needs a rendered component anyway. So both test runners alias every
9
+ * `.svelte` / `.vue` import to this module, which lets a test import the plugin's own code even when
10
+ * that code's module graph reaches a component.
11
+ *
12
+ * It throws rather than returning an inert value: a test that really does try to render gets a sentence
13
+ * saying why it cannot, instead of a component that silently does nothing.
14
+ *
15
+ * @throws Always.
16
+ */
17
+ export default function frameworkComponentStub(): never {
18
+ throw new Error(MESSAGE);
19
+ }
20
+
21
+ /**
22
+ * Svelte's `mount`, stubbed -- see {@link unmount} for why this module stands in for the whole package
23
+ * under jest.
24
+ *
25
+ * @throws Always.
26
+ */
27
+ export function mount(): never {
28
+ throw new Error(MESSAGE);
29
+ }
30
+
31
+ /**
32
+ * Svelte's `unmount`, stubbed.
33
+ *
34
+ * Jest maps the whole `svelte` package here, not just the component: svelte reaches its own runtime
35
+ * through Node subpath imports (`#client/constants`), and jest's ESM resolver hands back the types entry
36
+ * for those, so every suite that loads svelte dies on "does not provide an export named 'COMMENT_NODE'".
37
+ * Vitest resolves them correctly and gets the real package -- only the component is stubbed there.
38
+ *
39
+ * The two functions the generated view uses are the two that are stubbed. A view that imports something
40
+ * else from `svelte` needs it added here, or its unit test will fail on the missing export.
41
+ *
42
+ * @throws Always.
43
+ */
44
+ export function unmount(): never {
45
+ throw new Error(MESSAGE);
46
+ }
@@ -0,0 +1,10 @@
1
+ import process from 'node:process';
2
+ import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
3
+ import {
4
+ gate,
5
+ parseGateArguments
6
+ } from 'obsidian-dev-utils/script-utils/gate';
7
+
8
+ const [, , ...$arguments] = process.argv;
9
+ const options = parseGateArguments($arguments);
10
+ await wrapCliTask(() => gate(options));
@@ -0,0 +1,6 @@
1
+ <%# Keyed on the TOOL first, exactly as the format scripts are, and for the same reason. What -%>
2
+ <%# `npm run lint:fix` runs is decided by the linter answer; only eslint has a preset-specific runner, so -%>
3
+ <%# it splits again underneath. Splitting on the preset first is what made every obsidian-dev-utils -%>
4
+ <%# preset emit the dev-utils ESLint runner whatever was chosen -- so `linter: biome` installed biome, -%>
5
+ <%# emitted `biome.json`, and then ran eslint, which died looking for a config that was never written. -%>
6
+ <%- render('tool') -%>
@@ -0,0 +1,8 @@
1
+ import { execSync } from 'node:child_process';
2
+ import process from 'node:process';
3
+
4
+ try {
5
+ execSync('biome lint --write .', { stdio: 'inherit' });
6
+ } catch {
7
+ process.exit(1);
8
+ }
@@ -0,0 +1,3 @@
1
+ <%# The obsidian-dev-utils presets go through the dev-utils runner, which finds the config and the -%>
2
+ <%# paths for them; standalone has no dev-utils and shells out directly. -%>
3
+ <%- render('preset') -%>
@@ -0,0 +1,7 @@
1
+ import process from 'node:process';
2
+ import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
3
+ import { lint } from 'obsidian-dev-utils/script-utils/linters/eslint';
4
+
5
+ const [, , ...paths] = process.argv;
6
+
7
+ await wrapCliTask(() => lint({ paths, shouldFix: true }));
@@ -0,0 +1,8 @@
1
+ import { execSync } from 'node:child_process';
2
+ import process from 'node:process';
3
+
4
+ try {
5
+ execSync('eslint . --fix', { stdio: 'inherit' });
6
+ } catch {
7
+ process.exit(1);
8
+ }
@@ -0,0 +1,7 @@
1
+ import process from 'node:process';
2
+ import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
3
+ import { lint } from 'obsidian-dev-utils/script-utils/linters/markdownlint';
4
+
5
+ const [, , ...paths] = process.argv;
6
+
7
+ await wrapCliTask(() => lint({ paths, shouldFix: true }));
@@ -0,0 +1,37 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { globSync } from 'node:fs';
3
+ import process from 'node:process';
4
+
5
+ try {
6
+ execSync('markdownlint-cli2 --fix .', { stdio: 'inherit' });
7
+ } catch {
8
+ process.exit(1);
9
+ }
10
+
11
+ const mdFiles = globSync('**/*.md', {
12
+ exclude: ['.git/**', 'dist/**', 'node_modules/**']
13
+ });
14
+
15
+ if (mdFiles.length > 0) {
16
+ try {
17
+ execSync(
18
+ [
19
+ 'linkinator',
20
+ ...mdFiles,
21
+ '--retry',
22
+ '--retry-errors',
23
+ '--retry-errors-count',
24
+ '3',
25
+ '--retry-errors-jitter',
26
+ '5',
27
+ '--url-rewrite-search',
28
+ 'https://www\\.npmjs\\.com/package/',
29
+ '--url-rewrite-replace',
30
+ 'https://registry.npmjs.org/'
31
+ ].join(' '),
32
+ { stdio: 'inherit' }
33
+ );
34
+ } catch {
35
+ process.exit(1);
36
+ }
37
+ }
@@ -0,0 +1,7 @@
1
+ import process from 'node:process';
2
+ import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
3
+ import { lint } from 'obsidian-dev-utils/script-utils/linters/markdownlint';
4
+
5
+ const [, , ...paths] = process.argv;
6
+
7
+ await wrapCliTask(() => lint({ paths }));
@@ -0,0 +1,37 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { globSync } from 'node:fs';
3
+ import process from 'node:process';
4
+
5
+ try {
6
+ execSync('markdownlint-cli2 .', { stdio: 'inherit' });
7
+ } catch {
8
+ process.exit(1);
9
+ }
10
+
11
+ const mdFiles = globSync('**/*.md', {
12
+ exclude: ['.git/**', 'dist/**', 'node_modules/**']
13
+ });
14
+
15
+ if (mdFiles.length > 0) {
16
+ try {
17
+ execSync(
18
+ [
19
+ 'linkinator',
20
+ ...mdFiles,
21
+ '--retry',
22
+ '--retry-errors',
23
+ '--retry-errors-count',
24
+ '3',
25
+ '--retry-errors-jitter',
26
+ '5',
27
+ '--url-rewrite-search',
28
+ 'https://www\\.npmjs\\.com/package/',
29
+ '--url-rewrite-replace',
30
+ 'https://registry.npmjs.org/'
31
+ ].join(' '),
32
+ { stdio: 'inherit' }
33
+ );
34
+ } catch {
35
+ process.exit(1);
36
+ }
37
+ }
@@ -0,0 +1,6 @@
1
+ <%# Keyed on the TOOL first, exactly as the format scripts are, and for the same reason. What -%>
2
+ <%# `npm run lint` runs is decided by the linter answer; only eslint has a preset-specific runner, so -%>
3
+ <%# it splits again underneath. Splitting on the preset first is what made every obsidian-dev-utils -%>
4
+ <%# preset emit the dev-utils ESLint runner whatever was chosen -- so `linter: biome` installed biome, -%>
5
+ <%# emitted `biome.json`, and then ran eslint, which died looking for a config that was never written. -%>
6
+ <%- render('tool') -%>
@@ -0,0 +1,8 @@
1
+ import { execSync } from 'node:child_process';
2
+ import process from 'node:process';
3
+
4
+ try {
5
+ execSync('biome lint .', { stdio: 'inherit' });
6
+ } catch {
7
+ process.exit(1);
8
+ }
@@ -0,0 +1,3 @@
1
+ <%# The obsidian-dev-utils presets go through the dev-utils runner, which finds the config and the -%>
2
+ <%# paths for them; standalone has no dev-utils and shells out directly. -%>
3
+ <%- render('preset') -%>
@@ -0,0 +1,7 @@
1
+ import process from 'node:process';
2
+ import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
3
+ import { lint } from 'obsidian-dev-utils/script-utils/linters/eslint';
4
+
5
+ const [, , ...paths] = process.argv;
6
+
7
+ await wrapCliTask(() => lint({ paths }));
@@ -0,0 +1,8 @@
1
+ import { execSync } from 'node:child_process';
2
+ import process from 'node:process';
3
+
4
+ try {
5
+ execSync('eslint .', { stdio: 'inherit' });
6
+ } catch {
7
+ process.exit(1);
8
+ }
@@ -0,0 +1,14 @@
1
+ import type { MarkdownlintCli2ConfigurationSchema } from 'obsidian-dev-utils/script-utils/linters/markdownlint-types/@types/markdownlint-cli2-config-schema';
2
+
3
+ import { obsidianDevUtilsConfig } from 'obsidian-dev-utils/script-utils/linters/markdownlint-cli2-config';
4
+
5
+ export const config: MarkdownlintCli2ConfigurationSchema = {
6
+ ...obsidianDevUtilsConfig,
7
+ config: {
8
+ ...obsidianDevUtilsConfig.config,
9
+ // Turned on here, against the shared default of off: every paragraph in this repo's markdown is one
10
+ // physical line, and this is what stops hard wrapping from coming back. The key has to live inside
11
+ // `config` - the spread above replaces the whole object, so a key beside it would be silently ignored.
12
+ 'no-soft-break-in-paragraph': true
13
+ }
14
+ };
@@ -0,0 +1,36 @@
1
+ import type { Options } from 'markdownlint';
2
+
3
+ import relativeLinksRule from 'markdownlint-rule-relative-links';
4
+
5
+ /**
6
+ * The keys `markdownlint-cli2` reads from a config module that `markdownlint`'s own `Options` does not
7
+ * declare. Named rather than written inline, because an anonymous object type in a signature is a type
8
+ * nothing else can refer to -- and an intersection is exactly where a reader wants to look one up.
9
+ */
10
+ interface MarkdownlintCli2Extras {
11
+ customRules?: unknown[];
12
+ globs?: string[];
13
+ ignores?: string[];
14
+ }
15
+
16
+ export const config: MarkdownlintCli2Extras & Options = {
17
+ config: {
18
+ // Every key quoted because `'relative-links'` has to be, and the style is all-or-none per object.
19
+ 'default': true,
20
+ 'MD013': false,
21
+ 'MD024': {
22
+ // eslint-disable-next-line camelcase -- `siblings_only` is markdownlint's own option name.
23
+ siblings_only: true
24
+ },
25
+ 'MD052': {
26
+ /* eslint-disable camelcase -- `ignored_labels` and `shortcut_syntax` are markdownlint's own option names. */
27
+ ignored_labels: ['!note', '!warning'],
28
+ shortcut_syntax: true
29
+ /* eslint-enable camelcase -- `ignored_labels` and `shortcut_syntax` are markdownlint's own option names. */
30
+ },
31
+ 'relative-links': true
32
+ },
33
+ customRules: [relativeLinksRule],
34
+ globs: ['**/*.md'],
35
+ ignores: ['node_modules/**', '.git/**', 'dist/**']
36
+ };
@@ -0,0 +1,9 @@
1
+ export const config = {
2
+ <% _lintStagedPatterns.forEach((entry, i) => { -%>
3
+ '<%- entry.pattern %>': [
4
+ <% entry.commands.forEach((command, j) => { -%>
5
+ '<%- command %>'<%= j < entry.commands.length - 1 ? ',' : '' %>
6
+ <% }); -%>
7
+ ]<%= i < _lintStagedPatterns.length - 1 ? ',' : '' %>
8
+ <% }); -%>
9
+ };
@@ -0,0 +1 @@
1
+ <%- render('plugins') -%>
@@ -0,0 +1,7 @@
1
+ import autoprefixer from 'autoprefixer';
2
+
3
+ export const config = {
4
+ plugins: [
5
+ autoprefixer()
6
+ ]
7
+ };
@@ -0,0 +1,3 @@
1
+ import { execFromRoot } from 'obsidian-dev-utils/script-utils/root';
2
+
3
+ await execFromRoot('husky');
@@ -0,0 +1,3 @@
1
+ import { execSync } from 'node:child_process';
2
+
3
+ execSync('husky', { stdio: 'inherit' });
@@ -0,0 +1,12 @@
1
+ import type { Config } from 'prettier';
2
+
3
+ const PRINT_WIDTH = 120;
4
+ const TAB_WIDTH = 2;
5
+
6
+ export const config: Config = {
7
+ printWidth: PRINT_WIDTH,
8
+ semi: true,
9
+ singleQuote: true,
10
+ tabWidth: TAB_WIDTH,
11
+ trailingComma: 'none'
12
+ };
@@ -0,0 +1,129 @@
1
+ <%# Sorted as one group: the per-answer partials contribute imports in question-registration order, -%>
2
+ <%# which is not the order an import-sorting lint rule wants. See `sortImports` in `src/templates.ts`. -%>
3
+ <%- sortImports(`import commonjsModule from '@rollup/plugin-commonjs';
4
+ import { nodeResolve } from '@rollup/plugin-node-resolve';
5
+ import terserModule from '@rollup/plugin-terser';
6
+ import typescriptModule from '@rollup/plugin-typescript';
7
+ import { builtinModules } from 'node:module';
8
+ import process from 'node:process';
9
+ import ts, {
10
+ getModeForResolutionAtIndex,
11
+ ModuleKind
12
+ } from 'typescript';
13
+ ${render('import')}`) -%>
14
+
15
+ /**
16
+ * A module whose types describe the CommonJS shape: the factory hiding under a `default` key.
17
+ *
18
+ * Named rather than written inline inside {@link PluginFactory}, because an anonymous object type in a
19
+ * signature is a type nothing else can refer to.
20
+ */
21
+ interface DefaultExported<TDefault> {
22
+ default: TDefault;
23
+ }
24
+
25
+ /**
26
+ * Restores the call signature of a plugin whose types describe the CommonJS shape.
27
+ *
28
+ * Every `@rollup/plugin-*` ships an ESM build whose default export IS the plugin factory, but declares
29
+ * its types from one CommonJS-shaped `.d.ts`. Under `moduleResolution: node16` TypeScript therefore
30
+ * models each default import as the module object and rejects the call, while at runtime the import
31
+ * really is the factory. Reading `.default` instead type-checks and then crashes, so neither form is
32
+ * right on its own. This follows the runtime and keeps each plugin's own option types, and it is a
33
+ * no-op for any plugin whose types are already correct.
34
+ */
35
+ type PluginFactory<TImported> = TImported extends DefaultExported<infer TDefault> ? TDefault : TImported;
36
+
37
+ function asPluginFactory<TImported>(imported: TImported): PluginFactory<TImported> {
38
+ return imported as PluginFactory<TImported>;
39
+ }
40
+
41
+ const commonjs = asPluginFactory(commonjsModule);
42
+ const terser = asPluginFactory(terserModule);
43
+ const typescript = asPluginFactory(typescriptModule);
44
+ <%- render('unwrap') -%>
45
+
46
+ /**
47
+ * TypeScript as `@rollup/plugin-typescript` ought to call it.
48
+ *
49
+ * The plugin asks `getModeForResolutionAtIndex` for each import's resolution mode without passing the
50
+ * compiler options, and without them TypeScript answers `undefined`. So every import in `src/` resolves
51
+ * under the `require` condition, while a declaration file that pins `resolution-mode: import` gets the
52
+ * ESM types. A package that ships both, such as `@codemirror/state`, is then loaded twice, and its
53
+ * classes stop being assignable to themselves: TS2416 against obsidian-dev-utils' `StateFieldSpec`.
54
+ * Handing over the `module` the emitted `tsconfig.json` declares restores the per-file mode tsc uses.
55
+ */
56
+ const typescriptWithResolutionModes: typeof ts = {
57
+ ...ts,
58
+ getModeForResolutionAtIndex: (file, index) => getModeForResolutionAtIndex(file, index, { module: ModuleKind.Node16 })
59
+ };
60
+
61
+ const isProduction = process.env['BUILD'] === 'production';
62
+ const distFolder = process.env['DIST_FOLDER'] ?? (isProduction ? 'dist/build' : 'dist/dev');
63
+
64
+ const EXTERNAL = [
65
+ 'obsidian',
66
+ 'electron',
67
+ '@codemirror/autocomplete',
68
+ '@codemirror/collab',
69
+ '@codemirror/commands',
70
+ '@codemirror/language',
71
+ '@codemirror/lint',
72
+ '@codemirror/search',
73
+ '@codemirror/state',
74
+ '@codemirror/view',
75
+ '@lezer/common',
76
+ '@lezer/highlight',
77
+ '@lezer/lr',
78
+ 'esbuild',
79
+ 'eslint',
80
+ ...builtinModules
81
+ ];
82
+
83
+ <%# Each per-answer plugin partial ends its entry with a comma so two of them concatenate into a valid -%>
84
+ <%# list. The LAST entry of the whole array must not carry one, so the array is assembled here and its -%>
85
+ <%# trailing comma stripped, rather than every partial having to know whether it is last. -%>
86
+ <%
87
+ const plugins = `${render('pre-plugin')} // The emitted \`tsconfig.json\` declares \`noEmit: true\` and allows \`.ts\` import specifiers, both right
88
+ // For the file itself -- more than tsc reads it. This plugin compiles WITH emit, so it rejects that
89
+ // Config outright (TS5096, and an \`outDir\` it insists must sit inside the output directory). The
90
+ // Overrides belong here, in the one tool that needs them, exactly as \`jest.config.ts\` overrides
91
+ // \`rootDir\` for the same reason.
92
+ typescript({
93
+ // The emitted \`tsconfig.json\` inlines a source map. A production build writes none, and the plugin
94
+ // Warns on every such build that it was asked for one that nothing will output.
95
+ inlineSourceMap: !isProduction,
96
+ inlineSources: !isProduction,
97
+ noEmit: false,
98
+ ${render('lint-out-dir')} outDir: distFolder,
99
+ rewriteRelativeImportExtensions: true,
100
+ sourceMap: !isProduction,
101
+ typescript: typescriptWithResolutionModes
102
+ }),
103
+ nodeResolve({ browser: true }),
104
+ commonjs(),
105
+ ${render('post-plugin')} ...(isProduction ? [terser()] : []),
106
+ `;
107
+ -%>
108
+ export const config = {
109
+ external: EXTERNAL,
110
+ input: 'src/main.ts',
111
+ output: {
112
+ banner: `/*
113
+ THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
114
+ if you want to view the source, please visit the github repository of this plugin
115
+ */
116
+ `,
117
+ exports: 'default',
118
+ file: `${distFolder}/main.js`,
119
+ format: 'cjs',
120
+ // An Obsidian plugin is one file: the manifest names `main.js` and nothing loads a second chunk.
121
+ // Any dynamic import in the sources -- the obsidian-dev-utils presets have several -- otherwise
122
+ // Makes rollup refuse `output.file` and demand `output.dir`.
123
+ inlineDynamicImports: true,
124
+ sourcemap: isProduction ? false : 'inline'
125
+ },
126
+ plugins: [
127
+ <%- plugins.replace(/,(?<Trailing>\s*)$/, '$<Trailing>') -%>
128
+ ]
129
+ };
@@ -0,0 +1,5 @@
1
+ <%# Shared by preact, react and solid rather than copied into each, for the reason the webpack CSS -%>
2
+ <%# partial gives: `demo` forces react on top of the chosen framework, so two copies of this line and -%>
3
+ <%# of its `unwrap` twin collided as TS2300 and TS2451. The per-framework `post-plugin` partials stay -%>
4
+ <%# per-framework -- each passes its own babel presets. -%>
5
+ import babelModule from '@rollup/plugin-babel';
@@ -0,0 +1 @@
1
+ import jsonModule from '@rollup/plugin-json';
@@ -0,0 +1,4 @@
1
+ <%# Shared by every styling answer that reaches rollup through rollup-plugin-postcss, rather than one -%>
2
+ <%# identical copy per answer: `demo` forces a second styling answer on top of the chosen one, and two -%>
3
+ <%# copies of this line collide as TS2300. Its `unwrap` twin is shared for the same reason. -%>
4
+ import postcssModule from 'rollup-plugin-postcss';
@@ -0,0 +1 @@
1
+ import scssModule from 'rollup-plugin-scss';
@@ -0,0 +1,2 @@
1
+ import svelteModule from 'rollup-plugin-svelte';
2
+ import { sveltePreprocess } from 'svelte-preprocess';
@@ -0,0 +1 @@
1
+ import vueModule from 'rollup-plugin-vue';
@@ -0,0 +1 @@
1
+ import wasmModule from '@rollup/plugin-wasm';
@@ -0,0 +1 @@
1
+ // eslint-disable-next-line unicorn/name-replacements -- `outDir` is TypeScript's own compiler-option name.
@@ -0,0 +1,4 @@
1
+ babel({
2
+ babelHelpers: 'bundled',
3
+ extensions: ['.js', '.jsx', '.ts', '.tsx']
4
+ }),
@@ -0,0 +1,5 @@
1
+ babel({
2
+ babelHelpers: 'bundled',
3
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
4
+ presets: ['@babel/preset-react']
5
+ }),
@@ -0,0 +1,4 @@
1
+ <%# Shared by every styling answer that reaches rollup through rollup-plugin-postcss, like its `import` and -%>
2
+ <%# `unwrap` twins. `autoModules` is the plugin's default and is what scopes `*.module.css` while leaving an -%>
3
+ <%# ordinary stylesheet alone -- which matters because `demo` forces a second styling answer alongside. -%>
4
+ postcss({ extract: 'styles.css' }),
@@ -0,0 +1,4 @@
1
+ // `fileName`, not the deprecated `output`: rollup-plugin-scss 4 tests `options.output === 'string'`
2
+ // (the value, not its type), so `output: 'styles.css'` is ignored and the asset falls back to its
3
+ // Default name -- rollup then writes `assets/output-<hash>.css`, which Obsidian never loads.
4
+ scss({ fileName: 'styles.css' }),
@@ -0,0 +1,4 @@
1
+ babel({
2
+ babelHelpers: 'bundled',
3
+ extensions: ['.js', '.jsx', '.ts', '.tsx']
4
+ }),
@@ -0,0 +1,4 @@
1
+ // `auto-inline` rather than the default `auto`: the default only inlines under `maxFileSize` and
2
+ // Copies anything larger out to a separate file, which an Obsidian release does not ship. It also
3
+ // Drops the `fs`/`path` branch the default emits for loading that separate file.
4
+ wasm({ targetEnv: 'auto-inline' }),
@@ -0,0 +1,4 @@
1
+ svelte({
2
+ compilerOptions: { css: 'injected' },
3
+ preprocess: sveltePreprocess()
4
+ }),
@@ -0,0 +1,13 @@
1
+ vue(),
2
+ // `rollup-plugin-vue` passes a `<script lang="ts">` block on as a virtual module (`*.vue?vue&type=script…lang.ts`)
3
+ // And compiles none of it, and the `typescript` plugin below only compiles files in the tsconfig
4
+ // Program, which a virtual module never is. This pass strips the types from exactly those modules. It
5
+ // Reads no babel config file, so a JSX preset another framework configures cannot parse them first.
6
+ babel({
7
+ babelHelpers: 'bundled',
8
+ babelrc: false,
9
+ configFile: false,
10
+ extensions: ['.ts'],
11
+ include: [/\.vue\?vue&type=script/u],
12
+ presets: ['@babel/preset-typescript']
13
+ }),
@@ -0,0 +1 @@
1
+ const babel = asPluginFactory(babelModule);
@@ -0,0 +1 @@
1
+ const json = asPluginFactory(jsonModule);
@@ -0,0 +1 @@
1
+ const postcss = asPluginFactory(postcssModule);
@@ -0,0 +1 @@
1
+ const scss = asPluginFactory(scssModule);
@@ -0,0 +1 @@
1
+ const svelte = asPluginFactory(svelteModule);
@@ -0,0 +1 @@
1
+ const vue = asPluginFactory(vueModule);
@@ -0,0 +1 @@
1
+ const wasm = asPluginFactory(wasmModule);
@@ -0,0 +1,7 @@
1
+ import process from 'node:process';
2
+ import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
3
+ import { spellcheck } from 'obsidian-dev-utils/script-utils/linters/cspell';
4
+
5
+ const [, , ...paths] = process.argv;
6
+
7
+ await wrapCliTask(() => spellcheck({ paths }));
@@ -0,0 +1,8 @@
1
+ import { execSync } from 'node:child_process';
2
+ import process from 'node:process';
3
+
4
+ try {
5
+ execSync('cspell . --no-progress', { stdio: 'inherit' });
6
+ } catch {
7
+ process.exit(1);
8
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The unit runners' stand-in for a stylesheet import.
3
+ *
4
+ * `src/main.ts` imports the plugin's stylesheet for its side effect, so that the bundler emits
5
+ * `styles.css` -- and `src/main.test.ts` imports `src/main.ts`. Neither runner should load the real
6
+ * file: jest has no transform for `.css` / `.scss` and parses one as JavaScript, and on the `tailwind`
7
+ * answer the file `src/main.ts` names does not exist until `npm run build:styles` has run. So both
8
+ * runners send every stylesheet import here, exactly as they send every `.svelte` / `.vue` import to
9
+ * `framework-component-stub.ts`.
10
+ *
11
+ * It is an empty class-name map rather than a module that throws: importing a stylesheet is the normal
12
+ * path of every plugin that has one, and a CSS-modules import that reads a class name gets `undefined`
13
+ * instead of a crash.
14
+ */
15
+ const stylesheetStub: Readonly<Record<string, string>> = {};
16
+
17
+ export default stylesheetStub;
@@ -0,0 +1,8 @@
1
+ import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
2
+ import { testCoverage } from 'obsidian-dev-utils/script-utils/test-runners/vitest';
3
+
4
+ await wrapCliTask(() =>
5
+ testCoverage({
6
+ projects: ['unit-tests']
7
+ })
8
+ );
@@ -0,0 +1 @@
1
+ <%- render('tool') -%>