@mnaoumov/create-obsidian-plugin 0.0.0-stage → 1.0.1
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/LICENSE +19 -0
- package/README.md +341 -2
- package/dist/main.js +4184 -0
- package/package.json +83 -4
- package/src/main.ts +650 -0
- package/templates/default/.depcheckrc.json.ejs +19 -0
- package/templates/default/.editorconfig.ejs +11 -0
- package/templates/default/.env.ejs +1 -0
- package/templates/default/.env@vault_has-vault-false.ejs +2 -0
- package/templates/default/.env@vault_has-vault-true.ejs +1 -0
- package/templates/default/.gitattributes.ejs +7 -0
- package/templates/default/.github/FUNDING.yml.ejs +3 -0
- package/templates/default/.github/ISSUE_TEMPLATE/bug_report.yml.ejs +71 -0
- package/templates/default/.github/ISSUE_TEMPLATE/config.yml.ejs +1 -0
- package/templates/default/.github/ISSUE_TEMPLATE/feature_request.yml.ejs +61 -0
- package/templates/default/.github/workflows/attest-release-assets.yml.ejs +24 -0
- package/templates/default/.github/workflows/ci.yml.ejs +20 -0
- package/templates/default/.github/workflows/ci.yml@steps_biome-linter.ejs +1 -0
- package/templates/default/.github/workflows/ci.yml@steps_cspell.ejs +1 -0
- package/templates/default/.github/workflows/ci.yml@steps_dprint.ejs +1 -0
- package/templates/default/.github/workflows/ci.yml@steps_eslint.ejs +1 -0
- package/templates/default/.github/workflows/ci.yml@steps_jest.ejs +1 -0
- package/templates/default/.github/workflows/ci.yml@steps_markdownlint.ejs +1 -0
- package/templates/default/.github/workflows/ci.yml@steps_prettier.ejs +1 -0
- package/templates/default/.github/workflows/ci.yml@steps_vitest.ejs +1 -0
- package/templates/default/.github/workflows/release.yml.ejs +27 -0
- package/templates/default/.github/workflows/update-license-year.yml.ejs +38 -0
- package/templates/default/.gitignore_common.ejs +27 -0
- package/templates/default/.gitignore_scss.ejs +1 -0
- package/templates/default/.gitignore_tailwind.ejs +3 -0
- package/templates/default/.husky/commit-msg.ejs +1 -0
- package/templates/default/.husky/pre-commit.ejs +1 -0
- package/templates/default/.markdownlint-cli2.mjs.ejs +4 -0
- package/templates/default/.nano-staged.mjs.ejs +5 -0
- package/templates/default/.npmrc.ejs +1 -0
- package/templates/default/.parcelrc.ejs +9 -0
- package/templates/default/.parcelrc@transformers_svelte.ejs +1 -0
- package/templates/default/.prettierignore.ejs +10 -0
- package/templates/default/.typesafe-i18n.json.ejs +5 -0
- package/templates/default/CONTRIBUTING.md.ejs +49 -0
- package/templates/default/CONTRIBUTING.md@demo-vault_dev-utils.ejs +15 -0
- package/templates/default/CONTRIBUTING.md@scripts_biome-formatter.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_biome-linter.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_conventional-commits.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_cspell.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_dev-utils.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_dprint.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_eslint.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_jest.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_markdownlint.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_prettier.ejs +1 -0
- package/templates/default/CONTRIBUTING.md@scripts_vitest.ejs +1 -0
- package/templates/default/LICENSE.ejs +21 -0
- package/templates/default/README.md.ejs +28 -0
- package/templates/default/README.md@demo-vault_dev-utils.ejs +12 -0
- package/templates/default/README.md@preset_dev-utils.ejs +12 -0
- package/templates/default/README.md@support_has-funding.ejs +8 -0
- package/templates/default/babel.config.json.ejs +8 -0
- package/templates/default/babel.config.mjs.ejs +5 -0
- package/templates/default/biome.jsonc.ejs +47 -0
- package/templates/default/commitlint.config.ts.ejs +1 -0
- package/templates/default/cspell.json.ejs +67 -0
- package/templates/default/demo-vault/.gitignore.ejs +15 -0
- package/templates/default/demo-vault/.obsidian/app.json.ejs +4 -0
- package/templates/default/demo-vault/.obsidian/community-plugins.json.ejs +4 -0
- package/templates/default/demo-vault/00 Start.md.ejs +32 -0
- package/templates/default/demo-vault/00 Start.md@features_wasm.ejs +1 -0
- package/templates/default/demo-vault/01 Sample commands.md.ejs +38 -0
- package/templates/default/demo-vault/01 Sample commands.md@commands_wasm.ejs +4 -0
- package/templates/default/demo-vault/02 Settings.md.ejs +40 -0
- package/templates/default/demo-vault/03 WebAssembly.md.ejs +34 -0
- package/templates/default/demo-vault/Materials/01 Sample commands/Scratch note.md.ejs +5 -0
- package/templates/default/demo-vault/README.md.ejs +10 -0
- package/templates/default/demo-vault/_assets/CodeScriptToolkit/demoSetup.ts.ejs +88 -0
- package/templates/default/demo-vault/_assets/CodeScriptToolkit/demoSetup.ts@commands_wasm.ejs +10 -0
- package/templates/default/demo-vault/_assets/CodeScriptToolkit/startup.ts.ejs +17 -0
- package/templates/default/dprint.json_dev-utils.ejs +10 -0
- package/templates/default/dprint.json_standalone.ejs +26 -0
- package/templates/default/e2e/sample.spec.ts_obsidian-test.ejs +16 -0
- package/templates/default/e2e/sample.spec.ts_obsidian-test@lint-no-void-disable_dev-utils.ejs +3 -0
- package/templates/default/e2e/sample.spec.ts_obsidian-test@lint-no-void-enable_dev-utils.ejs +1 -0
- package/templates/default/e2e/sample.spec.ts_obsidian-test@unofficial_with-unofficial.ejs +13 -0
- package/templates/default/e2e/sample.spec.ts_wdio-obsidian.ejs +7 -0
- package/templates/default/e2e/sample.spec.ts_wdio-obsidian@unofficial_with-unofficial.ejs +15 -0
- package/templates/default/eslint.config.mts_dev-utils.ejs +1 -0
- package/templates/default/eslint.config.mts_standalone.ejs +119 -0
- package/templates/default/eslint.config.mts_standalone@extra-files_has-e2e.ejs +2 -0
- package/templates/default/jest.config.ts.ejs +57 -0
- package/templates/default/jest.config.ts@lint-root-dir_dev-utils.ejs +1 -0
- package/templates/default/jest.config.ts@ts-jest-tsconfig_solid.ejs +8 -0
- package/templates/default/linkinator.config.json.ejs +11 -0
- package/templates/default/manifest.json.ejs +11 -0
- package/templates/default/manifest.json@funding_has-funding.ejs +1 -0
- package/templates/default/manifest.json@platform_desktop-and-mobile.ejs +1 -0
- package/templates/default/manifest.json@platform_desktop-only.ejs +1 -0
- package/templates/default/package.json.ejs +32 -0
- package/templates/default/package.json@targets_parcel.ejs +36 -0
- package/templates/default/parcel-namer-obsidian.cjs.ejs +26 -0
- package/templates/default/parcel-resolver-obsidian.cjs.ejs +37 -0
- package/templates/default/parcel-transformer-inline-imports.cjs.ejs +39 -0
- package/templates/default/parcel-transformer-svelte.cjs.ejs +67 -0
- package/templates/default/pinned-versions.json.ejs +1 -0
- package/templates/default/pnpm-workspace.yaml.ejs +19 -0
- package/templates/default/postcss.config.cjs.ejs +12 -0
- package/templates/default/prettier.config.mjs.ejs +5 -0
- package/templates/default/rollup.config.mjs.ejs +7 -0
- package/templates/default/scripts/babel.config.ts_rollup.ejs +16 -0
- package/templates/default/scripts/babel.config.ts_rollup@babel-plugin_preact.ejs +1 -0
- package/templates/default/scripts/babel.config.ts_rollup@babel-preset_react.ejs +1 -0
- package/templates/default/scripts/babel.config.ts_rollup@babel-preset_solid.ejs +1 -0
- package/templates/default/scripts/build-clean.ts.ejs +4 -0
- package/templates/default/scripts/build-compile.ts.ejs +4 -0
- package/templates/default/scripts/build-styles.ts.ejs +12 -0
- package/templates/default/scripts/build.ts.ejs +6 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler.ejs +63 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@compile_svelte.ejs +4 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@fs-import_hot-reload-plugin.ejs +2 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@hot-reload_hot-reload-plugin.ejs +3 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@import_tailwind.ejs +2 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@lint-build-styles_dev-utils.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@reload_obsidian-cli.ejs +5 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@run_parcel.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@run_rollup.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@run_vite.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_cli-bundler@run_webpack.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild.ejs +3 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@compile_svelte.ejs +4 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@dev-utils-pre-build_tailwind.ejs +2 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@fs-import_hot-reload-plugin.ejs +2 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@hot-reload_hot-reload-plugin.ejs +4 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@import_postcss.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@import_scss.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@import_solid.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@import_svelte.ejs +10 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@import_tailwind.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@import_vue.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@lint-build-styles_dev-utils.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@options_preact.ejs +2 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@options_react.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@options_wasm.ejs +5 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@plugin_postcss.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@plugin_scss.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@plugin_solid.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@plugin_svelte.ejs +5 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@plugin_vue.ejs +1 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@preset_dev-utils.ejs +7 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@preset_standalone.ejs +138 -0
- package/templates/default/scripts/build.ts@bundler_esbuild@reload_obsidian-cli.ejs +6 -0
- package/templates/default/scripts/commit.ts_dev-utils.ejs +3 -0
- package/templates/default/scripts/commit.ts_standalone.ejs +3 -0
- package/templates/default/scripts/commitlint-config.ts.ejs +5 -0
- package/templates/default/scripts/demo-vault-global-setup.ts.ejs +43 -0
- package/templates/default/scripts/dev.ts.ejs +6 -0
- package/templates/default/scripts/dev.ts@bundler_cli-bundler.ejs +8 -0
- package/templates/default/scripts/dev.ts@bundler_esbuild.ejs +3 -0
- package/templates/default/scripts/dev.ts@bundler_esbuild@dev-utils-pre-build_tailwind.ejs +2 -0
- package/templates/default/scripts/dev.ts@bundler_esbuild@lint-build-styles_dev-utils.ejs +1 -0
- package/templates/default/scripts/dev.ts@bundler_esbuild@preset_dev-utils.ejs +7 -0
- package/templates/default/scripts/dev.ts@bundler_esbuild@preset_standalone.ejs +3 -0
- package/templates/default/scripts/esbuild-plugins.ts.ejs +20 -0
- package/templates/default/scripts/esbuild-plugins.ts@dev-utils-import_vue.ejs +2 -0
- package/templates/default/scripts/esbuild-plugins.ts@dev-utils-plugin_vue.ejs +1 -0
- package/templates/default/scripts/esbuild-plugins.ts@dev-utils-plugin_wasm.ejs +13 -0
- package/templates/default/scripts/eslint-config.ts.ejs +113 -0
- package/templates/default/scripts/eslint-config.ts@extra-files_has-e2e.ejs +7 -0
- package/templates/default/scripts/find-overexposed-fix.ts.ejs +26 -0
- package/templates/default/scripts/find-overexposed.ts.ejs +15 -0
- package/templates/default/scripts/format-check.ts.ejs +4 -0
- package/templates/default/scripts/format-check.ts@tool_biome-formatter.ejs +8 -0
- package/templates/default/scripts/format-check.ts@tool_dprint.ejs +3 -0
- package/templates/default/scripts/format-check.ts@tool_dprint@preset_dev-utils.ejs +7 -0
- package/templates/default/scripts/format-check.ts@tool_dprint@preset_standalone.ejs +8 -0
- package/templates/default/scripts/format-check.ts@tool_prettier.ejs +8 -0
- package/templates/default/scripts/format.ts.ejs +4 -0
- package/templates/default/scripts/format.ts@tool_biome-formatter.ejs +8 -0
- package/templates/default/scripts/format.ts@tool_dprint.ejs +3 -0
- package/templates/default/scripts/format.ts@tool_dprint@preset_dev-utils.ejs +7 -0
- package/templates/default/scripts/format.ts@tool_dprint@preset_standalone.ejs +8 -0
- package/templates/default/scripts/format.ts@tool_prettier.ejs +8 -0
- package/templates/default/scripts/framework-component-stub.ts.ejs +46 -0
- package/templates/default/scripts/gate.ts.ejs +10 -0
- package/templates/default/scripts/lint-fix.ts.ejs +6 -0
- package/templates/default/scripts/lint-fix.ts@tool_biome-linter.ejs +8 -0
- package/templates/default/scripts/lint-fix.ts@tool_eslint.ejs +3 -0
- package/templates/default/scripts/lint-fix.ts@tool_eslint@preset_dev-utils.ejs +7 -0
- package/templates/default/scripts/lint-fix.ts@tool_eslint@preset_standalone.ejs +8 -0
- package/templates/default/scripts/lint-md-fix.ts_dev-utils.ejs +7 -0
- package/templates/default/scripts/lint-md-fix.ts_standalone.ejs +37 -0
- package/templates/default/scripts/lint-md.ts_dev-utils.ejs +7 -0
- package/templates/default/scripts/lint-md.ts_standalone.ejs +37 -0
- package/templates/default/scripts/lint.ts.ejs +6 -0
- package/templates/default/scripts/lint.ts@tool_biome-linter.ejs +8 -0
- package/templates/default/scripts/lint.ts@tool_eslint.ejs +3 -0
- package/templates/default/scripts/lint.ts@tool_eslint@preset_dev-utils.ejs +7 -0
- package/templates/default/scripts/lint.ts@tool_eslint@preset_standalone.ejs +8 -0
- package/templates/default/scripts/markdownlint-cli2-config.ts_dev-utils.ejs +14 -0
- package/templates/default/scripts/markdownlint-cli2-config.ts_standalone.ejs +36 -0
- package/templates/default/scripts/nano-staged-config.ts.ejs +9 -0
- package/templates/default/scripts/postcss.config.ts.ejs +1 -0
- package/templates/default/scripts/postcss.config.ts@plugins_postcss.ejs +7 -0
- package/templates/default/scripts/prepare.ts_dev-utils.ejs +3 -0
- package/templates/default/scripts/prepare.ts_standalone.ejs +3 -0
- package/templates/default/scripts/prettier.config.ts.ejs +12 -0
- package/templates/default/scripts/rollup.config.ts.ejs +129 -0
- package/templates/default/scripts/rollup.config.ts@import_rollup-babel.ejs +5 -0
- package/templates/default/scripts/rollup.config.ts@import_rollup-json.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@import_rollup-postcss.ejs +4 -0
- package/templates/default/scripts/rollup.config.ts@import_scss.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@import_svelte.ejs +2 -0
- package/templates/default/scripts/rollup.config.ts@import_vue.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@import_wasm.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@lint-out-dir_dev-utils.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@post-plugin_preact.ejs +4 -0
- package/templates/default/scripts/rollup.config.ts@post-plugin_react.ejs +5 -0
- package/templates/default/scripts/rollup.config.ts@post-plugin_rollup-json.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@post-plugin_rollup-postcss.ejs +4 -0
- package/templates/default/scripts/rollup.config.ts@post-plugin_scss.ejs +4 -0
- package/templates/default/scripts/rollup.config.ts@post-plugin_solid.ejs +4 -0
- package/templates/default/scripts/rollup.config.ts@post-plugin_wasm.ejs +4 -0
- package/templates/default/scripts/rollup.config.ts@pre-plugin_svelte.ejs +4 -0
- package/templates/default/scripts/rollup.config.ts@pre-plugin_vue.ejs +13 -0
- package/templates/default/scripts/rollup.config.ts@unwrap_rollup-babel.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@unwrap_rollup-json.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@unwrap_rollup-postcss.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@unwrap_scss.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@unwrap_svelte.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@unwrap_vue.ejs +1 -0
- package/templates/default/scripts/rollup.config.ts@unwrap_wasm.ejs +1 -0
- package/templates/default/scripts/spellcheck.ts_dev-utils.ejs +7 -0
- package/templates/default/scripts/spellcheck.ts_standalone.ejs +8 -0
- package/templates/default/scripts/stylesheet-stub.ts.ejs +17 -0
- package/templates/default/scripts/test-coverage.ts.ejs +8 -0
- package/templates/default/scripts/test-e2e.ts.ejs +1 -0
- package/templates/default/scripts/test-e2e.ts@tool_obsidian-test.ejs +8 -0
- package/templates/default/scripts/test-e2e.ts@tool_wdio-obsidian.ejs +8 -0
- package/templates/default/scripts/test-integration-android.ts.ejs +8 -0
- package/templates/default/scripts/test-integration-demo-vault.ts.ejs +8 -0
- package/templates/default/scripts/test-integration-desktop-performance.ts.ejs +8 -0
- package/templates/default/scripts/test-integration-desktop.ts.ejs +8 -0
- package/templates/default/scripts/test-integration-no-app.ts.ejs +8 -0
- package/templates/default/scripts/test-integration.ts.ejs +22 -0
- package/templates/default/scripts/test-watch.ts_dev-utils.ejs +1 -0
- package/templates/default/scripts/test-watch.ts_dev-utils@tool_jest.ejs +13 -0
- package/templates/default/scripts/test-watch.ts_dev-utils@tool_vitest.ejs +8 -0
- package/templates/default/scripts/test-watch.ts_standalone.ejs +1 -0
- package/templates/default/scripts/test-watch.ts_standalone@tool_jest.ejs +13 -0
- package/templates/default/scripts/test-watch.ts_standalone@tool_vitest.ejs +8 -0
- package/templates/default/scripts/test.ts_dev-utils.ejs +1 -0
- package/templates/default/scripts/test.ts_dev-utils@tool_jest.ejs +13 -0
- package/templates/default/scripts/test.ts_dev-utils@tool_vitest.ejs +8 -0
- package/templates/default/scripts/test.ts_standalone.ejs +1 -0
- package/templates/default/scripts/test.ts_standalone@tool_jest.ejs +13 -0
- package/templates/default/scripts/test.ts_standalone@tool_vitest.ejs +8 -0
- package/templates/default/scripts/version.ts_dev-utils.ejs +10 -0
- package/templates/default/scripts/version.ts_standalone.ejs +317 -0
- package/templates/default/scripts/vite.config.ts.ejs +76 -0
- package/templates/default/scripts/vite.config.ts@import_preact.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@import_react.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@import_solid.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@import_svelte.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@import_vue.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@lint-empty-out-dir_dev-utils.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@lint-out-dir_dev-utils.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@plugin_preact.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@plugin_react.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@plugin_solid.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@plugin_svelte.ejs +1 -0
- package/templates/default/scripts/vite.config.ts@plugin_vue.ejs +1 -0
- package/templates/default/scripts/vitest-config.ts.ejs +75 -0
- package/templates/default/scripts/vitest-config.ts@post-config_solid.ejs +67 -0
- package/templates/default/scripts/wasm-module-stub.ts.ejs +21 -0
- package/templates/default/scripts/webpack.config.ts.ejs +124 -0
- package/templates/default/scripts/webpack.config.ts@import_svelte.ejs +1 -0
- package/templates/default/scripts/webpack.config.ts@import_vue.ejs +1 -0
- package/templates/default/scripts/webpack.config.ts@import_webpack-css-extract.ejs +4 -0
- package/templates/default/scripts/webpack.config.ts@lint-webpack-default_dev-utils.ejs +1 -0
- package/templates/default/scripts/webpack.config.ts@plugin_vue.ejs +1 -0
- package/templates/default/scripts/webpack.config.ts@plugin_webpack-css-extract.ejs +4 -0
- package/templates/default/scripts/webpack.config.ts@rule_css-modules.ejs +7 -0
- package/templates/default/scripts/webpack.config.ts@rule_css.ejs +4 -0
- package/templates/default/scripts/webpack.config.ts@rule_postcss.ejs +4 -0
- package/templates/default/scripts/webpack.config.ts@rule_scss.ejs +4 -0
- package/templates/default/scripts/webpack.config.ts@rule_solid.ejs +17 -0
- package/templates/default/scripts/webpack.config.ts@rule_svelte.ejs +7 -0
- package/templates/default/scripts/webpack.config.ts@rule_tailwind.ejs +4 -0
- package/templates/default/scripts/webpack.config.ts@rule_vue.ejs +4 -0
- package/templates/default/scripts/webpack.config.ts@rule_wasm.ejs +8 -0
- package/templates/default/scripts/webpack.config.ts@ts-loader-compiler-options_vue.ejs +5 -0
- package/templates/default/scripts/webpack.config.ts@ts-loader-options_vue.ejs +5 -0
- package/templates/default/src/demo-vault-buttons.demo-vault.integration.test.ts.ejs +12 -0
- package/templates/default/src/demo-vault.no-app.integration.test.ts.ejs +18 -0
- package/templates/default/src/editor-extensions/sample-state-field.ts_dev-utils.ejs +56 -0
- package/templates/default/src/editor-extensions/sample-state-field.ts_standalone.ejs +60 -0
- package/templates/default/src/editor-extensions/sample-view-plugin.ts.ejs +66 -0
- package/templates/default/src/editor-extensions/sample-widget.ts.ejs +22 -0
- package/templates/default/src/editor-suggests/sample-editor-suggest.ts.ejs +42 -0
- package/templates/default/src/i18n/en/index.ts.ejs +10 -0
- package/templates/default/src/i18n/index.ts_i18next.ejs +21 -0
- package/templates/default/src/i18n/index.ts_typesafe-i18n.ejs +14 -0
- package/templates/default/src/i18n/locales/en.json.ejs +3 -0
- package/templates/default/src/lit-elements/sample-lit-element.ts.ejs +54 -0
- package/templates/default/src/main.test.ts.ejs +11 -0
- package/templates/default/src/main.test.ts@test-imports_vitest.ejs +6 -0
- package/templates/default/src/main.ts.ejs +4 -0
- package/templates/default/src/main.ts@import_css-modules.ejs +1 -0
- package/templates/default/src/main.ts@import_css.ejs +1 -0
- package/templates/default/src/main.ts@import_postcss.ejs +1 -0
- package/templates/default/src/main.ts@import_scss.ejs +1 -0
- package/templates/default/src/main.ts@import_tailwind.ejs +1 -0
- package/templates/default/src/modals/sample-form-modal.ts.ejs +35 -0
- package/templates/default/src/modals/sample-suggest-modal.ts.ejs +37 -0
- package/templates/default/src/plugin-settings-component.test.ts_demo.ejs +49 -0
- package/templates/default/src/plugin-settings-component.test.ts_demo@test-imports_vitest.ejs +5 -0
- package/templates/default/src/plugin-settings-component.test.ts_enhanced.ejs +41 -0
- package/templates/default/src/plugin-settings-component.test.ts_enhanced@test-imports_vitest.ejs +5 -0
- package/templates/default/src/plugin-settings-component.ts_demo.ejs +87 -0
- package/templates/default/src/plugin-settings-component.ts_enhanced.ejs +27 -0
- package/templates/default/src/plugin-settings-tab.ts_demo.ejs +286 -0
- package/templates/default/src/plugin-settings-tab.ts_enhanced.ejs +26 -0
- package/templates/default/src/plugin-settings.test.ts_demo.ejs +14 -0
- package/templates/default/src/plugin-settings.test.ts_demo@test-imports_vitest.ejs +6 -0
- package/templates/default/src/plugin-settings.ts_demo.ejs +64 -0
- package/templates/default/src/plugin-settings.ts_enhanced.ejs +3 -0
- package/templates/default/src/plugin.test.ts_jest.ejs +9 -0
- package/templates/default/src/plugin.test.ts_vitest.ejs +14 -0
- package/templates/default/src/plugin.ts_demo.ejs +316 -0
- package/templates/default/src/plugin.ts_demo@import_i18next.ejs +1 -0
- package/templates/default/src/plugin.ts_demo@import_lit.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@import_preact.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@import_react.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@import_solid.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@import_svelte.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@import_typesafe-i18n.ejs +1 -0
- package/templates/default/src/plugin.ts_demo@import_vue.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@import_wasm.ejs +1 -0
- package/templates/default/src/plugin.ts_demo@method_ui-view.ejs +7 -0
- package/templates/default/src/plugin.ts_demo@onload_i18next.ejs +2 -0
- package/templates/default/src/plugin.ts_demo@onload_lit.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@onload_preact.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@onload_react.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@onload_solid.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@onload_svelte.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@onload_typesafe-i18n.ejs +8 -0
- package/templates/default/src/plugin.ts_demo@onload_vue.ejs +4 -0
- package/templates/default/src/plugin.ts_demo@onload_wasm.ejs +2 -0
- package/templates/default/src/plugin.ts_enhanced.ejs +72 -0
- package/templates/default/src/plugin.ts_enhanced@import2_codemirror.ejs +3 -0
- package/templates/default/src/plugin.ts_enhanced@import2_i18next.ejs +2 -0
- package/templates/default/src/plugin.ts_enhanced@import2_lit.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@import2_preact.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@import2_react.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@import2_solid.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@import2_svelte.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@import2_typesafe-i18n.ejs +2 -0
- package/templates/default/src/plugin.ts_enhanced@import2_vue.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@import2_wasm.ejs +1 -0
- package/templates/default/src/plugin.ts_enhanced@method_ui-view.ejs +7 -0
- package/templates/default/src/plugin.ts_enhanced@onload_codemirror.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@onload_i18next.ejs +2 -0
- package/templates/default/src/plugin.ts_enhanced@onload_lit.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@onload_preact.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@onload_react.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@onload_solid.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@onload_svelte.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@onload_typesafe-i18n.ejs +8 -0
- package/templates/default/src/plugin.ts_enhanced@onload_vue.ejs +4 -0
- package/templates/default/src/plugin.ts_enhanced@onload_wasm.ejs +2 -0
- package/templates/default/src/plugin.ts_standalone.ejs +56 -0
- package/templates/default/src/plugin.ts_standalone@import_codemirror.ejs +3 -0
- package/templates/default/src/plugin.ts_standalone@import_i18next.ejs +1 -0
- package/templates/default/src/plugin.ts_standalone@import_lit.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@import_preact.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@import_react.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@import_solid.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@import_svelte.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@import_typesafe-i18n.ejs +1 -0
- package/templates/default/src/plugin.ts_standalone@import_vue.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@import_wasm.ejs +1 -0
- package/templates/default/src/plugin.ts_standalone@method_ui-view.ejs +7 -0
- package/templates/default/src/plugin.ts_standalone@onload_codemirror.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@onload_i18next.ejs +2 -0
- package/templates/default/src/plugin.ts_standalone@onload_lit.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@onload_preact.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@onload_react.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@onload_solid.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@onload_svelte.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@onload_typesafe-i18n.ejs +8 -0
- package/templates/default/src/plugin.ts_standalone@onload_vue.ejs +4 -0
- package/templates/default/src/plugin.ts_standalone@onload_wasm.ejs +2 -0
- package/templates/default/src/preact-components/sample-preact-component.tsx_dev-utils.ejs +47 -0
- package/templates/default/src/preact-components/sample-preact-component.tsx_standalone.ejs +47 -0
- package/templates/default/src/react-components/sample-react-component.tsx_dev-utils.ejs +35 -0
- package/templates/default/src/react-components/sample-react-component.tsx_standalone.ejs +47 -0
- package/templates/default/src/settings.ts.ejs +32 -0
- package/templates/default/src/solid-components/sample-solid-component.tsx_dev-utils.ejs +47 -0
- package/templates/default/src/solid-components/sample-solid-component.tsx_standalone.ejs +47 -0
- package/templates/default/src/styles/css-modules.d.ts.ejs +4 -0
- package/templates/default/src/styles/main.css_dev-utils.ejs +17 -0
- package/templates/default/src/styles/main.css_dev-utils@content_tailwind.ejs +1 -0
- package/templates/default/src/styles/main.css_standalone.ejs +11 -0
- package/templates/default/src/styles/main.css_standalone@content_tailwind.ejs +1 -0
- package/templates/default/src/styles/main.module.css.ejs +3 -0
- package/templates/default/src/styles/main.scss_dev-utils.ejs +16 -0
- package/templates/default/src/styles/main.scss_standalone.ejs +10 -0
- package/templates/default/src/styles/styles.d.ts.ejs +4 -0
- package/templates/default/src/svelte-components/sample-svelte-component.d.ts.ejs +7 -0
- package/templates/default/src/svelte-components/sample-svelte-component.svelte.ejs +24 -0
- package/templates/default/src/views/sample-lit-view.ts.ejs +30 -0
- package/templates/default/src/views/sample-lit-view.ts@lint-register-element_dev-utils.ejs +1 -0
- package/templates/default/src/views/sample-preact-view.tsx_dev-utils.ejs +45 -0
- package/templates/default/src/views/sample-preact-view.tsx_standalone.ejs +42 -0
- package/templates/default/src/views/sample-react-view.tsx_dev-utils.ejs +47 -0
- package/templates/default/src/views/sample-react-view.tsx_standalone.ejs +49 -0
- package/templates/default/src/views/sample-solid-view.tsx_dev-utils.ejs +46 -0
- package/templates/default/src/views/sample-solid-view.tsx_standalone.ejs +46 -0
- package/templates/default/src/views/sample-svelte-view.ts.ejs +47 -0
- package/templates/default/src/views/sample-view.ts.ejs +37 -0
- package/templates/default/src/views/sample-vue-view.ts.ejs +34 -0
- package/templates/default/src/vue-components/sample-vue-component.d.ts.ejs +6 -0
- package/templates/default/src/vue-components/sample-vue-component.vue.ejs +25 -0
- package/templates/default/src/wasm/README.md.ejs +29 -0
- package/templates/default/src/wasm/answer.ts_esbuild.ejs +23 -0
- package/templates/default/src/wasm/answer.ts_parcel.ejs +29 -0
- package/templates/default/src/wasm/answer.ts_rollup.ejs +19 -0
- package/templates/default/src/wasm/answer.ts_vite.ejs +29 -0
- package/templates/default/src/wasm/answer.ts_webpack.ejs +29 -0
- package/templates/default/src/wasm/module.wasm +0 -0
- package/templates/default/src/wasm/module.wat.ejs +12 -0
- package/templates/default/src/wasm/sample-command.ts.ejs +33 -0
- package/templates/default/src/wasm.d.ts_esbuild.ejs +12 -0
- package/templates/default/src/wasm.d.ts_parcel.ejs +7 -0
- package/templates/default/src/wasm.d.ts_rollup.ejs +8 -0
- package/templates/default/src/wasm.d.ts_vite.ejs +8 -0
- package/templates/default/src/wasm.d.ts_webpack.ejs +7 -0
- package/templates/default/tsconfig.json_dev-utils.ejs +34 -0
- package/templates/default/tsconfig.json_dev-utils@compiler-options_i18next.ejs +1 -0
- package/templates/default/tsconfig.json_dev-utils@compiler-options_lit.ejs +2 -0
- package/templates/default/tsconfig.json_dev-utils@compiler-options_preact.ejs +2 -0
- package/templates/default/tsconfig.json_dev-utils@compiler-options_react.ejs +1 -0
- package/templates/default/tsconfig.json_dev-utils@compiler-options_solid.ejs +2 -0
- package/templates/default/tsconfig.json_dev-utils@include_has-e2e.ejs +1 -0
- package/templates/default/tsconfig.json_dev-utils@include_svelte.ejs +1 -0
- package/templates/default/tsconfig.json_dev-utils@include_vue.ejs +1 -0
- package/templates/default/tsconfig.json_dev-utils@types_jest.ejs +2 -0
- package/templates/default/tsconfig.json_dev-utils@types_svelte.ejs +2 -0
- package/templates/default/tsconfig.json_dev-utils@types_wdio-obsidian.ejs +5 -0
- package/templates/default/tsconfig.json_dev-utils@types_with-unofficial.ejs +2 -0
- package/templates/default/tsconfig.json_standalone.ejs +47 -0
- package/templates/default/tsconfig.json_standalone@compiler-options_i18next.ejs +1 -0
- package/templates/default/tsconfig.json_standalone@compiler-options_lit.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@compiler-options_preact.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@compiler-options_react.ejs +1 -0
- package/templates/default/tsconfig.json_standalone@compiler-options_solid.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@include-extra_preact.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@include-extra_react.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@include-extra_solid.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@include_has-e2e.ejs +1 -0
- package/templates/default/tsconfig.json_standalone@include_svelte.ejs +1 -0
- package/templates/default/tsconfig.json_standalone@include_vue.ejs +1 -0
- package/templates/default/tsconfig.json_standalone@types_jest.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@types_svelte.ejs +2 -0
- package/templates/default/tsconfig.json_standalone@types_wdio-obsidian.ejs +5 -0
- package/templates/default/tsconfig.json_standalone@types_with-unofficial.ejs +2 -0
- package/templates/default/versions.json.ejs +3 -0
- package/templates/default/vite.config.ts.ejs +3 -0
- package/templates/default/vitest.config.ts_dev-utils.ejs +1 -0
- package/templates/default/vitest.config.ts_standalone.ejs +55 -0
- package/templates/default/vitest.config.ts_standalone@jsx_solid.ejs +11 -0
- package/templates/default/wdio.conf.ts.ejs +21 -0
- package/templates/default/webpack.config.ts.ejs +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
jsx: 'automatic',
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// esbuild's own loader, rather than `esbuild-plugin-wasm`: that plugin follows the WebAssembly
|
|
2
|
+
// ESM-integration proposal and emits a top-level `await`, which esbuild supports only for the `esm`
|
|
3
|
+
// Output format -- and this bundle is `cjs`, because that is what Obsidian loads. `binary` inlines the
|
|
4
|
+
// File as base64 and hands the importing module a `Uint8Array`, with no await anywhere.
|
|
5
|
+
loader: { '.wasm': 'binary' },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
postcssPlugin(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sassPlugin(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
solidPlugin(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vuePlugin(),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { build } from 'obsidian-dev-utils/script-utils/bundlers/esbuild';
|
|
2
|
+
import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
|
|
3
|
+
|
|
4
|
+
<%- render('dev-utils-pre-build') -%>
|
|
5
|
+
import { customEsbuildPlugins } from './esbuild-plugins.ts';
|
|
6
|
+
|
|
7
|
+
await wrapCliTask(() => build({ customEsbuildPlugins }));
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
copyFileSync,
|
|
3
|
+
existsSync,
|
|
4
|
+
mkdirSync,
|
|
5
|
+
renameSync,
|
|
6
|
+
rmSync<%- render('fs-import') %>
|
|
7
|
+
} from 'node:fs';
|
|
8
|
+
import { builtinModules } from 'node:module';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import process from 'node:process';
|
|
11
|
+
|
|
12
|
+
import esbuild from 'esbuild';
|
|
13
|
+
<%- render('import') -%>
|
|
14
|
+
|
|
15
|
+
const prod = process.argv[2] !== 'dev';
|
|
16
|
+
<%- render('compile') -%>
|
|
17
|
+
|
|
18
|
+
if (existsSync('.env')) {
|
|
19
|
+
process.loadEnvFile('.env');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const distFolder = prod ? 'dist/build' : 'dist/dev';
|
|
23
|
+
|
|
24
|
+
if (existsSync(distFolder)) {
|
|
25
|
+
rmSync(distFolder, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
mkdirSync(distFolder, { recursive: true });
|
|
28
|
+
|
|
29
|
+
copyFileSync('manifest.json', join(distFolder, 'manifest.json'));
|
|
30
|
+
<%- render('hot-reload') -%>
|
|
31
|
+
|
|
32
|
+
const banner = `/*
|
|
33
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
34
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
35
|
+
*/
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const context = await esbuild.context({
|
|
39
|
+
banner: {
|
|
40
|
+
js: banner
|
|
41
|
+
},
|
|
42
|
+
entryPoints: ['src/main.ts'],
|
|
43
|
+
bundle: true,
|
|
44
|
+
external: [
|
|
45
|
+
'obsidian',
|
|
46
|
+
'electron',
|
|
47
|
+
'@codemirror/autocomplete',
|
|
48
|
+
'@codemirror/collab',
|
|
49
|
+
'@codemirror/commands',
|
|
50
|
+
'@codemirror/language',
|
|
51
|
+
'@codemirror/lint',
|
|
52
|
+
'@codemirror/search',
|
|
53
|
+
'@codemirror/state',
|
|
54
|
+
'@codemirror/view',
|
|
55
|
+
'@lezer/common',
|
|
56
|
+
'@lezer/highlight',
|
|
57
|
+
'@lezer/lr',
|
|
58
|
+
'esbuild',
|
|
59
|
+
'eslint',
|
|
60
|
+
...builtinModules
|
|
61
|
+
],
|
|
62
|
+
conditions: ['browser'],
|
|
63
|
+
format: 'cjs',
|
|
64
|
+
keepNames: true,
|
|
65
|
+
logLevel: 'info',
|
|
66
|
+
minify: prod,
|
|
67
|
+
outfile: join(distFolder, 'main.js'),
|
|
68
|
+
platform: 'node',
|
|
69
|
+
sourcemap: prod ? false : 'inline',
|
|
70
|
+
target: 'esnext',
|
|
71
|
+
treeShaking: true,
|
|
72
|
+
<%- render('options') -%>
|
|
73
|
+
plugins: [
|
|
74
|
+
<%- render('plugin') -%>
|
|
75
|
+
renameCssPlugin(distFolder),
|
|
76
|
+
copyToObsidianPluginsFolderPlugin(prod, distFolder)
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (prod) {
|
|
81
|
+
await context.rebuild();
|
|
82
|
+
process.exit(0);
|
|
83
|
+
} else {
|
|
84
|
+
await context.watch();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function copyToObsidianPluginsFolderPlugin(isProduction: boolean, dist: string): esbuild.Plugin {
|
|
88
|
+
return {
|
|
89
|
+
name: 'copy-to-obsidian-plugins-folder',
|
|
90
|
+
setup(build): void {
|
|
91
|
+
build.onEnd(async () => {
|
|
92
|
+
if (isProduction) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const obsidianConfigFolder = process.env.OBSIDIAN_CONFIG_FOLDER ?? '';
|
|
97
|
+
if (!obsidianConfigFolder) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const pluginFolder = join(obsidianConfigFolder, 'plugins', '<%= pluginId %>');
|
|
102
|
+
if (!existsSync(pluginFolder)) {
|
|
103
|
+
mkdirSync(pluginFolder, { recursive: true });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const { cpSync } = await import('node:fs');
|
|
107
|
+
cpSync(dist, pluginFolder, { recursive: true });
|
|
108
|
+
<%- render({ section: 'reload', indentLevel: 4 }) -%>
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Renames the emitted stylesheet to the only name Obsidian reads.
|
|
116
|
+
*
|
|
117
|
+
* `outfile` is `<dist>/main.js`, so esbuild writes the bundled CSS beside it as `<dist>/main.css`.
|
|
118
|
+
* Obsidian loads a plugin's stylesheet from `styles.css` and nothing else, so without this the file
|
|
119
|
+
* ships and is never read -- a build that succeeds and a plugin with no styles.
|
|
120
|
+
*
|
|
121
|
+
* Registered BEFORE `copyToObsidianPluginsFolderPlugin`: esbuild runs `onEnd` callbacks in plugin
|
|
122
|
+
* order, and the copy into the vault has to see the renamed file. Unconditional and existence-guarded
|
|
123
|
+
* rather than gated on the styling answer, so there is nothing to keep in sync -- a project with no
|
|
124
|
+
* stylesheet simply has nothing to rename.
|
|
125
|
+
*/
|
|
126
|
+
function renameCssPlugin(dist: string): esbuild.Plugin {
|
|
127
|
+
return {
|
|
128
|
+
name: 'rename-css',
|
|
129
|
+
setup(build): void {
|
|
130
|
+
build.onEnd(() => {
|
|
131
|
+
const mainCssPath = join(dist, 'main.css');
|
|
132
|
+
if (existsSync(mainCssPath)) {
|
|
133
|
+
renameSync(mainCssPath, join(dist, 'styles.css'));
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { PopulateFilesParams } from 'obsidian-integration-testing';
|
|
2
|
+
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import process from 'node:process';
|
|
5
|
+
import { CODE_SCRIPT_TOOLKIT_PLUGIN_ID } from 'obsidian-dev-utils/script-utils/demo-vault-buttons';
|
|
6
|
+
import { getRootFolder } from 'obsidian-dev-utils/script-utils/root';
|
|
7
|
+
import { buildDemoVaultPopulate } from 'obsidian-integration-testing';
|
|
8
|
+
import { createSetup } from 'obsidian-integration-testing/vitest-global-setup-plugin';
|
|
9
|
+
|
|
10
|
+
// CodeScript Toolkit is what turns a ```code-button fence into a button, and its root-relative
|
|
11
|
+
// `require('/demoSetup.ts')` into a call. In real use the in-vault `demo-vault-helper` installs it from
|
|
12
|
+
// The community registry on first launch — a NETWORK step. Seeding the copy it already installed into the
|
|
13
|
+
// In-repo demo vault keeps this run hermetic and independent of that bootstrap, which is why the suite
|
|
14
|
+
// Needs `demo-vault/` opened in Obsidian once before it can run. See CONTRIBUTING.md.
|
|
15
|
+
const CODE_SCRIPT_TOOLKIT_SETTINGS = {
|
|
16
|
+
invocableScriptsFolder: 'Invocables',
|
|
17
|
+
modulesRoot: '_assets/CodeScriptToolkit',
|
|
18
|
+
shouldHandleProtocolUrls: true,
|
|
19
|
+
startupScriptPath: 'startup.ts'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function populate(): PopulateFilesParams {
|
|
23
|
+
return buildDemoVaultPopulate({
|
|
24
|
+
demoVaultPath: join(getRootFolder() ?? process.cwd(), 'demo-vault'),
|
|
25
|
+
injectPlugins: [{
|
|
26
|
+
data: CODE_SCRIPT_TOOLKIT_SETTINGS,
|
|
27
|
+
pluginId: CODE_SCRIPT_TOOLKIT_PLUGIN_ID
|
|
28
|
+
}]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Pre-populates the whole `demo-vault/` tree (plus the CodeScript Toolkit binary and its settings) before
|
|
33
|
+
// Obsidian opens, so the startup scan indexes every note in one pass. Used by
|
|
34
|
+
// `integration-tests:demo-vault`.
|
|
35
|
+
const { setup, teardown } = createSetup({
|
|
36
|
+
enableCommunityPlugins: [CODE_SCRIPT_TOOLKIT_PLUGIN_ID],
|
|
37
|
+
populate
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
setup,
|
|
42
|
+
teardown
|
|
43
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<%# The twin of build.ts.ejs, and it has to be: `dev` is `build` in watch mode, so the two scripts are -%>
|
|
2
|
+
<%# one decision made once. Keyed on the BUNDLER first for that reason -- keying it on the PRESET is -%>
|
|
3
|
+
<%# what left every obsidian-dev-utils preset watching with esbuild whatever bundler was answered, -%>
|
|
4
|
+
<%# while `npm run build` ran the answered one and the emitted config, loaders and plugins went unread -%>
|
|
5
|
+
<%# by the path a developer actually spends the day in. -%>
|
|
6
|
+
<%- render('bundler') -%>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%# build.ts already IS the watch script for the four command-line bundlers: it reads `dev` off argv -%>
|
|
2
|
+
<%# and derives watchFlag, dist/dev, sourcemaps, the .hotreload marker and the vault copy from it. So -%>
|
|
3
|
+
<%# `dev` re-enters it rather than restating any of that. Byte-identical to the esbuild+standalone -%>
|
|
4
|
+
<%# partial, and deliberately a second copy: one shared partial contributed by both the CLI bundlers -%>
|
|
5
|
+
<%# and `standalone` would render TWICE on standalone plus a command-line bundler. -%>
|
|
6
|
+
const BUILD_MODE_ARGUMENT_INDEX = 2;
|
|
7
|
+
process.argv[BUILD_MODE_ARGUMENT_INDEX] = 'dev';
|
|
8
|
+
await import('./build.ts');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// eslint-disable-next-line import-x/no-unassigned-import -- Importing the module RUNS the style build; there is nothing to bind.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { dev } from 'obsidian-dev-utils/script-utils/bundlers/esbuild';
|
|
2
|
+
import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
|
|
3
|
+
|
|
4
|
+
<%- render('dev-utils-pre-build') -%>
|
|
5
|
+
import { customEsbuildPlugins } from './esbuild-plugins.ts';
|
|
6
|
+
|
|
7
|
+
await wrapCliTask(() => dev({ customEsbuildPlugins }));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Plugin } from 'esbuild';
|
|
2
|
+
<%- render('dev-utils-import') -%>
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The esbuild plugins obsidian-dev-utils' own build does not already register.
|
|
6
|
+
*
|
|
7
|
+
* `build()` and `dev()` spread `customEsbuildPlugins` into their plugin list, which is the whole seam.
|
|
8
|
+
* They ship a svelte wrapper and a sass plugin built in -- which is exactly why svelte and SCSS work on
|
|
9
|
+
* these presets untouched -- but nothing for Vue, so `esbuild-plugin-vue3` was installed and never
|
|
10
|
+
* wired in, and any project reaching a `.vue` file from its module graph failed with "No loader is
|
|
11
|
+
* configured for `.vue` files".
|
|
12
|
+
*
|
|
13
|
+
* Shared by `build.ts` and `dev.ts` rather than written into each: one list, one place to add to.
|
|
14
|
+
*/
|
|
15
|
+
<%# Each per-answer partial ends its entry with a comma so two of them concatenate into a valid list. -%>
|
|
16
|
+
<%# The LAST one's comma is then a trailing comma, which the shared ESLint config rejects, so it is -%>
|
|
17
|
+
<%# stripped here rather than by making every partial know whether it is last. -%>
|
|
18
|
+
<%# With no entry at all the list is `[]` on one line, which is how the formatter writes an empty array. -%>
|
|
19
|
+
<% const devUtilsPlugins = render('dev-utils-plugin').replace(/,(?<Trailing>\s*)$/, '$<Trailing>'); -%>
|
|
20
|
+
export const customEsbuildPlugins: Plugin[] = [<%- devUtilsPlugins === '' ? '' : `\n${devUtilsPlugins}` -%>];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vuePlugin(),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The obsidian-dev-utils `build()` owns the esbuild options, so the `.wasm` loader is set from inside a
|
|
2
|
+
// Plugin -- the one seam it exposes. Same decision as the standalone preset makes with a plain
|
|
3
|
+
// `loader` option, and for the same reason: `esbuild-plugin-wasm` emits a top-level `await`, which
|
|
4
|
+
// Esbuild supports only for `esm` output, and an Obsidian bundle is `cjs`.
|
|
5
|
+
{
|
|
6
|
+
name: 'wasm-binary-loader',
|
|
7
|
+
setup(build): void {
|
|
8
|
+
build.initialOptions.loader = {
|
|
9
|
+
...build.initialOptions.loader,
|
|
10
|
+
'.wasm': 'binary'
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
},
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
defineConfig,
|
|
5
|
+
globalIgnores
|
|
6
|
+
} from 'eslint/config';
|
|
7
|
+
import { defineEslintConfigs } from 'obsidian-dev-utils/script-utils/linters/eslint-config';
|
|
8
|
+
|
|
9
|
+
export const configs: Linter.Config[] = defineEslintConfigs({
|
|
10
|
+
customConfigs(context) {
|
|
11
|
+
return defineConfig(
|
|
12
|
+
globalIgnores([
|
|
13
|
+
// `defineEslintConfigs` ignores whatever `.gitignore` names, which already covers `main.js`,
|
|
14
|
+
// `dist` and `node_modules`. These four it cannot: the three extensions are not TypeScript and so
|
|
15
|
+
// Are governed by no config object of its own, and `demo-vault/` is COMMITTED, so it is in no
|
|
16
|
+
// Ignore file. The demo scripts show unusual module and `require` styles on purpose; a linter that
|
|
17
|
+
// "fixes" them breaks the lesson.
|
|
18
|
+
'**/*.cjs',
|
|
19
|
+
'**/*.js',
|
|
20
|
+
'**/*.mjs',
|
|
21
|
+
'demo-vault/**'
|
|
22
|
+
]),
|
|
23
|
+
{
|
|
24
|
+
files: context.allFiles(),
|
|
25
|
+
rules: {
|
|
26
|
+
// `process.env['BUILD']` is not a style choice. TypeScript's `noPropertyAccessFromIndexSignature`
|
|
27
|
+
// — which `@tsconfig/strictest` turns on, and this preset inherits — REJECTS the dotted form on
|
|
28
|
+
// An index signature, so the compiler and this rule disagree about the same line. The compiler
|
|
29
|
+
// Wins, because its complaint is an error and this one is a preference. Biome's `useLiteralKeys`
|
|
30
|
+
// Is turned off in `biome.jsonc` for exactly the same reason. The shared config sets
|
|
31
|
+
// `dot-notation` only over `context.testFiles`, and only with the two class-property allowances,
|
|
32
|
+
// So this clash is not handled upstream and has to be re-stated here.
|
|
33
|
+
'@typescript-eslint/dot-notation': ['error', { allowIndexSignaturePropertyAccess: true }]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
// `moment` is banned for bundle size, which does not apply here: Obsidian bundles it and
|
|
38
|
+
// Re-exports it, so it is imported from `'obsidian'` and the dependency exists only so
|
|
39
|
+
// `moment.Duration` and friends type-check against the version the app actually runs. A no-op
|
|
40
|
+
// Unless the project depends on it. Both file sets matter: the rule reads the dependency out of
|
|
41
|
+
// `package.json` and the import out of the source.
|
|
42
|
+
files: [...context.sourceFiles, 'package.json'],
|
|
43
|
+
rules: {
|
|
44
|
+
'depend/ban-dependencies': ['error', { allowed: ['moment'] }]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
// Scoped to the source files, not to everything, because the rule comes from
|
|
49
|
+
// `obsidianmd.configs.recommended` and the shared config scopes THAT to `context.sourceFiles`. A
|
|
50
|
+
// Flat-config rule entry is resolved against the plugins in scope for the file it matches, so
|
|
51
|
+
// Naming an obsidianmd rule over a wider set is not a wider check -- it is
|
|
52
|
+
// "could not find plugin", and ESLint refuses to start.
|
|
53
|
+
files: context.sourceFiles,
|
|
54
|
+
rules: {
|
|
55
|
+
'obsidianmd/ui/sentence-case': [
|
|
56
|
+
'error',
|
|
57
|
+
{
|
|
58
|
+
brands: [<% _sentenceCaseBrands.forEach((brand, i) => { %>'<%- brand %>'<%= i < _sentenceCaseBrands.length - 1 ? ', ' : '' %><% }); %>]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
// Two imports only a build or a bundler can resolve. `src/main.ts` imports the stylesheet
|
|
65
|
+
// `npm run build:styles` writes, which is absent until the first build and present after it -- so an
|
|
66
|
+
// Inline disable is wrong in both states, an unresolved import before and an unused directive after.
|
|
67
|
+
// `data-url:` is a parcel scheme that only parcel's own resolver knows. Both patterns are named
|
|
68
|
+
// Whether or not the answer that emits them was chosen: a pattern matching nothing costs nothing.
|
|
69
|
+
files: context.sourceFiles,
|
|
70
|
+
rules: {
|
|
71
|
+
'import-x/no-unresolved': ['error', { ignore: ['^data-url:', String.raw`tailwind\.generated\.css$`] }]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
// Files whose default export is dictated from outside, the way the shared config already exempts
|
|
76
|
+
// The root configs and `src/main.ts`. An ambient `declare module` describes how a `.wasm`, a CSS
|
|
77
|
+
// Module or a single-file component is imported, and each of those IS a default import. The two
|
|
78
|
+
// Stubs stand in for such modules in the unit runners, and typesafe-i18n's generator reads each
|
|
79
|
+
// Locale's default export.
|
|
80
|
+
files: [
|
|
81
|
+
'**/*.d.ts',
|
|
82
|
+
'scripts/*-stub.ts',
|
|
83
|
+
'src/i18n/*/index.ts'
|
|
84
|
+
],
|
|
85
|
+
rules: {
|
|
86
|
+
'import-x/no-default-export': 'off'
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
// Every rollup plugin is imported as `<name>Module` on purpose: its types describe the CommonJS
|
|
91
|
+
// Shape, so `asPluginFactory` unwraps the import and the unwrapped binding takes the plugin's own
|
|
92
|
+
// Name. Which plugins are imported depends on the answers, so an inline directive per import would
|
|
93
|
+
// Have to be composed per answer. Named whether or not rollup was chosen, like the patterns above.
|
|
94
|
+
files: ['scripts/rollup.config.ts'],
|
|
95
|
+
rules: {
|
|
96
|
+
'import-x/no-rename-default': 'off'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
editContext(context) {
|
|
102
|
+
// The shared config's root-config list is the three a plugin built on `obsidian-dev-utils` always has
|
|
103
|
+
// (`commitlint.config.ts`, `eslint.config.mts`, `vitest.config.ts`). This project may also have a root
|
|
104
|
+
// Wrapper for another runner, and a root `*.ts` that ESLint reaches but no config object matches is a
|
|
105
|
+
// File linted with nothing. Named unconditionally: a glob matching no emitted file costs nothing, and
|
|
106
|
+
// `tsconfig.json` includes `./*.ts` whichever of them was written.
|
|
107
|
+
context.rootConfigFiles.push(
|
|
108
|
+
'jest.config.ts',
|
|
109
|
+
'vite.config.ts',
|
|
110
|
+
'webpack.config.ts'
|
|
111
|
+
);<%- render('extra-files') %>
|
|
112
|
+
}
|
|
113
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// Typed rules need every file ESLint reaches to be in the tsconfig `include`, so this list and the
|
|
4
|
+
// Emitted `tsconfig.json`'s `include` have to agree. `e2e/` reaches both through the same `has-e2e`
|
|
5
|
+
// Partial, and only when an end-to-end runner was chosen. It goes in `testFiles` rather than
|
|
6
|
+
// `sourceFiles`, because an end-to-end spec is a test and wants the same relaxations one gets.
|
|
7
|
+
context.testFiles.push('e2e/**/*.ts');
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import {
|
|
4
|
+
CliTaskResult,
|
|
5
|
+
wrapCliTask
|
|
6
|
+
} from 'obsidian-dev-utils/script-utils/cli-utils';
|
|
7
|
+
import {
|
|
8
|
+
findOverExposure,
|
|
9
|
+
formatOverExposureFindings
|
|
10
|
+
} from 'obsidian-dev-utils/script-utils/linters/over-exposure';
|
|
11
|
+
|
|
12
|
+
const [, , ...$arguments] = process.argv;
|
|
13
|
+
|
|
14
|
+
const { values } = parseArgs({
|
|
15
|
+
// eslint-disable-next-line unicorn/name-replacements -- `args` is `node:util`'s own option name.
|
|
16
|
+
args: $arguments,
|
|
17
|
+
options: {
|
|
18
|
+
force: { type: 'boolean' }
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
await wrapCliTask(() => {
|
|
23
|
+
const findings = findOverExposure({ projectFolder: process.cwd(), shouldFix: true, shouldForce: values.force ?? false });
|
|
24
|
+
process.stdout.write(formatOverExposureFindings(findings, { baseFolder: process.cwd() }));
|
|
25
|
+
return CliTaskResult.Success(findings.every((finding) => finding.wasFixed));
|
|
26
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import {
|
|
3
|
+
CliTaskResult,
|
|
4
|
+
wrapCliTask
|
|
5
|
+
} from 'obsidian-dev-utils/script-utils/cli-utils';
|
|
6
|
+
import {
|
|
7
|
+
findOverExposure,
|
|
8
|
+
formatOverExposureFindings
|
|
9
|
+
} from 'obsidian-dev-utils/script-utils/linters/over-exposure';
|
|
10
|
+
|
|
11
|
+
await wrapCliTask(() => {
|
|
12
|
+
const findings = findOverExposure({ projectFolder: process.cwd() });
|
|
13
|
+
process.stdout.write(formatOverExposureFindings(findings, { baseFolder: process.cwd() }));
|
|
14
|
+
return CliTaskResult.Success(findings.length === 0);
|
|
15
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<%# Formatting is keyed on the TOOL first, unlike every other template here, which splits on the -%>
|
|
2
|
+
<%# preset. What `npm run format:check` runs is decided by the formatter answer; only dprint has a -%>
|
|
3
|
+
<%# preset-specific runner, so it splits again underneath. -%>
|
|
4
|
+
<%- render('tool') -%>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
|
|
3
|
+
import { format } from 'obsidian-dev-utils/script-utils/formatters/dprint';
|
|
4
|
+
|
|
5
|
+
const [, , ...paths] = process.argv;
|
|
6
|
+
|
|
7
|
+
await wrapCliTask(() => format({ paths, rewrite: false }));
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<%# Formatting is keyed on the TOOL first, unlike every other template here, which splits on the -%>
|
|
2
|
+
<%# preset. What `npm run format` runs is decided by the formatter answer; only dprint has a -%>
|
|
3
|
+
<%# preset-specific runner, so it splits again underneath. -%>
|
|
4
|
+
<%- render('tool') -%>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
|
|
3
|
+
import { format } from 'obsidian-dev-utils/script-utils/formatters/dprint';
|
|
4
|
+
|
|
5
|
+
const [, , ...paths] = process.argv;
|
|
6
|
+
|
|
7
|
+
await wrapCliTask(() => format({ paths }));
|