@cbnventures/nova 0.30.1 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/package.json +1 -1
- package/build/src/cli/generate/docker-image/index.d.ts.map +1 -1
- package/build/src/cli/generate/docker-image/index.js +6 -5
- package/build/src/cli/generate/docker-image/index.js.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.d.ts +0 -4
- package/build/src/cli/generate/must-haves/dotenv.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.js +7 -171
- package/build/src/cli/generate/must-haves/dotenv.js.map +1 -1
- package/build/src/cli/index.js +30 -1
- package/build/src/cli/index.js.map +1 -1
- package/build/src/cli/scaffold/app/android.d.ts +4 -1
- package/build/src/cli/scaffold/app/android.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/android.js +91 -39
- package/build/src/cli/scaffold/app/android.js.map +1 -1
- package/build/src/cli/scaffold/app/apple.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/apple.js +1 -0
- package/build/src/cli/scaffold/app/apple.js.map +1 -1
- package/build/src/cli/scaffold/app/astro.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/astro.js +11 -3
- package/build/src/cli/scaffold/app/astro.js.map +1 -1
- package/build/src/cli/scaffold/app/cloudflare-workers.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/cloudflare-workers.js +1 -0
- package/build/src/cli/scaffold/app/cloudflare-workers.js.map +1 -1
- package/build/src/cli/scaffold/app/discord-bot.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/discord-bot.js +38 -0
- package/build/src/cli/scaffold/app/discord-bot.js.map +1 -1
- package/build/src/cli/scaffold/app/docker-image.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/docker-image.js +2 -0
- package/build/src/cli/scaffold/app/docker-image.js.map +1 -1
- package/build/src/cli/scaffold/app/expressjs.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/expressjs.js +21 -0
- package/build/src/cli/scaffold/app/expressjs.js.map +1 -1
- package/build/src/cli/scaffold/app/nextjs.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/nextjs.js +3 -0
- package/build/src/cli/scaffold/app/nextjs.js.map +1 -1
- package/build/src/cli/scaffold/app/vite.d.ts.map +1 -1
- package/build/src/cli/scaffold/app/vite.js +7 -0
- package/build/src/cli/scaffold/app/vite.js.map +1 -1
- package/build/src/cli/scaffold/docs/docusaurus.d.ts.map +1 -1
- package/build/src/cli/scaffold/docs/docusaurus.js +3 -24
- package/build/src/cli/scaffold/docs/docusaurus.js.map +1 -1
- package/build/src/cli/scaffold/package/github-action.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/github-action.js +7 -0
- package/build/src/cli/scaffold/package/github-action.js.map +1 -1
- package/build/src/cli/scaffold/package/homebridge.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/homebridge.js +5 -1
- package/build/src/cli/scaffold/package/homebridge.js.map +1 -1
- package/build/src/cli/scaffold/package/node-cli.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/node-cli.js +1 -0
- package/build/src/cli/scaffold/package/node-cli.js.map +1 -1
- package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/pfsense.js +7 -0
- package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
- package/build/src/cli/scaffold/starter/base.d.ts.map +1 -1
- package/build/src/cli/scaffold/starter/base.js +85 -70
- package/build/src/cli/scaffold/starter/base.js.map +1 -1
- package/build/src/lib/dotenv.d.ts +2 -1
- package/build/src/lib/dotenv.d.ts.map +1 -1
- package/build/src/lib/dotenv.js +171 -1
- package/build/src/lib/dotenv.js.map +1 -1
- package/build/src/lib/regex.d.ts +4 -1
- package/build/src/lib/regex.d.ts.map +1 -1
- package/build/src/lib/regex.js +4 -1
- package/build/src/lib/regex.js.map +1 -1
- package/build/src/lib/run-scripts.d.ts.map +1 -1
- package/build/src/lib/run-scripts.js +102 -19
- package/build/src/lib/run-scripts.js.map +1 -1
- package/build/src/lib/scaffold-presentation.d.ts +8 -0
- package/build/src/lib/scaffold-presentation.d.ts.map +1 -0
- package/build/src/lib/scaffold-presentation.js +272 -0
- package/build/src/lib/scaffold-presentation.js.map +1 -0
- package/build/src/lib/scaffold.d.ts +5 -3
- package/build/src/lib/scaffold.d.ts.map +1 -1
- package/build/src/lib/scaffold.js +380 -261
- package/build/src/lib/scaffold.js.map +1 -1
- package/build/src/lib/utility.d.ts +2 -2
- package/build/src/lib/utility.d.ts.map +1 -1
- package/build/src/lib/utility.js +13 -9
- package/build/src/lib/utility.js.map +1 -1
- package/build/src/types/cli/generate/docker-image/index.d.ts +3 -0
- package/build/src/types/cli/generate/must-haves/dotenv.d.ts +0 -146
- package/build/src/types/cli/scaffold/app/android.d.ts +39 -14
- package/build/src/types/cli/scaffold/app/apple.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/astro.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/cloudflare-workers.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/discord-bot.d.ts +12 -0
- package/build/src/types/cli/scaffold/app/docker-image.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/expressjs.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/nextjs.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/vite.d.ts +3 -0
- package/build/src/types/cli/scaffold/docs/docusaurus.d.ts +3 -3
- package/build/src/types/cli/scaffold/package/github-action.d.ts +3 -0
- package/build/src/types/cli/scaffold/package/homebridge.d.ts +3 -0
- package/build/src/types/cli/scaffold/package/node-cli.d.ts +3 -0
- package/build/src/types/cli/scaffold/package/pfsense.d.ts +3 -0
- package/build/src/types/cli/scaffold/starter/base.d.ts +41 -15
- package/build/src/types/lib/dotenv.d.ts +158 -0
- package/build/src/types/lib/regex.d.ts +15 -0
- package/build/src/types/lib/run-scripts.d.ts +36 -5
- package/build/src/types/lib/scaffold-presentation.d.ts +295 -0
- package/build/src/types/lib/scaffold.d.ts +323 -105
- package/build/src/types/lib/utility.d.ts +2 -0
- package/build/src/types/tests/cli/index.test.d.ts +8 -1
- package/build/src/types/tests/cli/scaffold/app/android.test.d.ts +36 -0
- package/build/src/types/tests/cli/scaffold/app/expressjs.test.d.ts +51 -0
- package/build/src/types/tests/cli/scaffold/app/nextjs.test.d.ts +15 -0
- package/build/src/types/tests/cli/scaffold/docs/docusaurus.test.d.ts +2 -2
- package/build/src/types/tests/cli/scaffold/starter/base.test.d.ts +73 -0
- package/build/src/types/tests/cli/utility/run-scripts.test.d.ts +36 -1
- package/build/src/types/tests/homebridge-custom-ui.test.d.ts +19 -0
- package/build/src/types/tests/lib/scaffold-presentation.test.d.ts +135 -0
- package/build/src/types/tests/lib/scaffold.test.d.ts +16 -2
- package/build/src/types/tests/scaffold-output-contract.test.d.ts +38 -1
- package/build/templates/generators/docker-image/astro-node/Dockerfile +4 -4
- package/build/templates/generators/docker-image/nextjs-standalone/Dockerfile +4 -4
- package/build/templates/generators/docker-image/node/Dockerfile +5 -6
- package/build/templates/generators/docker-image/static-site/Dockerfile +4 -4
- package/build/templates/generators/github/workflows/publish/targets/docker-hub.yml +2 -2
- package/build/templates/generators/github/workflows/publish/targets/ghcr.yml +2 -2
- package/build/templates/generators/must-haves/agent-conventions/conventions/documentation.md +2 -2
- package/build/templates/scaffold/app/android/package.json +5 -5
- package/build/templates/scaffold/app/android/scripts/android-environment.mjs +74 -0
- package/build/templates/scaffold/app/android/scripts/run-android.mjs +82 -0
- package/build/templates/scaffold/app/android/scripts/run-gradle.mjs +5 -9
- package/build/templates/scaffold/app/apple/Sources/App.swift +9 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-1024.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/Contents.json +74 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/Contents.json +6 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/NovaLogo.imageset/Contents.json +16 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/NovaLogo.imageset/nova.svg +5 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialFacebook.imageset/Contents.json +17 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialFacebook.imageset/facebook.svg +1 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialGitHub.imageset/Contents.json +17 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialGitHub.imageset/github.svg +1 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialGooglePlay.imageset/Contents.json +17 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialGooglePlay.imageset/google-play.svg +1 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialInstagram.imageset/Contents.json +17 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialInstagram.imageset/instagram.svg +1 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialLinkedIn.imageset/Contents.json +17 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialLinkedIn.imageset/linkedin.svg +1 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialX.imageset/Contents.json +17 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialX.imageset/x.svg +1 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialYouTube.imageset/Contents.json +17 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/SocialYouTube.imageset/youtube.svg +1 -0
- package/build/templates/scaffold/app/apple/Sources/ContentView.swift +415 -9
- package/build/templates/scaffold/app/apple/package.json +4 -4
- package/build/templates/scaffold/app/apple/project.yml +1 -0
- package/build/templates/scaffold/app/astro/package.json +5 -5
- package/build/templates/scaffold/app/astro/src/pages/index.astro +88 -5
- package/build/templates/scaffold/app/cloudflare-workers/package.json +7 -4
- package/build/templates/scaffold/app/cloudflare-workers/wrangler.toml +1 -1
- package/build/templates/scaffold/app/discord-bot/package.json +7 -7
- package/build/templates/scaffold/app/discord-bot/src/bot.test.ts +48 -0
- package/build/templates/scaffold/app/discord-bot/src/bot.ts +128 -0
- package/build/templates/scaffold/app/discord-bot/src/index.ts +12 -27
- package/build/templates/scaffold/app/discord-bot/src/types/bot.d.ts +34 -0
- package/build/templates/scaffold/app/discord-bot/src/types/bot.test.d.ts +8 -0
- package/build/templates/scaffold/app/discord-bot/src/types/index.d.ts +6 -0
- package/build/templates/scaffold/app/docker-image/package.json +5 -5
- package/build/templates/scaffold/app/express/package.json +7 -4
- package/build/templates/scaffold/app/express/src/app.test.ts +44 -0
- package/build/templates/scaffold/app/express/src/app.ts +72 -0
- package/build/templates/scaffold/app/express/src/index.ts +51 -13
- package/build/templates/scaffold/app/express/src/types/app.d.ts +32 -0
- package/build/templates/scaffold/app/express/src/types/app.test.d.ts +8 -0
- package/build/templates/scaffold/app/express/src/types/index.d.ts +20 -0
- package/build/templates/scaffold/app/nextjs/package.json +5 -2
- package/build/templates/scaffold/app/nextjs/src/app/globals.css +1 -9
- package/build/templates/scaffold/app/nextjs/src/app/layout.tsx +6 -2
- package/build/templates/scaffold/app/nextjs/src/app/page.tsx +87 -3
- package/build/templates/scaffold/app/vite/eslint.config.mts +2 -1
- package/build/templates/scaffold/app/vite/index.html +2 -1
- package/build/templates/scaffold/app/vite/package.json +5 -2
- package/build/templates/scaffold/docs/docusaurus/docs/customize.mdx +38 -0
- package/build/templates/scaffold/docs/docusaurus/docs/intro.mdx +22 -1
- package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +120 -2
- package/build/templates/scaffold/docs/docusaurus/package.json +5 -2
- package/build/templates/scaffold/docs/docusaurus/sidebars.ts +4 -1
- package/build/templates/scaffold/docs/docusaurus/src/pages/index.tsx +109 -0
- package/build/templates/scaffold/docs/docusaurus/src/types/pages/index.d.ts +15 -0
- package/build/templates/scaffold/docs/docusaurus/static/images/nova.svg +5 -0
- package/build/templates/scaffold/package/github-action/package.json +6 -6
- package/build/templates/scaffold/package/github-action/src/index.ts +4 -4
- package/build/templates/scaffold/package/github-action/src/run.test.ts +56 -2
- package/build/templates/scaffold/package/github-action/src/run.ts +46 -2
- package/build/templates/scaffold/package/github-action/src/types/run.d.ts +2 -1
- package/build/templates/scaffold/package/homebridge/eslint.config.mts +3 -6
- package/build/templates/scaffold/package/homebridge/package.json +13 -13
- package/build/templates/scaffold/package/node-cli/bin/cli.mjs +33 -0
- package/build/templates/scaffold/package/node-cli/package.json +13 -10
- package/build/templates/scaffold/package/node-cli/src/index.ts +2 -2
- package/build/templates/scaffold/package/node-cli/src/program.ts +354 -19
- package/build/templates/scaffold/package/node-cli/src/status.test.ts +18 -0
- package/build/templates/scaffold/package/node-cli/src/status.ts +39 -0
- package/build/templates/scaffold/package/node-cli/src/types/program.d.ts +125 -0
- package/build/templates/scaffold/package/node-cli/src/types/status.d.ts +15 -0
- package/build/templates/scaffold/package/pfsense/package.json +10 -10
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].inc +14 -7
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].xml +23 -12
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/sbin/[__WORKSPACE_NAME__] +3 -3
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/info.xml +2 -1
- package/build/templates/scaffold/package/pfsense/port/pkg-descr +4 -3
- package/build/templates/scaffold/package/pfsense/tests/project.test.ts +32 -0
- package/build/templates/scaffold/package/pfsense/tests/types/project.test.d.ts +6 -0
- package/build/templates/scaffold-options/app/android-launchpad/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/Navigation.kt +39 -0
- package/build/templates/scaffold-options/app/android-launchpad/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/ui/main/MainScreen.kt +558 -0
- package/build/templates/scaffold-options/app/android-native/app/build.gradle.kts +77 -0
- package/build/templates/scaffold-options/app/android-native/app/proguard-rules.pro +1 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/AndroidManifest.xml +22 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/MainActivity.kt +29 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/NavigationKeys.kt +6 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/data/DataRepository.kt +12 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/theme/Color.kt +11 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/theme/Theme.kt +50 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/theme/Type.kt +36 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/java/[__ANDROID_PACKAGE_PATH__]/ui/main/MainScreenViewModel.kt +27 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/arrow_up_right.xml +9 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/ic_launcher_background.xml +9 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/ic_launcher_foreground.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/nova_logo.xml +9 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/social_facebook.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/social_github.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/social_google_play.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/social_instagram.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/social_linkedin.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/social_x.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/social_youtube.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/values/strings.xml +3 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/values/themes.xml +5 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/xml/backup_rules.xml +13 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/xml/data_extraction_rules.xml +19 -0
- package/build/templates/scaffold-options/app/android-native/app/src/test/java/[__ANDROID_PACKAGE_PATH__]/ui/main/MainScreenViewModelTest.kt +27 -0
- package/build/templates/scaffold-options/app/android-native/build.gradle.kts +6 -0
- package/build/templates/scaffold-options/app/android-native/gradle/libs.versions.toml +33 -0
- package/build/templates/scaffold-options/app/android-native/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/build/templates/scaffold-options/app/android-native/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/build/templates/scaffold-options/app/android-native/gradle.properties +29 -0
- package/build/templates/scaffold-options/app/android-native/gradlew +172 -0
- package/build/templates/scaffold-options/app/android-native/gradlew.bat +84 -0
- package/build/templates/scaffold-options/app/android-native/settings.gradle.kts +34 -0
- package/build/templates/scaffold-options/app/vite/framework/react/config/framework-ignore-files.ts +1 -0
- package/build/templates/scaffold-options/app/vite/framework/react/src/app.tsx +90 -1
- package/build/templates/scaffold-options/app/vite/framework/react/src/main.ts +1 -0
- package/build/templates/scaffold-options/app/vite/framework/react/tsconfig.json +1 -0
- package/build/templates/scaffold-options/app/vite/framework/svelte/config/framework-ignore-files.ts +1 -0
- package/build/templates/scaffold-options/app/vite/framework/svelte/src/app.svelte +72 -5
- package/build/templates/scaffold-options/app/vite/framework/svelte/src/main.ts +1 -0
- package/build/templates/scaffold-options/app/vite/framework/svelte/tsconfig.json +1 -0
- package/build/templates/scaffold-options/app/vite/framework/vanilla/config/framework-ignore-files.ts +1 -0
- package/build/templates/scaffold-options/app/vite/framework/vanilla/src/main.ts +45 -1
- package/build/templates/scaffold-options/app/vite/framework/vanilla/tsconfig.json +1 -0
- package/build/templates/scaffold-options/app/vite/framework/vue/config/framework-ignore-files.ts +1 -0
- package/build/templates/scaffold-options/app/vite/framework/vue/src/app.vue +186 -5
- package/build/templates/scaffold-options/app/vite/framework/vue/src/main.ts +1 -0
- package/build/templates/scaffold-options/app/vite/framework/vue/tsconfig.json +1 -0
- package/build/templates/scaffold-options/app/web-launchpad/public/favicon.svg +5 -0
- package/build/templates/scaffold-options/app/web-launchpad/public/nova-socials.svg +28 -0
- package/build/templates/scaffold-options/app/web-launchpad/src/styles/nova-launchpad.css +397 -0
- package/build/templates/scaffold-options/package/homebridge/custom-ui/config/eslint-custom-ui.ts +19 -0
- package/build/templates/scaffold-options/package/homebridge/custom-ui/homebridge-ui/public/index.html +206 -16
- package/build/templates/scaffold-options/package/homebridge/custom-ui/homebridge-ui/public/index.js +252 -2
- package/build/templates/scaffold-options/package/homebridge/schema-ui/config/eslint-custom-ui.ts +1 -0
- package/package.json +1 -1
- package/build/templates/scaffold/docs/docusaurus/src/pages/index.mdx +0 -8
- package/build/templates/scaffold/package/node-cli/src/index.test.ts +0 -15
- package/build/templates/scaffold-options/package/homebridge/custom-ui/homebridge-ui/public/styles.css +0 -12
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
1
2
|
import { promises as fs } from 'node:fs';
|
|
2
3
|
import { dirname, isAbsolute, join, relative, resolve, sep, } from 'node:path';
|
|
3
4
|
import { fileURLToPath } from 'node:url';
|
|
@@ -5,8 +6,13 @@ import { minimatch } from 'minimatch';
|
|
|
5
6
|
import prompts from 'prompts';
|
|
6
7
|
import novaPackageJson from '../../package.json' with { type: 'json' };
|
|
7
8
|
import { Logger } from '../toolkit/index.js';
|
|
9
|
+
import { Runner as LibCorepack } from './corepack.js';
|
|
10
|
+
import { writeDotenvFiles } from './dotenv.js';
|
|
11
|
+
import { libEnvNamespace } from './env-namespace.js';
|
|
8
12
|
import { LIB_REGEX_PATTERN_NON_ALPHANUMERIC_RUN, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PLACEHOLDER_PROJECT_SLUG, LIB_REGEX_PLACEHOLDER_WORKSPACE_IDENTIFIER, LIB_REGEX_PLACEHOLDER_WORKSPACE_NAME, LIB_REGEX_PLACEHOLDER_WORKSPACE_PACKAGE_NAME, LIB_REGEX_PLACEHOLDER_WORKSPACE_RELATIVE_PATH, LIB_REGEX_PLACEHOLDER_WORKSPACE_TITLE, } from './regex.js';
|
|
13
|
+
import { confirmScaffoldPlan, createScaffoldProgress, reportScaffoldCompletion, reportScaffoldPlan, resolveDisplayPath, resolveScaffoldInstall, } from './scaffold-presentation.js';
|
|
9
14
|
import { discoverPathsWithFile, isPlainObject, pathExists, resolveTemplatePath, saveGeneratedFile, } from './utility.js';
|
|
15
|
+
const LIB_SCAFFOLD_DEFAULT_PACKAGE_MANAGER = 'npm@11.18.0';
|
|
10
16
|
function applyTemplateReplacements(input, replacements) {
|
|
11
17
|
let output = input;
|
|
12
18
|
for (const replacement of replacements) {
|
|
@@ -24,6 +30,72 @@ function reportError(message) {
|
|
|
24
30
|
process.exitCode = 1;
|
|
25
31
|
return;
|
|
26
32
|
}
|
|
33
|
+
export function resolveScaffoldInstallInvocation(packageManager) {
|
|
34
|
+
const command = (packageManager === 'npm') ? 'npm' : 'corepack';
|
|
35
|
+
const commandArguments = (packageManager === 'npm') ? ['install'] : [
|
|
36
|
+
packageManager,
|
|
37
|
+
'install',
|
|
38
|
+
];
|
|
39
|
+
return {
|
|
40
|
+
command,
|
|
41
|
+
commandArguments,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export async function installScaffoldDependencies(rootDirectory, packageManager) {
|
|
45
|
+
const invocation = resolveScaffoldInstallInvocation(packageManager);
|
|
46
|
+
const command = invocation['command'];
|
|
47
|
+
const commandArguments = invocation['commandArguments'];
|
|
48
|
+
let output = '';
|
|
49
|
+
const executor = (promiseResolve) => {
|
|
50
|
+
const childProcess = spawn(command, commandArguments, {
|
|
51
|
+
cwd: rootDirectory,
|
|
52
|
+
env: {
|
|
53
|
+
...process.env,
|
|
54
|
+
COREPACK_ENABLE_STRICT: '0',
|
|
55
|
+
},
|
|
56
|
+
stdio: [
|
|
57
|
+
'inherit',
|
|
58
|
+
'pipe',
|
|
59
|
+
'pipe',
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
const appendOutput = (chunk) => {
|
|
63
|
+
output += String(chunk);
|
|
64
|
+
return;
|
|
65
|
+
};
|
|
66
|
+
const handleClose = (code) => {
|
|
67
|
+
promiseResolve({
|
|
68
|
+
output,
|
|
69
|
+
succeeded: code === 0,
|
|
70
|
+
});
|
|
71
|
+
return;
|
|
72
|
+
};
|
|
73
|
+
const handleError = (error) => {
|
|
74
|
+
Logger.customize({
|
|
75
|
+
name: 'installScaffoldDependencies',
|
|
76
|
+
purpose: 'spawn',
|
|
77
|
+
}).debug(error);
|
|
78
|
+
output += `${error.message}\n`;
|
|
79
|
+
promiseResolve({
|
|
80
|
+
output,
|
|
81
|
+
succeeded: false,
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
};
|
|
85
|
+
if (childProcess.stdout !== null) {
|
|
86
|
+
childProcess.stdout.setEncoding('utf-8');
|
|
87
|
+
childProcess.stdout.on('data', appendOutput);
|
|
88
|
+
}
|
|
89
|
+
if (childProcess.stderr !== null) {
|
|
90
|
+
childProcess.stderr.setEncoding('utf-8');
|
|
91
|
+
childProcess.stderr.on('data', appendOutput);
|
|
92
|
+
}
|
|
93
|
+
childProcess.once('error', handleError);
|
|
94
|
+
childProcess.once('close', handleClose);
|
|
95
|
+
return;
|
|
96
|
+
};
|
|
97
|
+
return new Promise(executor);
|
|
98
|
+
}
|
|
27
99
|
export function resolveWorkspacePackageName(projectSlug, workspaceName, category) {
|
|
28
100
|
if (category === 'package') {
|
|
29
101
|
return workspaceName;
|
|
@@ -211,69 +283,12 @@ export async function promptScaffoldOptions(context, defaults) {
|
|
|
211
283
|
}
|
|
212
284
|
const monorepoResolvedName = (monorepoNameValue ?? monorepoPromptsAnswers['name']);
|
|
213
285
|
const monorepoResolvedWorkspaceName = (monorepoWorkspaceNameValue ?? monorepoPromptsAnswers['workspaceName']);
|
|
214
|
-
|
|
215
|
-
const resolvedOutputDirectory = resolve(currentDirectory, monorepoOutputValue);
|
|
216
|
-
return {
|
|
217
|
-
mode: 'monorepo',
|
|
218
|
-
name: monorepoResolvedName,
|
|
219
|
-
workspaceName: monorepoResolvedWorkspaceName,
|
|
220
|
-
outputDirectory: resolvedOutputDirectory,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
const directoryChoices = [
|
|
224
|
-
{
|
|
225
|
-
title: 'Create a new directory',
|
|
226
|
-
value: 'new-directory',
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
title: 'Build in current working directory',
|
|
230
|
-
value: 'current-directory',
|
|
231
|
-
},
|
|
232
|
-
];
|
|
233
|
-
const directoryAnswers = await prompts({
|
|
234
|
-
type: 'select',
|
|
235
|
-
name: 'directoryChoice',
|
|
236
|
-
message: 'Where should the project be created?',
|
|
237
|
-
choices: directoryChoices,
|
|
238
|
-
initial: 0,
|
|
239
|
-
}, {
|
|
240
|
-
onCancel: () => false,
|
|
241
|
-
});
|
|
242
|
-
if (directoryAnswers['directoryChoice'] === undefined) {
|
|
243
|
-
cancelled = true;
|
|
244
|
-
}
|
|
245
|
-
if (cancelled === true) {
|
|
246
|
-
return undefined;
|
|
247
|
-
}
|
|
248
|
-
const directoryChoice = directoryAnswers['directoryChoice'];
|
|
249
|
-
if (directoryChoice === 'current-directory') {
|
|
250
|
-
return {
|
|
251
|
-
mode: 'monorepo',
|
|
252
|
-
name: monorepoResolvedName,
|
|
253
|
-
workspaceName: monorepoResolvedWorkspaceName,
|
|
254
|
-
outputDirectory: process.cwd(),
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
const outputAnswers = await prompts({
|
|
258
|
-
type: 'text',
|
|
259
|
-
name: 'output',
|
|
260
|
-
message: 'Output directory:',
|
|
261
|
-
initial: `./${monorepoResolvedName}`,
|
|
262
|
-
}, {
|
|
263
|
-
onCancel: () => false,
|
|
264
|
-
});
|
|
265
|
-
if (outputAnswers['output'] === undefined) {
|
|
266
|
-
cancelled = true;
|
|
267
|
-
}
|
|
268
|
-
if (cancelled === true) {
|
|
269
|
-
return undefined;
|
|
270
|
-
}
|
|
271
|
-
const monorepoResolvedOutput = outputAnswers['output'];
|
|
286
|
+
const resolvedOutputDirectory = resolve(currentDirectory, monorepoOutputValue ?? `./${monorepoResolvedName}`);
|
|
272
287
|
return {
|
|
273
288
|
mode: 'monorepo',
|
|
274
289
|
name: monorepoResolvedName,
|
|
275
290
|
workspaceName: monorepoResolvedWorkspaceName,
|
|
276
|
-
outputDirectory:
|
|
291
|
+
outputDirectory: resolvedOutputDirectory,
|
|
277
292
|
};
|
|
278
293
|
}
|
|
279
294
|
const nameValue = defaults['name'] ?? undefined;
|
|
@@ -449,20 +464,18 @@ export async function createWorkspaceDirectory(basePath, workspaceName) {
|
|
|
449
464
|
return workspaceDirectory;
|
|
450
465
|
}
|
|
451
466
|
export async function writeTemplateFiles(templateDirectory, targetDirectory, replacements) {
|
|
452
|
-
const currentDirectory = process.cwd();
|
|
453
467
|
const entries = await collectFiles(templateDirectory, '');
|
|
454
468
|
for (const entry of entries) {
|
|
455
469
|
const sourcePath = join(templateDirectory, entry);
|
|
456
470
|
const targetEntry = applyTemplateReplacements(entry, replacements);
|
|
457
471
|
const targetPath = join(targetDirectory, targetEntry);
|
|
458
|
-
const sourceContent = await fs.readFile(sourcePath
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}).info(`Created "${relativePath}".`);
|
|
472
|
+
const sourceContent = await fs.readFile(sourcePath);
|
|
473
|
+
const sourceStats = await fs.stat(sourcePath);
|
|
474
|
+
const isBinary = sourceContent.includes(0);
|
|
475
|
+
const content = (isBinary === true) ? sourceContent : applyTemplateReplacements(sourceContent.toString('utf-8'), replacements);
|
|
476
|
+
await fs.mkdir(dirname(targetPath), { recursive: true });
|
|
477
|
+
await fs.writeFile(targetPath, content);
|
|
478
|
+
await fs.chmod(targetPath, sourceStats.mode);
|
|
466
479
|
}
|
|
467
480
|
return;
|
|
468
481
|
}
|
|
@@ -489,7 +502,35 @@ export async function updateScaffoldPackageJson(workspaceDirectory, updates) {
|
|
|
489
502
|
'optionalDependencies',
|
|
490
503
|
'peerDependencies',
|
|
491
504
|
].includes(updateEntry[0]);
|
|
492
|
-
|
|
505
|
+
let sectionOutput = section;
|
|
506
|
+
if (updateEntry[0] === 'scripts') {
|
|
507
|
+
const sectionEntries = Object.entries(section);
|
|
508
|
+
const orderedScriptEntries = [];
|
|
509
|
+
const usedScriptKeys = new Set();
|
|
510
|
+
for (const sectionEntry of sectionEntries) {
|
|
511
|
+
if (sectionEntry[0].includes(':') === true) {
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
orderedScriptEntries.push(sectionEntry);
|
|
515
|
+
usedScriptKeys.add(sectionEntry[0]);
|
|
516
|
+
for (const childEntry of sectionEntries) {
|
|
517
|
+
if (childEntry[0].startsWith(`${sectionEntry[0]}:`) === true) {
|
|
518
|
+
orderedScriptEntries.push(childEntry);
|
|
519
|
+
usedScriptKeys.add(childEntry[0]);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
for (const sectionEntry of sectionEntries) {
|
|
524
|
+
if (usedScriptKeys.has(sectionEntry[0]) === false) {
|
|
525
|
+
orderedScriptEntries.push(sectionEntry);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
sectionOutput = Object.fromEntries(orderedScriptEntries);
|
|
529
|
+
}
|
|
530
|
+
else if (isSortedSection === true) {
|
|
531
|
+
sectionOutput = Object.fromEntries(Object.entries(section).sort((firstEntry, secondEntry) => firstEntry[0].localeCompare(secondEntry[0])));
|
|
532
|
+
}
|
|
533
|
+
Reflect.set(packageJson, updateEntry[0], sectionOutput);
|
|
493
534
|
}
|
|
494
535
|
const content = `${JSON.stringify(packageJson, null, 2)}\n`;
|
|
495
536
|
await fs.writeFile(packageJsonPath, content, 'utf-8');
|
|
@@ -516,10 +557,48 @@ function resolveMonorepoRootTemplateDirectory() {
|
|
|
516
557
|
const currentDirectory = dirname(fileURLToPath(import.meta.url));
|
|
517
558
|
return join(currentDirectory, '..', '..', 'templates', 'scaffold', 'starter', 'base');
|
|
518
559
|
}
|
|
560
|
+
function resolveScaffoldGitignoreProjectExcludes(config) {
|
|
561
|
+
const gitignoreValue = config['gitignore'];
|
|
562
|
+
if (isPlainObject(gitignoreValue) === false) {
|
|
563
|
+
return [];
|
|
564
|
+
}
|
|
565
|
+
const gitignore = gitignoreValue;
|
|
566
|
+
const projectExcludesValue = gitignore['projectExcludes'];
|
|
567
|
+
if (Array.isArray(projectExcludesValue) === false) {
|
|
568
|
+
return [];
|
|
569
|
+
}
|
|
570
|
+
const projectExcludes = [];
|
|
571
|
+
for (const projectExcludeValue of projectExcludesValue) {
|
|
572
|
+
const resolvedProjectExcludeValue = projectExcludeValue;
|
|
573
|
+
if (typeof resolvedProjectExcludeValue === 'string' && resolvedProjectExcludeValue.trim() !== '') {
|
|
574
|
+
projectExcludes.push(resolvedProjectExcludeValue);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return projectExcludes;
|
|
578
|
+
}
|
|
579
|
+
function resolveScaffoldGitignoreTemplatePath() {
|
|
580
|
+
const currentDirectory = dirname(fileURLToPath(import.meta.url));
|
|
581
|
+
return join(currentDirectory, '..', '..', 'templates', 'generators', 'must-haves', 'gitignore', 'gitignore');
|
|
582
|
+
}
|
|
583
|
+
async function writeScaffoldGitignore(rootDirectory, projectExcludes = []) {
|
|
584
|
+
const templatePath = resolveScaffoldGitignoreTemplatePath();
|
|
585
|
+
const templateContent = await fs.readFile(templatePath, 'utf-8');
|
|
586
|
+
const content = (projectExcludes.length > 0) ? `${templateContent}${projectExcludes.join('\n')}\n` : templateContent;
|
|
587
|
+
const targetPath = join(rootDirectory, '.gitignore');
|
|
588
|
+
await saveGeneratedFile(targetPath, content, false, {
|
|
589
|
+
command: 'nova generate must-haves gitignore',
|
|
590
|
+
docsSlug: 'cli/generators/must-haves/gitignore',
|
|
591
|
+
mode: 'strict',
|
|
592
|
+
}, false);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
519
595
|
export async function getMonorepoRootPlannedPaths(outputDirectory) {
|
|
520
596
|
const templateDirectory = resolveMonorepoRootTemplateDirectory();
|
|
521
597
|
const templateEntries = await collectFiles(templateDirectory, '');
|
|
522
598
|
return [
|
|
599
|
+
join(outputDirectory, '.env'),
|
|
600
|
+
join(outputDirectory, '.env.sample'),
|
|
601
|
+
join(outputDirectory, '.gitignore'),
|
|
523
602
|
join(outputDirectory, 'package.json'),
|
|
524
603
|
join(outputDirectory, 'nova.config.json'),
|
|
525
604
|
join(outputDirectory, 'turbo.json'),
|
|
@@ -527,7 +606,6 @@ export async function getMonorepoRootPlannedPaths(outputDirectory) {
|
|
|
527
606
|
];
|
|
528
607
|
}
|
|
529
608
|
export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
530
|
-
const currentDirectory = process.cwd();
|
|
531
609
|
await fs.mkdir(outputDirectory, { recursive: true });
|
|
532
610
|
const appsDirectory = join(outputDirectory, 'apps');
|
|
533
611
|
await fs.mkdir(appsDirectory, { recursive: true });
|
|
@@ -536,8 +614,8 @@ export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
|
536
614
|
const packageJsonContent = {
|
|
537
615
|
name: `${projectSlug}-project`,
|
|
538
616
|
version: '0.0.0',
|
|
539
|
-
private: true,
|
|
540
617
|
type: 'module',
|
|
618
|
+
private: true,
|
|
541
619
|
scripts: {
|
|
542
620
|
'dev': 'nova utility run-scripts --parallel --node-env development \'dev:*\'',
|
|
543
621
|
'dev:workspaces': 'turbo run dev',
|
|
@@ -572,7 +650,7 @@ export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
|
572
650
|
'apps/*',
|
|
573
651
|
'packages/*',
|
|
574
652
|
],
|
|
575
|
-
packageManager:
|
|
653
|
+
packageManager: LIB_SCAFFOLD_DEFAULT_PACKAGE_MANAGER,
|
|
576
654
|
engines: {
|
|
577
655
|
node: '^22 || ^24',
|
|
578
656
|
},
|
|
@@ -590,11 +668,6 @@ export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
|
590
668
|
};
|
|
591
669
|
const packageJsonPath = join(outputDirectory, 'package.json');
|
|
592
670
|
await fs.writeFile(packageJsonPath, `${JSON.stringify(packageJsonContent, null, 2)}\n`, 'utf-8');
|
|
593
|
-
const packageJsonRelativePath = relative(currentDirectory, packageJsonPath);
|
|
594
|
-
Logger.customize({
|
|
595
|
-
name: 'createMonorepoRoot',
|
|
596
|
-
purpose: 'written',
|
|
597
|
-
}).info(`Created "${packageJsonRelativePath}".`);
|
|
598
671
|
const turboJsonContent = {
|
|
599
672
|
$schema: 'https://turbo.build/schema.json',
|
|
600
673
|
globalDependencies: [
|
|
@@ -664,11 +737,6 @@ export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
|
664
737
|
};
|
|
665
738
|
const turboJsonPath = join(outputDirectory, 'turbo.json');
|
|
666
739
|
await fs.writeFile(turboJsonPath, `${JSON.stringify(turboJsonContent, null, 2)}\n`, 'utf-8');
|
|
667
|
-
const turboJsonRelativePath = relative(currentDirectory, turboJsonPath);
|
|
668
|
-
Logger.customize({
|
|
669
|
-
name: 'createMonorepoRoot',
|
|
670
|
-
purpose: 'written',
|
|
671
|
-
}).info(`Created "${turboJsonRelativePath}".`);
|
|
672
740
|
const projectTitle = projectSlug
|
|
673
741
|
.split('-')
|
|
674
742
|
.map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`)
|
|
@@ -679,6 +747,8 @@ export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
|
679
747
|
slug: projectSlug,
|
|
680
748
|
title: projectTitle,
|
|
681
749
|
},
|
|
750
|
+
legalName: 'Example Company',
|
|
751
|
+
startingYear: new Date().getFullYear(),
|
|
682
752
|
},
|
|
683
753
|
workspaces: {
|
|
684
754
|
'./': {
|
|
@@ -687,176 +757,76 @@ export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
|
687
757
|
policy: 'freezable',
|
|
688
758
|
},
|
|
689
759
|
},
|
|
760
|
+
environment: {
|
|
761
|
+
workspaces: {
|
|
762
|
+
'./': {
|
|
763
|
+
prefix: 'ROOT_',
|
|
764
|
+
},
|
|
765
|
+
},
|
|
766
|
+
},
|
|
690
767
|
};
|
|
691
768
|
const novaConfigPath = join(outputDirectory, 'nova.config.json');
|
|
692
769
|
await fs.writeFile(novaConfigPath, `${JSON.stringify(novaConfigContent, null, 2)}\n`, 'utf-8');
|
|
693
|
-
const novaConfigRelativePath = relative(currentDirectory, novaConfigPath);
|
|
694
|
-
Logger.customize({
|
|
695
|
-
name: 'createMonorepoRoot',
|
|
696
|
-
purpose: 'written',
|
|
697
|
-
}).info(`Created "${novaConfigRelativePath}".`);
|
|
698
770
|
const rootTemplateDirectory = resolveMonorepoRootTemplateDirectory();
|
|
699
771
|
const replacements = new Map([[
|
|
700
772
|
LIB_REGEX_PLACEHOLDER_PROJECT_SLUG,
|
|
701
773
|
projectSlug,
|
|
702
774
|
]]);
|
|
703
775
|
await writeTemplateFiles(rootTemplateDirectory, outputDirectory, replacements);
|
|
776
|
+
await writeScaffoldGitignore(outputDirectory);
|
|
777
|
+
await writeDotenvFiles({
|
|
778
|
+
report: false,
|
|
779
|
+
targetDirectory: outputDirectory,
|
|
780
|
+
variables: [],
|
|
781
|
+
});
|
|
704
782
|
return;
|
|
705
783
|
}
|
|
706
|
-
export
|
|
707
|
-
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
{
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
{
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
{
|
|
730
|
-
title: 'read-me',
|
|
731
|
-
description: 'Project README with badges and documentation links',
|
|
732
|
-
value: 'read-me',
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
title: 'agent-conventions',
|
|
736
|
-
description: 'Coding agent rules and conventions',
|
|
737
|
-
value: 'agent-conventions',
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
title: 'funding',
|
|
741
|
-
description: 'GitHub sponsor and funding links',
|
|
742
|
-
value: 'funding',
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
title: 'issue-template',
|
|
746
|
-
description: 'GitHub issue forms for bugs, features, and support',
|
|
747
|
-
value: 'issue-template',
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
title: 'workflows',
|
|
751
|
-
description: 'GitHub Actions CI/CD automation',
|
|
752
|
-
value: 'workflows',
|
|
753
|
-
},
|
|
754
|
-
];
|
|
755
|
-
const answers = await prompts({
|
|
756
|
-
type: 'multiselect',
|
|
757
|
-
name: 'generators',
|
|
758
|
-
message: 'Run generators? (space to select, enter to confirm)',
|
|
759
|
-
choices: generatorChoices,
|
|
760
|
-
hint: '- Space to select. Return to submit',
|
|
761
|
-
}, {
|
|
762
|
-
onCancel: () => false,
|
|
763
|
-
});
|
|
764
|
-
if (answers['generators'] === undefined) {
|
|
765
|
-
cancelled = true;
|
|
766
|
-
}
|
|
767
|
-
if (cancelled === true) {
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
const selected = answers['generators'];
|
|
771
|
-
if (selected.length === 0) {
|
|
772
|
-
Logger.customize({
|
|
773
|
-
name: 'promptPostScaffoldGenerators',
|
|
774
|
-
purpose: 'skip',
|
|
775
|
-
}).info('No generators selected. Skipping.');
|
|
776
|
-
return;
|
|
784
|
+
export function resolveScaffoldEnvironmentPrefix(environment, workspaceName) {
|
|
785
|
+
const existingPrefixes = [];
|
|
786
|
+
for (const scopeName of [
|
|
787
|
+
'project',
|
|
788
|
+
'workspaces',
|
|
789
|
+
'workflows',
|
|
790
|
+
]) {
|
|
791
|
+
const scopeValue = environment[scopeName];
|
|
792
|
+
if (isPlainObject(scopeValue) === false) {
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
const scope = scopeValue;
|
|
796
|
+
const entryValues = (scopeName === 'project') ? [scope] : Object.values(scope);
|
|
797
|
+
for (const entryValue of entryValues) {
|
|
798
|
+
if (isPlainObject(entryValue) === false) {
|
|
799
|
+
continue;
|
|
800
|
+
}
|
|
801
|
+
const entry = entryValue;
|
|
802
|
+
const prefixValue = entry['prefix'];
|
|
803
|
+
if (typeof prefixValue === 'string') {
|
|
804
|
+
existingPrefixes.push(prefixValue);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
777
807
|
}
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
const generatorResult = await generatorModule({ replaceFile: true });
|
|
789
|
-
if (generatorResult === 'cancelled') {
|
|
790
|
-
Logger.customize({
|
|
791
|
-
name: 'promptPostScaffoldGenerators',
|
|
792
|
-
purpose: 'cancelled',
|
|
793
|
-
}).info('Generator cancelled. Skipping remaining generators.');
|
|
808
|
+
const basePrefix = `${workspaceName.toUpperCase().replace(LIB_REGEX_PATTERN_NON_ALPHANUMERIC_RUN, '_')}_`;
|
|
809
|
+
let candidate = basePrefix;
|
|
810
|
+
let candidateIndex = 1;
|
|
811
|
+
let hasConflict = true;
|
|
812
|
+
while (hasConflict === true) {
|
|
813
|
+
hasConflict = libEnvNamespace.isReservedPrefix(candidate);
|
|
814
|
+
if (hasConflict === false) {
|
|
815
|
+
for (const existingPrefix of existingPrefixes) {
|
|
816
|
+
if (libEnvNamespace.prefixesOverlap(candidate, existingPrefix) === true) {
|
|
817
|
+
hasConflict = true;
|
|
794
818
|
break;
|
|
795
819
|
}
|
|
796
820
|
}
|
|
797
821
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
purpose: 'error',
|
|
802
|
-
}).error(`Failed to run generator "${generatorName}".`);
|
|
803
|
-
Logger.customize({
|
|
804
|
-
name: 'promptPostScaffoldGenerators',
|
|
805
|
-
purpose: 'errorDetail',
|
|
806
|
-
}).debug(error);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
process.chdir(originalCwd);
|
|
810
|
-
return;
|
|
811
|
-
}
|
|
812
|
-
async function loadGenerator(name) {
|
|
813
|
-
switch (name) {
|
|
814
|
-
case 'editorconfig': {
|
|
815
|
-
const editorconfigModule = await import('../cli/generate/must-haves/editorconfig.js');
|
|
816
|
-
return (options) => editorconfigModule['Runner'].run(options);
|
|
817
|
-
}
|
|
818
|
-
case 'gitignore': {
|
|
819
|
-
const gitignoreModule = await import('../cli/generate/must-haves/gitignore.js');
|
|
820
|
-
return (options) => gitignoreModule['Runner'].run(options);
|
|
821
|
-
}
|
|
822
|
-
case 'dotenv': {
|
|
823
|
-
const dotenvModule = await import('../cli/generate/must-haves/dotenv.js');
|
|
824
|
-
return (options) => dotenvModule['Runner'].run(options);
|
|
825
|
-
}
|
|
826
|
-
case 'license': {
|
|
827
|
-
const licenseModule = await import('../cli/generate/must-haves/license.js');
|
|
828
|
-
return (options) => licenseModule['Runner'].run(options);
|
|
829
|
-
}
|
|
830
|
-
case 'read-me': {
|
|
831
|
-
const readMeModule = await import('../cli/generate/must-haves/read-me.js');
|
|
832
|
-
return (options) => readMeModule['Runner'].run(options);
|
|
833
|
-
}
|
|
834
|
-
case 'agent-conventions': {
|
|
835
|
-
const agentConventionsModule = await import('../cli/generate/must-haves/agent-conventions.js');
|
|
836
|
-
return (options) => agentConventionsModule['Runner'].run(options);
|
|
837
|
-
}
|
|
838
|
-
case 'funding': {
|
|
839
|
-
const fundingModule = await import('../cli/generate/github/funding.js');
|
|
840
|
-
return (options) => fundingModule['Runner'].run(options);
|
|
841
|
-
}
|
|
842
|
-
case 'issue-template': {
|
|
843
|
-
const issueTemplateModule = await import('../cli/generate/github/issue-template.js');
|
|
844
|
-
return (options) => issueTemplateModule['Runner'].run(options);
|
|
845
|
-
}
|
|
846
|
-
case 'workflows': {
|
|
847
|
-
const workflowsModule = await import('../cli/generate/github/workflows-blueprint.js');
|
|
848
|
-
return (options) => workflowsModule['Runner'].generate(options);
|
|
849
|
-
}
|
|
850
|
-
default: {
|
|
851
|
-
Logger.customize({
|
|
852
|
-
name: 'loadGenerator',
|
|
853
|
-
purpose: 'unknown',
|
|
854
|
-
}).warn(`Unknown generator "${name}". Skipping.`);
|
|
855
|
-
return undefined;
|
|
822
|
+
if (hasConflict === true) {
|
|
823
|
+
candidate = `W${candidateIndex}_${basePrefix}`;
|
|
824
|
+
candidateIndex += 1;
|
|
856
825
|
}
|
|
857
826
|
}
|
|
827
|
+
return candidate;
|
|
858
828
|
}
|
|
859
|
-
export async function registerWorkspaceInConfig(configFilePath, workspaceRelPath, workspacePackageName, category) {
|
|
829
|
+
export async function registerWorkspaceInConfig(configFilePath, workspaceRelPath, workspacePackageName, workspaceName, category, environmentVariables) {
|
|
860
830
|
let parsedConfig = undefined;
|
|
861
831
|
try {
|
|
862
832
|
const raw = await fs.readFile(configFilePath, 'utf-8');
|
|
@@ -902,11 +872,28 @@ export async function registerWorkspaceInConfig(configFilePath, workspaceRelPath
|
|
|
902
872
|
policy,
|
|
903
873
|
});
|
|
904
874
|
Reflect.set(parsedConfig, 'workspaces', workspaces);
|
|
875
|
+
const parsedEnvironment = parsedConfig['environment'];
|
|
876
|
+
if (parsedEnvironment !== undefined && isPlainObject(parsedEnvironment) === false) {
|
|
877
|
+
reportError('The root nova.config.json "environment" field must be an object.');
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
const environment = parsedEnvironment ?? {};
|
|
881
|
+
const parsedEnvironmentWorkspaces = environment['workspaces'];
|
|
882
|
+
if (parsedEnvironmentWorkspaces !== undefined && isPlainObject(parsedEnvironmentWorkspaces) === false) {
|
|
883
|
+
reportError('The root nova.config.json "environment.workspaces" field must be an object.');
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
const environmentWorkspaces = parsedEnvironmentWorkspaces ?? {};
|
|
887
|
+
const environmentWorkspace = {
|
|
888
|
+
prefix: resolveScaffoldEnvironmentPrefix(environment, workspaceName),
|
|
889
|
+
};
|
|
890
|
+
if (environmentVariables.length > 0) {
|
|
891
|
+
Reflect.set(environmentWorkspace, 'variables', environmentVariables);
|
|
892
|
+
}
|
|
893
|
+
Reflect.set(environmentWorkspaces, workspaceRelPath, environmentWorkspace);
|
|
894
|
+
Reflect.set(environment, 'workspaces', environmentWorkspaces);
|
|
895
|
+
Reflect.set(parsedConfig, 'environment', environment);
|
|
905
896
|
await fs.writeFile(configFilePath, `${JSON.stringify(parsedConfig, null, 2)}\n`, 'utf-8');
|
|
906
|
-
Logger.customize({
|
|
907
|
-
name: 'registerWorkspaceInConfig',
|
|
908
|
-
purpose: 'written',
|
|
909
|
-
}).info(`Registered workspace "${configName}" in nova.config.json.`);
|
|
910
897
|
return;
|
|
911
898
|
}
|
|
912
899
|
export async function runScaffold(options, definition) {
|
|
@@ -932,10 +919,6 @@ export async function runScaffold(options, definition) {
|
|
|
932
919
|
reportError('Found a standalone project. Run from an empty directory to create a new monorepo, or add a valid "workspaces" field to use workspace mode. No scaffold files were written.');
|
|
933
920
|
return;
|
|
934
921
|
}
|
|
935
|
-
Logger.customize({
|
|
936
|
-
name: 'CliScaffold.run',
|
|
937
|
-
purpose: 'context',
|
|
938
|
-
}).info(`Detected mode: ${context['context']}.`);
|
|
939
922
|
let existingRoot = undefined;
|
|
940
923
|
if (context['context'] === 'workspace') {
|
|
941
924
|
existingRoot = await loadExistingRoot(context['root']);
|
|
@@ -948,9 +931,14 @@ export async function runScaffold(options, definition) {
|
|
|
948
931
|
}
|
|
949
932
|
}
|
|
950
933
|
if (isNonInteractive === true
|
|
951
|
-
&&
|
|
952
|
-
|
|
953
|
-
|
|
934
|
+
&& options['workspaceName'] === undefined) {
|
|
935
|
+
reportError('Non-interactive scaffolding requires --workspace-name. No scaffold files were written.');
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
if (isNonInteractive === true
|
|
939
|
+
&& context['context'] === 'workspace'
|
|
940
|
+
&& options['output'] === undefined) {
|
|
941
|
+
reportError('Adding a workspace non-interactively also requires --output. No scaffold files were written.');
|
|
954
942
|
return;
|
|
955
943
|
}
|
|
956
944
|
if (isNonInteractive === true
|
|
@@ -977,6 +965,10 @@ export async function runScaffold(options, definition) {
|
|
|
977
965
|
}).warn('Scaffold cancelled.');
|
|
978
966
|
return;
|
|
979
967
|
}
|
|
968
|
+
if (config['mode'] === 'monorepo' && config['outputDirectory'] === currentDirectory) {
|
|
969
|
+
reportError('A new project must be created in a new directory, not the current working directory. Choose a different --output path. No scaffold files were written.');
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
980
972
|
if (LIB_REGEX_PATTERN_SLUG_SIMPLE.test(config['name']) === false) {
|
|
981
973
|
reportError('The project name must be a lowercase slug containing only letters, numbers, hyphens, or underscores. No scaffold files were written.');
|
|
982
974
|
return;
|
|
@@ -985,12 +977,24 @@ export async function runScaffold(options, definition) {
|
|
|
985
977
|
reportError('The workspace name must be a lowercase slug containing only letters, numbers, hyphens, or underscores. No scaffold files were written.');
|
|
986
978
|
return;
|
|
987
979
|
}
|
|
980
|
+
if (await pathExists(config['outputDirectory']) === true) {
|
|
981
|
+
if (config['mode'] === 'monorepo') {
|
|
982
|
+
reportError(`The project destination "${resolveDisplayPath(currentDirectory, config['outputDirectory'])}" already exists. A new project scaffold requires a new directory; choose a different --output path. No scaffold files were written.`);
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
reportError(`The workspace destination "${resolveDisplayPath(currentDirectory, config['outputDirectory'])}" already exists. Choose a different --output path for the new workspace. No scaffold files were written.`);
|
|
986
|
+
}
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
988
989
|
const projectSlug = config['name'];
|
|
989
990
|
const workspacePackageNameBase = resolveWorkspacePackageName(projectSlug, config['workspaceName'], definition['category']);
|
|
990
991
|
const workspacePackageNamePrefix = definition['workspacePackageNamePrefix'] ?? '';
|
|
991
992
|
const workspacePackageName = (workspacePackageNamePrefix !== '' && workspacePackageNameBase.startsWith(workspacePackageNamePrefix) === false) ? `${workspacePackageNamePrefix}${workspacePackageNameBase}` : workspacePackageNameBase;
|
|
992
993
|
const configRoot = (config['mode'] === 'monorepo') ? config['outputDirectory'] : currentDirectory;
|
|
993
994
|
const configFilePath = join(configRoot, 'nova.config.json');
|
|
995
|
+
const rootGitignorePath = join(configRoot, '.gitignore');
|
|
996
|
+
const shouldCreateRootGitignore = config['mode'] === 'workspace' && await pathExists(rootGitignorePath) === false;
|
|
997
|
+
const scaffoldGitignoreProjectExcludes = (existingRoot === undefined) ? [] : resolveScaffoldGitignoreProjectExcludes(existingRoot['config']);
|
|
994
998
|
const workspaceBaseDirectory = (definition['category'] === 'package') ? 'packages' : 'apps';
|
|
995
999
|
const workspaceDirectory = (config['mode'] === 'monorepo') ? join(configRoot, workspaceBaseDirectory, config['workspaceName']) : config['outputDirectory'];
|
|
996
1000
|
const workspaceRelPath = normalizeWorkspaceRelativePath(configRoot, workspaceDirectory);
|
|
@@ -1077,14 +1081,34 @@ export async function runScaffold(options, definition) {
|
|
|
1077
1081
|
}
|
|
1078
1082
|
const templateAnswers = templateResolution['answers'];
|
|
1079
1083
|
const templateReplacements = templateResolution['replacements'];
|
|
1084
|
+
let resolvedReplacements = new Map();
|
|
1080
1085
|
const templateValidationError = (definition['validateTemplateAnswers'] === undefined) ? undefined : definition.validateTemplateAnswers(templateAnswers);
|
|
1086
|
+
if (definition['resolveReplacements'] !== undefined) {
|
|
1087
|
+
resolvedReplacements = definition.resolveReplacements(config['workspaceName']);
|
|
1088
|
+
}
|
|
1081
1089
|
if (templateValidationError !== undefined) {
|
|
1082
1090
|
reportError(`${templateValidationError} No scaffold files were written.`);
|
|
1083
1091
|
return;
|
|
1084
1092
|
}
|
|
1093
|
+
const shouldInstall = resolveScaffoldInstall(options['install']);
|
|
1094
|
+
const environmentVariables = definition['environmentVariables'] ?? [];
|
|
1095
|
+
let packageManagerValue = LIB_SCAFFOLD_DEFAULT_PACKAGE_MANAGER;
|
|
1096
|
+
if (existingRoot !== undefined) {
|
|
1097
|
+
packageManagerValue = existingRoot['packageJson']['packageManager'];
|
|
1098
|
+
}
|
|
1099
|
+
const packageManagerDescriptor = LibCorepack.parsePackageManager(packageManagerValue);
|
|
1100
|
+
if (shouldInstall === true && packageManagerDescriptor === undefined) {
|
|
1101
|
+
reportError('Installing scaffold dependencies requires an exact npm, pnpm, or Yarn Corepack descriptor in the root package.json "packageManager" field. No scaffold files were written.');
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
let packageManager = 'npm';
|
|
1105
|
+
if (packageManagerDescriptor !== undefined) {
|
|
1106
|
+
packageManager = packageManagerDescriptor['name'];
|
|
1107
|
+
}
|
|
1085
1108
|
const replacements = new Map([
|
|
1086
1109
|
...coreReplacements,
|
|
1087
1110
|
...templateReplacements,
|
|
1111
|
+
...resolvedReplacements,
|
|
1088
1112
|
]);
|
|
1089
1113
|
const workspaceTemplateSubpaths = [definition['templateSubpath']];
|
|
1090
1114
|
if (definition['resolveWorkspaceTemplateSubpaths'] !== undefined) {
|
|
@@ -1117,7 +1141,7 @@ export async function runScaffold(options, definition) {
|
|
|
1117
1141
|
const conflictingPaths = await findFileConflicts(plannedPaths);
|
|
1118
1142
|
if (conflictingPaths.length > 0) {
|
|
1119
1143
|
const conflictMessage = conflictingPaths.map((conflictingPath) => relative(configRoot, conflictingPath)).join(', ');
|
|
1120
|
-
reportError(`Scaffolding
|
|
1144
|
+
reportError(`Scaffolding found existing files at paths it needs to create: ${conflictMessage}. Move those files or choose a different destination, then run the command again. No scaffold files were written.`);
|
|
1121
1145
|
return;
|
|
1122
1146
|
}
|
|
1123
1147
|
let isWorkspaceCovered = existingRoot === undefined;
|
|
@@ -1130,10 +1154,41 @@ export async function runScaffold(options, definition) {
|
|
|
1130
1154
|
}
|
|
1131
1155
|
}
|
|
1132
1156
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1157
|
+
const destination = resolveDisplayPath(currentDirectory, workspaceDirectory);
|
|
1158
|
+
const projectRoot = resolveDisplayPath(currentDirectory, configRoot);
|
|
1159
|
+
const primaryScript = definition['primaryScript'] ?? 'dev';
|
|
1160
|
+
let presentationOptions = [];
|
|
1161
|
+
if (definition['resolvePresentationOptions'] !== undefined) {
|
|
1162
|
+
presentationOptions = definition.resolvePresentationOptions(config['workspaceName']);
|
|
1163
|
+
}
|
|
1164
|
+
if (shouldCreateRootGitignore === true) {
|
|
1165
|
+
presentationOptions.push({
|
|
1166
|
+
flag: 'Root .gitignore',
|
|
1167
|
+
value: 'Generate missing file',
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
presentationOptions.push({
|
|
1171
|
+
flag: 'Dependencies',
|
|
1172
|
+
value: (shouldInstall === true) ? `Install with ${packageManager}` : 'Skip installation',
|
|
1173
|
+
});
|
|
1174
|
+
reportScaffoldPlan({
|
|
1175
|
+
additionalOptions: presentationOptions,
|
|
1176
|
+
answers: templateAnswers,
|
|
1177
|
+
displayName: definition['displayName'],
|
|
1178
|
+
destination,
|
|
1179
|
+
mode: config['mode'],
|
|
1180
|
+
project: projectSlug,
|
|
1181
|
+
questions: definition['templateQuestions'] ?? [],
|
|
1182
|
+
workspacePackageName,
|
|
1183
|
+
});
|
|
1184
|
+
const confirmed = await confirmScaffoldPlan(isNonInteractive, isDryRun);
|
|
1185
|
+
if (confirmed === false) {
|
|
1186
|
+
Logger.customize({
|
|
1187
|
+
name: 'CliScaffold.run',
|
|
1188
|
+
purpose: 'cancelled',
|
|
1189
|
+
}).warn('Scaffold cancelled. No files were written.');
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1137
1192
|
if (isDryRun === true) {
|
|
1138
1193
|
if (config['mode'] === 'monorepo') {
|
|
1139
1194
|
Logger.customize({
|
|
@@ -1141,10 +1196,20 @@ export async function runScaffold(options, definition) {
|
|
|
1141
1196
|
purpose: 'dryRunRoot',
|
|
1142
1197
|
}).info(`Would create monorepo root at "${configRoot}".`);
|
|
1143
1198
|
}
|
|
1199
|
+
else if (shouldCreateRootGitignore === true) {
|
|
1200
|
+
Logger.customize({
|
|
1201
|
+
name: 'CliScaffold.run',
|
|
1202
|
+
purpose: 'dryRunGitignore',
|
|
1203
|
+
}).info(`Would create the missing root .gitignore at "${rootGitignorePath}".`);
|
|
1204
|
+
}
|
|
1144
1205
|
Logger.customize({
|
|
1145
1206
|
name: 'CliScaffold.run',
|
|
1146
1207
|
purpose: 'dryRunWorkspace',
|
|
1147
1208
|
}).info(`Would create workspace at "${workspaceDirectory}" and register "${workspaceRelPath}".`);
|
|
1209
|
+
Logger.customize({
|
|
1210
|
+
name: 'CliScaffold.run',
|
|
1211
|
+
purpose: 'dryRunDotenv',
|
|
1212
|
+
}).info(`Would create Nova's baseline .env and .env.sample files at "${workspaceDirectory}".`);
|
|
1148
1213
|
if (rootTemplateDirectories.length > 0) {
|
|
1149
1214
|
Logger.customize({
|
|
1150
1215
|
name: 'CliScaffold.run',
|
|
@@ -1157,11 +1222,37 @@ export async function runScaffold(options, definition) {
|
|
|
1157
1222
|
purpose: 'dryRunWorkspaces',
|
|
1158
1223
|
}).info(`Would add "${normalizedWorkspaceRelPath}" to the root package.json workspaces.`);
|
|
1159
1224
|
}
|
|
1225
|
+
reportScaffoldCompletion({
|
|
1226
|
+
completionNotes: definition['completionNotes'] ?? [],
|
|
1227
|
+
dependenciesInstalled: false,
|
|
1228
|
+
displayName: definition['displayName'],
|
|
1229
|
+
dryRun: true,
|
|
1230
|
+
packageManager,
|
|
1231
|
+
primaryScript,
|
|
1232
|
+
projectRoot,
|
|
1233
|
+
shouldConfigure: config['mode'] === 'monorepo',
|
|
1234
|
+
workspacePackageName,
|
|
1235
|
+
});
|
|
1160
1236
|
return;
|
|
1161
1237
|
}
|
|
1238
|
+
const progressTotal = 3
|
|
1239
|
+
+ ((config['mode'] === 'monorepo') ? 1 : 0)
|
|
1240
|
+
+ ((shouldCreateRootGitignore === true) ? 1 : 0)
|
|
1241
|
+
+ ((shouldInstall === true) ? 1 : 0);
|
|
1242
|
+
const progress = createScaffoldProgress(progressTotal);
|
|
1162
1243
|
if (config['mode'] === 'monorepo') {
|
|
1244
|
+
progress.start('Preparing monorepo root', projectRoot);
|
|
1163
1245
|
await createMonorepoRoot(configRoot, projectSlug);
|
|
1246
|
+
await progress.complete();
|
|
1247
|
+
}
|
|
1248
|
+
if (shouldCreateRootGitignore === true) {
|
|
1249
|
+
progress.start('Generating root .gitignore', projectRoot);
|
|
1250
|
+
if (await pathExists(rootGitignorePath) === false) {
|
|
1251
|
+
await writeScaffoldGitignore(configRoot, scaffoldGitignoreProjectExcludes);
|
|
1252
|
+
}
|
|
1253
|
+
await progress.complete();
|
|
1164
1254
|
}
|
|
1255
|
+
progress.start(`Writing ${definition['displayName']} workspace`, destination);
|
|
1165
1256
|
await fs.mkdir(workspaceDirectory, { recursive: true });
|
|
1166
1257
|
const workspaceTemplateWrites = workspaceTemplateDirectories.map((workspaceTemplateDirectory) => writeTemplateFiles(workspaceTemplateDirectory, workspaceDirectory, replacements));
|
|
1167
1258
|
const rootTemplateWrites = rootTemplateDirectories.map((rootTemplateDirectory) => writeTemplateFiles(rootTemplateDirectory, configRoot, replacements));
|
|
@@ -1179,6 +1270,7 @@ export async function runScaffold(options, definition) {
|
|
|
1179
1270
|
name: 'CliScaffold.run',
|
|
1180
1271
|
purpose: 'workspaceFinalizer',
|
|
1181
1272
|
}).debug(workspaceFinalizerError);
|
|
1273
|
+
progress.clear();
|
|
1182
1274
|
reportError(`The ${definition['typeName']} framework could not finish preparing the workspace. The generated files were left in place for inspection, but the workspace was not registered.`);
|
|
1183
1275
|
return;
|
|
1184
1276
|
}
|
|
@@ -1196,19 +1288,46 @@ export async function runScaffold(options, definition) {
|
|
|
1196
1288
|
}
|
|
1197
1289
|
const rootPackageJsonContents = `${JSON.stringify(existingRoot['packageJson'], null, 2)}\n`;
|
|
1198
1290
|
await fs.writeFile(rootPackageJsonPath, rootPackageJsonContents, 'utf-8');
|
|
1199
|
-
Logger.customize({
|
|
1200
|
-
name: 'CliScaffold.run',
|
|
1201
|
-
purpose: 'workspaces',
|
|
1202
|
-
}).info(`Added "${normalizedWorkspaceRelPath}" to the root package.json workspaces.`);
|
|
1203
|
-
}
|
|
1204
|
-
await registerWorkspaceInConfig(configFilePath, workspaceRelPath, workspacePackageName, definition['category']);
|
|
1205
|
-
Logger.customize({
|
|
1206
|
-
name: 'CliScaffold.run',
|
|
1207
|
-
purpose: 'complete',
|
|
1208
|
-
}).info(`Scaffold complete for ${definition['category']} ${definition['typeName']}.`);
|
|
1209
|
-
if (config['mode'] === 'monorepo' && isNonInteractive === false) {
|
|
1210
|
-
await promptPostScaffoldGenerators(configRoot);
|
|
1211
1291
|
}
|
|
1292
|
+
await progress.complete();
|
|
1293
|
+
progress.start('Registering workspace', workspacePackageName);
|
|
1294
|
+
await registerWorkspaceInConfig(configFilePath, workspaceRelPath, workspacePackageName, config['workspaceName'], definition['category'], environmentVariables);
|
|
1295
|
+
await progress.complete();
|
|
1296
|
+
progress.start('Generating environment files', destination);
|
|
1297
|
+
await writeDotenvFiles({
|
|
1298
|
+
report: false,
|
|
1299
|
+
targetDirectory: workspaceDirectory,
|
|
1300
|
+
variables: environmentVariables,
|
|
1301
|
+
});
|
|
1302
|
+
await progress.complete();
|
|
1303
|
+
let installSucceeded = false;
|
|
1304
|
+
if (shouldInstall === true) {
|
|
1305
|
+
progress.start(`Installing dependencies with ${packageManager}`, projectRoot);
|
|
1306
|
+
const installResult = await installScaffoldDependencies(configRoot, packageManager);
|
|
1307
|
+
if (installResult['succeeded'] === false) {
|
|
1308
|
+
progress.clear();
|
|
1309
|
+
const installOutput = installResult['output'].trim();
|
|
1310
|
+
if (installOutput !== '') {
|
|
1311
|
+
process.stderr.write(`\n${installOutput}\n`);
|
|
1312
|
+
}
|
|
1313
|
+
reportError(`Dependency installation failed. The scaffold files remain available at "${configRoot}". Run "${packageManager} install" from that directory after resolving the package-manager error.`);
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
installSucceeded = true;
|
|
1317
|
+
await progress.complete();
|
|
1318
|
+
}
|
|
1319
|
+
progress.finish(`${definition['displayName']} scaffold ready`);
|
|
1320
|
+
reportScaffoldCompletion({
|
|
1321
|
+
completionNotes: definition['completionNotes'] ?? [],
|
|
1322
|
+
dependenciesInstalled: installSucceeded,
|
|
1323
|
+
displayName: definition['displayName'],
|
|
1324
|
+
dryRun: false,
|
|
1325
|
+
packageManager,
|
|
1326
|
+
primaryScript,
|
|
1327
|
+
projectRoot,
|
|
1328
|
+
shouldConfigure: config['mode'] === 'monorepo',
|
|
1329
|
+
workspacePackageName,
|
|
1330
|
+
});
|
|
1212
1331
|
return;
|
|
1213
1332
|
}
|
|
1214
1333
|
//# sourceMappingURL=scaffold.js.map
|