@livx.cc/appwrap 0.56.0 → 0.57.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livx.cc/appwrap",
3
- "version": "0.56.0",
3
+ "version": "0.57.0",
4
4
  "description": "Wrap any PWA into a native app with native capabilities (appwrap runtime + @livx.cc/native-kit).",
5
5
  "license": "MIT",
6
6
  "author": "Elya Livshitz",
@@ -6,6 +6,21 @@ default_platform(:ios)
6
6
  APP_ID = '__APP_ID__'.freeze
7
7
  TEAM_ID = '__TEAM_ID__'.freeze
8
8
 
9
+ # iOS app-extension targets discovered from the generated wrapper. Each dir under
10
+ # App_Resources/iOS/extensions/ carrying an extension.json is a SEPARATE Xcode target (name = dir
11
+ # name, e.g. AppwrapWidget / NotificationService). Its bundle id MUST be a child `<APP_ID>.<name>`
12
+ # (Apple rejects an extension whose id equals the app's or has >1 extra period), and it needs its
13
+ # OWN App Store profile. NS already stamps the correct child PRODUCT_BUNDLE_IDENTIFIER at prepare —
14
+ # the per-target signing below must NOT clobber it (a single unscoped update_code_signing_settings
15
+ # rewrites EVERY target's bundle id to APP_ID → collision at upload).
16
+ def appwrap_ios_extensions
17
+ ext_root = File.expand_path('../App_Resources/iOS/extensions', __dir__)
18
+ return [] unless Dir.exist?(ext_root)
19
+ Dir.children(ext_root)
20
+ .select { |name| File.file?(File.join(ext_root, name, 'extension.json')) }
21
+ .sort
22
+ end
23
+
9
24
  # Run `ns prepare` (which shells out to `pod install`) with a SANITIZED gem env.
10
25
  #
11
26
  # Why: fastlane runs under its own Ruby and exports GEM_HOME/GEM_PATH into every child process. On a
@@ -50,8 +65,12 @@ def appwrap_archive_and_sign_ios
50
65
  is_key_content_base64: true
51
66
  )
52
67
 
53
- # readonly: certs/profiles must be seeded once via `fastlane match appstore` (see workflow header).
54
- match(type: 'appstore', readonly: true, app_identifier: APP_ID,
68
+ # The app AND each extension sign with their OWN App Store profile — pull them all here.
69
+ # readonly: certs/profiles must be seeded once via `fastlane match appstore` (see workflow header);
70
+ # regenerate them (incl. per-extension) via the `regen_profiles` lane if capabilities changed.
71
+ extensions = appwrap_ios_extensions
72
+ ext_ids = extensions.map { |name| "#{APP_ID}.#{name}" }
73
+ match(type: 'appstore', readonly: true, app_identifier: [APP_ID, *ext_ids],
55
74
  git_url: ENV['MATCH_GIT_URL'], api_key: api_key)
56
75
 
57
76
  # NativeScript prepares the Xcode project inside the wrapper dir (native/ = parent of fastlane/).
@@ -59,22 +78,44 @@ def appwrap_archive_and_sign_ios
59
78
  appwrap_prepare_ios
60
79
 
61
80
  # NS defaults the project to automatic signing → archive can't find a profile. Pin manual signing
62
- # to the match-provided App Store profile (name exported by match into ENV).
63
- profile = ENV["sigh_#{APP_ID}_appstore_profile-name"] || "match AppStore #{APP_ID}"
81
+ # PER TARGET to the match-provided App Store profile (name exported by match into ENV). `targets:`
82
+ # is REQUIRED so each call scopes to ONE target — an unscoped call rewrites EVERY target's
83
+ # bundle_identifier to APP_ID, clobbering the extensions' child ids → CFBundleIdentifier collision.
84
+ provisioning = {}
85
+ resolve_profile = ->(bundle_id) { ENV["sigh_#{bundle_id}_appstore_profile-name"] || "match AppStore #{bundle_id}" }
86
+
87
+ app_profile = resolve_profile.call(APP_ID)
88
+ provisioning[APP_ID] = app_profile
64
89
  update_code_signing_settings(
65
90
  use_automatic_signing: false,
66
91
  path: 'platforms/ios/native.xcodeproj',
92
+ targets: ['native'], # main app target only — leave NS's child ids on the extensions untouched
67
93
  team_id: TEAM_ID,
68
94
  bundle_identifier: APP_ID,
69
95
  code_sign_identity: 'Apple Distribution',
70
- profile_name: profile
96
+ profile_name: app_profile
71
97
  )
72
98
 
99
+ extensions.each do |name|
100
+ ext_id = "#{APP_ID}.#{name}"
101
+ ext_profile = resolve_profile.call(ext_id)
102
+ provisioning[ext_id] = ext_profile
103
+ update_code_signing_settings(
104
+ use_automatic_signing: false,
105
+ path: 'platforms/ios/native.xcodeproj',
106
+ targets: [name],
107
+ team_id: TEAM_ID,
108
+ bundle_identifier: ext_id,
109
+ code_sign_identity: 'Apple Distribution',
110
+ profile_name: ext_profile
111
+ )
112
+ end
113
+
73
114
  build_app(
74
115
  workspace: 'platforms/ios/native.xcworkspace',
75
116
  scheme: 'native',
76
117
  export_method: 'app-store',
77
- export_options: { provisioningProfiles: { APP_ID => profile } }
118
+ export_options: { provisioningProfiles: provisioning }
78
119
  )
79
120
 
80
121
  api_key