Skip to content

refactor: replace simple-plist with a typescript safe version#84

Merged
damiant merged 5 commits intomainfrom
fix-simple-plist
Jan 21, 2026
Merged

refactor: replace simple-plist with a typescript safe version#84
damiant merged 5 commits intomainfrom
fix-simple-plist

Conversation

@damiant
Copy link
Owner

@damiant damiant commented Jan 21, 2026

This pull request primarily refactors the codebase to reduce the use of exported interfaces and functions, making many previously exported items internal to their modules. It also updates the iOS project’s use of property list (plist) file handling by switching to a different plist library, and cleans up some unused or redundant code. There are also minor dependency updates and configuration tweaks.

Refactoring: Restricting Scope of Interfaces and Functions

  • Many interfaces and functions that were previously exported are now internal (not exported), improving encapsulation and reducing the public API surface. This affects files such as src/analyze-size.ts, src/android-debug-models.ts, src/audit.ts, src/capacitor-migrate.ts, src/monorepo-nx.ts, src/monorepo.ts, src/rules-capacitor-plugins.ts, src/splash-icon.ts, and others. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Dependency and Library Updates

  • Replaces the simple-plist library with @webnativellc/simple-plist for reading and writing plist files in src/native-project-ios.ts, and updates the relevant usage accordingly. Also updates package.json dependencies to reflect this change and adds @types/semver. [1] [2] [3] [4] [5] [6]

Code and Configuration Cleanup

  • Removes unused or redundant functions such as getAndroidManifestIntent, checkAndroidManifest, warnIfNotUsing, and excludeIgnoredTips. [1] [2] [3] [4] [5]
  • Changes several exported functions to internal scope, such as angularGenerate, extractErrors, setupServerCertificate, getNpmToken, passesRemoteFilter, and migrateCapacitorPlugin. [1] [2] [3] [4] [5] [6]

Development and Build Configuration

  • Updates .vscode/launch.json to reorder and re-add the "Run vitest" configuration, making it easier to run tests from VS Code. [1] [2]

These changes collectively improve code maintainability, reduce the risk of unintended usage of internal APIs, and modernize dependencies.

Summary by CodeRabbit

  • Chores

    • Updated dependencies (plist handling library & type definitions) and package entries.
    • Enabled stricter TypeScript checking (skipLibCheck disabled).
    • Adjusted IDE/debug launch configurations.
  • Refactor

    • Reduced module public surface by converting numerous previously exported symbols to internal-only, consolidating the public API.
  • Other

    • Replaced plist usage across iOS-related flows.

✏️ Tip: You can customize this high-level summary in your review settings.

@damiant damiant requested a review from Copilot January 21, 2026 15:24
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

This PR reduces the public API surface by removing many export modifiers, deletes several functions, migrates plist usage from simple-plist to @webnativellc/simple-plist, updates dependencies and tooling (package.json, .vscode/launch.json), and enables library type checking in tsconfig.json.

Changes

