Skip to content

Commit 5ac83d8

Browse files
mikehardythymikee
andcommitted
fix(ios): allow detailed scriptPhases object in config (#1611)
* fix(ios, scriptPhases): allow detailed scriptPhases object in config WIP align the joi schema for scriptPhases with the actually allowed values * fix: bring back object type to scripPhases validation * fix: default to empty array Co-authored-by: Michał Pierzchała <[email protected]>
1 parent 810b6a0 commit 5ac83d8

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

packages/cli-config/src/__tests__/__snapshots__/index-test.ts.snap

+26-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ Object {
5151
"configurations": Array [],
5252
"podspecPath": "<<REPLACED>>/node_modules/react-native-test/ReactNativeTest.podspec",
5353
"scriptPhases": Array [
54-
"./abc",
54+
Object {
55+
"name": "abc",
56+
"path": "./phase.sh",
57+
},
5558
],
5659
},
5760
},
@@ -68,7 +71,28 @@ Object {
6871
"configurations": Array [],
6972
"podspecPath": "<<REPLACED>>/node_modules/react-native-test/ReactNativeTest.podspec",
7073
"scriptPhases": Array [
71-
"./customLocation/custom.sh",
74+
Object {
75+
"dependency_file": "/path/to/dependency/file",
76+
"execution_position": "after_compile",
77+
"input_file_lists": Array [
78+
"input_file_1",
79+
"input_file_2",
80+
],
81+
"input_files": Array [
82+
"input_file",
83+
],
84+
"name": "[TEST] Some Configuration",
85+
"output_file_lists": Array [
86+
"output_file_1",
87+
"output_file_2",
88+
],
89+
"output_files": Array [
90+
"output_file",
91+
],
92+
"path": "./customLocation/custom.sh",
93+
"shell_path": "some/shell/path/bash",
94+
"show_env_vars_in_log": false,
95+
},
7296
],
7397
},
7498
},

packages/cli-config/src/__tests__/index-test.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,20 @@ test('should read a config of a dependency and use it to load other settings', (
9797
dependency: {
9898
platforms: {
9999
ios: {
100-
scriptPhases: ["./customLocation/custom.sh"]
100+
scriptPhases: [
101+
{
102+
name: "[TEST] Some Configuration",
103+
path: "./customLocation/custom.sh",
104+
execution_position: "after_compile",
105+
input_files: ["input_file"],
106+
shell_path: "some/shell/path/bash",
107+
output_files: ["output_file"],
108+
input_file_lists: ["input_file_1", "input_file_2"],
109+
output_file_lists: ["output_file_1", "output_file_2"],
110+
show_env_vars_in_log: false,
111+
dependency_file: "/path/to/dependency/file"
112+
}
113+
]
101114
}
102115
}
103116
}
@@ -133,7 +146,7 @@ test('should merge project configuration with default values', () => {
133146
"react-native-test": {
134147
platforms: {
135148
ios: {
136-
scriptPhases: ["./abc"]
149+
scriptPhases: [{name: "abc", path: "./phase.sh"}]
137150
}
138151
},
139152
}

packages/cli-config/src/schema.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const dependencyConfig = t
6969
ios: t
7070
// IOSDependencyParams
7171
.object({
72-
scriptPhases: t.array().items(t.string()),
72+
scriptPhases: t.array().items(t.object()),
7373
configurations: t.array().items(t.string()).default([]),
7474
})
7575
.default({}),
@@ -120,7 +120,7 @@ export const projectConfig = t
120120
.object({
121121
podspecPath: t.string(),
122122
configurations: t.array().items(t.string()).default([]),
123-
scriptPhases: t.array().items(t.string()).default([]),
123+
scriptPhases: t.array().items(t.object()).default([]),
124124
})
125125
.allow(null),
126126
android: t

0 commit comments

Comments
 (0)