Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add watch-widget type target #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hannojg
Copy link
Contributor

@hannojg hannojg commented Dec 22, 2023

With this change its possible to set the type to watch-widget.

Addresses: #6

To get watch widgets working, it depends on:

@bwees
Copy link

bwees commented Sep 5, 2024

What is the best way of implementing this? I tried merging all 3 PRs into my own fork and then adding that as a dependency but many errors are thrown:

ommand failed
npm error npm error command sh -c expo-module prepare
npm error npm error Configuring module
npm error npm error expo-module-scripts: README.md exists, not updating
npm error npm error src/icon/withImageAsset.ts(297,5): error TS2345: Argument of type '{ filename: string; idiom: "universal"; platform: string; size: string; }' is not assignable to parameter of type 'ContentsJsonImage'.
npm error npm error   Object literal may only specify known properties, and 'platform' does not exist in type 'ContentsJsonImage'.
npm error npm error src/icon/withIosIcon.ts(243,5): error TS2345: Argument of type '{ filename: string; idiom: "universal"; platform: string; size: string; }' is not assignable to parameter of type 'ContentsJsonImage'.
npm error npm error   Object literal may only specify known properties, and 'platform' does not exist in type 'ContentsJsonImage'.
npm error npm error src/withXcodeChanges.ts(75,29): error TS2345: Argument of type 'ExportedConfigWithProps<XcodeProject>' is not assignable to parameter of type 'ExpoConfig'.
npm error npm error   Types of property 'scheme' are incompatible.
npm error npm error     Type 'string | string[] | undefined' is not assignable to type 'string | undefined'.
npm error npm error       Type 'string[]' is not assignable to type 'string'.
npm error npm error Tried to guess the docs homepage for @bacons/apple-targets; add it under the "homepage" entry in package.json
npm error npm error npm warn using --force Recommended protections disabled.
npm error npm error npm warn invalid config include="\"dev\\n\\npeer\\n\\noptional\"" set in environment
npm error npm error npm warn invalid config Must be one or more of: prod, dev, optional, peer

@bwees
Copy link

bwees commented Sep 16, 2024

I have added a few @ts-expect-error tags on the offending lines in my branch, however when I do the expo prebuild, I get the following error and Xcode is unable to compile:

You're using an experimental Config Plugin that is subject to breaking changes and has no E2E tests.
✔ Config synced
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: An error occurred while processing the post-install hook of the Podfile.

[Xcodeproj] Consistency issue: no parent for object `SwiftUI.framework`: `FrameworksBuildPhase`, `FrameworksBuildPhase`

It also appears that the Info.plist file is not generated properly (missing the NSExtensionPointIdentifier) but that is able to be added easily by just creating the file myself.

here is my config for the watch widget:

/** @type {import('@bacons/apple-targets').Config} */
module.exports = {
    type: "watch-widget",
    name: "watchwidget",
    bundleIdentifier: ".widget",
};

and the watch app:

/** @type {import('@bacons/apple-targets').Config} */
module.exports = {
  type: "watch",
  name: "Maroon Rides Watch App",
  identifier: "com.bwees.reveille-rides.watch",
  deploymentTarget: "9.0",
  icon: "../../assets/icon.png",
  frameworks: [
    "SwiftUI"
  ],
  dependencyTargets: ["watchwidget"]
};

@hannojg are you able to advise on what a correct config file would look like and if there is something else I need to fix?

@bwees
Copy link

bwees commented Sep 16, 2024

it appears that it may be getting confused with multiple targets requesting SwiftUI. If I remove the main watch app's SwiftUI framework declaration, it appears to complete rebuild correctly

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.

2 participants