expo-watch 0.1.4 → 0.2.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/README.md CHANGED
@@ -55,8 +55,67 @@ Be aware of how string are escaped in JSON and that string values need to use ex
55
55
 
56
56
  ### Full configuration options
57
57
 
58
+ You can copy this configuration and adjust it to your needs. Remmeber to replace all TODOs.
59
+
58
60
  ```json
59
- {}
61
+ {
62
+ "targetName": "Example Watch App",
63
+ "buildSettings": {
64
+ "ASSETCATALOG_COMPILER_APPICON_NAME": "AppIcon",
65
+ "ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS": "YES",
66
+ "ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME": "AccentColor",
67
+ "CLANG_ANALYZER_NONNULL": "YES",
68
+ "CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION": "YES_AGGRESSIVE",
69
+ "CLANG_CXX_LANGUAGE_STANDARD": "\"gnu++20\"",
70
+ "CLANG_ENABLE_OBJC_WEAK": "YES",
71
+ "CLANG_WARN_DOCUMENTATION_COMMENTS": "YES",
72
+ "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER": "YES",
73
+ "CLANG_WARN_UNGUARDED_AVAILABILITY": "YES_AGGRESSIVE",
74
+ "CODE_SIGN_IDENTITY": "\"Apple Development\"",
75
+ "CODE_SIGN_STYLE": "Automatic",
76
+ "CURRENT_PROJECT_VERSION": "1",
77
+ "DEVELOPMENT_ASSET_PATHS": "\"\\\"../Example\\ Watch\\ App/Preview\\ Content\\\"\"", // TODO
78
+ "DEVELOPMENT_TEAM": "\"XXXXXXXXXX\"", // TODO
79
+ "ENABLE_USER_SCRIPT_SANDBOXING": "YES",
80
+ "GCC_C_LANGUAGE_STANDARD": "gnu17",
81
+ "GENERATE_INFOPLIST_FILE": "YES",
82
+ "INFOPLIST_KEY_CFBundleDisplayName": "\"Example App\"", // TODO
83
+ "INFOPLIST_KEY_UISupportedInterfaceOrientations": "\"UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown\"",
84
+ "INFOPLIST_KEY_WKCompanionAppBundleIdentifier": "com.example.parentapp", // TODO
85
+ "INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp": "YES",
86
+ "LD_RUNPATH_SEARCH_PATHS": "(\"$(inherited)\",\"@executable_path/Frameworks\")",
87
+ "LOCALIZATION_PREFERS_STRING_CATALOGS": "YES",
88
+ "MTL_FAST_MATH": "YES",
89
+ "PRODUCT_BUNDLE_IDENTIFIER": "com.example.parentapp.watchkitapp", // TODO
90
+ "PRODUCT_NAME": "\"$(TARGET_NAME)\"",
91
+ "SDKROOT": "watchos",
92
+ "SKIP_INSTALL": "YES",
93
+ "SWIFT_EMIT_LOC_STRINGS": "YES",
94
+ "SWIFT_VERSION": 5.0,
95
+ "TARGETED_DEVICE_FAMILY": 4,
96
+ "WATCHOS_DEPLOYMENT_TARGET": 8.0
97
+ },
98
+ "debugBuildSettings": {
99
+ "DEBUG_INFORMATION_FORMAT": "dwarf",
100
+ "ENABLE_PREVIEWS": "YES",
101
+ "MTL_ENABLE_DEBUG_INFO": "INCLUDE_SOURCE",
102
+ "OTHER_SWIFT_FLAGS": "\"$(inherited) -D EXPO_CONFIGURATION_DEBUG\"",
103
+ "SWIFT_ACTIVE_COMPILATION_CONDITIONS": "\"DEBUG $(inherited)\"",
104
+ "SWIFT_OPTIMIZATION_LEVEL": "-Onone"
105
+ },
106
+ "releaseBuildSettings": {
107
+ "DEBUG_INFORMATION_FORMAT": "\"dwarf-with-dsym\"",
108
+ "ENABLE_PREVIEWS": "NO",
109
+ "MTL_ENABLE_DEBUG_INFO": "NO",
110
+ "OTHER_SWIFT_FLAGS": "\"$(inherited) -D EXPO_CONFIGURATION_RELEASE\"",
111
+ "SWIFT_COMPILATION_MODE": "wholemodule",
112
+ "SWIFT_OPTIMIZATION_LEVEL": "\"-O\"",
113
+ "VALIDATE_PRODUCT": "YES"
114
+ },
115
+ "files": ["Assets.xcassets", "ContentView.swift", "WatchApp.swift"],
116
+ "compileSources": ["ContentView.swift", "WatchApp.swift"],
117
+ "copyBundleResources": ["Assets.xcassets", "Preview Assets.xcassets"]
118
+ }
60
119
  ```
61
120
 
62
121
  ### Options
@@ -75,6 +134,16 @@ If true it will add propert _MARKETING_VERSION_ with version found in from app.j
75
134
 
76
135
  This list is intentionally empty by default. Plugin do not provide any hidden build settings. Feel free to copy it from above.
77
136
 
137
+ These settings are applied to both Debug and Release configurations.
138
+
139
+ #### debugBuildSettings?: Record<string, string | number> (default: {})
140
+
141
+ Build settings applied only to the Debug configuration. They are merged on top of `buildSettings`.
142
+
143
+ #### releaseBuildSettings?: Record<string, string | number> (default: {})
144
+
145
+ Build settings applied only to the Release configuration. They are merged on top of `buildSettings`. Keep debug-only settings such as `SWIFT_OPTIMIZATION_LEVEL = -Onone` or the `DEBUG` compilation condition out of `buildSettings`, otherwise the archived watch app is built without optimizations.
146
+
78
147
  #### files?: string[] (default: [])