Cohort / File(s) Summary
Public API visibility changes
src/analyze-size.ts, src/android-debug-models.ts, src/angular-generate.ts, src/audit.ts, src/capacitor-build.ts, src/capacitor-migrate.ts, src/error-handler.ts, src/live-reload.ts, src/monorepo.ts, src/npm-info.ts, src/rules-capacitor-plugins.ts, src/splash-icon.ts, src/utilities.ts, src/xcode.ts
Removed export from multiple interfaces, enums, and functions (e.g., SizeResults, WebViewPage, angularGenerate, SecurityVulnerability, KeyStoreSettings, MonoFolder, getNpmToken, migrateCapacitorPlugin, AssetType, passesRemoteFilter, iosFolder), making them module-internal. Review callers for broken imports.
Function removals & signature changes
src/analyzer.ts, src/capacitor-configure.ts, src/ignore.ts, src/monorepo-nx.ts
Deleted functions/types: getAndroidManifestIntent, checkAndroidManifest, warnIfNotUsing, getCapacitorConfigWebDir, excludeIgnoredTips, NXWorkspace. Updated checkCordovaAndroidPreferenceMinimum signature to explicit `(preference: string, minVersion: string): Tip
Plist library migration
src/native-project-ios.ts, src/xcode.ts
Replaced simple-plist with @webnativellc/simple-plist and adapted calls to readFileSync/writeFileSync (helper renames). Verify plist I/O behavior and types.
Dependency & tooling changes
package.json, .vscode/launch.json, tsconfig.json
package.json: add @webnativellc/simple-plist, @types/semver; remove simple-plist. .vscode/launch.json: reorganized and added "Run Extension Tests". tsconfig.json: skipLibCheck set false.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through exports one by one,
Tightened the burrow till errands were done.
Swapped a plist friend, tuned the launch light,
Shelved some functions out of sight.
Happy hops—small changes, snug and bright! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring objective: replacing simple-plist with a TypeScript-safe version (@webnativellc/simple-plist). This is the primary functional change evident in the dependency updates and library usage modifications across src/native-project-ios.ts and src/xcode.ts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the codebase to replace the simple-plist library with @webnativellc/simple-plist, improve encapsulation by making several interfaces and functions internal, and clean up unused code. The primary motivation appears to be improving type safety (evidenced by the skipLibCheck change) while reducing the public API surface.

Changes:

  • Replaces simple-plist with @webnativellc/simple-plist for iOS property list file handling
  • Converts many exported interfaces and functions to internal scope across multiple modules
  • Removes unused/dead code including functions like excludeIgnoredTips, getAndroidManifestIntent, checkAndroidManifest, and warnIfNotUsing
  • Updates TypeScript configuration to enable stricter library type checking
  • Reorders VS Code launch configurations for better developer experience

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Adds @webnativellc/simple-plist and @types/semver dependencies, removes simple-plist
package-lock.json Updates lockfile with new plist library and updated dependency versions
src/native-project-ios.ts Switches to new plist library but incompletely - missing writeFileSync import
src/xcode.ts Updates plist import and makes iosFolder function internal
tsconfig.json Disables skipLibCheck to enable stricter type checking
src/utilities.ts Makes passesRemoteFilter function internal
src/splash-icon.ts Makes AssetType enum internal
src/rules-capacitor-plugins.ts Makes interface and migration function internal
src/npm-info.ts Makes getNpmToken function internal
src/monorepo.ts Makes MonoFolder interface internal
src/monorepo-nx.ts Removes unused NXWorkspace interface
src/live-reload.ts Makes setupServerCertificate function internal
src/ignore.ts Removes unused excludeIgnoredTips function
src/error-handler.ts Makes extractErrors function internal
src/capacitor-migrate.ts Makes MinPlugin and AndroidStudioInfo interfaces internal
src/capacitor-configure.ts Removes duplicate getCapacitorConfigWebDir function
src/capacitor-build.ts Makes KeyStoreSettings interface internal
src/audit.ts Makes SecurityVulnerability interface internal
src/angular-generate.ts Makes angularGenerate function internal
src/android-debug-models.ts Makes WebViewPage interface internal
src/analyzer.ts Removes unused functions, adds type annotations to exported function
src/analyze-size.ts Makes SizeResults and SizeResult interfaces internal
.vscode/launch.json Reorders debug configurations

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/analyzer.ts (1)

246-257: Return type is too narrow (can return undefined).

This function still returns undefined when cordovaConfig is missing or when the preference meets the minimum, but the signature now promises Tip. This is misleading and can break builds under strictNullChecks.

🔧 Proposed fix
-export function checkCordovaAndroidPreferenceMinimum(preference: string, minVersion: string): Tip {
+export function checkCordovaAndroidPreferenceMinimum(
+  preference: string,
+  minVersion: string,
+): Tip | undefined {
🤖 Fix all issues with AI agents
In `@src/native-project-ios.ts`:
- Around line 227-231: The current setDisplayName method reads the Info.plist
via readFileSync but writes the modified object back with fs.writeFileSync,
which will serialize to "[object Object]"; change the write to use the plist
serializer from `@webnativellc/simple-plist` (the library you used to parse it) so
the plist is correctly serialized—update setDisplayName to call the plist
library's write method (or its writeFileSync) instead of fs.writeFileSync and
ensure the import references match (keep references to setDisplayName,
this._infoPlistPath, and the readFileSync call so you modify the correct
function).

@damiant damiant merged commit 824343b into main Jan 21, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant