Refactor: Make the tuikit project generator cross-platform and testable#73
Open
phranck wants to merge 1 commit into
Open
Refactor: Make the tuikit project generator cross-platform and testable#73phranck wants to merge 1 commit into
phranck wants to merge 1 commit into
Conversation
- Sanitize project names into three separate values (display name, Swift identifier, filesystem path); reject '..', embedded slashes, and control characters before writing any file - Non-identifier characters become underscores in the Swift identifier (my-app -> my_app) so Package.swift and target names always compile - Add --yes/-y and TUIKIT_NON_INTERACTIVE=1 for CI-friendly runs; suppress the banner and the "Open in Xcode?" prompt in that mode - Guard Xcode defaults, the "open Package.swift" call, and the Xcode prompt behind a macOS check so nothing macOS-only runs on Linux - Pin swiftly to Swift 6.0.3 (matching the SDK gates) instead of installing latest; refuse the swift.org tarball path on non-Ubuntu distributions instead of pretending to be Ubuntu - Symmetric install/uninstall: resolve_install_path finds the script's own directory first and falls back to the installer defaults - Add an integration test script (scripts/tests/project-template/) that covers sanitization, path validation, OS/arch detection, basic generation, and hyphen sanitization end to end - Rewrite the README to describe non-interactive mode, name handling, the pinned Swift version, and remove the stale .swiftpm claim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #30.
Summary
my-app→my_app), and invalid names (.., embedded/, control characters, empty) are rejected before any file is written.--yes/-yandTUIKIT_NON_INTERACTIVE=1suppress every prompt (Xcode-open, PATH-update, Swift-install-consent), enabling CI runs. The banner is skipped in this mode.defaults write com.apple.dt.Xcode …,open Package.swift, and the "Open in Xcode?" prompt now run only whendetect_osreportsmacos.6.0.3(matching the SDK gates) instead oflatest; the swift.org tarball path refuses non-Ubuntu distributions instead of pretending to be Ubuntu.resolve_install_pathfinds the script's own bin directory first and falls back to the same defaultsinstall.shuses.tuikit uninstalland the generatedtuikit-uninstallboth work.scripts/tests/project-template/test-tuikit-generator.shcovers sanitization, path validation, OS/arch detection, basic project generation, invalid-name rejection, and hyphen sanitization end to end..swiftpmclaim; documented non-interactive mode, name handling, the pinned Swift version, and macOS/Linux behavior).Test plan
scripts/tests/project-template/test-tuikit-generator.sh— 12 assertions pass on macOS (helpers, path detection, generation with sanitization)./scripts/test-linux.shgreen on macOS (Swift 6.0.3) and Linux (Docker 6.0.3-noble), warning-fatalPackage.swiftand target names