79
148
 
80
149
  List of files that will be linked to xcode workspace. Here you include all swift and xcassets files.
@@ -94,6 +163,13 @@ List of xcassets files. Typically these two files.
94
163
  ]
95
164
  ```
96
165
 
166
+ Localized `.strings` files are added by their path inside the `.lproj` folder. List them in both `files` and `copyBundleResources`.
167
+
168
+ ```json
169
+ "files": ["en.lproj/Localizable.strings", "nb.lproj/Localizable.strings"],
170
+ "copyBundleResources": ["en.lproj/Localizable.strings", "nb.lproj/Localizable.strings"]
171
+ ```
172
+
97
173
  ## Contributing
98
174
 
99
175
  As this a niche plugin it is not possible to provide a lot of support. If you have any issues please open an issue on this repo. I will try to help you as much as I can. There are only handful of code files in this plugin so you can easily debug it yourself.
@@ -102,7 +178,7 @@ Make a clone of this repo and local reference in your project. You can also exam
102
178
 
103
179
  ```json
104
180
  "plugins": [
105
- "../../../expo-watc/plugin/src/app.plugin.js",
181
+ "../../../expo-watch/plugin/src/app.plugin.js",
106
182
  {
107
183
  //...long config file
108
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-watch",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Watch companion app for iOS Expo app. ",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,9 +1,8 @@
1
1
  import { XcodeProject } from '@expo/config-plugins';
2
- interface BuildSettigs {
3
- [key: string]: string | number;
4
- }
5
- export declare function addXCConfigurationList(xcodeProject: XcodeProject, { targetName, buildSettings, }: {
2
+ export type BuildSettings = Record<string, string | number>;
3
+ export declare function addXCConfigurationList(xcodeProject: XcodeProject, { targetName, buildSettings, debugBuildSettings, releaseBuildSettings, }: {
6
4
  targetName: string;
7
- buildSettings: BuildSettigs;
5
+ buildSettings: BuildSettings;
6
+ debugBuildSettings: BuildSettings;
7
+ releaseBuildSettings: BuildSettings;
8
8
  }): any;
9
- export {};
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addXCConfigurationList = addXCConfigurationList;
4
- function addXCConfigurationList(xcodeProject, { targetName, buildSettings, }) {
4
+ function addXCConfigurationList(xcodeProject, { targetName, buildSettings, debugBuildSettings, releaseBuildSettings, }) {
5
5
  const buildConfigurationsList = [
6
6
  {
7
7
  isa: 'XCBuildConfiguration',
8
- buildSettings,
8
+ buildSettings: { ...buildSettings, ...debugBuildSettings },
9
9
  name: 'Debug',
10
10
  },
11
11
  {
12
12
  isa: 'XCBuildConfiguration',
13
- buildSettings,
13
+ buildSettings: { ...buildSettings, ...releaseBuildSettings },
14
14
  name: 'Release',
15
15
  },
16
16
  ];
@@ -1,9 +1,12 @@
1
1
  import { ConfigPlugin } from '@expo/config-plugins';
2
+ import { BuildSettings } from './addXCConfigurationList';
2
3
  declare const withWatchApp: ConfigPlugin<{
3
4
  targetName?: string;
4
5
  groupName?: string;
5
6
  setVersionFromCompanionApp?: boolean;
6
- buildSettings?: Record<string, string | number>;
7
+ buildSettings?: BuildSettings;
8
+ debugBuildSettings?: BuildSettings;
9
+ releaseBuildSettings?: BuildSettings;
7
10
  files?: string[];
8
11
  compileSources?: string[];
9
12
  copyBundleResources?: string[];
@@ -8,7 +8,7 @@ const addTargetDependency_1 = require("./addTargetDependency");
8
8
  const addToPbxNativeTargetSection_1 = require("./addToPbxNativeTargetSection");
9
9
  const addToPbxProjectSection_1 = require("./addToPbxProjectSection");
10
10
  const addXCConfigurationList_1 = require("./addXCConfigurationList");
11
- const withWatchApp = (config, { targetName = 'Sample Watch App', groupName = 'Embed Watch Content', setVersionFromCompanionApp = true, buildSettings = {}, files = [], compileSources = [], copyBundleResources = [], } = {}) => {
11
+ const withWatchApp = (config, { targetName = 'Sample Watch App', groupName = 'Embed Watch Content', setVersionFromCompanionApp = true, buildSettings = {}, debugBuildSettings = {}, releaseBuildSettings = {}, files = [], compileSources = [], copyBundleResources = [], } = {}) => {
12
12
  return (0, config_plugins_1.withXcodeProject)(config, (config) => {
13
13
  const version = config.version ?? '1.0.0';
14
14
  const xcodeProject = config.modResults;
@@ -21,6 +21,8 @@ const withWatchApp = (config, { targetName = 'Sample Watch App', groupName = 'Em
21
21
  ? { MARKETING_VERSION: version }
22
22
  : undefined),
23
23
  },
24
+ debugBuildSettings,
25
+ releaseBuildSettings,
24
26
  });
25
27
  const productFile = (0, addProductFile_1.addProductFile)(xcodeProject, {
26
28
  targetName,