@ykdz/template 0.0.23 → 0.0.24
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 +85 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +797 -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 +134 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +36 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +106 -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 +138 -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 +408 -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 +94 -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 +179 -0
- package/node_modules/@ykdz/template-builtin-presets/package.json +67 -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/.pnpmfile.cts +14 -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 +23 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.yaml +29 -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/tsconfig.json +4 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/turbo.json +18 -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-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 +21 -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 +83 -21
- 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 +1 -0
- 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 +2 -1
- 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-core/dist/Cargo.toml +1 -1
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +9 -0
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +54 -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 +31 -2
- package/node_modules/@ykdz/template-core/dist/module-graph.js +40 -0
- package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +43 -0
- package/node_modules/@ykdz/template-core/dist/package-contribution.js +24 -0
- package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +24 -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 +8 -1
- package/node_modules/@ykdz/template-core/dist/project-github.js +86 -8
- 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 → template-builtin-presets}/templates/vike-app/db/turbo.json +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/turbo.json +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/playwright.config.ts +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/templates/vike-app → template-builtin-presets/templates/vue-hono-app}/web/turbo.json +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,665 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { validateProjectBlueprint, } from "@ykdz/template-shared";
|
|
4
|
-
import { PackageAdditionSupport, } from "@ykdz/template-shared";
|
|
5
|
-
import { collectGeneratedManifestCatalogReferences, pnpmWorkspaceYamlWithCatalogDependencies, } from "./dependency-catalog.js";
|
|
6
|
-
import { renderTurboRunCommand } from "./module-graph.js";
|
|
7
|
-
import { assertTypeScriptPackageBoundaryForLinkIntent, packageTurboConfig, planPackageLinks, } from "./package-linking.js";
|
|
8
|
-
import { findPresetSourceManifestPreset, } from "./preset-source.js";
|
|
9
|
-
import { defaultPackagePathForPresetSourcePackageAddition, planPresetSourcePackageAddition, } from "./projection-capabilities.js";
|
|
10
|
-
import { renderProject } from "./renderer.js";
|
|
11
|
-
function projectNameFromBlueprint(blueprint, fallbackProjectName) {
|
|
12
|
-
const firstPackage = blueprint.packages?.[0];
|
|
13
|
-
const match = firstPackage?.name.match(/^@([^/]+)\//);
|
|
14
|
-
if (match?.[1]) {
|
|
15
|
-
return match[1];
|
|
16
|
-
}
|
|
17
|
-
if (/^[a-z0-9][a-z0-9._-]*$/.test(fallbackProjectName)) {
|
|
18
|
-
return fallbackProjectName;
|
|
19
|
-
}
|
|
20
|
-
throw new Error("Cannot infer workspace package scope from the stored Project Blueprint or root package.json");
|
|
21
|
-
}
|
|
22
|
-
function assertSafePackageLeaf(name) {
|
|
23
|
-
if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) {
|
|
24
|
-
throw new Error("--name must be a lowercase package leaf name using letters, numbers, and hyphens");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
const reservedPackagePathCollections = new Set([
|
|
28
|
-
".devcontainer",
|
|
29
|
-
".git",
|
|
30
|
-
".github",
|
|
31
|
-
".template",
|
|
32
|
-
"build",
|
|
33
|
-
"coverage",
|
|
34
|
-
"dist",
|
|
35
|
-
"node_modules",
|
|
36
|
-
"out",
|
|
37
|
-
"target",
|
|
38
|
-
]);
|
|
39
|
-
function assertSafePackagePathSegment(packagePath, segment) {
|
|
40
|
-
if (!/^[a-z0-9][a-z0-9-]*$/.test(segment)) {
|
|
41
|
-
throw new Error(`Package Path ${packagePath} must use safe path segments with lowercase letters, numbers, and hyphens`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function validateExplicitPackagePath(packagePath) {
|
|
45
|
-
if (path.isAbsolute(packagePath)) {
|
|
46
|
-
throw new Error(`Package Path ${packagePath} must be relative`);
|
|
47
|
-
}
|
|
48
|
-
if (packagePath !== packagePath.trim()) {
|
|
49
|
-
throw new Error(`Package Path ${packagePath} must not contain whitespace`);
|
|
50
|
-
}
|
|
51
|
-
if (packagePath === ".." ||
|
|
52
|
-
packagePath.startsWith("../") ||
|
|
53
|
-
packagePath.endsWith("/..") ||
|
|
54
|
-
packagePath.includes("/../")) {
|
|
55
|
-
throw new Error(`Package Path ${packagePath} must not escape the workspace`);
|
|
56
|
-
}
|
|
57
|
-
const normalized = path.posix.normalize(packagePath);
|
|
58
|
-
if (normalized !== packagePath || packagePath.includes("\\")) {
|
|
59
|
-
throw new Error(`Package Path ${packagePath} must be exactly two safe path segments`);
|
|
60
|
-
}
|
|
61
|
-
const segments = packagePath.split("/");
|
|
62
|
-
if (segments.length !== 2) {
|
|
63
|
-
throw new Error(`Package Path ${packagePath} must be exactly two safe path segments`);
|
|
64
|
-
}
|
|
65
|
-
const [collection, packageDirectory] = segments;
|
|
66
|
-
if (!collection || !packageDirectory) {
|
|
67
|
-
throw new Error(`Package Path ${packagePath} must be exactly two safe path segments`);
|
|
68
|
-
}
|
|
69
|
-
if (reservedPackagePathCollections.has(collection)) {
|
|
70
|
-
throw new Error(`Package Path ${packagePath} uses reserved collection ${collection}`);
|
|
71
|
-
}
|
|
72
|
-
assertSafePackagePathSegment(packagePath, collection);
|
|
73
|
-
assertSafePackagePathSegment(packagePath, packageDirectory);
|
|
74
|
-
if (reservedPackagePathCollections.has(packageDirectory)) {
|
|
75
|
-
throw new Error(`Package Path ${packagePath} uses reserved package directory ${packageDirectory}`);
|
|
76
|
-
}
|
|
77
|
-
return packagePath;
|
|
78
|
-
}
|
|
79
|
-
function supportedPackageAdditionPresetNames(manifest) {
|
|
80
|
-
return manifest.presets
|
|
81
|
-
.filter((preset) => preset.packageAdditionSupport === PackageAdditionSupport.Supported)
|
|
82
|
-
.map((preset) => preset.name);
|
|
83
|
-
}
|
|
84
|
-
function formatUnsupportedPackageAdditionPresetError(preset, manifest) {
|
|
85
|
-
return [
|
|
86
|
-
`Preset ${preset} cannot be used for Package Addition.`,
|
|
87
|
-
"It can still initialize a Generated Repository, but it cannot be added to an existing one.",
|
|
88
|
-
`Supported Package Addition presets: ${supportedPackageAdditionPresetNames(manifest).join(", ")}`,
|
|
89
|
-
].join("\n");
|
|
90
|
-
}
|
|
91
|
-
function assertNoPackageConflict(blueprint, packageName, packagePath) {
|
|
92
|
-
const existingByName = blueprint.packages?.find((pkg) => pkg.name === packageName);
|
|
93
|
-
if (existingByName) {
|
|
94
|
-
throw new Error(`Package Path ${packagePath} conflicts with existing package ${existingByName.name} at ${existingByName.path}`);
|
|
95
|
-
}
|
|
96
|
-
const existingByPath = blueprint.packages?.find((pkg) => pkg.path === packagePath);
|
|
97
|
-
if (existingByPath) {
|
|
98
|
-
throw new Error(`Package Path ${packagePath} conflicts with existing package ${existingByPath.name} at ${existingByPath.path}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function formatAvailablePackagePaths(blueprint) {
|
|
102
|
-
return (blueprint.packages ?? [])
|
|
103
|
-
.map((projectPackage) => projectPackage.path)
|
|
104
|
-
.join(", ");
|
|
105
|
-
}
|
|
106
|
-
function packageLinkIntentForSingleConsumer(options) {
|
|
107
|
-
if (options.consumerPackagePath === options.providerPackagePath) {
|
|
108
|
-
throw new Error(`Package Link Intent cannot link ${options.providerPackagePath} from itself`);
|
|
109
|
-
}
|
|
110
|
-
const consumer = options.blueprint.packages?.find((projectPackage) => projectPackage.path === options.consumerPackagePath);
|
|
111
|
-
if (!consumer) {
|
|
112
|
-
const availablePackagePaths = formatAvailablePackagePaths(options.blueprint);
|
|
113
|
-
throw new Error([
|
|
114
|
-
`Unknown Package Path for --link-from: ${options.consumerPackagePath}`,
|
|
115
|
-
availablePackagePaths
|
|
116
|
-
? `Available Package Paths: ${availablePackagePaths}`
|
|
117
|
-
: undefined,
|
|
118
|
-
]
|
|
119
|
-
.filter((line) => line !== undefined)
|
|
120
|
-
.join("\n"));
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
consumerPackagePath: options.consumerPackagePath,
|
|
124
|
-
providerPackagePath: options.providerPackagePath,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function packageLinkIntentsForConsumers(options) {
|
|
128
|
-
const packageLinkIntents = [];
|
|
129
|
-
const seenConsumerPackagePaths = new Set();
|
|
130
|
-
for (const consumerPackagePath of options.consumerPackagePaths) {
|
|
131
|
-
if (seenConsumerPackagePaths.has(consumerPackagePath)) {
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
seenConsumerPackagePaths.add(consumerPackagePath);
|
|
135
|
-
packageLinkIntents.push(packageLinkIntentForSingleConsumer({
|
|
136
|
-
blueprint: options.blueprint,
|
|
137
|
-
consumerPackagePath,
|
|
138
|
-
providerPackagePath: options.providerPackagePath,
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
return packageLinkIntents;
|
|
142
|
-
}
|
|
143
|
-
async function assertPackageLinkIntentConsumersAreTypeScriptBoundaries(options) {
|
|
144
|
-
for (const intent of options.packageLinkIntents) {
|
|
145
|
-
const consumer = options.blueprint.packages?.find((projectPackage) => projectPackage.path === intent.consumerPackagePath);
|
|
146
|
-
if (!consumer) {
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (consumer.role !== undefined && consumer.sourcePreset !== undefined) {
|
|
150
|
-
assertTypeScriptPackageBoundaryForLinkIntent(consumer, "consumer");
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
try {
|
|
154
|
-
const manifest = await readJson(path.join(options.root, consumer.path, "package.json"));
|
|
155
|
-
const scripts = isRecord(manifest) ? manifest.scripts : undefined;
|
|
156
|
-
const hasTypeScriptPackageShape = isRecord(manifest) &&
|
|
157
|
-
manifest.type === "module" &&
|
|
158
|
-
isRecord(scripts) &&
|
|
159
|
-
(typeof scripts.typecheck === "string" ||
|
|
160
|
-
typeof scripts["typecheck:run"] === "string");
|
|
161
|
-
if (hasTypeScriptPackageShape) {
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
assertTypeScriptPackageBoundaryForLinkIntent(consumer, "consumer");
|
|
165
|
-
}
|
|
166
|
-
catch (error) {
|
|
167
|
-
if (isNodeError(error) && error.code === "ENOENT") {
|
|
168
|
-
assertTypeScriptPackageBoundaryForLinkIntent(consumer, "consumer");
|
|
169
|
-
}
|
|
170
|
-
throw error;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
async function readJson(filePath) {
|
|
175
|
-
return JSON.parse(await readFile(filePath, "utf8"));
|
|
176
|
-
}
|
|
177
|
-
async function writeJson(filePath, value) {
|
|
178
|
-
await writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
179
|
-
}
|
|
180
|
-
async function assertMissingPackagePath(packagePath, targetPath) {
|
|
181
|
-
try {
|
|
182
|
-
await stat(targetPath);
|
|
183
|
-
}
|
|
184
|
-
catch (error) {
|
|
185
|
-
if (isNodeError(error) && error.code === "ENOENT") {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
190
|
-
throw new Error(`Package Path ${packagePath} conflicts with existing filesystem path ${targetPath}`);
|
|
191
|
-
}
|
|
192
|
-
function resolveGeneratedPath(root, relativePath) {
|
|
193
|
-
if (path.isAbsolute(relativePath)) {
|
|
194
|
-
throw new Error(`Package Addition paths must be relative: ${relativePath}`);
|
|
195
|
-
}
|
|
196
|
-
const resolvedRoot = path.resolve(root);
|
|
197
|
-
const resolvedPath = path.resolve(resolvedRoot, relativePath);
|
|
198
|
-
const insideRoot = resolvedPath === resolvedRoot ||
|
|
199
|
-
resolvedPath.startsWith(`${resolvedRoot}${path.sep}`);
|
|
200
|
-
if (!insideRoot) {
|
|
201
|
-
throw new Error(`Package Addition path escapes the Generated Repository: ${relativePath}`);
|
|
202
|
-
}
|
|
203
|
-
return resolvedPath;
|
|
204
|
-
}
|
|
205
|
-
function isNodeError(error) {
|
|
206
|
-
return error instanceof Error && "code" in error;
|
|
207
|
-
}
|
|
208
|
-
function isRecord(value) {
|
|
209
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
210
|
-
}
|
|
211
|
-
function assertRootPackageJson(input) {
|
|
212
|
-
if (!isRecord(input)) {
|
|
213
|
-
throw new Error("Cannot update root Package Addition scripts: package.json must be an object");
|
|
214
|
-
}
|
|
215
|
-
if (!isRecord(input.scripts)) {
|
|
216
|
-
throw new Error("Cannot update root Package Addition scripts: scripts must be an object");
|
|
217
|
-
}
|
|
218
|
-
for (const scriptName of ["check", "fix"]) {
|
|
219
|
-
if (typeof input.scripts[scriptName] !== "string") {
|
|
220
|
-
throw new Error(`Cannot update root Package Addition scripts: scripts.${scriptName} must be a string`);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
async function readGeneratedWorkspaceBlueprint(root) {
|
|
225
|
-
const blueprintPath = path.join(root, ".template/blueprint.json");
|
|
226
|
-
let blueprintJson;
|
|
227
|
-
try {
|
|
228
|
-
blueprintJson = await readJson(blueprintPath);
|
|
229
|
-
}
|
|
230
|
-
catch (error) {
|
|
231
|
-
if (error instanceof SyntaxError ||
|
|
232
|
-
(isNodeError(error) && error.code === "ENOENT")) {
|
|
233
|
-
throw new Error("Package Addition requires a valid .template/blueprint.json", { cause: error });
|
|
234
|
-
}
|
|
235
|
-
throw error;
|
|
236
|
-
}
|
|
237
|
-
const result = validateProjectBlueprint(blueprintJson);
|
|
238
|
-
if (!result.ok) {
|
|
239
|
-
if (isRecord(blueprintJson) &&
|
|
240
|
-
blueprintJson.projectKind === "single-package") {
|
|
241
|
-
throw new Error("Package Addition only supports existing workspace Generated Repositories");
|
|
242
|
-
}
|
|
243
|
-
throw new Error("Package Addition requires a valid .template/blueprint.json");
|
|
244
|
-
}
|
|
245
|
-
const blueprint = result.value;
|
|
246
|
-
if (blueprint.projectKind !== "multi-package") {
|
|
247
|
-
throw new Error("Package Addition only supports existing workspace Generated Repositories");
|
|
248
|
-
}
|
|
249
|
-
if (blueprint.packageManager !== "pnpm") {
|
|
250
|
-
throw new Error("Package Addition only supports pnpm workspace Generated Repositories");
|
|
251
|
-
}
|
|
252
|
-
if (!blueprint.packages || blueprint.packages.length === 0) {
|
|
253
|
-
throw new Error("Package Addition requires package definitions in the stored Project Blueprint");
|
|
254
|
-
}
|
|
255
|
-
await stat(path.join(root, "turbo.json"));
|
|
256
|
-
await stat(path.join(root, "pnpm-workspace.yaml"));
|
|
257
|
-
return blueprint;
|
|
258
|
-
}
|
|
259
|
-
async function readGeneratedRepositoryPackageMetadata(root) {
|
|
260
|
-
const packageJson = await readJson(path.join(root, "package.json"));
|
|
261
|
-
if (!isRecord(packageJson)) {
|
|
262
|
-
throw new Error("Package Addition requires root package.json to be an object");
|
|
263
|
-
}
|
|
264
|
-
const projectName = packageJson.name;
|
|
265
|
-
if (typeof projectName !== "string" || projectName.length === 0) {
|
|
266
|
-
throw new Error("Package Addition requires root package.json to declare name");
|
|
267
|
-
}
|
|
268
|
-
if (!isRecord(packageJson.engines)) {
|
|
269
|
-
throw new Error("Package Addition requires root package.json to declare engines.node");
|
|
270
|
-
}
|
|
271
|
-
const nodeVersion = packageJson.engines.node;
|
|
272
|
-
if (typeof nodeVersion !== "string" || nodeVersion.length === 0) {
|
|
273
|
-
throw new Error("Package Addition requires root package.json to declare engines.node");
|
|
274
|
-
}
|
|
275
|
-
return { projectName, nodeVersion };
|
|
276
|
-
}
|
|
277
|
-
function workspaceTextWithPackageGlob(text, glob) {
|
|
278
|
-
if (text.includes(` - ${glob}`)) {
|
|
279
|
-
return text;
|
|
280
|
-
}
|
|
281
|
-
const nextText = text.replace(/^packages:\n/m, `packages:\n - ${glob}\n`);
|
|
282
|
-
if (nextText === text) {
|
|
283
|
-
throw new Error("Cannot update pnpm workspace membership: missing packages section");
|
|
284
|
-
}
|
|
285
|
-
return nextText;
|
|
286
|
-
}
|
|
287
|
-
function packageAdditionCatalogDependencies(operations) {
|
|
288
|
-
const manifests = [];
|
|
289
|
-
for (const operation of operations) {
|
|
290
|
-
if (operation.kind !== "writeJson" ||
|
|
291
|
-
path.basename(operation.to) !== "package.json") {
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
if (!isRecord(operation.value)) {
|
|
295
|
-
throw new Error(`Package Addition package manifest must be an object: ${operation.to}`);
|
|
296
|
-
}
|
|
297
|
-
manifests.push(operation.value);
|
|
298
|
-
}
|
|
299
|
-
return collectGeneratedManifestCatalogReferences(manifests);
|
|
300
|
-
}
|
|
301
|
-
function generatedPackageManifestFromOperations(operations, packagePath) {
|
|
302
|
-
for (const operation of operations) {
|
|
303
|
-
if (operation.kind !== "writeJson" ||
|
|
304
|
-
operation.to !== `${packagePath}/package.json`) {
|
|
305
|
-
continue;
|
|
306
|
-
}
|
|
307
|
-
if (!isRecord(operation.value)) {
|
|
308
|
-
throw new Error(`Package Addition package manifest must be an object: ${operation.to}`);
|
|
309
|
-
}
|
|
310
|
-
return operation.value;
|
|
311
|
-
}
|
|
312
|
-
return undefined;
|
|
313
|
-
}
|
|
314
|
-
async function packageManifestsForTaskGraph(options) {
|
|
315
|
-
const manifests = [];
|
|
316
|
-
for (const packageDefinition of options.blueprint.packages ?? []) {
|
|
317
|
-
const manifestOverride = options.manifestOverrides?.get(packageDefinition.path);
|
|
318
|
-
const manifestFromOperations = generatedPackageManifestFromOperations(options.operations, packageDefinition.path);
|
|
319
|
-
if (manifestOverride !== undefined) {
|
|
320
|
-
manifests.push(manifestOverride);
|
|
321
|
-
continue;
|
|
322
|
-
}
|
|
323
|
-
if (manifestFromOperations !== undefined) {
|
|
324
|
-
manifests.push(manifestFromOperations);
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
const manifest = await readJson(path.join(options.root, packageDefinition.path, "package.json"));
|
|
328
|
-
assertObjectManifest(manifest, packageDefinition.path);
|
|
329
|
-
manifests.push(manifest);
|
|
330
|
-
}
|
|
331
|
-
return manifests;
|
|
332
|
-
}
|
|
333
|
-
function blueprintWithPackage(blueprint, packageName, packagePath, packageRole, packageSourcePreset, packageLinkIntents) {
|
|
334
|
-
const nextBlueprint = {
|
|
335
|
-
...blueprint,
|
|
336
|
-
packages: [
|
|
337
|
-
...(blueprint.packages ?? []),
|
|
338
|
-
{
|
|
339
|
-
name: packageName,
|
|
340
|
-
path: packagePath,
|
|
341
|
-
role: packageRole,
|
|
342
|
-
sourcePreset: packageSourcePreset,
|
|
343
|
-
},
|
|
344
|
-
],
|
|
345
|
-
packageLinkIntents: packageLinkIntents.length > 0
|
|
346
|
-
? [...(blueprint.packageLinkIntents ?? []), ...packageLinkIntents]
|
|
347
|
-
: blueprint.packageLinkIntents,
|
|
348
|
-
};
|
|
349
|
-
const result = validateProjectBlueprint(nextBlueprint);
|
|
350
|
-
if (!result.ok) {
|
|
351
|
-
throw new Error("Package Addition would write an invalid .template/blueprint.json");
|
|
352
|
-
}
|
|
353
|
-
return result.value;
|
|
354
|
-
}
|
|
355
|
-
function assertObjectManifest(input, packagePath) {
|
|
356
|
-
if (!isRecord(input)) {
|
|
357
|
-
throw new Error(`Cannot update Package Link Intent manifest for ${packagePath}: package.json must be an object`);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function recordSortedByKey(record) {
|
|
361
|
-
return Object.fromEntries(Object.entries(record).toSorted(([left], [right]) => left.localeCompare(right)));
|
|
362
|
-
}
|
|
363
|
-
async function consumerManifestUpdatesForPackageLinkIntents(options) {
|
|
364
|
-
const updates = [];
|
|
365
|
-
for (const [packagePath, packageLinkDependencies,] of options.manifestDependenciesByPackagePath) {
|
|
366
|
-
const manifest = await readJson(path.join(options.root, packagePath, "package.json"));
|
|
367
|
-
assertObjectManifest(manifest, packagePath);
|
|
368
|
-
if (manifest.dependencies !== undefined &&
|
|
369
|
-
!isRecord(manifest.dependencies)) {
|
|
370
|
-
throw new Error(`Cannot update Package Link Intent manifest for ${packagePath}: dependencies must be an object`);
|
|
371
|
-
}
|
|
372
|
-
updates.push({
|
|
373
|
-
packagePath,
|
|
374
|
-
manifest: {
|
|
375
|
-
...manifest,
|
|
376
|
-
dependencies: recordSortedByKey({
|
|
377
|
-
...manifest.dependencies,
|
|
378
|
-
...packageLinkDependencies,
|
|
379
|
-
}),
|
|
380
|
-
},
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
return updates;
|
|
384
|
-
}
|
|
385
|
-
function rootScriptWithTurboPackageTasks(options) {
|
|
386
|
-
const rootCommands = options.script
|
|
387
|
-
.split(" && ")
|
|
388
|
-
.filter((command) => !command.startsWith("turbo run "));
|
|
389
|
-
const turboCommand = renderTurboRunCommand(options.taskNames);
|
|
390
|
-
return [...rootCommands, turboCommand].join(" && ");
|
|
391
|
-
}
|
|
392
|
-
function rootPackageJsonWithPackageTaskFilters(input, blueprint) {
|
|
393
|
-
void blueprint;
|
|
394
|
-
assertRootPackageJson(input);
|
|
395
|
-
const checkScript = input.scripts.check;
|
|
396
|
-
const fixScript = input.scripts.fix;
|
|
397
|
-
if (checkScript === undefined || fixScript === undefined) {
|
|
398
|
-
throw new Error("Cannot update root Package Addition scripts: check and fix scripts are required");
|
|
399
|
-
}
|
|
400
|
-
return {
|
|
401
|
-
...input,
|
|
402
|
-
scripts: {
|
|
403
|
-
...input.scripts,
|
|
404
|
-
check: rootScriptWithTurboPackageTasks({
|
|
405
|
-
script: checkScript,
|
|
406
|
-
taskNames: [
|
|
407
|
-
"format:check:run",
|
|
408
|
-
"lint:run",
|
|
409
|
-
"typecheck:run",
|
|
410
|
-
"build:run",
|
|
411
|
-
"test:run",
|
|
412
|
-
"test:e2e:run",
|
|
413
|
-
"check:run",
|
|
414
|
-
],
|
|
415
|
-
}),
|
|
416
|
-
fix: rootScriptWithTurboPackageTasks({
|
|
417
|
-
script: fixScript,
|
|
418
|
-
taskNames: ["format:write:run", "lint:fix:run", "fix:run"],
|
|
419
|
-
}),
|
|
420
|
-
},
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
function manifestExportUsesCompiledRuntime(value) {
|
|
424
|
-
if (!isRecord(value)) {
|
|
425
|
-
return false;
|
|
426
|
-
}
|
|
427
|
-
const rootExport = value["."];
|
|
428
|
-
if (!isRecord(rootExport)) {
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
|
-
return (typeof rootExport.default === "string" &&
|
|
432
|
-
rootExport.default.startsWith("./dist/"));
|
|
433
|
-
}
|
|
434
|
-
function packageManifestsNeedDependencyBuilds(manifests) {
|
|
435
|
-
const compiledPackageNames = new Set(manifests
|
|
436
|
-
.filter((manifest) => manifestExportUsesCompiledRuntime(manifest.exports))
|
|
437
|
-
.map((manifest) => manifest.name)
|
|
438
|
-
.filter((name) => typeof name === "string"));
|
|
439
|
-
if (compiledPackageNames.size === 0) {
|
|
440
|
-
return false;
|
|
441
|
-
}
|
|
442
|
-
return manifests.some((manifest) => Object.entries(manifest.dependencies ?? {}).some(([dependencyName, specifier]) => specifier === "workspace:*" && compiledPackageNames.has(dependencyName)));
|
|
443
|
-
}
|
|
444
|
-
function turboConfigForPackageManifests(manifests) {
|
|
445
|
-
return packageTurboConfig({
|
|
446
|
-
dependencyBuildsRequired: packageManifestsNeedDependencyBuilds(manifests),
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
function rootPackageJsonWithSharedOxcRuntimeDependencies(input, requiresSharedOxcConfiguration) {
|
|
450
|
-
if (!requiresSharedOxcConfiguration) {
|
|
451
|
-
return input;
|
|
452
|
-
}
|
|
453
|
-
if (input.type !== undefined && input.type !== "module") {
|
|
454
|
-
throw new Error('Cannot update root OXC configuration: package.json type must be "module" or omitted');
|
|
455
|
-
}
|
|
456
|
-
if (input.devDependencies !== undefined && !isRecord(input.devDependencies)) {
|
|
457
|
-
throw new Error("Cannot update root OXC configuration dependencies: devDependencies must be an object");
|
|
458
|
-
}
|
|
459
|
-
return {
|
|
460
|
-
...input,
|
|
461
|
-
type: "module",
|
|
462
|
-
devDependencies: {
|
|
463
|
-
...input.devDependencies,
|
|
464
|
-
oxfmt: input.devDependencies?.oxfmt ?? "catalog:",
|
|
465
|
-
oxlint: input.devDependencies?.oxlint ?? "catalog:",
|
|
466
|
-
"oxlint-tsgolint": input.devDependencies?.["oxlint-tsgolint"] ?? "catalog:",
|
|
467
|
-
},
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
function catalogDependenciesWithSharedOxcRuntimeDependencies(catalogDependencies, requiresSharedOxcConfiguration) {
|
|
471
|
-
const dependencies = [...catalogDependencies];
|
|
472
|
-
if (!requiresSharedOxcConfiguration) {
|
|
473
|
-
return dependencies;
|
|
474
|
-
}
|
|
475
|
-
for (const dependency of ["oxfmt", "oxlint", "oxlint-tsgolint"]) {
|
|
476
|
-
if (!dependencies.includes(dependency)) {
|
|
477
|
-
dependencies.push(dependency);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return dependencies;
|
|
481
|
-
}
|
|
482
|
-
async function planRootUpdates(root, blueprint, packageName, packagePath, packageRole, packageSourcePreset, packageLinkIntents, workspacePackageGlob, catalogDependencies, requiresSharedOxcConfiguration, operations) {
|
|
483
|
-
const nextBlueprint = blueprintWithPackage(blueprint, packageName, packagePath, packageRole, packageSourcePreset, packageLinkIntents);
|
|
484
|
-
const consumerManifestUpdates = packageLinkIntents.length > 0
|
|
485
|
-
? await consumerManifestUpdatesForPackageLinkIntents({
|
|
486
|
-
root,
|
|
487
|
-
manifestDependenciesByPackagePath: planPackageLinks([
|
|
488
|
-
{
|
|
489
|
-
name: packageName,
|
|
490
|
-
path: packagePath,
|
|
491
|
-
role: packageRole,
|
|
492
|
-
sourcePreset: packageSourcePreset,
|
|
493
|
-
},
|
|
494
|
-
], packageLinkIntents).manifestDependenciesByPackagePath,
|
|
495
|
-
})
|
|
496
|
-
: [];
|
|
497
|
-
const manifestOverrides = new Map(consumerManifestUpdates.map((update) => [
|
|
498
|
-
update.packagePath,
|
|
499
|
-
update.manifest,
|
|
500
|
-
]));
|
|
501
|
-
const packageManifests = await packageManifestsForTaskGraph({
|
|
502
|
-
root,
|
|
503
|
-
blueprint: nextBlueprint,
|
|
504
|
-
operations,
|
|
505
|
-
manifestOverrides,
|
|
506
|
-
});
|
|
507
|
-
const workspaceText = pnpmWorkspaceYamlWithCatalogDependencies(workspaceTextWithPackageGlob(await readFile(path.join(root, "pnpm-workspace.yaml"), "utf8"), workspacePackageGlob), catalogDependenciesWithSharedOxcRuntimeDependencies(catalogDependencies, requiresSharedOxcConfiguration));
|
|
508
|
-
const rootPackageJson = rootPackageJsonWithPackageTaskFilters(await readJson(path.join(root, "package.json")), nextBlueprint);
|
|
509
|
-
return {
|
|
510
|
-
blueprint: nextBlueprint,
|
|
511
|
-
rootPackageJson: rootPackageJsonWithSharedOxcRuntimeDependencies(rootPackageJson, requiresSharedOxcConfiguration),
|
|
512
|
-
turboConfig: turboConfigForPackageManifests(packageManifests),
|
|
513
|
-
workspaceText,
|
|
514
|
-
consumerManifestUpdates,
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
async function readTextIfExists(filePath) {
|
|
518
|
-
try {
|
|
519
|
-
return await readFile(filePath, "utf8");
|
|
520
|
-
}
|
|
521
|
-
catch (error) {
|
|
522
|
-
if (isNodeError(error) && error.code === "ENOENT") {
|
|
523
|
-
return undefined;
|
|
524
|
-
}
|
|
525
|
-
throw error;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
async function writeIfMissing(filePath, text) {
|
|
529
|
-
if ((await readTextIfExists(filePath)) !== undefined) {
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
await writeFile(filePath, text, "utf8");
|
|
533
|
-
}
|
|
534
|
-
async function ensureRootOxfmtConfig(root, sharedOxcRoot) {
|
|
535
|
-
await writeIfMissing(path.join(root, "oxfmt.config.ts"), await readFile(path.join(sharedOxcRoot, "oxfmt.config.ts"), "utf8"));
|
|
536
|
-
}
|
|
537
|
-
async function ensureRootOxlintConfig(options) {
|
|
538
|
-
const nodeConfig = await readFile(path.join(options.sharedOxcRoot, "node", "oxlint.config.ts"), "utf8");
|
|
539
|
-
const vueConfig = await readFile(path.join(options.sharedOxcRoot, "vue", "oxlint.config.ts"), "utf8");
|
|
540
|
-
const targetPath = path.join(options.root, "oxlint.config.ts");
|
|
541
|
-
const currentConfig = await readTextIfExists(targetPath);
|
|
542
|
-
if (currentConfig === undefined) {
|
|
543
|
-
await writeFile(targetPath, options.addedPreset === "vue-app" ? vueConfig : nodeConfig, "utf8");
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
if (options.addedPreset !== "vue-app" || currentConfig === vueConfig) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
if (currentConfig === nodeConfig) {
|
|
550
|
-
await writeFile(targetPath, vueConfig, "utf8");
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
throw new Error("Cannot update root OXC lint configuration for Vue Package Addition: oxlint.config.ts has local changes");
|
|
554
|
-
}
|
|
555
|
-
async function ensureRootOxcConfiguration(options) {
|
|
556
|
-
if (!options.sharedOxcRoot) {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
await ensureRootOxfmtConfig(options.root, options.sharedOxcRoot);
|
|
560
|
-
await ensureRootOxlintConfig({
|
|
561
|
-
root: options.root,
|
|
562
|
-
sharedOxcRoot: options.sharedOxcRoot,
|
|
563
|
-
addedPreset: options.addedPreset,
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
function gitignoreContainsEntry(text, entry) {
|
|
567
|
-
return text
|
|
568
|
-
.split(/\r?\n/)
|
|
569
|
-
.some((line) => line.trim() === entry || line.trim() === `${entry}/`);
|
|
570
|
-
}
|
|
571
|
-
function gitignoreTextWithEntries(text, entries) {
|
|
572
|
-
const missingEntries = entries.filter((entry) => !gitignoreContainsEntry(text, entry));
|
|
573
|
-
if (missingEntries.length === 0) {
|
|
574
|
-
return text;
|
|
575
|
-
}
|
|
576
|
-
const prefix = text.trimEnd();
|
|
577
|
-
return `${prefix}${prefix.length > 0 ? "\n" : ""}${missingEntries.join("\n")}\n`;
|
|
578
|
-
}
|
|
579
|
-
function rootGitignoreEntriesForPackageAddition(preset, requiresSharedOxcConfiguration) {
|
|
580
|
-
const entries = requiresSharedOxcConfiguration
|
|
581
|
-
? ["node_modules", "dist"]
|
|
582
|
-
: [];
|
|
583
|
-
if (preset === "vue-app") {
|
|
584
|
-
entries.push("playwright-report", "test-results");
|
|
585
|
-
}
|
|
586
|
-
return entries;
|
|
587
|
-
}
|
|
588
|
-
async function ensureRootGitignoreEntries(root, entries) {
|
|
589
|
-
if (entries.length === 0) {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
const gitignorePath = path.join(root, ".gitignore");
|
|
593
|
-
const currentText = (await readTextIfExists(gitignorePath)) ?? "";
|
|
594
|
-
const nextText = gitignoreTextWithEntries(currentText, entries);
|
|
595
|
-
if (nextText !== currentText) {
|
|
596
|
-
await writeFile(gitignorePath, nextText, "utf8");
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
export async function addPackage(options) {
|
|
600
|
-
assertSafePackageLeaf(options.name);
|
|
601
|
-
const root = path.resolve(options.cwd);
|
|
602
|
-
const blueprint = await readGeneratedWorkspaceBlueprint(root);
|
|
603
|
-
const repositoryMetadata = await readGeneratedRepositoryPackageMetadata(root);
|
|
604
|
-
const projectName = projectNameFromBlueprint(blueprint, repositoryMetadata.projectName);
|
|
605
|
-
const packageName = `@${projectName}/${options.name}`;
|
|
606
|
-
const preset = findPresetSourceManifestPreset(options.presetSourceManifest, options.preset);
|
|
607
|
-
if (!preset) {
|
|
608
|
-
throw new Error(`Unknown preset for Package Addition: ${options.preset}`);
|
|
609
|
-
}
|
|
610
|
-
if (preset.packageAdditionSupport !== PackageAdditionSupport.Supported) {
|
|
611
|
-
throw new Error(formatUnsupportedPackageAdditionPresetError(options.preset, options.presetSourceManifest));
|
|
612
|
-
}
|
|
613
|
-
const packagePath = options.path
|
|
614
|
-
? validateExplicitPackagePath(options.path)
|
|
615
|
-
: defaultPackagePathForPresetSourcePackageAddition(preset, options.name, options.projectionSourceRoots);
|
|
616
|
-
const additionPlan = await planPresetSourcePackageAddition({
|
|
617
|
-
preset,
|
|
618
|
-
sourceRoots: options.projectionSourceRoots,
|
|
619
|
-
addition: {
|
|
620
|
-
root,
|
|
621
|
-
blueprint,
|
|
622
|
-
packageLeafName: options.name,
|
|
623
|
-
packageName,
|
|
624
|
-
packagePath,
|
|
625
|
-
nodeVersion: repositoryMetadata.nodeVersion,
|
|
626
|
-
},
|
|
627
|
-
});
|
|
628
|
-
const requiresSharedOxcConfiguration = additionPlan.sourceRoots?.sharedOxc !== undefined;
|
|
629
|
-
assertNoPackageConflict(blueprint, packageName, additionPlan.packagePath);
|
|
630
|
-
const packageLinkIntents = packageLinkIntentsForConsumers({
|
|
631
|
-
blueprint,
|
|
632
|
-
consumerPackagePaths: options.linkFrom ?? [],
|
|
633
|
-
providerPackagePath: additionPlan.packagePath,
|
|
634
|
-
});
|
|
635
|
-
await assertPackageLinkIntentConsumersAreTypeScriptBoundaries({
|
|
636
|
-
root,
|
|
637
|
-
blueprint,
|
|
638
|
-
packageLinkIntents,
|
|
639
|
-
});
|
|
640
|
-
await assertMissingPackagePath(additionPlan.packagePath, path.join(root, additionPlan.packagePath));
|
|
641
|
-
const rootUpdatePlan = await planRootUpdates(root, blueprint, packageName, additionPlan.packagePath, additionPlan.packageRole, additionPlan.packageSourcePreset, packageLinkIntents, additionPlan.workspaceMembershipGlob ?? additionPlan.workspacePackageGlob, packageAdditionCatalogDependencies(additionPlan.operations), requiresSharedOxcConfiguration, additionPlan.operations);
|
|
642
|
-
await mkdir(path.join(root, additionPlan.packagePath), { recursive: true });
|
|
643
|
-
await ensureRootOxcConfiguration({
|
|
644
|
-
root,
|
|
645
|
-
sharedOxcRoot: additionPlan.sourceRoots?.sharedOxc,
|
|
646
|
-
addedPreset: options.preset,
|
|
647
|
-
});
|
|
648
|
-
await ensureRootGitignoreEntries(root, rootGitignoreEntriesForPackageAddition(options.preset, requiresSharedOxcConfiguration));
|
|
649
|
-
await renderProject({
|
|
650
|
-
sourceRoot: additionPlan.sourceRoot,
|
|
651
|
-
sourceRoots: additionPlan.sourceRoots,
|
|
652
|
-
targetRoot: root,
|
|
653
|
-
operations: [...additionPlan.operations],
|
|
654
|
-
});
|
|
655
|
-
for (const textFile of additionPlan.textFiles ?? []) {
|
|
656
|
-
await writeFile(resolveGeneratedPath(root, textFile.path), textFile.text, "utf8");
|
|
657
|
-
}
|
|
658
|
-
await writeFile(path.join(root, "pnpm-workspace.yaml"), rootUpdatePlan.workspaceText, "utf8");
|
|
659
|
-
await writeJson(path.join(root, "package.json"), rootUpdatePlan.rootPackageJson);
|
|
660
|
-
await writeJson(path.join(root, "turbo.json"), rootUpdatePlan.turboConfig);
|
|
661
|
-
for (const update of rootUpdatePlan.consumerManifestUpdates) {
|
|
662
|
-
await writeJson(path.join(root, update.packagePath, "package.json"), update.manifest);
|
|
663
|
-
}
|
|
664
|
-
await writeJson(path.join(root, ".template/blueprint.json"), rootUpdatePlan.blueprint);
|
|
665
|
-
}
|