@ykdz/template 0.0.23 → 0.0.25
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/dist/cli.js +4 -575
- package/dist/main.d.ts +1 -0
- package/dist/main.js +370 -0
- package/node_modules/@typescript/old/LICENSE.txt +55 -0
- package/node_modules/@typescript/old/README.md +50 -0
- package/node_modules/@typescript/old/SECURITY.md +39 -0
- package/node_modules/@typescript/old/ThirdPartyNoticeText.txt +193 -0
- package/node_modules/@typescript/old/bin/tsc +2 -0
- package/node_modules/@typescript/old/bin/tsserver +2 -0
- package/node_modules/@typescript/old/lib/_tsc.js +134465 -0
- package/node_modules/@typescript/old/lib/_tsserver.js +659 -0
- package/node_modules/@typescript/old/lib/_typingsInstaller.js +222 -0
- package/node_modules/@typescript/old/lib/cs/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/de/diagnosticMessages.generated.json +2125 -0
- package/node_modules/@typescript/old/lib/es/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/fr/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/it/diagnosticMessages.generated.json +2125 -0
- package/node_modules/@typescript/old/lib/ja/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/ko/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/lib.d.ts +20 -0
- package/node_modules/@typescript/old/lib/lib.decorators.d.ts +382 -0
- package/node_modules/@typescript/old/lib/lib.decorators.legacy.d.ts +20 -0
- package/node_modules/@typescript/old/lib/lib.dom.asynciterable.d.ts +18 -0
- package/node_modules/@typescript/old/lib/lib.dom.d.ts +45125 -0
- package/node_modules/@typescript/old/lib/lib.dom.iterable.d.ts +18 -0
- package/node_modules/@typescript/old/lib/lib.es2015.collection.d.ts +150 -0
- package/node_modules/@typescript/old/lib/lib.es2015.core.d.ts +595 -0
- package/node_modules/@typescript/old/lib/lib.es2015.d.ts +26 -0
- package/node_modules/@typescript/old/lib/lib.es2015.generator.d.ts +75 -0
- package/node_modules/@typescript/old/lib/lib.es2015.iterable.d.ts +603 -0
- package/node_modules/@typescript/old/lib/lib.es2015.promise.d.ts +79 -0
- package/node_modules/@typescript/old/lib/lib.es2015.proxy.d.ts +126 -0
- package/node_modules/@typescript/old/lib/lib.es2015.reflect.d.ts +142 -0
- package/node_modules/@typescript/old/lib/lib.es2015.symbol.d.ts +44 -0
- package/node_modules/@typescript/old/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
- package/node_modules/@typescript/old/lib/lib.es2016.array.include.d.ts +114 -0
- package/node_modules/@typescript/old/lib/lib.es2016.d.ts +19 -0
- package/node_modules/@typescript/old/lib/lib.es2016.full.d.ts +21 -0
- package/node_modules/@typescript/old/lib/lib.es2016.intl.d.ts +29 -0
- package/node_modules/@typescript/old/lib/lib.es2017.arraybuffer.d.ts +19 -0
- package/node_modules/@typescript/old/lib/lib.es2017.d.ts +24 -0
- package/node_modules/@typescript/old/lib/lib.es2017.date.d.ts +29 -0
- package/node_modules/@typescript/old/lib/lib.es2017.full.d.ts +21 -0
- package/node_modules/@typescript/old/lib/lib.es2017.intl.d.ts +42 -0
- package/node_modules/@typescript/old/lib/lib.es2017.object.d.ts +47 -0
- package/node_modules/@typescript/old/lib/lib.es2017.sharedmemory.d.ts +133 -0
- package/node_modules/@typescript/old/lib/lib.es2017.string.d.ts +43 -0
- package/node_modules/@typescript/old/lib/lib.es2017.typedarrays.d.ts +51 -0
- package/node_modules/@typescript/old/lib/lib.es2018.asyncgenerator.d.ts +75 -0
- package/node_modules/@typescript/old/lib/lib.es2018.asynciterable.d.ts +51 -0
- package/node_modules/@typescript/old/lib/lib.es2018.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2018.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2018.intl.d.ts +81 -0
- package/node_modules/@typescript/old/lib/lib.es2018.promise.d.ts +28 -0
- package/node_modules/@typescript/old/lib/lib.es2018.regexp.d.ts +35 -0
- package/node_modules/@typescript/old/lib/lib.es2019.array.d.ts +77 -0
- package/node_modules/@typescript/old/lib/lib.es2019.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2019.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2019.intl.d.ts +21 -0
- package/node_modules/@typescript/old/lib/lib.es2019.object.d.ts +31 -0
- package/node_modules/@typescript/old/lib/lib.es2019.string.d.ts +35 -0
- package/node_modules/@typescript/old/lib/lib.es2019.symbol.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2020.bigint.d.ts +763 -0
- package/node_modules/@typescript/old/lib/lib.es2020.d.ts +25 -0
- package/node_modules/@typescript/old/lib/lib.es2020.date.d.ts +40 -0
- package/node_modules/@typescript/old/lib/lib.es2020.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2020.intl.d.ts +472 -0
- package/node_modules/@typescript/old/lib/lib.es2020.number.d.ts +26 -0
- package/node_modules/@typescript/old/lib/lib.es2020.promise.d.ts +45 -0
- package/node_modules/@typescript/old/lib/lib.es2020.sharedmemory.d.ts +97 -0
- package/node_modules/@typescript/old/lib/lib.es2020.string.d.ts +42 -0
- package/node_modules/@typescript/old/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
- package/node_modules/@typescript/old/lib/lib.es2021.d.ts +21 -0
- package/node_modules/@typescript/old/lib/lib.es2021.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2021.intl.d.ts +164 -0
- package/node_modules/@typescript/old/lib/lib.es2021.promise.d.ts +46 -0
- package/node_modules/@typescript/old/lib/lib.es2021.string.d.ts +31 -0
- package/node_modules/@typescript/old/lib/lib.es2021.weakref.d.ts +76 -0
- package/node_modules/@typescript/old/lib/lib.es2022.array.d.ts +119 -0
- package/node_modules/@typescript/old/lib/lib.es2022.d.ts +23 -0
- package/node_modules/@typescript/old/lib/lib.es2022.error.d.ts +73 -0
- package/node_modules/@typescript/old/lib/lib.es2022.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2022.intl.d.ts +143 -0
- package/node_modules/@typescript/old/lib/lib.es2022.object.d.ts +24 -0
- package/node_modules/@typescript/old/lib/lib.es2022.regexp.d.ts +37 -0
- package/node_modules/@typescript/old/lib/lib.es2022.string.d.ts +23 -0
- package/node_modules/@typescript/old/lib/lib.es2023.array.d.ts +922 -0
- package/node_modules/@typescript/old/lib/lib.es2023.collection.d.ts +19 -0
- package/node_modules/@typescript/old/lib/lib.es2023.d.ts +20 -0
- package/node_modules/@typescript/old/lib/lib.es2023.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2023.intl.d.ts +62 -0
- package/node_modules/@typescript/old/lib/lib.es2024.arraybuffer.d.ts +63 -0
- package/node_modules/@typescript/old/lib/lib.es2024.collection.d.ts +27 -0
- package/node_modules/@typescript/old/lib/lib.es2024.d.ts +24 -0
- package/node_modules/@typescript/old/lib/lib.es2024.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2024.object.d.ts +27 -0
- package/node_modules/@typescript/old/lib/lib.es2024.promise.d.ts +33 -0
- package/node_modules/@typescript/old/lib/lib.es2024.regexp.d.ts +23 -0
- package/node_modules/@typescript/old/lib/lib.es2024.sharedmemory.d.ts +66 -0
- package/node_modules/@typescript/old/lib/lib.es2024.string.d.ts +27 -0
- package/node_modules/@typescript/old/lib/lib.es2025.collection.d.ts +94 -0
- package/node_modules/@typescript/old/lib/lib.es2025.d.ts +23 -0
- package/node_modules/@typescript/old/lib/lib.es2025.float16.d.ts +443 -0
- package/node_modules/@typescript/old/lib/lib.es2025.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.es2025.intl.d.ts +200 -0
- package/node_modules/@typescript/old/lib/lib.es2025.iterator.d.ts +146 -0
- package/node_modules/@typescript/old/lib/lib.es2025.promise.d.ts +32 -0
- package/node_modules/@typescript/old/lib/lib.es2025.regexp.d.ts +30 -0
- package/node_modules/@typescript/old/lib/lib.es5.d.ts +4599 -0
- package/node_modules/@typescript/old/lib/lib.es6.d.ts +21 -0
- package/node_modules/@typescript/old/lib/lib.esnext.array.d.ts +33 -0
- package/node_modules/@typescript/old/lib/lib.esnext.collection.d.ts +47 -0
- package/node_modules/@typescript/old/lib/lib.esnext.d.ts +27 -0
- package/node_modules/@typescript/old/lib/lib.esnext.date.d.ts +21 -0
- package/node_modules/@typescript/old/lib/lib.esnext.decorators.d.ts +26 -0
- package/node_modules/@typescript/old/lib/lib.esnext.disposable.d.ts +191 -0
- package/node_modules/@typescript/old/lib/lib.esnext.error.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.esnext.full.d.ts +22 -0
- package/node_modules/@typescript/old/lib/lib.esnext.intl.d.ts +107 -0
- package/node_modules/@typescript/old/lib/lib.esnext.sharedmemory.d.ts +23 -0
- package/node_modules/@typescript/old/lib/lib.esnext.temporal.d.ts +485 -0
- package/node_modules/@typescript/old/lib/lib.esnext.typedarrays.d.ts +90 -0
- package/node_modules/@typescript/old/lib/lib.scripthost.d.ts +320 -0
- package/node_modules/@typescript/old/lib/lib.webworker.asynciterable.d.ts +18 -0
- package/node_modules/@typescript/old/lib/lib.webworker.d.ts +15606 -0
- package/node_modules/@typescript/old/lib/lib.webworker.importscripts.d.ts +21 -0
- package/node_modules/@typescript/old/lib/lib.webworker.iterable.d.ts +18 -0
- package/node_modules/@typescript/old/lib/pl/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/pt-br/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/ru/diagnosticMessages.generated.json +2125 -0
- package/node_modules/@typescript/old/lib/tr/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/tsc.js +8 -0
- package/node_modules/@typescript/old/lib/tsserver.js +8 -0
- package/node_modules/@typescript/old/lib/tsserverlibrary.d.ts +17 -0
- package/node_modules/@typescript/old/lib/tsserverlibrary.js +21 -0
- package/node_modules/@typescript/old/lib/typesMap.json +497 -0
- package/node_modules/@typescript/old/lib/typescript.d.ts +11448 -0
- package/node_modules/@typescript/old/lib/typescript.js +201039 -0
- package/node_modules/@typescript/old/lib/typingsInstaller.js +8 -0
- package/node_modules/@typescript/old/lib/watchGuard.js +53 -0
- package/node_modules/@typescript/old/lib/zh-cn/diagnosticMessages.generated.json +2129 -0
- package/node_modules/@typescript/old/lib/zh-tw/diagnosticMessages.generated.json +2125 -0
- package/node_modules/@typescript/old/package.json +118 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +83 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +804 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +3 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +2 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.d.ts +2 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.js +114 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +33 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +88 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/template-sources.d.ts +14 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/template-sources.js +26 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.d.ts +2 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.js +114 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.d.ts +2 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +382 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.d.ts +2 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.js +92 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.d.ts +2 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.js +162 -0
- package/node_modules/@ykdz/template-builtin-presets/package.json +68 -0
- package/node_modules/@ykdz/{template-builtin-source/templates/vue-app/.github/dependabot.yml → template-builtin-presets/templates/foundation/.github/dependabot-rust.yml} +13 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/dependabot.dynamic.template +4 -0
- package/node_modules/@ykdz/{template-builtin-source/templates/ts-lib → template-builtin-presets/templates/foundation}/.github/dependabot.yml +5 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check.dynamic.template +19 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/TODO.md.template +5 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/devcontainer.json +16 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/gitignore +8 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.dynamic.txt +19 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.yaml +28 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/rust/.vscode/extensions.json +3 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/rust/.vscode/settings.json +5 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/rust/devcontainer/devcontainer.json +21 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/check-boundaries.ts +12 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/run-root-owned-task.ts +69 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.json +9 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/turbo.json +25 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/.github/dependabot.yml +5 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.github/workflows/check.yml +23 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.vscode/extensions.json +3 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.vscode/settings.json +5 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.lock +16 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.toml +27 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/devcontainer/devcontainer.json +21 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/devcontainer/rust.Dockerfile +16 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/rust-toolchain.toml +3 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/node-pnpm.Dockerfile +12 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/shellcheck.Dockerfile +3 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/editor-customization/capabilities.json +38 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/oxc/node/oxlint.config.ts +6 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/oxc/oxfmt.config.ts +3 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/shared/oxc/tsconfig.config.json +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.app.json +25 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.json +8 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.node.json +30 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/tsconfig.test.json +9 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/vue/typescript/run-vue-tsc.ts +12 -0
- package/node_modules/@ykdz/{template-builtin-source/templates/vue-hono-app → template-builtin-presets/templates/ts-lib}/.github/dependabot.yml +5 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/.github/workflows/check.yml +19 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/ts-lib/src/index.ts +1 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/tsconfig.json +13 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/readiness.ts +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/src/types.d.ts +1 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/tsconfig.json +26 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/turbo.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/drizzle.config.ts +17 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/scripts/prepare-database.ts +45 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/tsconfig.json +22 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/turbo.json +10 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/Dockerfile +20 -30
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/index/+Page.telefunc.ts +0 -2
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/index/+Page.vue +2 -1
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/playwright.config.ts +1 -1
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/scripts/check-standalone-deployment.ts +84 -22
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/container-entrypoint.sh +33 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/test/e2e/app.spec.ts +3 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.app.json +34 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.json +9 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.node.json +31 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.test.json +11 -0
- package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/vike-app/web}/turbo.json +3 -2
- package/node_modules/@ykdz/{template-builtin-source/templates/vike-app → template-builtin-presets/templates/vue-app}/.github/dependabot.yml +5 -4
- package/node_modules/@ykdz/{template-builtin-source/templates/vue-hono-app/web → template-builtin-presets/templates/vue-app}/turbo.json +4 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/typescript/tsconfig.json +8 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/src/index.ts +3 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/src/server.ts +1 -1
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/test/app.test.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/tsconfig.build.json +9 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/tsconfig.json +25 -0
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/turbo.json +1 -1
- package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/playwright.config.ts +1 -1
- package/node_modules/@ykdz/{template-builtin-source/templates/vike-app → template-builtin-presets/templates/vue-hono-app}/web/turbo.json +2 -2
- package/node_modules/@ykdz/template-core/dist/Cargo.toml +1 -1
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +8 -0
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +48 -12
- package/node_modules/@ykdz/template-core/dist/devcontainer.d.ts +11 -3
- package/node_modules/@ykdz/template-core/dist/devcontainer.js +17 -3
- package/node_modules/@ykdz/template-core/dist/editor-customization.d.ts +5 -9
- package/node_modules/@ykdz/template-core/dist/editor-customization.js +8 -46
- package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +64 -33
- package/node_modules/@ykdz/template-core/dist/module-graph.js +117 -135
- package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +41 -0
- package/node_modules/@ykdz/template-core/dist/package-contribution.js +24 -0
- package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +22 -8
- package/node_modules/@ykdz/template-core/dist/preset-definition.d.ts +42 -0
- package/node_modules/@ykdz/template-core/dist/preset-definition.js +1 -0
- package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.d.ts +33 -0
- package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.js +161 -0
- package/node_modules/@ykdz/template-core/dist/project-github.d.ts +17 -2
- package/node_modules/@ykdz/template-core/dist/project-github.js +87 -14
- package/node_modules/@ykdz/template-core/dist/project-linking-v2.d.ts +20 -0
- package/node_modules/@ykdz/template-core/dist/project-linking-v2.js +37 -0
- package/node_modules/@ykdz/template-core/dist/renderer.d.ts +40 -5
- package/node_modules/@ykdz/template-core/dist/renderer.js +115 -30
- package/node_modules/@ykdz/template-core/dist/template-boundary-check.d.ts +21 -15
- package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +100 -50
- package/node_modules/@ykdz/template-core/dist/toolchain-baseline-update.d.ts +45 -0
- package/node_modules/@ykdz/template-core/dist/toolchain-baseline-update.js +27 -0
- package/node_modules/@ykdz/template-core/dist/toolchain-resolution.d.ts +1 -0
- package/node_modules/@ykdz/template-core/dist/toolchain-resolution.js +50 -52
- package/node_modules/@ykdz/template-core/package.json +10 -8
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/typescript/LICENSE.txt +55 -0
- package/node_modules/typescript/README.md +9 -0
- package/node_modules/typescript/bin/tsc6 +2 -0
- package/node_modules/typescript/lib/tsc.js +1 -0
- package/node_modules/typescript/lib/tsserverlibrary.d.ts +2 -0
- package/node_modules/typescript/lib/tsserverlibrary.js +1 -0
- package/node_modules/typescript/lib/typescript.d.ts +2 -0
- package/node_modules/typescript/lib/typescript.js +1 -0
- package/node_modules/typescript/package.json +39 -0
- package/node_modules/valibot/LICENSE.md +9 -0
- package/node_modules/valibot/README.md +94 -0
- package/node_modules/valibot/dist/index.cjs +7974 -0
- package/node_modules/valibot/dist/index.d.cts +16184 -0
- package/node_modules/valibot/dist/index.d.mts +16184 -0
- package/node_modules/valibot/dist/index.min.cjs +2 -0
- package/node_modules/valibot/dist/index.min.mjs +2 -0
- package/node_modules/valibot/dist/index.mjs +7663 -0
- package/node_modules/valibot/package.json +79 -0
- package/package.json +18 -12
- package/LICENSE +0 -21
- package/node_modules/@ykdz/template-builtin-source/dist/src/index.d.ts +0 -22
- package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +0 -103
- package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.d.ts +0 -7
- package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +0 -98
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.d.ts +0 -2
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +0 -15
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.d.ts +0 -9
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +0 -105
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.d.ts +0 -6
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +0 -197
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.d.ts +0 -5
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +0 -71
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.d.ts +0 -6
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +0 -281
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.d.ts +0 -8
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +0 -154
- package/node_modules/@ykdz/template-builtin-source/package.json +0 -93
- package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +0 -524
- package/node_modules/@ykdz/template-builtin-source/templates/shared/devcontainer/node-pnpm.Dockerfile +0 -6
- package/node_modules/@ykdz/template-builtin-source/templates/shared/editor-customization/capabilities.json +0 -56
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/node/oxlint.config.ts +0 -34
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/oxfmt.config.ts +0 -8
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/vue/oxlint.config.ts +0 -36
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml +0 -22
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/db/drizzle.config.ts +0 -10
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/scripts/container-entrypoint.sh +0 -52
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/scripts/prepare-database.sh +0 -6
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/src/index.ts +0 -3
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/main.ts +0 -8
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/stores/counter.ts +0 -12
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/style.css +0 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/test/app.test.ts +0 -14
- package/node_modules/@ykdz/template-core/dist/declarations.d.ts +0 -2
- package/node_modules/@ykdz/template-core/dist/declarations.js +0 -1
- package/node_modules/@ykdz/template-core/dist/generated-scenarios.d.ts +0 -76
- package/node_modules/@ykdz/template-core/dist/generated-scenarios.js +0 -658
- package/node_modules/@ykdz/template-core/dist/generation-context.d.ts +0 -23
- package/node_modules/@ykdz/template-core/dist/generation-context.js +0 -20
- package/node_modules/@ykdz/template-core/dist/next-step-instructions.d.ts +0 -30
- package/node_modules/@ykdz/template-core/dist/next-step-instructions.js +0 -181
- package/node_modules/@ykdz/template-core/dist/package-addition-support.d.ts +0 -6
- package/node_modules/@ykdz/template-core/dist/package-addition-support.js +0 -2
- package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +0 -12
- package/node_modules/@ykdz/template-core/dist/package-addition.js +0 -665
- package/node_modules/@ykdz/template-core/dist/package-linking.d.ts +0 -75
- package/node_modules/@ykdz/template-core/dist/package-linking.js +0 -157
- package/node_modules/@ykdz/template-core/dist/preset-projection.d.ts +0 -68
- package/node_modules/@ykdz/template-core/dist/preset-projection.js +0 -8
- package/node_modules/@ykdz/template-core/dist/preset-source.d.ts +0 -14
- package/node_modules/@ykdz/template-core/dist/preset-source.js +0 -294
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.d.ts +0 -31
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +0 -2170
- package/node_modules/@ykdz/template-core/dist/runtime-paths.d.ts +0 -1
- package/node_modules/@ykdz/template-core/dist/runtime-paths.js +0 -13
- package/node_modules/@ykdz/template-shared/dist/index.d.ts +0 -645
- package/node_modules/@ykdz/template-shared/dist/index.js +0 -1408
- package/node_modules/@ykdz/template-shared/package.json +0 -37
- /package/node_modules/@ykdz/{template-builtin-source/templates/vue-app/.github/workflows/check.yml → template-builtin-presets/templates/foundation/.github/workflows/check-playwright.yml} +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/rust-bin/.github/workflows/check.yml → template-builtin-presets/templates/foundation/.github/workflows/check-rust.yml} +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/ts-lib → template-builtin-presets/templates/foundation}/.github/workflows/check.yml +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/shared → template-builtin-presets/templates/foundation/rust}/devcontainer/rust.Dockerfile +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/rust-bin → template-builtin-presets/templates/foundation/rust}/rust-toolchain.toml +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/rustfmt.toml +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/src/main.rs +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/rust-bin/turbo.json +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/shared/devcontainer/browser-test.Dockerfile +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/src/main.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/src/stores/counter.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/src/style.css +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/vue-app → template-builtin-presets/templates/shared/vue}/test/app.test.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/ts-lib/src/name-schema.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/ts-lib/turbo.json +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/scripts/seed-example.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/db.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/index.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/queries/todos.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/schema.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/src/seed/example.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/db/test/todos.test.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/vike-app/db → template-builtin-presets/templates/vike-app/db-migrations}/drizzle/migrations/20260709120325_old_captain_flint/migration.sql +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/vike-app/db → template-builtin-presets/templates/vike-app/db-migrations}/drizzle/migrations/20260709120325_old_captain_flint/snapshot.json +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/+server.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/.env.example +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/Dockerfile.dockerignore +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/assets/logo.svg +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/components/CounterButton.vue +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/components/PageShell.vue +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/+Head.vue +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/+Layout.vue +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/+config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/pages/tailwind.css +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/scripts/run-playwright.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/server/api.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/server/app.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/types/env.d.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/types/global.d.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/vite.config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vike-app/web/vitest.config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source/templates/vue-hono-app → template-builtin-presets/templates/vue-app}/.github/workflows/check.yml +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/env.d.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/index.html +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/playwright.config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/scripts/run-playwright.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/src/App.vue +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/test/e2e/app.spec.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/vite.config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-app/vitest.config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/src/runtime.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/api/vitest.config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/env.d.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/index.html +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/scripts/run-playwright.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/src/App.vue +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/src/api.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/test/e2e/app.spec.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/vite.config.ts +0 -0
- /package/node_modules/@ykdz/{template-builtin-source → template-builtin-presets}/templates/vue-hono-app/web/vitest.config.ts +0 -0
|
@@ -1,2170 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validatePresetProjectionDeclaration as validateProjectionCapabilities, } from "@ykdz/template-shared";
|
|
4
|
-
import { collectGeneratedManifestCatalogDependencies, collectGeneratedManifestCatalogReferences, renderCargoLockForPackage, renderGeneratedPnpmWorkspaceYaml, renderCargoDependencyTomlEntries, } from "./dependency-catalog.js";
|
|
5
|
-
import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, dockerfileFirstRustPnpmDevcontainer, nodePnpmToolLayer, rustToolLayer, } from "./devcontainer.js";
|
|
6
|
-
import { editorCustomizationForCapabilities, loadEditorCustomizationDeclarations, } from "./editor-customization.js";
|
|
7
|
-
import { playwrightBrowserAssetsEnvironmentNeed, renderDeploymentCheckCommand, renderCheckLeafCommand, renderFixCommand, renderFixLeafCommand, renderRootCheckCommand, renderTurboRunCommand, } from "./module-graph.js";
|
|
8
|
-
import { packageManifestExposureFields, packageTurboConfig, planPackageLinks, } from "./package-linking.js";
|
|
9
|
-
export { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validateProjectionCapabilities, };
|
|
10
|
-
const strictTypescriptRootBoundary = {
|
|
11
|
-
kind: "workspace-orchestration",
|
|
12
|
-
path: ".",
|
|
13
|
-
};
|
|
14
|
-
const workspacePackageBoundary = {
|
|
15
|
-
kind: "package-boundary",
|
|
16
|
-
path: ".",
|
|
17
|
-
};
|
|
18
|
-
const requiredPlanCapabilityProviders = [
|
|
19
|
-
{
|
|
20
|
-
flag: "rootCheck",
|
|
21
|
-
kind: "strict-typescript-root",
|
|
22
|
-
label: "root check command",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
flag: "fixCommand",
|
|
26
|
-
kind: "oxc-format-lint",
|
|
27
|
-
label: "fix command",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
flag: "githubActions",
|
|
31
|
-
kind: "github-maintenance",
|
|
32
|
-
label: "GitHub Actions maintenance",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
flag: "dependabot",
|
|
36
|
-
kind: "github-maintenance",
|
|
37
|
-
label: "Dependabot maintenance",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
flag: "devcontainer",
|
|
41
|
-
kind: "node-pnpm-devcontainer",
|
|
42
|
-
label: "development container support",
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
const dependencyMaintenanceEcosystems = ["npm", "github-actions", "docker"];
|
|
46
|
-
function strictTypeScriptCompilerOptions(options) {
|
|
47
|
-
return {
|
|
48
|
-
...options,
|
|
49
|
-
erasableSyntaxOnly: true,
|
|
50
|
-
exactOptionalPropertyTypes: true,
|
|
51
|
-
forceConsistentCasingInFileNames: true,
|
|
52
|
-
isolatedModules: true,
|
|
53
|
-
noEmitOnError: true,
|
|
54
|
-
noFallthroughCasesInSwitch: true,
|
|
55
|
-
noImplicitOverride: true,
|
|
56
|
-
noImplicitReturns: true,
|
|
57
|
-
noUncheckedIndexedAccess: true,
|
|
58
|
-
skipLibCheck: false,
|
|
59
|
-
strict: true,
|
|
60
|
-
target: "es2023",
|
|
61
|
-
verbatimModuleSyntax: true,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
const capabilityInterpreters = {
|
|
65
|
-
"workspace-library-package": {
|
|
66
|
-
kind: "workspace-library-package",
|
|
67
|
-
contribute({ capability, state }) {
|
|
68
|
-
state.package = capability;
|
|
69
|
-
state.sourceRoot = templateSourceRoot(state, capability.packageSourcePreset);
|
|
70
|
-
state.packageDependencies.add("valibot");
|
|
71
|
-
state.operationFactories.push(workspaceLibraryPackageOperations);
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
"workspace-node-packages": {
|
|
75
|
-
kind: "workspace-node-packages",
|
|
76
|
-
contribute({ capability, state }) {
|
|
77
|
-
state.nodeWorkspace = capability;
|
|
78
|
-
state.sourceRoot = templateSourceRootForPreset(state, sourceRootPreset(capability));
|
|
79
|
-
state.operationFactories.push(workspaceNodePackagesOperations);
|
|
80
|
-
if (hasVikePackage(capability)) {
|
|
81
|
-
state.dependencyMaintenanceExtraDirectories.docker = ["/apps/web"];
|
|
82
|
-
state.deploymentCheckComponents.push({
|
|
83
|
-
kind: "deployment-image",
|
|
84
|
-
owner: { kind: "package-boundary", path: "apps/web" },
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
if (capability.packages.length > 1) {
|
|
88
|
-
state.rootScriptFragments.dev = "turbo run dev --parallel";
|
|
89
|
-
}
|
|
90
|
-
const vuePackage = findVuePackage(capability);
|
|
91
|
-
if (vuePackage !== undefined) {
|
|
92
|
-
state.rootCheckEnvironmentNeeds.push(playwrightBrowserAssetsEnvironmentNeed({
|
|
93
|
-
browser: "chromium",
|
|
94
|
-
owner: { kind: "package-boundary", path: vuePackage.path },
|
|
95
|
-
}));
|
|
96
|
-
state.editorCustomizationCapabilities.push("vue", "tailwind");
|
|
97
|
-
}
|
|
98
|
-
state.editorCustomizationCapabilities.push("vitest");
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
"rust-binary-workspace": {
|
|
102
|
-
kind: "rust-binary-workspace",
|
|
103
|
-
contribute({ capability, state }) {
|
|
104
|
-
state.rustWorkspace = capability;
|
|
105
|
-
state.sourceRoot = templateSourceRootForPreset(state, "rust-bin");
|
|
106
|
-
setDevelopmentContainerResource(state, capability.devcontainerResourceId, "rust-binary-workspace");
|
|
107
|
-
setEditorCustomizationResource(state, capability.editorCustomizationResourceId, "rust-binary-workspace");
|
|
108
|
-
state.rootCheckComponents.push({
|
|
109
|
-
kind: "turbo-package-check",
|
|
110
|
-
owner: workspaceGlobBoundary(capability.workspacePackageGlob),
|
|
111
|
-
});
|
|
112
|
-
state.rootFixComponents.push({
|
|
113
|
-
kind: "turbo-package-fix",
|
|
114
|
-
owner: workspaceGlobBoundary(capability.workspacePackageGlob),
|
|
115
|
-
});
|
|
116
|
-
state.packageCheckComponents.push({ kind: "rustfmt-check", owner: workspacePackageBoundary }, { kind: "cargo-clippy", owner: workspacePackageBoundary }, { kind: "cargo-test", owner: workspacePackageBoundary });
|
|
117
|
-
state.packageFixComponents.push({
|
|
118
|
-
kind: "rustfmt-write",
|
|
119
|
-
owner: workspacePackageBoundary,
|
|
120
|
-
});
|
|
121
|
-
state.dependencyMaintenanceEcosystems.push("npm", "cargo", "github-actions", "docker", "rust-toolchain");
|
|
122
|
-
state.editorCustomizationCapabilities.push("rust-tooling");
|
|
123
|
-
state.flags.rootCheck = true;
|
|
124
|
-
state.flags.fixCommand = true;
|
|
125
|
-
state.flags.githubActions = true;
|
|
126
|
-
state.flags.dependabot = true;
|
|
127
|
-
state.flags.devcontainer = true;
|
|
128
|
-
state.operationFactories.push(rustBinaryWorkspaceOperations);
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
"strict-typescript-root": {
|
|
132
|
-
kind: "strict-typescript-root",
|
|
133
|
-
contribute({ state }) {
|
|
134
|
-
state.rootCheckComponents.push({
|
|
135
|
-
kind: "typescript-typecheck",
|
|
136
|
-
owner: strictTypescriptRootBoundary,
|
|
137
|
-
});
|
|
138
|
-
const workspaceBoundary = workspaceBoundaryForState(state);
|
|
139
|
-
state.rootCheckComponents.push({
|
|
140
|
-
kind: "turbo-package-check",
|
|
141
|
-
owner: workspaceBoundary,
|
|
142
|
-
});
|
|
143
|
-
state.packageCheckComponents.push({
|
|
144
|
-
kind: "typescript-typecheck",
|
|
145
|
-
owner: workspacePackageBoundary,
|
|
146
|
-
});
|
|
147
|
-
state.rootScriptFragments.typecheck =
|
|
148
|
-
"tsc -p tsconfig.config.json --noEmit --pretty false";
|
|
149
|
-
state.packageScriptFragments.typecheck =
|
|
150
|
-
"tsc -p tsconfig.json --noEmit --pretty false";
|
|
151
|
-
state.rootDevDependencies.add("typescript");
|
|
152
|
-
state.packageDevDependencies.add("@types/node");
|
|
153
|
-
state.packageDevDependencies.add("typescript");
|
|
154
|
-
state.flags.rootCheck = true;
|
|
155
|
-
state.operationFactories.push(strictTypescriptOperations);
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
"oxc-format-lint": {
|
|
159
|
-
kind: "oxc-format-lint",
|
|
160
|
-
contribute({ capability, state }) {
|
|
161
|
-
state.sourceRoots.sharedOxc = state.projectionSourceRoots.sharedOxc();
|
|
162
|
-
setEditorCustomizationResource(state, capability.editorCustomizationResourceId, "oxc-format-lint");
|
|
163
|
-
state.rootCheckComponents.unshift({
|
|
164
|
-
kind: "oxc-format-check",
|
|
165
|
-
owner: strictTypescriptRootBoundary,
|
|
166
|
-
}, {
|
|
167
|
-
kind: "oxc-lint",
|
|
168
|
-
owner: strictTypescriptRootBoundary,
|
|
169
|
-
});
|
|
170
|
-
state.packageCheckComponents.push({ kind: "oxc-lint", owner: workspacePackageBoundary }, { kind: "oxc-format-check", owner: workspacePackageBoundary });
|
|
171
|
-
state.rootFixComponents.push({
|
|
172
|
-
kind: "oxc-format-write",
|
|
173
|
-
owner: strictTypescriptRootBoundary,
|
|
174
|
-
}, {
|
|
175
|
-
kind: "oxc-lint-fix",
|
|
176
|
-
owner: strictTypescriptRootBoundary,
|
|
177
|
-
}, {
|
|
178
|
-
kind: "turbo-package-fix",
|
|
179
|
-
owner: workspaceBoundaryForState(state),
|
|
180
|
-
});
|
|
181
|
-
state.packageFixComponents.push({ kind: "oxc-format-write", owner: workspacePackageBoundary }, { kind: "oxc-lint-fix", owner: workspacePackageBoundary });
|
|
182
|
-
state.rootScriptFragments["format:check"] =
|
|
183
|
-
"oxfmt --list-different oxlint.config.ts oxfmt.config.ts";
|
|
184
|
-
state.rootScriptFragments["format:write"] =
|
|
185
|
-
"oxfmt --write oxlint.config.ts oxfmt.config.ts";
|
|
186
|
-
state.rootScriptFragments.lint =
|
|
187
|
-
"oxlint --quiet --format=unix oxlint.config.ts oxfmt.config.ts";
|
|
188
|
-
state.rootScriptFragments["lint:fix"] =
|
|
189
|
-
"oxlint --format=unix oxlint.config.ts oxfmt.config.ts --fix";
|
|
190
|
-
state.packageScriptFragments["format:check"] =
|
|
191
|
-
"oxfmt --list-different --config ../../oxfmt.config.ts .";
|
|
192
|
-
state.packageScriptFragments["format:write"] =
|
|
193
|
-
"oxfmt --write --config ../../oxfmt.config.ts .";
|
|
194
|
-
state.packageScriptFragments.lint =
|
|
195
|
-
"oxlint --quiet --format=unix --config ../../oxlint.config.ts .";
|
|
196
|
-
state.packageScriptFragments["lint:fix"] =
|
|
197
|
-
"oxlint --format=unix --config ../../oxlint.config.ts . --fix";
|
|
198
|
-
state.rootDevDependencies.add("oxfmt");
|
|
199
|
-
state.rootDevDependencies.add("oxlint");
|
|
200
|
-
state.rootDevDependencies.add("oxlint-tsgolint");
|
|
201
|
-
state.packageDevDependencies.add("oxfmt");
|
|
202
|
-
state.packageDevDependencies.add("oxlint");
|
|
203
|
-
state.packageDevDependencies.add("oxlint-tsgolint");
|
|
204
|
-
state.editorCustomizationCapabilities.push("oxc-format-lint");
|
|
205
|
-
state.flags.fixCommand = true;
|
|
206
|
-
state.operationFactories.push(oxcFormatLintOperations);
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
"node-pnpm-devcontainer": {
|
|
210
|
-
kind: "node-pnpm-devcontainer",
|
|
211
|
-
contribute({ capability, state }) {
|
|
212
|
-
setDevelopmentContainerResource(state, capability.devcontainerResourceId, "node-pnpm-devcontainer");
|
|
213
|
-
state.flags.devcontainer = true;
|
|
214
|
-
state.operationFactories.push(nodePnpmDevcontainerOperations);
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
"github-maintenance": {
|
|
218
|
-
kind: "github-maintenance",
|
|
219
|
-
contribute({ state }) {
|
|
220
|
-
state.dependencyMaintenanceEcosystems.push(...dependencyMaintenanceEcosystems);
|
|
221
|
-
state.flags.githubActions = true;
|
|
222
|
-
state.flags.dependabot = true;
|
|
223
|
-
state.operationFactories.push(githubMaintenanceOperations);
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
function contributeProjectionCapability(capability, state) {
|
|
228
|
-
switch (capability.kind) {
|
|
229
|
-
case "workspace-library-package":
|
|
230
|
-
capabilityInterpreters["workspace-library-package"].contribute({
|
|
231
|
-
capability,
|
|
232
|
-
state,
|
|
233
|
-
});
|
|
234
|
-
return;
|
|
235
|
-
case "workspace-node-packages":
|
|
236
|
-
capabilityInterpreters["workspace-node-packages"].contribute({
|
|
237
|
-
capability,
|
|
238
|
-
state,
|
|
239
|
-
});
|
|
240
|
-
return;
|
|
241
|
-
case "rust-binary-workspace":
|
|
242
|
-
capabilityInterpreters["rust-binary-workspace"].contribute({
|
|
243
|
-
capability,
|
|
244
|
-
state,
|
|
245
|
-
});
|
|
246
|
-
return;
|
|
247
|
-
case "strict-typescript-root":
|
|
248
|
-
capabilityInterpreters["strict-typescript-root"].contribute({
|
|
249
|
-
capability,
|
|
250
|
-
state,
|
|
251
|
-
});
|
|
252
|
-
return;
|
|
253
|
-
case "oxc-format-lint":
|
|
254
|
-
capabilityInterpreters["oxc-format-lint"].contribute({
|
|
255
|
-
capability,
|
|
256
|
-
state,
|
|
257
|
-
});
|
|
258
|
-
return;
|
|
259
|
-
case "node-pnpm-devcontainer":
|
|
260
|
-
capabilityInterpreters["node-pnpm-devcontainer"].contribute({
|
|
261
|
-
capability,
|
|
262
|
-
state,
|
|
263
|
-
});
|
|
264
|
-
return;
|
|
265
|
-
case "github-maintenance":
|
|
266
|
-
capabilityInterpreters["github-maintenance"].contribute({
|
|
267
|
-
capability,
|
|
268
|
-
state,
|
|
269
|
-
});
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
export function interpretPresetProjectionDeclaration(options) {
|
|
274
|
-
const validation = validateProjectionCapabilities(options.declaration);
|
|
275
|
-
if (!validation.ok) {
|
|
276
|
-
throw new Error(`Projection Declaration is invalid:\n${validation.issues
|
|
277
|
-
.map((issue) => ` - ${issue.path}: ${issue.message}`)
|
|
278
|
-
.join("\n")}`);
|
|
279
|
-
}
|
|
280
|
-
const state = createProjectionCompositionState(options.sourceRoots);
|
|
281
|
-
for (const capability of validation.value.capabilities) {
|
|
282
|
-
contributeProjectionCapability(capability, state);
|
|
283
|
-
}
|
|
284
|
-
const checkPlan = {
|
|
285
|
-
components: state.rootCheckComponents,
|
|
286
|
-
environmentNeeds: state.rootCheckEnvironmentNeeds,
|
|
287
|
-
...(state.deploymentCheckComponents.length === 0
|
|
288
|
-
? {}
|
|
289
|
-
: { deploymentChecks: state.deploymentCheckComponents }),
|
|
290
|
-
};
|
|
291
|
-
const fixPlan = {
|
|
292
|
-
components: state.rootFixComponents,
|
|
293
|
-
};
|
|
294
|
-
const packageScripts = projectRootPackageScripts(checkPlan, fixPlan, state.rootScriptFragments);
|
|
295
|
-
const packageScriptsByPath = packageScriptsByWorkspacePath(state);
|
|
296
|
-
const dependencyMaintenancePolicy = {
|
|
297
|
-
ecosystems: uniqueValues(state.dependencyMaintenanceEcosystems),
|
|
298
|
-
extraDirectories: state.dependencyMaintenanceExtraDirectories,
|
|
299
|
-
...(state.rustWorkspace === undefined
|
|
300
|
-
? {}
|
|
301
|
-
: {
|
|
302
|
-
directories: {
|
|
303
|
-
cargo: `/${rustWorkspacePackagePath(options.context)}`,
|
|
304
|
-
},
|
|
305
|
-
}),
|
|
306
|
-
interval: "weekly",
|
|
307
|
-
};
|
|
308
|
-
if (state.sourceRoot === undefined) {
|
|
309
|
-
throw new Error("Projection Capability composition did not provide sourceRoot");
|
|
310
|
-
}
|
|
311
|
-
return {
|
|
312
|
-
sourceRoot: state.sourceRoot,
|
|
313
|
-
sourceRoots: state.sourceRoots,
|
|
314
|
-
operations: state.operationFactories.flatMap((factory) => factory({
|
|
315
|
-
context: options.context,
|
|
316
|
-
state,
|
|
317
|
-
packageScripts,
|
|
318
|
-
packageScriptsByPath,
|
|
319
|
-
})),
|
|
320
|
-
checkPlan,
|
|
321
|
-
fixPlan,
|
|
322
|
-
dependencyMaintenancePolicy,
|
|
323
|
-
packageScripts,
|
|
324
|
-
capabilities: completePlanCapabilityFlags(state.flags),
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
export function blueprintForPresetSourcePreset(preset, options = { targetDir: process.cwd() }) {
|
|
328
|
-
const packageScope = options.scope ?? projectNameFromDir(options.targetDir);
|
|
329
|
-
const projectName = projectNameFromDir(options.targetDir);
|
|
330
|
-
const packageManager = preset.supportedPackageManagers[0];
|
|
331
|
-
const blueprint = {
|
|
332
|
-
schemaVersion: 1,
|
|
333
|
-
preset: preset.name,
|
|
334
|
-
...(packageManager === undefined ? {} : { packageManager }),
|
|
335
|
-
projectKind: preset.supportedProjectKinds[0] ?? "multi-package",
|
|
336
|
-
features: [...preset.features],
|
|
337
|
-
};
|
|
338
|
-
if (preset.projection === undefined) {
|
|
339
|
-
return blueprint;
|
|
340
|
-
}
|
|
341
|
-
const validation = validateProjectionCapabilities(preset.projection);
|
|
342
|
-
if (!validation.ok) {
|
|
343
|
-
throw new Error(`Projection Declaration is invalid:\n${validation.issues
|
|
344
|
-
.map((issue) => ` - ${issue.path}: ${issue.message}`)
|
|
345
|
-
.join("\n")}`);
|
|
346
|
-
}
|
|
347
|
-
const packages = blueprintPackagesForCapabilities(validation.value.capabilities, packageScope, projectName);
|
|
348
|
-
return packages.length === 0 ? blueprint : { ...blueprint, packages };
|
|
349
|
-
}
|
|
350
|
-
export function projectPresetSourcePreset(options) {
|
|
351
|
-
if (options.preset.projection === undefined) {
|
|
352
|
-
throw new Error(`Preset ${options.preset.name} must declare a Projection Declaration`);
|
|
353
|
-
}
|
|
354
|
-
return interpretPresetProjectionDeclaration({
|
|
355
|
-
preset: options.preset,
|
|
356
|
-
declaration: options.preset.projection,
|
|
357
|
-
context: options.context,
|
|
358
|
-
sourceRoots: options.sourceRoots,
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
export async function planPresetSourcePackageAddition(options) {
|
|
362
|
-
if (options.preset.projection === undefined) {
|
|
363
|
-
throw new Error(`Preset ${options.preset.name} declares Package Addition support but has no Projection Declaration`);
|
|
364
|
-
}
|
|
365
|
-
const state = stateForProjectionDeclaration(options.preset.projection, options.sourceRoots);
|
|
366
|
-
const additionCapability = packageAdditionCapabilityForState(options.preset.name, state);
|
|
367
|
-
return {
|
|
368
|
-
packagePath: options.addition.packagePath,
|
|
369
|
-
workspacePackageGlob: additionCapability.workspacePackageGlob,
|
|
370
|
-
workspaceMembershipGlob: `${packageCollectionFromPackagePath(options.addition.packagePath)}/*`,
|
|
371
|
-
packageRole: additionCapability.packageRole,
|
|
372
|
-
packageSourcePreset: additionCapability.packageSourcePreset,
|
|
373
|
-
sourceRoot: templateSourceRootForPreset(state, additionCapability.sourcePreset),
|
|
374
|
-
sourceRoots: state.sourceRoots,
|
|
375
|
-
operations: packageAdditionOperationsForCapability({
|
|
376
|
-
capability: additionCapability,
|
|
377
|
-
packageName: options.addition.packageName,
|
|
378
|
-
packagePath: options.addition.packagePath,
|
|
379
|
-
nodeVersion: options.addition.nodeVersion,
|
|
380
|
-
}),
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
export function defaultPackagePathForPresetSourcePackageAddition(preset, packageLeafName, sourceRoots) {
|
|
384
|
-
if (preset.projection === undefined) {
|
|
385
|
-
throw new Error(`Preset ${preset.name} declares Package Addition support but has no Projection Declaration`);
|
|
386
|
-
}
|
|
387
|
-
const state = stateForProjectionDeclaration(preset.projection, sourceRoots);
|
|
388
|
-
const additionCapability = packageAdditionCapabilityForState(preset.name, state);
|
|
389
|
-
return `${packageCollection(additionCapability.workspacePackageGlob)}/${packageLeafName}`;
|
|
390
|
-
}
|
|
391
|
-
function createProjectionCompositionState(sourceRoots) {
|
|
392
|
-
return {
|
|
393
|
-
projectionSourceRoots: sourceRoots,
|
|
394
|
-
sourceRoots: {},
|
|
395
|
-
rootCheckComponents: [],
|
|
396
|
-
rootCheckEnvironmentNeeds: [],
|
|
397
|
-
deploymentCheckComponents: [],
|
|
398
|
-
packageCheckComponents: [],
|
|
399
|
-
rootFixComponents: [],
|
|
400
|
-
packageFixComponents: [],
|
|
401
|
-
rootScriptFragments: {},
|
|
402
|
-
packageScriptFragments: {},
|
|
403
|
-
rootDevDependencies: new Set(["turbo"]),
|
|
404
|
-
packageDependencies: new Set(),
|
|
405
|
-
packageDevDependencies: new Set(),
|
|
406
|
-
dependencyMaintenanceEcosystems: [],
|
|
407
|
-
dependencyMaintenanceExtraDirectories: {},
|
|
408
|
-
editorCustomizationCapabilities: [],
|
|
409
|
-
operationFactories: [],
|
|
410
|
-
flags: {},
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
function uniqueValues(values) {
|
|
414
|
-
return [...new Set(values)];
|
|
415
|
-
}
|
|
416
|
-
function setDevelopmentContainerResource(state, resourceId, capabilityKind) {
|
|
417
|
-
const root = state.projectionSourceRoots.sharedResource(resourceId);
|
|
418
|
-
if (root === undefined) {
|
|
419
|
-
throw new Error(`Projection Capability ${capabilityKind} references unresolved Development Container Shared Resource: ${resourceId}`);
|
|
420
|
-
}
|
|
421
|
-
const sourceRootKey = developmentContainerResourceSourceRootKey(resourceId);
|
|
422
|
-
state.devcontainerResource = { id: resourceId, root, sourceRootKey };
|
|
423
|
-
state.sourceRoots[sourceRootKey] = root;
|
|
424
|
-
}
|
|
425
|
-
function setEditorCustomizationResource(state, resourceId, capabilityKind) {
|
|
426
|
-
const root = state.projectionSourceRoots.sharedResource(resourceId);
|
|
427
|
-
if (root === undefined) {
|
|
428
|
-
throw new Error(`Projection Capability ${capabilityKind} references unresolved Editor Customization Shared Resource: ${resourceId}`);
|
|
429
|
-
}
|
|
430
|
-
state.editorCustomizationResource = {
|
|
431
|
-
id: resourceId,
|
|
432
|
-
root,
|
|
433
|
-
declarations: loadEditorCustomizationDeclarations(root),
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
function developmentContainerResourceSourceRootKey(resourceId) {
|
|
437
|
-
return `devcontainer:${resourceId}`;
|
|
438
|
-
}
|
|
439
|
-
function editorCustomizationDeclarationsForState(state) {
|
|
440
|
-
if (state.editorCustomizationResource === undefined) {
|
|
441
|
-
throw new Error("Projection Capability composition did not provide Editor Customization Shared Resource");
|
|
442
|
-
}
|
|
443
|
-
return state.editorCustomizationResource.declarations;
|
|
444
|
-
}
|
|
445
|
-
function projectNameFromDir(targetDir) {
|
|
446
|
-
return path.basename(path.resolve(targetDir));
|
|
447
|
-
}
|
|
448
|
-
function blueprintPackagesForCapabilities(capabilities, packageScope, projectName) {
|
|
449
|
-
return capabilities.flatMap((capability) => {
|
|
450
|
-
if (capability.kind === "workspace-library-package") {
|
|
451
|
-
return [
|
|
452
|
-
{
|
|
453
|
-
name: `@${packageScope}/${projectName}`,
|
|
454
|
-
path: `${packageCollection(capability.workspacePackageGlob)}/${projectName}`,
|
|
455
|
-
},
|
|
456
|
-
];
|
|
457
|
-
}
|
|
458
|
-
if (capability.kind === "workspace-node-packages") {
|
|
459
|
-
return capability.packages.map((nodePackage) => {
|
|
460
|
-
const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
|
|
461
|
-
return {
|
|
462
|
-
name: `@${packageScope}/${leaf}`,
|
|
463
|
-
path: nodePackage.path,
|
|
464
|
-
};
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
if (capability.kind === "rust-binary-workspace") {
|
|
468
|
-
const rustPackageName = cargoPackageNameFromProjectName(projectName);
|
|
469
|
-
return [
|
|
470
|
-
{
|
|
471
|
-
name: `${rustPackageName}-native`,
|
|
472
|
-
path: `packages/${rustPackageName}`,
|
|
473
|
-
},
|
|
474
|
-
];
|
|
475
|
-
}
|
|
476
|
-
return [];
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
function stateForProjectionDeclaration(declaration, sourceRoots) {
|
|
480
|
-
const validation = validateProjectionCapabilities(declaration);
|
|
481
|
-
if (!validation.ok) {
|
|
482
|
-
throw new Error(`Projection Declaration is invalid:\n${validation.issues
|
|
483
|
-
.map((issue) => ` - ${issue.path}: ${issue.message}`)
|
|
484
|
-
.join("\n")}`);
|
|
485
|
-
}
|
|
486
|
-
const state = createProjectionCompositionState(sourceRoots);
|
|
487
|
-
for (const capability of validation.value.capabilities) {
|
|
488
|
-
contributeProjectionCapability(capability, state);
|
|
489
|
-
}
|
|
490
|
-
return state;
|
|
491
|
-
}
|
|
492
|
-
function packageAdditionCapabilityForState(presetName, state) {
|
|
493
|
-
if (state.package !== undefined) {
|
|
494
|
-
const scripts = packageScriptsByWorkspacePath(state).get(state.package.workspacePackageGlob);
|
|
495
|
-
if (scripts === undefined) {
|
|
496
|
-
throw new Error(`Missing package scripts for ${state.package.workspacePackageGlob}`);
|
|
497
|
-
}
|
|
498
|
-
return {
|
|
499
|
-
sourcePreset: state.package.packageSourcePreset,
|
|
500
|
-
workspacePackageGlob: state.package.workspacePackageGlob,
|
|
501
|
-
packageRole: state.package.packageRole,
|
|
502
|
-
packageSourcePreset: state.package.packageSourcePreset,
|
|
503
|
-
sourceFiles: state.package.sourceFiles,
|
|
504
|
-
packageScripts: scripts,
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
if (state.nodeWorkspace !== undefined) {
|
|
508
|
-
if (state.nodeWorkspace.packages.length !== 1) {
|
|
509
|
-
throw new Error(`Preset ${presetName} is an initialization-only workspace and cannot be used for Package Addition`);
|
|
510
|
-
}
|
|
511
|
-
const nodePackage = state.nodeWorkspace.packages[0];
|
|
512
|
-
if (nodePackage === undefined) {
|
|
513
|
-
throw new Error(`Preset ${presetName} must declare one package for Package Addition`);
|
|
514
|
-
}
|
|
515
|
-
return {
|
|
516
|
-
sourcePreset: nodePackage.kind,
|
|
517
|
-
workspacePackageGlob: state.nodeWorkspace.workspacePackageGlob,
|
|
518
|
-
packageRole: "runtime-service",
|
|
519
|
-
packageSourcePreset: nodePackage.kind,
|
|
520
|
-
sourceFiles: nodePackage.sourceFiles,
|
|
521
|
-
packageScripts: nodePackageScripts(nodePackage, state.nodeWorkspace),
|
|
522
|
-
nodePackage,
|
|
523
|
-
nodeWorkspace: state.nodeWorkspace,
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
throw new Error(`Preset ${presetName} is an initialization-only workspace and cannot be used for Package Addition`);
|
|
527
|
-
}
|
|
528
|
-
function packageCollectionFromPackagePath(packagePath) {
|
|
529
|
-
const [workspaceCollection] = packagePath.split("/");
|
|
530
|
-
if (!workspaceCollection) {
|
|
531
|
-
throw new Error(`Invalid Package Path for Package Addition: ${packagePath}`);
|
|
532
|
-
}
|
|
533
|
-
return workspaceCollection;
|
|
534
|
-
}
|
|
535
|
-
function packageAdditionOperationsForCapability(options) {
|
|
536
|
-
switch (options.capability.packageSourcePreset) {
|
|
537
|
-
case "ts-lib":
|
|
538
|
-
return libraryPackageAdditionOperations(options);
|
|
539
|
-
case "hono-api":
|
|
540
|
-
return honoApiPackageAdditionOperations(options);
|
|
541
|
-
case "vike-app":
|
|
542
|
-
throw new Error("vike-app cannot be used for Package Addition");
|
|
543
|
-
case "vue-app":
|
|
544
|
-
return vueAppPackageAdditionOperations(options);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
function generationContextForPackageAddition(options) {
|
|
548
|
-
return {
|
|
549
|
-
projectName: {
|
|
550
|
-
kind: "ProjectName",
|
|
551
|
-
value: options.packageName.split("/").at(0)?.replace(/^@/, "") ?? "app",
|
|
552
|
-
},
|
|
553
|
-
preset: options.preset,
|
|
554
|
-
packageManager: { kind: "PackageManager", value: "pnpm" },
|
|
555
|
-
blueprint: {
|
|
556
|
-
schemaVersion: 1,
|
|
557
|
-
preset: options.preset,
|
|
558
|
-
packageManager: "pnpm",
|
|
559
|
-
projectKind: "multi-package",
|
|
560
|
-
features: [],
|
|
561
|
-
packages: [{ name: options.packageName, path: options.packagePath }],
|
|
562
|
-
},
|
|
563
|
-
toolchain: {
|
|
564
|
-
nodeLtsMajor: { kind: "NodeLtsMajor", value: options.nodeVersion },
|
|
565
|
-
packageManagerPin: { kind: "PackageManagerPin", value: "pnpm@10.34.4" },
|
|
566
|
-
source: "bundled-fallback",
|
|
567
|
-
diagnostics: [],
|
|
568
|
-
},
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
function libraryPackageAdditionOperations(options) {
|
|
572
|
-
const packageExposure = planPackageLinks([
|
|
573
|
-
{
|
|
574
|
-
name: options.packageName,
|
|
575
|
-
path: options.packagePath,
|
|
576
|
-
role: "shared-library",
|
|
577
|
-
sourcePreset: "ts-lib",
|
|
578
|
-
},
|
|
579
|
-
]).exposuresByPackagePath.get(options.packagePath);
|
|
580
|
-
if (packageExposure === undefined) {
|
|
581
|
-
throw new Error(`Missing Package Exposure for ${options.packagePath}`);
|
|
582
|
-
}
|
|
583
|
-
const exposureFields = packageManifestExposureFields(packageExposure);
|
|
584
|
-
return [
|
|
585
|
-
{
|
|
586
|
-
kind: "writeJson",
|
|
587
|
-
to: `${options.packagePath}/package.json`,
|
|
588
|
-
value: {
|
|
589
|
-
name: options.packageName,
|
|
590
|
-
version: "0.0.0",
|
|
591
|
-
private: true,
|
|
592
|
-
type: "module",
|
|
593
|
-
imports: exposureFields.imports,
|
|
594
|
-
exports: exposureFields.exports,
|
|
595
|
-
dependencies: {
|
|
596
|
-
valibot: "catalog:",
|
|
597
|
-
},
|
|
598
|
-
scripts: options.capability.packageScripts,
|
|
599
|
-
devDependencies: {
|
|
600
|
-
"@types/node": "catalog:",
|
|
601
|
-
oxfmt: "catalog:",
|
|
602
|
-
oxlint: "catalog:",
|
|
603
|
-
typescript: "catalog:",
|
|
604
|
-
},
|
|
605
|
-
engines: {
|
|
606
|
-
node: options.nodeVersion,
|
|
607
|
-
},
|
|
608
|
-
},
|
|
609
|
-
multilineArrays: ["files"],
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
kind: "writeJson",
|
|
613
|
-
to: `${options.packagePath}/tsconfig.json`,
|
|
614
|
-
value: libraryTsconfigJson(),
|
|
615
|
-
},
|
|
616
|
-
...options.capability.sourceFiles.map((sourceFile) => ({
|
|
617
|
-
kind: "copyFile",
|
|
618
|
-
from: sourceFile,
|
|
619
|
-
to: `${options.packagePath}/${sourceFile}`,
|
|
620
|
-
})),
|
|
621
|
-
];
|
|
622
|
-
}
|
|
623
|
-
function libraryTsconfigJson() {
|
|
624
|
-
return {
|
|
625
|
-
compilerOptions: strictTypeScriptCompilerOptions({
|
|
626
|
-
composite: true,
|
|
627
|
-
declaration: true,
|
|
628
|
-
declarationMap: true,
|
|
629
|
-
module: "nodenext",
|
|
630
|
-
moduleResolution: "nodenext",
|
|
631
|
-
rootDir: "src",
|
|
632
|
-
types: ["node"],
|
|
633
|
-
}),
|
|
634
|
-
include: ["src/**/*.ts"],
|
|
635
|
-
};
|
|
636
|
-
}
|
|
637
|
-
function honoApiPackageAdditionOperations(options) {
|
|
638
|
-
const packageExposure = planPackageLinks([
|
|
639
|
-
{
|
|
640
|
-
name: options.packageName,
|
|
641
|
-
path: options.packagePath,
|
|
642
|
-
role: "runtime-service",
|
|
643
|
-
sourcePreset: "hono-api",
|
|
644
|
-
},
|
|
645
|
-
]).exposuresByPackagePath.get(options.packagePath);
|
|
646
|
-
if (packageExposure === undefined) {
|
|
647
|
-
throw new Error(`Missing Package Exposure for ${options.packagePath}`);
|
|
648
|
-
}
|
|
649
|
-
return [
|
|
650
|
-
{
|
|
651
|
-
kind: "writeJson",
|
|
652
|
-
to: `${options.packagePath}/package.json`,
|
|
653
|
-
value: honoApiPackageJson(generationContextForPackageAddition({
|
|
654
|
-
preset: "hono-api",
|
|
655
|
-
packageName: options.packageName,
|
|
656
|
-
packagePath: options.packagePath,
|
|
657
|
-
nodeVersion: options.nodeVersion,
|
|
658
|
-
}), options.packageName, options.capability.packageScripts, packageManifestExposureFields(packageExposure)),
|
|
659
|
-
},
|
|
660
|
-
...honoApiTsconfigOperations(options.packagePath),
|
|
661
|
-
...options.capability.sourceFiles.map((sourceFile) => ({
|
|
662
|
-
kind: "copyFile",
|
|
663
|
-
from: sourceFile,
|
|
664
|
-
to: `${options.packagePath}/${sourceFile}`,
|
|
665
|
-
})),
|
|
666
|
-
];
|
|
667
|
-
}
|
|
668
|
-
function vueAppPackageAdditionOperations(options) {
|
|
669
|
-
return [
|
|
670
|
-
{
|
|
671
|
-
kind: "writeJson",
|
|
672
|
-
to: `${options.packagePath}/package.json`,
|
|
673
|
-
value: vuePackageJson(generationContextForPackageAddition({
|
|
674
|
-
preset: "vue-app",
|
|
675
|
-
packageName: options.packageName,
|
|
676
|
-
packagePath: options.packagePath,
|
|
677
|
-
nodeVersion: options.nodeVersion,
|
|
678
|
-
}), options.packageName, options.capability.packageScripts),
|
|
679
|
-
},
|
|
680
|
-
...vueAppTsconfigOperations(options.packagePath),
|
|
681
|
-
...options.capability.sourceFiles.map((sourceFile) => ({
|
|
682
|
-
kind: "copyFile",
|
|
683
|
-
from: sourceFile,
|
|
684
|
-
to: `${options.packagePath}/${sourceFile}`,
|
|
685
|
-
})),
|
|
686
|
-
];
|
|
687
|
-
}
|
|
688
|
-
function completePlanCapabilityFlags(flags) {
|
|
689
|
-
const missing = requiredPlanCapabilityProviders.filter((requirement) => flags[requirement.flag] !== true);
|
|
690
|
-
if (missing.length > 0) {
|
|
691
|
-
throw new Error(`Projection Capability composition did not provide required plan capabilities: ${missing
|
|
692
|
-
.map((requirement) => requirement.flag)
|
|
693
|
-
.join(", ")}`);
|
|
694
|
-
}
|
|
695
|
-
return {
|
|
696
|
-
rootCheck: true,
|
|
697
|
-
fixCommand: true,
|
|
698
|
-
githubActions: true,
|
|
699
|
-
dependabot: true,
|
|
700
|
-
devcontainer: true,
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
function packageScriptsByWorkspacePath(state) {
|
|
704
|
-
if (state.package === undefined && state.rustWorkspace === undefined) {
|
|
705
|
-
return new Map();
|
|
706
|
-
}
|
|
707
|
-
if (state.rustWorkspace !== undefined) {
|
|
708
|
-
return new Map([
|
|
709
|
-
[
|
|
710
|
-
state.rustWorkspace.workspacePackageGlob,
|
|
711
|
-
projectPackageScripts({
|
|
712
|
-
components: state.packageCheckComponents,
|
|
713
|
-
environmentNeeds: [],
|
|
714
|
-
}, {
|
|
715
|
-
components: state.packageFixComponents,
|
|
716
|
-
}, state.packageScriptFragments),
|
|
717
|
-
],
|
|
718
|
-
]);
|
|
719
|
-
}
|
|
720
|
-
return new Map([
|
|
721
|
-
[
|
|
722
|
-
state.package.workspacePackageGlob,
|
|
723
|
-
projectPackageScripts({
|
|
724
|
-
components: state.packageCheckComponents,
|
|
725
|
-
environmentNeeds: [],
|
|
726
|
-
}, {
|
|
727
|
-
components: state.packageFixComponents,
|
|
728
|
-
}, state.packageScriptFragments),
|
|
729
|
-
],
|
|
730
|
-
]);
|
|
731
|
-
}
|
|
732
|
-
function workspaceBoundaryForState(state) {
|
|
733
|
-
return workspaceGlobBoundary(state.nodeWorkspace?.workspacePackageGlob ??
|
|
734
|
-
state.package?.workspacePackageGlob ??
|
|
735
|
-
state.rustWorkspace?.workspacePackageGlob ??
|
|
736
|
-
"packages/*");
|
|
737
|
-
}
|
|
738
|
-
function workspaceGlobBoundary(workspacePackageGlob) {
|
|
739
|
-
return {
|
|
740
|
-
kind: "package-boundary",
|
|
741
|
-
path: workspacePackageGlob,
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
function hasVuePackage(capability) {
|
|
745
|
-
return findVuePackage(capability) !== undefined;
|
|
746
|
-
}
|
|
747
|
-
function hasVikePackage(capability) {
|
|
748
|
-
return capability.packages.some((nodePackage) => nodePackage.kind === "vike-app");
|
|
749
|
-
}
|
|
750
|
-
function findVuePackage(capability) {
|
|
751
|
-
return capability.packages.find((nodePackage) => nodePackage.kind === "vue-app" || nodePackage.kind === "vike-app");
|
|
752
|
-
}
|
|
753
|
-
function sourceRootPreset(capability) {
|
|
754
|
-
if (capability.packages.length === 1) {
|
|
755
|
-
const nodePackage = capability.packages[0];
|
|
756
|
-
if (nodePackage === undefined) {
|
|
757
|
-
throw new Error("Node package workspace must contain one package");
|
|
758
|
-
}
|
|
759
|
-
return nodePackage.kind;
|
|
760
|
-
}
|
|
761
|
-
return "vue-hono-app";
|
|
762
|
-
}
|
|
763
|
-
function projectRootPackageScripts(checkPlan, fixPlan, fragments) {
|
|
764
|
-
const leafFragments = leafScriptFragments(fragments);
|
|
765
|
-
const directFragments = directScriptFragments(fragments);
|
|
766
|
-
return {
|
|
767
|
-
check: `pnpm run check:boundaries && ${renderRootCheckCommand(checkPlan)}`,
|
|
768
|
-
...(checkPlan.deploymentChecks === undefined
|
|
769
|
-
? {}
|
|
770
|
-
: { "check:deployment": renderDeploymentCheckCommand(checkPlan) }),
|
|
771
|
-
fix: renderFixCommand(fixPlan),
|
|
772
|
-
...rootTaskEntrypoints(checkPlan, fixPlan),
|
|
773
|
-
...directFragments,
|
|
774
|
-
...leafFragments,
|
|
775
|
-
"check:boundaries": "turbo boundaries --no-color",
|
|
776
|
-
"check:run": noopTaskCommand(),
|
|
777
|
-
"fix:run": noopTaskCommand(),
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
function projectPackageScripts(checkPlan, fixPlan, fragments) {
|
|
781
|
-
void checkPlan;
|
|
782
|
-
void fixPlan;
|
|
783
|
-
return {
|
|
784
|
-
...directScriptFragments(fragments),
|
|
785
|
-
...leafScriptFragments(fragments),
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
const leafEntrypointNames = new Set([
|
|
789
|
-
"format:check",
|
|
790
|
-
"format:write",
|
|
791
|
-
"lint",
|
|
792
|
-
"lint:fix",
|
|
793
|
-
"typecheck",
|
|
794
|
-
"build",
|
|
795
|
-
"test",
|
|
796
|
-
"test:e2e",
|
|
797
|
-
]);
|
|
798
|
-
function leafScriptName(scriptName) {
|
|
799
|
-
return leafEntrypointNames.has(scriptName) ? `${scriptName}:run` : scriptName;
|
|
800
|
-
}
|
|
801
|
-
function leafScriptFragments(fragments) {
|
|
802
|
-
return Object.fromEntries(Object.entries(fragments)
|
|
803
|
-
.filter(([scriptName]) => leafEntrypointNames.has(scriptName))
|
|
804
|
-
.map(([scriptName, command]) => [leafScriptName(scriptName), command]));
|
|
805
|
-
}
|
|
806
|
-
function directScriptFragments(fragments) {
|
|
807
|
-
return Object.fromEntries(Object.entries(fragments).filter(([scriptName]) => !leafEntrypointNames.has(scriptName)));
|
|
808
|
-
}
|
|
809
|
-
function rootTaskEntrypoints(checkPlan, fixPlan) {
|
|
810
|
-
const taskNames = new Set([
|
|
811
|
-
...checkPlan.components.map((component) => renderCheckLeafCommand(component).startsWith("turbo run ")
|
|
812
|
-
? undefined
|
|
813
|
-
: leafEntrypointFromRunTask(component.kind)),
|
|
814
|
-
...fixPlan.components.map((component) => renderFixLeafCommand(component).startsWith("turbo run ")
|
|
815
|
-
? undefined
|
|
816
|
-
: leafEntrypointFromRunTask(component.kind)),
|
|
817
|
-
]);
|
|
818
|
-
const entries = [];
|
|
819
|
-
for (const taskName of taskNames) {
|
|
820
|
-
if (taskName === undefined) {
|
|
821
|
-
continue;
|
|
822
|
-
}
|
|
823
|
-
entries.push([taskName, renderTurboRunCommand([`${taskName}:run`])]);
|
|
824
|
-
}
|
|
825
|
-
return Object.fromEntries(entries);
|
|
826
|
-
}
|
|
827
|
-
function leafEntrypointFromRunTask(kind) {
|
|
828
|
-
switch (kind) {
|
|
829
|
-
case "oxc-format-check":
|
|
830
|
-
case "rustfmt-check":
|
|
831
|
-
return "format:check";
|
|
832
|
-
case "oxc-format-write":
|
|
833
|
-
case "rustfmt-write":
|
|
834
|
-
return "format:write";
|
|
835
|
-
case "oxc-lint":
|
|
836
|
-
case "cargo-clippy":
|
|
837
|
-
return "lint";
|
|
838
|
-
case "oxc-lint-fix":
|
|
839
|
-
return "lint:fix";
|
|
840
|
-
case "typescript-typecheck":
|
|
841
|
-
return "typecheck";
|
|
842
|
-
case "build":
|
|
843
|
-
return "build";
|
|
844
|
-
case "unit-test":
|
|
845
|
-
case "cargo-test":
|
|
846
|
-
return "test";
|
|
847
|
-
case "e2e-test":
|
|
848
|
-
return "test:e2e";
|
|
849
|
-
case "turbo-check":
|
|
850
|
-
case "turbo-package-typecheck":
|
|
851
|
-
case "turbo-package-build":
|
|
852
|
-
case "turbo-package-test":
|
|
853
|
-
case "turbo-package-e2e-test":
|
|
854
|
-
case "turbo-package-check":
|
|
855
|
-
case "turbo-fix":
|
|
856
|
-
case "turbo-package-fix":
|
|
857
|
-
return undefined;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
function noopTaskCommand() {
|
|
861
|
-
return 'node -e ""';
|
|
862
|
-
}
|
|
863
|
-
function packageCollection(workspacePackageGlob) {
|
|
864
|
-
return workspacePackageGlob.slice(0, -"/*".length);
|
|
865
|
-
}
|
|
866
|
-
function workspacePackagePath(context, capability) {
|
|
867
|
-
return `${packageCollection(capability.workspacePackageGlob)}/${context.projectName.value}`;
|
|
868
|
-
}
|
|
869
|
-
function workspacePackageName(context, capability) {
|
|
870
|
-
const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === workspacePackagePath(context, capability));
|
|
871
|
-
return (packageDefinition?.name ??
|
|
872
|
-
`@${context.projectName.value}/${context.projectName.value}`);
|
|
873
|
-
}
|
|
874
|
-
function cargoPackageNameFromProjectName(projectName) {
|
|
875
|
-
const slug = projectName
|
|
876
|
-
.normalize("NFKD")
|
|
877
|
-
.replace(/[\u0300-\u036f]/g, "")
|
|
878
|
-
.toLowerCase()
|
|
879
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
880
|
-
.replace(/^-+|-+$/g, "");
|
|
881
|
-
return slug || "rust-bin";
|
|
882
|
-
}
|
|
883
|
-
function rustProjectName(context) {
|
|
884
|
-
return cargoPackageNameFromProjectName(context.projectName.value);
|
|
885
|
-
}
|
|
886
|
-
function rustWorkspacePackagePath(context) {
|
|
887
|
-
return `packages/${rustProjectName(context)}`;
|
|
888
|
-
}
|
|
889
|
-
function rustWorkspacePackageName(context) {
|
|
890
|
-
return `${rustProjectName(context)}-native`;
|
|
891
|
-
}
|
|
892
|
-
function packageLinkPlanFor(context, capability) {
|
|
893
|
-
return planPackageLinks([
|
|
894
|
-
{
|
|
895
|
-
name: workspacePackageName(context, capability),
|
|
896
|
-
path: workspacePackagePath(context, capability),
|
|
897
|
-
role: capability.packageRole,
|
|
898
|
-
sourcePreset: capability.packageSourcePreset,
|
|
899
|
-
},
|
|
900
|
-
]);
|
|
901
|
-
}
|
|
902
|
-
function nodePackageDefinitions(context, capability) {
|
|
903
|
-
const nodeDefinitions = capability.packages
|
|
904
|
-
.filter((nodePackage) => nodePackage.kind === "hono-api")
|
|
905
|
-
.map((nodePackage) => ({
|
|
906
|
-
name: nodePackageName(context, nodePackage),
|
|
907
|
-
path: nodePackage.path,
|
|
908
|
-
role: "runtime-service",
|
|
909
|
-
sourcePreset: "hono-api",
|
|
910
|
-
}));
|
|
911
|
-
if (hasVikePackage(capability)) {
|
|
912
|
-
return [
|
|
913
|
-
...nodeDefinitions,
|
|
914
|
-
{
|
|
915
|
-
name: vikeDbPackageName(context),
|
|
916
|
-
path: vikeDbPackagePath(),
|
|
917
|
-
role: "shared-library",
|
|
918
|
-
sourcePreset: "ts-lib",
|
|
919
|
-
},
|
|
920
|
-
];
|
|
921
|
-
}
|
|
922
|
-
return nodeDefinitions;
|
|
923
|
-
}
|
|
924
|
-
function nodePackageName(context, nodePackage) {
|
|
925
|
-
const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === nodePackage.path);
|
|
926
|
-
if (packageDefinition !== undefined) {
|
|
927
|
-
return packageDefinition.name;
|
|
928
|
-
}
|
|
929
|
-
const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
|
|
930
|
-
return `@${context.projectName.value}/${leaf}`;
|
|
931
|
-
}
|
|
932
|
-
function nodePackageLinkPlan(context, capability) {
|
|
933
|
-
return planPackageLinks(nodePackageDefinitions(context, capability), capability.packageLinks ?? []);
|
|
934
|
-
}
|
|
935
|
-
function vikeDbPackagePath() {
|
|
936
|
-
return "packages/db";
|
|
937
|
-
}
|
|
938
|
-
function vikeDbPackageName(context) {
|
|
939
|
-
const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === vikeDbPackagePath());
|
|
940
|
-
return packageDefinition?.name ?? `@${context.projectName.value}/db`;
|
|
941
|
-
}
|
|
942
|
-
function rootPackageJson(context, packageScripts, state) {
|
|
943
|
-
return {
|
|
944
|
-
name: context.projectName.value,
|
|
945
|
-
version: "0.0.0",
|
|
946
|
-
private: true,
|
|
947
|
-
type: "module",
|
|
948
|
-
scripts: packageScripts,
|
|
949
|
-
devDependencies: catalogDependencies(state.rootDevDependencies),
|
|
950
|
-
engines: {
|
|
951
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
952
|
-
},
|
|
953
|
-
packageManager: context.toolchain.packageManagerPin.value,
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
function libraryPackageJson(context, state, capability, scripts) {
|
|
957
|
-
const packagePath = workspacePackagePath(context, capability);
|
|
958
|
-
const packageExposure = packageLinkPlanFor(context, capability).exposuresByPackagePath.get(packagePath);
|
|
959
|
-
if (packageExposure === undefined) {
|
|
960
|
-
throw new Error(`Missing Package Exposure for ${packagePath}`);
|
|
961
|
-
}
|
|
962
|
-
const exposureFields = packageManifestExposureFields(packageExposure);
|
|
963
|
-
return {
|
|
964
|
-
name: workspacePackageName(context, capability),
|
|
965
|
-
version: "0.0.0",
|
|
966
|
-
private: true,
|
|
967
|
-
type: "module",
|
|
968
|
-
imports: exposureFields.imports,
|
|
969
|
-
exports: exposureFields.exports,
|
|
970
|
-
dependencies: catalogDependencies(state.packageDependencies),
|
|
971
|
-
scripts,
|
|
972
|
-
devDependencies: catalogDependencies(state.packageDevDependencies),
|
|
973
|
-
engines: {
|
|
974
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
975
|
-
},
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
function honoApiPackageJson(context, packageName, scripts, exposureFields) {
|
|
979
|
-
return {
|
|
980
|
-
name: packageName,
|
|
981
|
-
version: "0.0.0",
|
|
982
|
-
private: true,
|
|
983
|
-
type: "module",
|
|
984
|
-
...(exposureFields === undefined
|
|
985
|
-
? {
|
|
986
|
-
imports: {
|
|
987
|
-
"#/*": {
|
|
988
|
-
default: "./dist/*.js",
|
|
989
|
-
types: "./src/*.ts",
|
|
990
|
-
},
|
|
991
|
-
},
|
|
992
|
-
}
|
|
993
|
-
: {
|
|
994
|
-
types: exposureFields.types,
|
|
995
|
-
exports: exposureFields.exports,
|
|
996
|
-
imports: exposureFields.imports,
|
|
997
|
-
}),
|
|
998
|
-
scripts,
|
|
999
|
-
dependencies: {
|
|
1000
|
-
"@hono/node-server": "catalog:",
|
|
1001
|
-
hono: "catalog:",
|
|
1002
|
-
},
|
|
1003
|
-
devDependencies: {
|
|
1004
|
-
"@types/node": "catalog:",
|
|
1005
|
-
oxfmt: "catalog:",
|
|
1006
|
-
oxlint: "catalog:",
|
|
1007
|
-
"oxlint-tsgolint": "catalog:",
|
|
1008
|
-
"tsc-alias": "catalog:",
|
|
1009
|
-
...(scripts.dev === undefined ? {} : { tsx: "catalog:" }),
|
|
1010
|
-
typescript: "catalog:",
|
|
1011
|
-
vitest: "catalog:",
|
|
1012
|
-
},
|
|
1013
|
-
engines: {
|
|
1014
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
1015
|
-
},
|
|
1016
|
-
};
|
|
1017
|
-
}
|
|
1018
|
-
function vuePackageJson(context, packageName, scripts, packageLinkDependencies = {}) {
|
|
1019
|
-
return {
|
|
1020
|
-
name: packageName,
|
|
1021
|
-
version: "0.0.0",
|
|
1022
|
-
private: true,
|
|
1023
|
-
type: "module",
|
|
1024
|
-
imports: {
|
|
1025
|
-
"#/*": {
|
|
1026
|
-
default: "./src/*.ts",
|
|
1027
|
-
types: "./src/*.ts",
|
|
1028
|
-
},
|
|
1029
|
-
},
|
|
1030
|
-
scripts,
|
|
1031
|
-
dependencies: {
|
|
1032
|
-
...packageLinkDependencies,
|
|
1033
|
-
...(Object.keys(packageLinkDependencies).length === 0
|
|
1034
|
-
? {}
|
|
1035
|
-
: { hono: "catalog:" }),
|
|
1036
|
-
pinia: "catalog:",
|
|
1037
|
-
vue: "catalog:",
|
|
1038
|
-
},
|
|
1039
|
-
devDependencies: {
|
|
1040
|
-
"@playwright/test": "catalog:",
|
|
1041
|
-
"@tailwindcss/vite": "catalog:",
|
|
1042
|
-
"@types/node": "catalog:",
|
|
1043
|
-
"@types/web-bluetooth": "catalog:",
|
|
1044
|
-
"@vitejs/plugin-vue": "catalog:",
|
|
1045
|
-
"@vue/tsconfig": "catalog:",
|
|
1046
|
-
oxfmt: "catalog:",
|
|
1047
|
-
oxlint: "catalog:",
|
|
1048
|
-
"oxlint-tsgolint": "catalog:",
|
|
1049
|
-
tailwindcss: "catalog:",
|
|
1050
|
-
typescript: "catalog:",
|
|
1051
|
-
vite: "catalog:",
|
|
1052
|
-
vitest: "catalog:",
|
|
1053
|
-
"vue-tsc": "catalog:",
|
|
1054
|
-
},
|
|
1055
|
-
engines: {
|
|
1056
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
1057
|
-
},
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
function vikePackageJson(context, packageName, scripts, packageLinkDependencies = {}) {
|
|
1061
|
-
return {
|
|
1062
|
-
name: packageName,
|
|
1063
|
-
version: "0.0.0",
|
|
1064
|
-
private: true,
|
|
1065
|
-
type: "module",
|
|
1066
|
-
imports: {
|
|
1067
|
-
"#/*": {
|
|
1068
|
-
default: "./*.ts",
|
|
1069
|
-
types: "./*.ts",
|
|
1070
|
-
},
|
|
1071
|
-
},
|
|
1072
|
-
scripts,
|
|
1073
|
-
dependencies: {
|
|
1074
|
-
...packageLinkDependencies,
|
|
1075
|
-
"@vikejs/hono": "catalog:",
|
|
1076
|
-
"drizzle-orm": "catalog:",
|
|
1077
|
-
hono: "catalog:",
|
|
1078
|
-
srvx: "catalog:",
|
|
1079
|
-
telefunc: "catalog:",
|
|
1080
|
-
vike: "catalog:",
|
|
1081
|
-
"vike-vue": "catalog:",
|
|
1082
|
-
vue: "catalog:",
|
|
1083
|
-
},
|
|
1084
|
-
devDependencies: {
|
|
1085
|
-
"@playwright/test": "catalog:",
|
|
1086
|
-
"@tailwindcss/vite": "catalog:",
|
|
1087
|
-
"@types/node": "catalog:",
|
|
1088
|
-
"@vitejs/plugin-vue": "catalog:",
|
|
1089
|
-
"@vue/tsconfig": "catalog:",
|
|
1090
|
-
oxfmt: "catalog:",
|
|
1091
|
-
oxlint: "catalog:",
|
|
1092
|
-
"oxlint-tsgolint": "catalog:",
|
|
1093
|
-
tailwindcss: "catalog:",
|
|
1094
|
-
turbo: "catalog:",
|
|
1095
|
-
typescript: "catalog:",
|
|
1096
|
-
vite: "catalog:",
|
|
1097
|
-
vitest: "catalog:",
|
|
1098
|
-
"vue-tsc": "catalog:",
|
|
1099
|
-
},
|
|
1100
|
-
engines: {
|
|
1101
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
1102
|
-
},
|
|
1103
|
-
packageManager: context.toolchain.packageManagerPin.value,
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
function vikeDbPackageJson(context) {
|
|
1107
|
-
return {
|
|
1108
|
-
name: vikeDbPackageName(context),
|
|
1109
|
-
version: "0.0.0",
|
|
1110
|
-
private: true,
|
|
1111
|
-
type: "module",
|
|
1112
|
-
imports: {
|
|
1113
|
-
"#db/*": {
|
|
1114
|
-
default: "./src/*.ts",
|
|
1115
|
-
types: "./src/*.ts",
|
|
1116
|
-
},
|
|
1117
|
-
},
|
|
1118
|
-
exports: {
|
|
1119
|
-
".": {
|
|
1120
|
-
default: "./src/index.ts",
|
|
1121
|
-
types: "./src/index.ts",
|
|
1122
|
-
},
|
|
1123
|
-
"./schema": {
|
|
1124
|
-
default: "./src/schema.ts",
|
|
1125
|
-
types: "./src/schema.ts",
|
|
1126
|
-
},
|
|
1127
|
-
"./queries/todos": {
|
|
1128
|
-
default: "./src/queries/todos.ts",
|
|
1129
|
-
types: "./src/queries/todos.ts",
|
|
1130
|
-
},
|
|
1131
|
-
"./readiness": {
|
|
1132
|
-
default: "./src/readiness.ts",
|
|
1133
|
-
types: "./src/readiness.ts",
|
|
1134
|
-
},
|
|
1135
|
-
},
|
|
1136
|
-
dependencies: {
|
|
1137
|
-
"drizzle-orm": "catalog:",
|
|
1138
|
-
},
|
|
1139
|
-
scripts: vikeDbPackageScripts(),
|
|
1140
|
-
devDependencies: {
|
|
1141
|
-
"@types/node": "catalog:",
|
|
1142
|
-
"drizzle-kit": "catalog:",
|
|
1143
|
-
oxfmt: "catalog:",
|
|
1144
|
-
oxlint: "catalog:",
|
|
1145
|
-
"oxlint-tsgolint": "catalog:",
|
|
1146
|
-
typescript: "catalog:",
|
|
1147
|
-
vitest: "catalog:",
|
|
1148
|
-
},
|
|
1149
|
-
engines: {
|
|
1150
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
1151
|
-
},
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
function vikeDbPackageScripts() {
|
|
1155
|
-
return {
|
|
1156
|
-
"build:run": "tsc -p tsconfig.json --noEmit",
|
|
1157
|
-
"db:generate": "drizzle-kit generate",
|
|
1158
|
-
"db:migrate": "drizzle-kit migrate",
|
|
1159
|
-
"db:prepare:deploy": "pnpm run db:migrate",
|
|
1160
|
-
"db:prepare:dev": "pnpm run db:push && pnpm run db:seed:example",
|
|
1161
|
-
"db:prepare:test": 'rm -f "${DATABASE_FILE:-./node_modules/.tmp/test.sqlite}" && pnpm run db:push && pnpm run db:seed:example',
|
|
1162
|
-
"db:push": "mkdir -p data node_modules/.tmp && drizzle-kit push",
|
|
1163
|
-
"db:seed:example": "node --experimental-strip-types scripts/seed-example.ts",
|
|
1164
|
-
"db:studio": "drizzle-kit studio",
|
|
1165
|
-
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
1166
|
-
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1167
|
-
"lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
1168
|
-
"lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
1169
|
-
"test:run": "DATABASE_FILE=./node_modules/.tmp/test.sqlite pnpm run db:prepare:test && DATABASE_FILE=./node_modules/.tmp/test.sqlite vitest run --reporter=agent --silent=passed-only; status=$?; rm -f ./node_modules/.tmp/test.sqlite; exit $status",
|
|
1170
|
-
"typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
1171
|
-
};
|
|
1172
|
-
}
|
|
1173
|
-
function catalogDependencies(dependencies) {
|
|
1174
|
-
return Object.fromEntries([...dependencies].toSorted().map((dependency) => [dependency, "catalog:"]));
|
|
1175
|
-
}
|
|
1176
|
-
function generationRecord(context) {
|
|
1177
|
-
return {
|
|
1178
|
-
packageName: "@ykdz/template",
|
|
1179
|
-
version: "0.0.0",
|
|
1180
|
-
command: `template init --preset ${context.blueprint.preset}`,
|
|
1181
|
-
toolchain: {
|
|
1182
|
-
nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
|
|
1183
|
-
packageManagerPin: context.toolchain.packageManagerPin.value,
|
|
1184
|
-
source: context.toolchain.source,
|
|
1185
|
-
},
|
|
1186
|
-
};
|
|
1187
|
-
}
|
|
1188
|
-
function rustCargoToml(projectName, dependencies = []) {
|
|
1189
|
-
return [
|
|
1190
|
-
"[package]",
|
|
1191
|
-
`name = "${projectName}"`,
|
|
1192
|
-
'version = "0.1.0"',
|
|
1193
|
-
'edition = "2024"',
|
|
1194
|
-
"",
|
|
1195
|
-
"[dependencies]",
|
|
1196
|
-
...renderCargoDependencyTomlEntries(dependencies),
|
|
1197
|
-
"",
|
|
1198
|
-
"[lints]",
|
|
1199
|
-
"workspace = true",
|
|
1200
|
-
"",
|
|
1201
|
-
"[workspace]",
|
|
1202
|
-
'members = ["."]',
|
|
1203
|
-
'resolver = "3"',
|
|
1204
|
-
"",
|
|
1205
|
-
"[workspace.lints.rust]",
|
|
1206
|
-
'unsafe_code = "forbid"',
|
|
1207
|
-
"",
|
|
1208
|
-
"[workspace.lints.clippy]",
|
|
1209
|
-
'all = "deny"',
|
|
1210
|
-
'pedantic = "deny"',
|
|
1211
|
-
'nursery = "deny"',
|
|
1212
|
-
"",
|
|
1213
|
-
"[profile.release]",
|
|
1214
|
-
'strip = "symbols"',
|
|
1215
|
-
'lto = "thin"',
|
|
1216
|
-
"codegen-units = 1",
|
|
1217
|
-
"",
|
|
1218
|
-
].join("\n");
|
|
1219
|
-
}
|
|
1220
|
-
function rustCargoLock(projectName) {
|
|
1221
|
-
return renderCargoLockForPackage({
|
|
1222
|
-
packageName: projectName,
|
|
1223
|
-
packageVersion: "0.1.0",
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
function rustRootPackageJson(context, packageScripts, state) {
|
|
1227
|
-
return {
|
|
1228
|
-
name: rustProjectName(context),
|
|
1229
|
-
version: "0.0.0",
|
|
1230
|
-
private: true,
|
|
1231
|
-
scripts: packageScripts,
|
|
1232
|
-
devDependencies: catalogDependencies(state.rootDevDependencies),
|
|
1233
|
-
engines: {
|
|
1234
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
1235
|
-
},
|
|
1236
|
-
packageManager: context.toolchain.packageManagerPin.value,
|
|
1237
|
-
};
|
|
1238
|
-
}
|
|
1239
|
-
function rustWorkspacePackageJson(context) {
|
|
1240
|
-
return {
|
|
1241
|
-
name: rustWorkspacePackageName(context),
|
|
1242
|
-
version: "0.0.0",
|
|
1243
|
-
private: true,
|
|
1244
|
-
scripts: rustWorkspacePackageScripts(),
|
|
1245
|
-
engines: {
|
|
1246
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
1247
|
-
},
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
function rustWorkspacePackageScripts() {
|
|
1251
|
-
return {
|
|
1252
|
-
"format:check:run": "cargo fmt --all -- --check",
|
|
1253
|
-
"format:write:run": "cargo fmt --all",
|
|
1254
|
-
"lint:run": "cargo clippy --workspace --all-targets -- -D warnings",
|
|
1255
|
-
"test:run": "cargo test --workspace",
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
function workspaceLibraryPackageOperations({ context, state, packageScripts, packageScriptsByPath, }) {
|
|
1259
|
-
if (state.package === undefined) {
|
|
1260
|
-
throw new Error("workspace-library-package capability state is missing");
|
|
1261
|
-
}
|
|
1262
|
-
const capability = state.package;
|
|
1263
|
-
const packagePath = workspacePackagePath(context, capability);
|
|
1264
|
-
const workspacePackageScripts = packageScriptsByPath.get(capability.workspacePackageGlob);
|
|
1265
|
-
if (workspacePackageScripts === undefined) {
|
|
1266
|
-
throw new Error(`Missing package scripts for ${capability.workspacePackageGlob}`);
|
|
1267
|
-
}
|
|
1268
|
-
const rootManifest = rootPackageJson(context, packageScripts, state);
|
|
1269
|
-
const packageManifest = libraryPackageJson(context, state, capability, workspacePackageScripts);
|
|
1270
|
-
return [
|
|
1271
|
-
{
|
|
1272
|
-
kind: "writeJson",
|
|
1273
|
-
to: "package.json",
|
|
1274
|
-
value: rootManifest,
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
kind: "writeText",
|
|
1278
|
-
to: "pnpm-workspace.yaml",
|
|
1279
|
-
text: renderGeneratedPnpmWorkspaceYaml({
|
|
1280
|
-
packages: [capability.workspacePackageGlob],
|
|
1281
|
-
dependencies: collectGeneratedManifestCatalogDependencies([
|
|
1282
|
-
rootManifest,
|
|
1283
|
-
packageManifest,
|
|
1284
|
-
]),
|
|
1285
|
-
}),
|
|
1286
|
-
},
|
|
1287
|
-
{
|
|
1288
|
-
kind: "writeJson",
|
|
1289
|
-
to: "turbo.json",
|
|
1290
|
-
value: packageTurboConfig({ dependencyBuildsRequired: false }),
|
|
1291
|
-
},
|
|
1292
|
-
{
|
|
1293
|
-
kind: "writeJson",
|
|
1294
|
-
to: `${packagePath}/package.json`,
|
|
1295
|
-
value: packageManifest,
|
|
1296
|
-
multilineArrays: ["files"],
|
|
1297
|
-
},
|
|
1298
|
-
{
|
|
1299
|
-
kind: "writeText",
|
|
1300
|
-
to: ".gitignore",
|
|
1301
|
-
text: [
|
|
1302
|
-
"node_modules",
|
|
1303
|
-
"dist",
|
|
1304
|
-
".env",
|
|
1305
|
-
".template/",
|
|
1306
|
-
".pnpm-store/",
|
|
1307
|
-
"",
|
|
1308
|
-
].join("\n"),
|
|
1309
|
-
},
|
|
1310
|
-
...capability.sourceFiles.map((sourceFile) => ({
|
|
1311
|
-
kind: "copyFile",
|
|
1312
|
-
from: sourceFile,
|
|
1313
|
-
to: `${packagePath}/${sourceFile}`,
|
|
1314
|
-
})),
|
|
1315
|
-
{
|
|
1316
|
-
kind: "writeJson",
|
|
1317
|
-
to: ".template/blueprint.json",
|
|
1318
|
-
value: context.blueprint,
|
|
1319
|
-
},
|
|
1320
|
-
{
|
|
1321
|
-
kind: "writeJson",
|
|
1322
|
-
to: ".template/generated-by.json",
|
|
1323
|
-
value: generationRecord(context),
|
|
1324
|
-
},
|
|
1325
|
-
];
|
|
1326
|
-
}
|
|
1327
|
-
function rustBinaryWorkspaceOperations({ context, state, packageScripts, }) {
|
|
1328
|
-
if (state.rustWorkspace === undefined) {
|
|
1329
|
-
throw new Error("rust-binary-workspace capability state is missing");
|
|
1330
|
-
}
|
|
1331
|
-
const capability = state.rustWorkspace;
|
|
1332
|
-
const packagePath = rustWorkspacePackagePath(context);
|
|
1333
|
-
const rootManifest = rustRootPackageJson(context, packageScripts, state);
|
|
1334
|
-
const packageManifest = rustWorkspacePackageJson(context);
|
|
1335
|
-
const rustLayer = rustToolLayer();
|
|
1336
|
-
const dockerfileFragments = readDevelopmentContainerDockerfileFragments(state, ["rust"]);
|
|
1337
|
-
const editorCustomization = editorCustomizationForCapabilities(state.editorCustomizationCapabilities, editorCustomizationDeclarationsForState(state));
|
|
1338
|
-
const developmentContainer = dockerfileFirstRustPnpmDevcontainer({
|
|
1339
|
-
name: context.projectName.value,
|
|
1340
|
-
nodeLayer: nodePnpmToolLayer({
|
|
1341
|
-
nodeVersion: context.toolchain.nodeLtsMajor.value,
|
|
1342
|
-
packageManagerPin: context.toolchain.packageManagerPin.value,
|
|
1343
|
-
}),
|
|
1344
|
-
rustLayer,
|
|
1345
|
-
dockerfileFragments,
|
|
1346
|
-
extensions: editorCustomization.extensions,
|
|
1347
|
-
settings: editorCustomization.settings,
|
|
1348
|
-
});
|
|
1349
|
-
return [
|
|
1350
|
-
{
|
|
1351
|
-
kind: "writeJson",
|
|
1352
|
-
to: "package.json",
|
|
1353
|
-
value: rootManifest,
|
|
1354
|
-
},
|
|
1355
|
-
{
|
|
1356
|
-
kind: "writeText",
|
|
1357
|
-
to: "pnpm-workspace.yaml",
|
|
1358
|
-
text: renderGeneratedPnpmWorkspaceYaml({
|
|
1359
|
-
packages: [capability.workspacePackageGlob],
|
|
1360
|
-
dependencies: collectGeneratedManifestCatalogDependencies([
|
|
1361
|
-
rootManifest,
|
|
1362
|
-
packageManifest,
|
|
1363
|
-
]),
|
|
1364
|
-
}),
|
|
1365
|
-
},
|
|
1366
|
-
{
|
|
1367
|
-
kind: "writeJson",
|
|
1368
|
-
to: "turbo.json",
|
|
1369
|
-
value: packageTurboConfig({ dependencyBuildsRequired: false }),
|
|
1370
|
-
},
|
|
1371
|
-
{
|
|
1372
|
-
kind: "writeJson",
|
|
1373
|
-
to: `${packagePath}/package.json`,
|
|
1374
|
-
value: packageManifest,
|
|
1375
|
-
},
|
|
1376
|
-
{
|
|
1377
|
-
kind: "writeText",
|
|
1378
|
-
to: `${packagePath}/Cargo.toml`,
|
|
1379
|
-
text: rustCargoToml(rustProjectName(context), capability.cargoDependencies ?? []),
|
|
1380
|
-
},
|
|
1381
|
-
{
|
|
1382
|
-
kind: "writeText",
|
|
1383
|
-
to: `${packagePath}/Cargo.lock`,
|
|
1384
|
-
text: rustCargoLock(rustProjectName(context)),
|
|
1385
|
-
},
|
|
1386
|
-
{
|
|
1387
|
-
kind: "copyFile",
|
|
1388
|
-
from: "rustfmt.toml",
|
|
1389
|
-
to: `${packagePath}/rustfmt.toml`,
|
|
1390
|
-
},
|
|
1391
|
-
{
|
|
1392
|
-
kind: "writeTextTemplate",
|
|
1393
|
-
from: "rust-toolchain.toml",
|
|
1394
|
-
to: "rust-toolchain.toml",
|
|
1395
|
-
replacements: {
|
|
1396
|
-
RUST_TOOLCHAIN: rustLayer.toolchain,
|
|
1397
|
-
},
|
|
1398
|
-
},
|
|
1399
|
-
{
|
|
1400
|
-
kind: "writeText",
|
|
1401
|
-
to: ".gitignore",
|
|
1402
|
-
text: [
|
|
1403
|
-
"target",
|
|
1404
|
-
"node_modules",
|
|
1405
|
-
"dist",
|
|
1406
|
-
".env",
|
|
1407
|
-
".template/",
|
|
1408
|
-
".pnpm-store/",
|
|
1409
|
-
"",
|
|
1410
|
-
].join("\n"),
|
|
1411
|
-
},
|
|
1412
|
-
...capability.sourceFiles.map((sourceFile) => ({
|
|
1413
|
-
kind: "copyFile",
|
|
1414
|
-
from: sourceFile,
|
|
1415
|
-
to: `${packagePath}/${sourceFile}`,
|
|
1416
|
-
})),
|
|
1417
|
-
{
|
|
1418
|
-
kind: "writeJson",
|
|
1419
|
-
to: ".template/blueprint.json",
|
|
1420
|
-
value: context.blueprint,
|
|
1421
|
-
},
|
|
1422
|
-
{
|
|
1423
|
-
kind: "writeJson",
|
|
1424
|
-
to: ".template/generated-by.json",
|
|
1425
|
-
value: generationRecord(context),
|
|
1426
|
-
},
|
|
1427
|
-
{
|
|
1428
|
-
kind: "writeJson",
|
|
1429
|
-
to: ".devcontainer/devcontainer.json",
|
|
1430
|
-
value: developmentContainer.devcontainer,
|
|
1431
|
-
multilineArrays: ["customizations.vscode.extensions"],
|
|
1432
|
-
},
|
|
1433
|
-
{
|
|
1434
|
-
...developmentContainer.dockerfileOperation,
|
|
1435
|
-
},
|
|
1436
|
-
{
|
|
1437
|
-
kind: "writeJson",
|
|
1438
|
-
to: ".vscode/extensions.json",
|
|
1439
|
-
value: {
|
|
1440
|
-
recommendations: editorCustomization.extensions,
|
|
1441
|
-
},
|
|
1442
|
-
},
|
|
1443
|
-
{
|
|
1444
|
-
kind: "writeJson",
|
|
1445
|
-
to: ".vscode/settings.json",
|
|
1446
|
-
value: editorCustomization.settings,
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
kind: "copyFile",
|
|
1450
|
-
from: ".github/workflows/check.yml",
|
|
1451
|
-
to: ".github/workflows/check.yml",
|
|
1452
|
-
},
|
|
1453
|
-
{
|
|
1454
|
-
kind: "writeTextTemplate",
|
|
1455
|
-
from: ".github/dependabot.yml",
|
|
1456
|
-
to: ".github/dependabot.yml",
|
|
1457
|
-
replacements: {
|
|
1458
|
-
CARGO_PACKAGE_DIRECTORY: `/${packagePath}`,
|
|
1459
|
-
},
|
|
1460
|
-
},
|
|
1461
|
-
];
|
|
1462
|
-
}
|
|
1463
|
-
function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
1464
|
-
if (state.nodeWorkspace === undefined) {
|
|
1465
|
-
throw new Error("workspace-node-packages capability state is missing");
|
|
1466
|
-
}
|
|
1467
|
-
const capability = state.nodeWorkspace;
|
|
1468
|
-
const packageLinkPlan = nodePackageLinkPlan(context, capability);
|
|
1469
|
-
const nodePackageManifests = capability.packages.map((nodePackage) => {
|
|
1470
|
-
const scripts = nodePackageScripts(nodePackage, capability);
|
|
1471
|
-
const packageName = nodePackageName(context, nodePackage);
|
|
1472
|
-
if (nodePackage.kind === "hono-api") {
|
|
1473
|
-
const exposure = packageLinkPlan.exposuresByPackagePath.get(nodePackage.path);
|
|
1474
|
-
return honoApiPackageJson(context, packageName, scripts, exposure === undefined
|
|
1475
|
-
? undefined
|
|
1476
|
-
: packageManifestExposureFields(exposure));
|
|
1477
|
-
}
|
|
1478
|
-
if (nodePackage.kind === "vike-app") {
|
|
1479
|
-
return vikePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
|
|
1480
|
-
}
|
|
1481
|
-
return vuePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
|
|
1482
|
-
});
|
|
1483
|
-
const vikeDbManifest = hasVikePackage(capability)
|
|
1484
|
-
? vikeDbPackageJson(context)
|
|
1485
|
-
: undefined;
|
|
1486
|
-
const packageManifests = vikeDbManifest === undefined
|
|
1487
|
-
? nodePackageManifests
|
|
1488
|
-
: [...nodePackageManifests, vikeDbManifest];
|
|
1489
|
-
const rootManifest = rootPackageJson(context, packageScripts, state);
|
|
1490
|
-
if (rootManifest === undefined) {
|
|
1491
|
-
throw new Error("workspace-node-packages rendered no package manifests");
|
|
1492
|
-
}
|
|
1493
|
-
return [
|
|
1494
|
-
{
|
|
1495
|
-
kind: "writeJson",
|
|
1496
|
-
to: "package.json",
|
|
1497
|
-
value: rootManifest,
|
|
1498
|
-
},
|
|
1499
|
-
{
|
|
1500
|
-
kind: "writeText",
|
|
1501
|
-
to: "pnpm-workspace.yaml",
|
|
1502
|
-
text: renderGeneratedPnpmWorkspaceYaml({
|
|
1503
|
-
packages: workspacePackageGlobsForNodeWorkspace(capability),
|
|
1504
|
-
dependencies: capability.packageLinks === undefined
|
|
1505
|
-
? collectGeneratedManifestCatalogDependencies([
|
|
1506
|
-
rootManifest,
|
|
1507
|
-
...packageManifests,
|
|
1508
|
-
])
|
|
1509
|
-
: collectGeneratedManifestCatalogReferences([
|
|
1510
|
-
rootManifest,
|
|
1511
|
-
...packageManifests,
|
|
1512
|
-
]),
|
|
1513
|
-
...(hasVuePackage(capability)
|
|
1514
|
-
? {
|
|
1515
|
-
allowBuilds: {
|
|
1516
|
-
esbuild: true,
|
|
1517
|
-
},
|
|
1518
|
-
}
|
|
1519
|
-
: {}),
|
|
1520
|
-
}),
|
|
1521
|
-
},
|
|
1522
|
-
{
|
|
1523
|
-
kind: "writeJson",
|
|
1524
|
-
to: "turbo.json",
|
|
1525
|
-
value: {
|
|
1526
|
-
tasks: {
|
|
1527
|
-
...packageLinkPlan.turboTasks,
|
|
1528
|
-
...(hasVuePackage(capability)
|
|
1529
|
-
? {
|
|
1530
|
-
dev: {
|
|
1531
|
-
cache: false,
|
|
1532
|
-
persistent: true,
|
|
1533
|
-
},
|
|
1534
|
-
}
|
|
1535
|
-
: {}),
|
|
1536
|
-
},
|
|
1537
|
-
boundaries: packageTurboConfig({
|
|
1538
|
-
dependencyBuildsRequired: false,
|
|
1539
|
-
}).boundaries,
|
|
1540
|
-
},
|
|
1541
|
-
},
|
|
1542
|
-
{
|
|
1543
|
-
kind: "writeText",
|
|
1544
|
-
to: ".gitignore",
|
|
1545
|
-
text: gitignoreForNodeWorkspace(capability),
|
|
1546
|
-
},
|
|
1547
|
-
...capability.packages.flatMap((nodePackage, index) => [
|
|
1548
|
-
{
|
|
1549
|
-
kind: "writeJson",
|
|
1550
|
-
to: `${nodePackage.path}/package.json`,
|
|
1551
|
-
value: nodePackageManifests[index],
|
|
1552
|
-
},
|
|
1553
|
-
...nodePackageTsconfigOperations(nodePackage, capability),
|
|
1554
|
-
...nodePackage.sourceFiles.flatMap((sourceFile) => vikeTemplateSourceOperation({
|
|
1555
|
-
context,
|
|
1556
|
-
nodePackage,
|
|
1557
|
-
sourceFile,
|
|
1558
|
-
workspace: capability,
|
|
1559
|
-
})),
|
|
1560
|
-
]),
|
|
1561
|
-
...(vikeDbManifest === undefined ? [] : vikeDbPackageOperations(context)),
|
|
1562
|
-
{
|
|
1563
|
-
kind: "writeJson",
|
|
1564
|
-
to: ".template/blueprint.json",
|
|
1565
|
-
value: context.blueprint,
|
|
1566
|
-
},
|
|
1567
|
-
{
|
|
1568
|
-
kind: "writeJson",
|
|
1569
|
-
to: ".template/generated-by.json",
|
|
1570
|
-
value: generationRecord(context),
|
|
1571
|
-
},
|
|
1572
|
-
];
|
|
1573
|
-
}
|
|
1574
|
-
function nodePackageScripts(nodePackage, workspace) {
|
|
1575
|
-
const oxcScripts = {
|
|
1576
|
-
"format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
1577
|
-
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1578
|
-
lint: "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
1579
|
-
"lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
1580
|
-
};
|
|
1581
|
-
if (nodePackage.kind === "hono-api") {
|
|
1582
|
-
return {
|
|
1583
|
-
"build:run": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
1584
|
-
...(workspace.packages.length > 1
|
|
1585
|
-
? { dev: "tsx watch src/server.ts" }
|
|
1586
|
-
: {}),
|
|
1587
|
-
...leafScriptFragments(oxcScripts),
|
|
1588
|
-
start: "node dist/server.js",
|
|
1589
|
-
"test:run": "vitest run --reporter=agent --silent=passed-only",
|
|
1590
|
-
"typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
if (nodePackage.kind === "vike-app") {
|
|
1594
|
-
const dbCommand = "DATABASE_FILE=../../apps/web/data/app.sqlite pnpm --dir ../../packages/db run db:prepare:dev";
|
|
1595
|
-
return {
|
|
1596
|
-
"build:run": "vike build",
|
|
1597
|
-
"check:deployment": "node --experimental-strip-types scripts/check-standalone-deployment.ts",
|
|
1598
|
-
dev: `${dbCommand} && vike dev`,
|
|
1599
|
-
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
1600
|
-
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1601
|
-
"lint:run": "oxlint --quiet --format=unix --type-aware --config ../../oxlint.config.ts .",
|
|
1602
|
-
"lint:fix:run": "oxlint --type-aware --format=unix --config ../../oxlint.config.ts . --fix",
|
|
1603
|
-
preview: `${dbCommand} && vike preview`,
|
|
1604
|
-
start: "node ./dist/server/index.mjs",
|
|
1605
|
-
"test:run": "vitest run --reporter=agent --silent=passed-only --passWithNoTests",
|
|
1606
|
-
"test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
|
|
1607
|
-
"typecheck:run": "vue-tsc --build --noEmit --pretty false",
|
|
1608
|
-
};
|
|
1609
|
-
}
|
|
1610
|
-
return {
|
|
1611
|
-
"build:run": "vite build",
|
|
1612
|
-
dev: "vite",
|
|
1613
|
-
...leafScriptFragments(oxcScripts),
|
|
1614
|
-
preview: "vite preview",
|
|
1615
|
-
"test:run": "vitest run --reporter=agent --silent=passed-only",
|
|
1616
|
-
"test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
|
|
1617
|
-
"typecheck:run": workspace.packages.length > 1
|
|
1618
|
-
? "vue-tsc --build --pretty false"
|
|
1619
|
-
: "vue-tsc --build --noEmit --pretty false",
|
|
1620
|
-
};
|
|
1621
|
-
}
|
|
1622
|
-
function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
1623
|
-
if (nodePackage.kind === "vike-app") {
|
|
1624
|
-
return [
|
|
1625
|
-
{
|
|
1626
|
-
kind: "writeJson",
|
|
1627
|
-
to: `${nodePackage.path}/tsconfig.json`,
|
|
1628
|
-
value: {
|
|
1629
|
-
files: [],
|
|
1630
|
-
references: [
|
|
1631
|
-
{ path: "../../packages/db" },
|
|
1632
|
-
{ path: "./tsconfig.app.json" },
|
|
1633
|
-
{ path: "./tsconfig.test.json" },
|
|
1634
|
-
{ path: "./tsconfig.node.json" },
|
|
1635
|
-
],
|
|
1636
|
-
},
|
|
1637
|
-
},
|
|
1638
|
-
{
|
|
1639
|
-
kind: "writeJson",
|
|
1640
|
-
to: `${nodePackage.path}/tsconfig.app.json`,
|
|
1641
|
-
value: {
|
|
1642
|
-
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
1643
|
-
compilerOptions: {
|
|
1644
|
-
...strictTypeScriptCompilerOptions({
|
|
1645
|
-
composite: true,
|
|
1646
|
-
module: "esnext",
|
|
1647
|
-
moduleResolution: "bundler",
|
|
1648
|
-
paths: { "#/*": ["./*"] },
|
|
1649
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
1650
|
-
types: ["node"],
|
|
1651
|
-
}),
|
|
1652
|
-
skipLibCheck: true,
|
|
1653
|
-
},
|
|
1654
|
-
include: [
|
|
1655
|
-
"+server.ts",
|
|
1656
|
-
"assets/**/*.svg",
|
|
1657
|
-
"components/**/*.vue",
|
|
1658
|
-
"pages/**/*.ts",
|
|
1659
|
-
"pages/**/*.vue",
|
|
1660
|
-
"server/**/*.ts",
|
|
1661
|
-
"types/**/*.d.ts",
|
|
1662
|
-
],
|
|
1663
|
-
},
|
|
1664
|
-
},
|
|
1665
|
-
{
|
|
1666
|
-
kind: "writeJson",
|
|
1667
|
-
to: `${nodePackage.path}/tsconfig.test.json`,
|
|
1668
|
-
value: {
|
|
1669
|
-
extends: "./tsconfig.app.json",
|
|
1670
|
-
compilerOptions: {
|
|
1671
|
-
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1672
|
-
paths: { "#/*": ["./*"] },
|
|
1673
|
-
skipLibCheck: true,
|
|
1674
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
|
|
1675
|
-
types: ["node", "vitest/globals"],
|
|
1676
|
-
},
|
|
1677
|
-
include: ["test/**/*.ts", "vitest.config.ts"],
|
|
1678
|
-
},
|
|
1679
|
-
},
|
|
1680
|
-
{
|
|
1681
|
-
kind: "writeJson",
|
|
1682
|
-
to: `${nodePackage.path}/tsconfig.node.json`,
|
|
1683
|
-
multilineArrays: ["include"],
|
|
1684
|
-
value: {
|
|
1685
|
-
compilerOptions: {
|
|
1686
|
-
...strictTypeScriptCompilerOptions({
|
|
1687
|
-
composite: true,
|
|
1688
|
-
module: "esnext",
|
|
1689
|
-
moduleResolution: "bundler",
|
|
1690
|
-
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1691
|
-
paths: { "#/*": ["./*"] },
|
|
1692
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
1693
|
-
types: ["node"],
|
|
1694
|
-
}),
|
|
1695
|
-
skipLibCheck: true,
|
|
1696
|
-
},
|
|
1697
|
-
include: [
|
|
1698
|
-
"playwright.config.ts",
|
|
1699
|
-
"scripts/**/*.ts",
|
|
1700
|
-
"vite.config.ts",
|
|
1701
|
-
"vitest.config.ts",
|
|
1702
|
-
],
|
|
1703
|
-
},
|
|
1704
|
-
},
|
|
1705
|
-
];
|
|
1706
|
-
}
|
|
1707
|
-
if (nodePackage.kind === "hono-api") {
|
|
1708
|
-
return [
|
|
1709
|
-
{
|
|
1710
|
-
kind: "writeJson",
|
|
1711
|
-
to: `${nodePackage.path}/tsconfig.json`,
|
|
1712
|
-
value: {
|
|
1713
|
-
compilerOptions: strictTypeScriptCompilerOptions({
|
|
1714
|
-
composite: true,
|
|
1715
|
-
...(workspace.packages.length > 1
|
|
1716
|
-
? { declaration: true, declarationMap: true }
|
|
1717
|
-
: {}),
|
|
1718
|
-
module: "nodenext",
|
|
1719
|
-
moduleResolution: "nodenext",
|
|
1720
|
-
types: ["node", "vitest/globals"],
|
|
1721
|
-
}),
|
|
1722
|
-
include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
|
|
1723
|
-
},
|
|
1724
|
-
},
|
|
1725
|
-
{
|
|
1726
|
-
kind: "writeJson",
|
|
1727
|
-
to: `${nodePackage.path}/tsconfig.build.json`,
|
|
1728
|
-
value: {
|
|
1729
|
-
extends: "./tsconfig.json",
|
|
1730
|
-
compilerOptions: {
|
|
1731
|
-
outDir: "dist",
|
|
1732
|
-
rootDir: "src",
|
|
1733
|
-
types: ["node"],
|
|
1734
|
-
},
|
|
1735
|
-
include: ["src/**/*.ts"],
|
|
1736
|
-
},
|
|
1737
|
-
},
|
|
1738
|
-
];
|
|
1739
|
-
}
|
|
1740
|
-
return [
|
|
1741
|
-
{
|
|
1742
|
-
kind: "writeJson",
|
|
1743
|
-
to: `${nodePackage.path}/tsconfig.json`,
|
|
1744
|
-
value: {
|
|
1745
|
-
files: [],
|
|
1746
|
-
references: [
|
|
1747
|
-
{ path: "./tsconfig.app.json" },
|
|
1748
|
-
{ path: "./tsconfig.test.json" },
|
|
1749
|
-
{ path: "./tsconfig.node.json" },
|
|
1750
|
-
],
|
|
1751
|
-
},
|
|
1752
|
-
},
|
|
1753
|
-
{
|
|
1754
|
-
kind: "writeJson",
|
|
1755
|
-
to: `${nodePackage.path}/tsconfig.app.json`,
|
|
1756
|
-
value: {
|
|
1757
|
-
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
1758
|
-
compilerOptions: strictTypeScriptCompilerOptions({
|
|
1759
|
-
composite: true,
|
|
1760
|
-
module: "esnext",
|
|
1761
|
-
moduleResolution: "bundler",
|
|
1762
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
1763
|
-
types: ["web-bluetooth"],
|
|
1764
|
-
}),
|
|
1765
|
-
include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
|
|
1766
|
-
},
|
|
1767
|
-
},
|
|
1768
|
-
{
|
|
1769
|
-
kind: "writeJson",
|
|
1770
|
-
to: `${nodePackage.path}/tsconfig.test.json`,
|
|
1771
|
-
value: {
|
|
1772
|
-
extends: "./tsconfig.app.json",
|
|
1773
|
-
compilerOptions: {
|
|
1774
|
-
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1775
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
|
|
1776
|
-
types: ["node", "vitest/globals", "web-bluetooth"],
|
|
1777
|
-
},
|
|
1778
|
-
include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"],
|
|
1779
|
-
},
|
|
1780
|
-
},
|
|
1781
|
-
{
|
|
1782
|
-
kind: "writeJson",
|
|
1783
|
-
to: `${nodePackage.path}/tsconfig.node.json`,
|
|
1784
|
-
multilineArrays: ["include"],
|
|
1785
|
-
value: {
|
|
1786
|
-
compilerOptions: strictTypeScriptCompilerOptions({
|
|
1787
|
-
composite: true,
|
|
1788
|
-
module: "esnext",
|
|
1789
|
-
moduleResolution: "bundler",
|
|
1790
|
-
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1791
|
-
...(workspace.packages.length > 1
|
|
1792
|
-
? { outDir: "./node_modules/.tmp/tsconfig.node" }
|
|
1793
|
-
: {}),
|
|
1794
|
-
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
1795
|
-
types: ["node"],
|
|
1796
|
-
}),
|
|
1797
|
-
include: [
|
|
1798
|
-
"playwright.config.ts",
|
|
1799
|
-
"scripts/**/*.ts",
|
|
1800
|
-
"vite.config.ts",
|
|
1801
|
-
"vitest.config.ts",
|
|
1802
|
-
],
|
|
1803
|
-
},
|
|
1804
|
-
},
|
|
1805
|
-
];
|
|
1806
|
-
}
|
|
1807
|
-
function honoApiTsconfigOperations(packagePath) {
|
|
1808
|
-
const operations = nodePackageTsconfigOperations({
|
|
1809
|
-
kind: "hono-api",
|
|
1810
|
-
path: "apps/api",
|
|
1811
|
-
sourceFiles: [],
|
|
1812
|
-
}, {
|
|
1813
|
-
kind: "workspace-node-packages",
|
|
1814
|
-
workspacePackageGlob: "apps/*",
|
|
1815
|
-
packages: [
|
|
1816
|
-
{
|
|
1817
|
-
kind: "hono-api",
|
|
1818
|
-
path: "apps/api",
|
|
1819
|
-
sourceFiles: [],
|
|
1820
|
-
},
|
|
1821
|
-
],
|
|
1822
|
-
});
|
|
1823
|
-
return operations.map((operation) => ({
|
|
1824
|
-
...operation,
|
|
1825
|
-
to: operation.to.replace(/^apps\/api/, packagePath),
|
|
1826
|
-
}));
|
|
1827
|
-
}
|
|
1828
|
-
function vueAppTsconfigOperations(packagePath) {
|
|
1829
|
-
const operations = nodePackageTsconfigOperations({
|
|
1830
|
-
kind: "vue-app",
|
|
1831
|
-
path: "apps/web",
|
|
1832
|
-
sourceFiles: [],
|
|
1833
|
-
}, {
|
|
1834
|
-
kind: "workspace-node-packages",
|
|
1835
|
-
workspacePackageGlob: "apps/*",
|
|
1836
|
-
packages: [
|
|
1837
|
-
{
|
|
1838
|
-
kind: "vue-app",
|
|
1839
|
-
path: "apps/web",
|
|
1840
|
-
sourceFiles: [],
|
|
1841
|
-
},
|
|
1842
|
-
],
|
|
1843
|
-
});
|
|
1844
|
-
return operations.map((operation) => ({
|
|
1845
|
-
...operation,
|
|
1846
|
-
to: operation.to.replace(/^apps\/web/, packagePath),
|
|
1847
|
-
}));
|
|
1848
|
-
}
|
|
1849
|
-
function sourcePathWithinNodePackage(sourceFile, workspace) {
|
|
1850
|
-
if (workspace.packages.length === 1 && !sourceFile.startsWith("web/")) {
|
|
1851
|
-
return sourceFile;
|
|
1852
|
-
}
|
|
1853
|
-
return sourceFile.replace(/^(api|web)\//, "");
|
|
1854
|
-
}
|
|
1855
|
-
function nodePackageTargetPath(nodePackage, sourceFile, workspace) {
|
|
1856
|
-
const packageRelativePath = sourcePathWithinNodePackage(sourceFile, workspace);
|
|
1857
|
-
return `${nodePackage.path}/${packageRelativePath}`;
|
|
1858
|
-
}
|
|
1859
|
-
function vikeTemplateSourceOperation(options) {
|
|
1860
|
-
const to = nodePackageTargetPath(options.nodePackage, options.sourceFile, options.workspace);
|
|
1861
|
-
const copyOperation = {
|
|
1862
|
-
kind: "copyFile",
|
|
1863
|
-
from: options.sourceFile,
|
|
1864
|
-
to,
|
|
1865
|
-
};
|
|
1866
|
-
if (options.nodePackage.kind === "vike-app" &&
|
|
1867
|
-
options.sourceFile === "web/Dockerfile") {
|
|
1868
|
-
return [
|
|
1869
|
-
{
|
|
1870
|
-
kind: "writeTextTemplate",
|
|
1871
|
-
from: options.sourceFile,
|
|
1872
|
-
to,
|
|
1873
|
-
replacements: {
|
|
1874
|
-
NODE_VERSION: options.context.toolchain.nodeLtsMajor.value,
|
|
1875
|
-
PACKAGE_MANAGER_PIN: options.context.toolchain.packageManagerPin.value,
|
|
1876
|
-
WEB_PACKAGE_NAME: nodePackageName(options.context, options.nodePackage),
|
|
1877
|
-
},
|
|
1878
|
-
},
|
|
1879
|
-
];
|
|
1880
|
-
}
|
|
1881
|
-
if (options.nodePackage.kind === "vike-app" &&
|
|
1882
|
-
[
|
|
1883
|
-
"web/pages/index/+Page.telefunc.ts",
|
|
1884
|
-
"web/server/app.ts",
|
|
1885
|
-
"web/types/global.d.ts",
|
|
1886
|
-
].includes(options.sourceFile)) {
|
|
1887
|
-
const dbPackageName = vikeDbPackageName(options.context);
|
|
1888
|
-
const replacements = {
|
|
1889
|
-
"web/pages/index/+Page.telefunc.ts": `import { createTodo, listTodos } from "${dbPackageName}/queries/todos";`,
|
|
1890
|
-
"web/server/app.ts": [
|
|
1891
|
-
`import { createDatabase } from "${dbPackageName}";`,
|
|
1892
|
-
`import { assertDatabaseReady } from "${dbPackageName}/readiness";`,
|
|
1893
|
-
].join("\n"),
|
|
1894
|
-
"web/types/global.d.ts": `import type { Database } from "${dbPackageName}";`,
|
|
1895
|
-
};
|
|
1896
|
-
return [
|
|
1897
|
-
copyOperation,
|
|
1898
|
-
{
|
|
1899
|
-
kind: "replaceAnchors",
|
|
1900
|
-
path: to,
|
|
1901
|
-
language: "typescript",
|
|
1902
|
-
replacements: {
|
|
1903
|
-
"db-package-import": replacements[options.sourceFile],
|
|
1904
|
-
},
|
|
1905
|
-
},
|
|
1906
|
-
];
|
|
1907
|
-
}
|
|
1908
|
-
return [copyOperation];
|
|
1909
|
-
}
|
|
1910
|
-
const vikeDbSourceFiles = [
|
|
1911
|
-
"db/turbo.json",
|
|
1912
|
-
"db/drizzle.config.ts",
|
|
1913
|
-
"db/drizzle/migrations/20260709120325_old_captain_flint/migration.sql",
|
|
1914
|
-
"db/drizzle/migrations/20260709120325_old_captain_flint/snapshot.json",
|
|
1915
|
-
"db/scripts/seed-example.ts",
|
|
1916
|
-
"db/src/db.ts",
|
|
1917
|
-
"db/src/index.ts",
|
|
1918
|
-
"db/src/queries/todos.ts",
|
|
1919
|
-
"db/src/readiness.ts",
|
|
1920
|
-
"db/src/seed/example.ts",
|
|
1921
|
-
"db/src/schema.ts",
|
|
1922
|
-
"db/test/todos.test.ts",
|
|
1923
|
-
];
|
|
1924
|
-
function vikeDbPackageOperations(context) {
|
|
1925
|
-
const packagePath = vikeDbPackagePath();
|
|
1926
|
-
return [
|
|
1927
|
-
{
|
|
1928
|
-
kind: "writeJson",
|
|
1929
|
-
to: `${packagePath}/package.json`,
|
|
1930
|
-
value: vikeDbPackageJson(context),
|
|
1931
|
-
},
|
|
1932
|
-
{
|
|
1933
|
-
kind: "writeJson",
|
|
1934
|
-
to: `${packagePath}/tsconfig.json`,
|
|
1935
|
-
value: vikeDbTsconfigJson(),
|
|
1936
|
-
},
|
|
1937
|
-
...vikeDbSourceFiles.map((sourceFile) => ({
|
|
1938
|
-
kind: "copyFile",
|
|
1939
|
-
from: sourceFile,
|
|
1940
|
-
to: `${packagePath}/${sourceFile.replace(/^db\//, "")}`,
|
|
1941
|
-
})),
|
|
1942
|
-
];
|
|
1943
|
-
}
|
|
1944
|
-
function vikeDbTsconfigJson() {
|
|
1945
|
-
return {
|
|
1946
|
-
compilerOptions: {
|
|
1947
|
-
...strictTypeScriptCompilerOptions({
|
|
1948
|
-
composite: true,
|
|
1949
|
-
declaration: true,
|
|
1950
|
-
declarationMap: true,
|
|
1951
|
-
module: "esnext",
|
|
1952
|
-
moduleResolution: "bundler",
|
|
1953
|
-
paths: { "#db/*": ["./src/*"] },
|
|
1954
|
-
rootDir: ".",
|
|
1955
|
-
types: ["node"],
|
|
1956
|
-
}),
|
|
1957
|
-
skipLibCheck: true,
|
|
1958
|
-
},
|
|
1959
|
-
include: ["src/**/*.ts", "test/**/*.ts", "drizzle.config.ts"],
|
|
1960
|
-
};
|
|
1961
|
-
}
|
|
1962
|
-
function workspacePackageGlobsForNodeWorkspace(workspace) {
|
|
1963
|
-
return hasVikePackage(workspace)
|
|
1964
|
-
? [workspace.workspacePackageGlob, "packages/*"]
|
|
1965
|
-
: [workspace.workspacePackageGlob];
|
|
1966
|
-
}
|
|
1967
|
-
function gitignoreForNodeWorkspace(workspace) {
|
|
1968
|
-
return [
|
|
1969
|
-
"node_modules",
|
|
1970
|
-
"dist",
|
|
1971
|
-
...(hasVuePackage(workspace) ? ["playwright-report", "test-results"] : []),
|
|
1972
|
-
".env",
|
|
1973
|
-
".template/",
|
|
1974
|
-
".pnpm-store/",
|
|
1975
|
-
"",
|
|
1976
|
-
].join("\n");
|
|
1977
|
-
}
|
|
1978
|
-
function strictTypescriptOperations({ context, state, }) {
|
|
1979
|
-
if (state.package === undefined && state.nodeWorkspace === undefined) {
|
|
1980
|
-
throw new Error("strict-typescript-root requires a workspace package layout");
|
|
1981
|
-
}
|
|
1982
|
-
const rootConfigTsconfigOperation = () => {
|
|
1983
|
-
if (state.sourceRoots.sharedOxc === undefined) {
|
|
1984
|
-
throw new Error("strict-typescript-root requires shared OXC source when rendering tsconfig.config.json");
|
|
1985
|
-
}
|
|
1986
|
-
return {
|
|
1987
|
-
kind: "copyFile",
|
|
1988
|
-
from: "tsconfig.config.json",
|
|
1989
|
-
to: "tsconfig.config.json",
|
|
1990
|
-
sourceRoot: "sharedOxc",
|
|
1991
|
-
};
|
|
1992
|
-
};
|
|
1993
|
-
if (state.nodeWorkspace !== undefined) {
|
|
1994
|
-
return [
|
|
1995
|
-
{
|
|
1996
|
-
kind: "writeJson",
|
|
1997
|
-
to: "tsconfig.json",
|
|
1998
|
-
value: {
|
|
1999
|
-
files: [],
|
|
2000
|
-
references: rootTsconfigReferences(state.nodeWorkspace),
|
|
2001
|
-
},
|
|
2002
|
-
},
|
|
2003
|
-
rootConfigTsconfigOperation(),
|
|
2004
|
-
];
|
|
2005
|
-
}
|
|
2006
|
-
const libraryPackage = state.package;
|
|
2007
|
-
return [
|
|
2008
|
-
{
|
|
2009
|
-
kind: "writeJson",
|
|
2010
|
-
to: "tsconfig.json",
|
|
2011
|
-
value: {
|
|
2012
|
-
files: [],
|
|
2013
|
-
},
|
|
2014
|
-
},
|
|
2015
|
-
rootConfigTsconfigOperation(),
|
|
2016
|
-
{
|
|
2017
|
-
kind: "writeJson",
|
|
2018
|
-
to: `${workspacePackagePath(context, libraryPackage)}/tsconfig.json`,
|
|
2019
|
-
value: libraryTsconfigJson(),
|
|
2020
|
-
},
|
|
2021
|
-
];
|
|
2022
|
-
}
|
|
2023
|
-
function rootTsconfigReferences(workspace) {
|
|
2024
|
-
return workspace.packages.flatMap((nodePackage) => {
|
|
2025
|
-
if (nodePackage.kind === "hono-api") {
|
|
2026
|
-
return hasVuePackage(workspace)
|
|
2027
|
-
? []
|
|
2028
|
-
: [{ path: `./${nodePackage.path}/tsconfig.json` }];
|
|
2029
|
-
}
|
|
2030
|
-
if (nodePackage.kind === "vike-app") {
|
|
2031
|
-
return [
|
|
2032
|
-
{ path: "./packages/db" },
|
|
2033
|
-
{ path: `./${nodePackage.path}/tsconfig.app.json` },
|
|
2034
|
-
{ path: `./${nodePackage.path}/tsconfig.test.json` },
|
|
2035
|
-
{ path: `./${nodePackage.path}/tsconfig.node.json` },
|
|
2036
|
-
];
|
|
2037
|
-
}
|
|
2038
|
-
return [
|
|
2039
|
-
{ path: `./${nodePackage.path}/tsconfig.app.json` },
|
|
2040
|
-
{ path: `./${nodePackage.path}/tsconfig.test.json` },
|
|
2041
|
-
{ path: `./${nodePackage.path}/tsconfig.node.json` },
|
|
2042
|
-
];
|
|
2043
|
-
});
|
|
2044
|
-
}
|
|
2045
|
-
function oxcFormatLintOperations({ state, }) {
|
|
2046
|
-
const editorCustomization = editorCustomizationForCapabilities(state.editorCustomizationCapabilities, editorCustomizationDeclarationsForState(state));
|
|
2047
|
-
return [
|
|
2048
|
-
{
|
|
2049
|
-
kind: "copyFile",
|
|
2050
|
-
sourceRoot: "sharedOxc",
|
|
2051
|
-
from: state.nodeWorkspace && hasVuePackage(state.nodeWorkspace)
|
|
2052
|
-
? "vue/oxlint.config.ts"
|
|
2053
|
-
: "node/oxlint.config.ts",
|
|
2054
|
-
to: "oxlint.config.ts",
|
|
2055
|
-
},
|
|
2056
|
-
{
|
|
2057
|
-
kind: "copyFile",
|
|
2058
|
-
sourceRoot: "sharedOxc",
|
|
2059
|
-
from: "oxfmt.config.ts",
|
|
2060
|
-
to: "oxfmt.config.ts",
|
|
2061
|
-
},
|
|
2062
|
-
{
|
|
2063
|
-
kind: "writeJson",
|
|
2064
|
-
to: ".vscode/extensions.json",
|
|
2065
|
-
value: {
|
|
2066
|
-
recommendations: editorCustomization.extensions,
|
|
2067
|
-
},
|
|
2068
|
-
multilineArrays: ["recommendations"],
|
|
2069
|
-
},
|
|
2070
|
-
{
|
|
2071
|
-
kind: "writeJson",
|
|
2072
|
-
to: ".vscode/settings.json",
|
|
2073
|
-
value: editorCustomization.settings,
|
|
2074
|
-
},
|
|
2075
|
-
];
|
|
2076
|
-
}
|
|
2077
|
-
function nodePnpmDevcontainerOperations({ context, state, }) {
|
|
2078
|
-
const additionalLayers = state.nodeWorkspace && hasVuePackage(state.nodeWorkspace)
|
|
2079
|
-
? [browserTestToolLayer()]
|
|
2080
|
-
: [];
|
|
2081
|
-
const dockerfileFragments = readDevelopmentContainerDockerfileFragments(state, additionalLayers.length === 0 ? [] : ["browserTest"]);
|
|
2082
|
-
const editorCustomization = editorCustomizationForCapabilities(state.editorCustomizationCapabilities, editorCustomizationDeclarationsForState(state));
|
|
2083
|
-
const developmentContainer = checkedDockerfileFirstNodePnpmDevcontainer({
|
|
2084
|
-
name: context.projectName.value,
|
|
2085
|
-
layer: nodePnpmToolLayer({
|
|
2086
|
-
nodeVersion: context.toolchain.nodeLtsMajor.value,
|
|
2087
|
-
packageManagerPin: context.toolchain.packageManagerPin.value,
|
|
2088
|
-
}),
|
|
2089
|
-
dockerfileFragments,
|
|
2090
|
-
additionalLayers,
|
|
2091
|
-
extensions: editorCustomization.extensions,
|
|
2092
|
-
settings: editorCustomization.settings,
|
|
2093
|
-
});
|
|
2094
|
-
return [
|
|
2095
|
-
{
|
|
2096
|
-
kind: "writeJson",
|
|
2097
|
-
to: ".devcontainer/devcontainer.json",
|
|
2098
|
-
value: developmentContainer.devcontainer,
|
|
2099
|
-
multilineArrays: ["customizations.vscode.extensions"],
|
|
2100
|
-
},
|
|
2101
|
-
{
|
|
2102
|
-
...developmentContainer.dockerfileOperation,
|
|
2103
|
-
},
|
|
2104
|
-
];
|
|
2105
|
-
}
|
|
2106
|
-
function readDevelopmentContainerDockerfileFragments(state, optionalFragments) {
|
|
2107
|
-
if (state.devcontainerResource === undefined) {
|
|
2108
|
-
throw new Error("Projection Capability composition did not provide a Development Container Shared Resource");
|
|
2109
|
-
}
|
|
2110
|
-
const fragmentNames = {
|
|
2111
|
-
nodePnpm: "node-pnpm.Dockerfile",
|
|
2112
|
-
browserTest: "browser-test.Dockerfile",
|
|
2113
|
-
rust: "rust.Dockerfile",
|
|
2114
|
-
};
|
|
2115
|
-
const selected = new Set(optionalFragments);
|
|
2116
|
-
return {
|
|
2117
|
-
sourceRoot: state.devcontainerResource.sourceRootKey,
|
|
2118
|
-
nodePnpm: readDevelopmentContainerDockerfileFragment(state.devcontainerResource, fragmentNames.nodePnpm),
|
|
2119
|
-
...(selected.has("browserTest")
|
|
2120
|
-
? {
|
|
2121
|
-
browserTest: readDevelopmentContainerDockerfileFragment(state.devcontainerResource, fragmentNames.browserTest),
|
|
2122
|
-
}
|
|
2123
|
-
: {}),
|
|
2124
|
-
...(selected.has("rust")
|
|
2125
|
-
? {
|
|
2126
|
-
rust: readDevelopmentContainerDockerfileFragment(state.devcontainerResource, fragmentNames.rust),
|
|
2127
|
-
}
|
|
2128
|
-
: {}),
|
|
2129
|
-
};
|
|
2130
|
-
}
|
|
2131
|
-
function readDevelopmentContainerDockerfileFragment(resource, fragmentName) {
|
|
2132
|
-
const filePath = path.join(resource.root, fragmentName);
|
|
2133
|
-
try {
|
|
2134
|
-
return {
|
|
2135
|
-
from: fragmentName,
|
|
2136
|
-
text: readFileSync(filePath, "utf8"),
|
|
2137
|
-
};
|
|
2138
|
-
}
|
|
2139
|
-
catch (error) {
|
|
2140
|
-
if (isMissingDevelopmentContainerFragmentError(error)) {
|
|
2141
|
-
throw new Error(`Development Container Shared Resource ${resource.id} is missing Dockerfile fragment: ${fragmentName}`, { cause: error });
|
|
2142
|
-
}
|
|
2143
|
-
throw error;
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
function isMissingDevelopmentContainerFragmentError(error) {
|
|
2147
|
-
return (error instanceof Error &&
|
|
2148
|
-
"code" in error &&
|
|
2149
|
-
(error.code === "ENOENT" || error.code === "ENOTDIR"));
|
|
2150
|
-
}
|
|
2151
|
-
function githubMaintenanceOperations() {
|
|
2152
|
-
return [
|
|
2153
|
-
{
|
|
2154
|
-
kind: "copyFile",
|
|
2155
|
-
from: ".github/workflows/check.yml",
|
|
2156
|
-
to: ".github/workflows/check.yml",
|
|
2157
|
-
},
|
|
2158
|
-
{
|
|
2159
|
-
kind: "copyFile",
|
|
2160
|
-
from: ".github/dependabot.yml",
|
|
2161
|
-
to: ".github/dependabot.yml",
|
|
2162
|
-
},
|
|
2163
|
-
];
|
|
2164
|
-
}
|
|
2165
|
-
function templateSourceRoot(state, sourcePreset) {
|
|
2166
|
-
return templateSourceRootForPreset(state, sourcePreset);
|
|
2167
|
-
}
|
|
2168
|
-
function templateSourceRootForPreset(state, sourcePreset) {
|
|
2169
|
-
return state.projectionSourceRoots.preset(sourcePreset);
|
|
2170
|
-
}
|