Skip to content

Commit 83d8af4

Browse files
stoneman1frostney
authored andcommitted
Added automatic React linking to the iOS side (#44)
1 parent 8745ceb commit 83d8af4

File tree

4 files changed

+164
-3
lines changed

4 files changed

+164
-3
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ $ react-native-create-library MyFancyLibrary
2929

3030
This will create the folder `MyFancyLibrary` in which the library will be created in.
3131

32+
Now install dependencies by running this command in the newly created library.
33+
```
34+
$ npm install
35+
```
36+
3237
```
3338
Usage: react-native-create-library [options] <name>
3439

command.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
console.log(`
2929
${emoji.get('books')} Created library ${name} in \`./${name}\`.
3030
${emoji.get('clock9')} It took ${Date.now() - beforeCreation}ms.
31-
${emoji.get('arrow_right')} To get started type \`cd ./${name}\``);
31+
${emoji.get('arrow_right')} To get started type \`cd ./${name}\` and run \`npm install\``);
3232
}).catch((err) => {
3333
console.error(`Error while creating library ${name}`);
3434

templates/general.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ ${name};
7474
}, {
7575
name: () => 'package.json',
7676
content: ({ moduleName, platforms }) => {
77-
let dependencies = '"react-native": "^0.41.2"';
77+
let dependencies = `
78+
"react": "16.0.0-alpha.6",
79+
"react-native": "^0.44.1"`;
7880
if (platforms.indexOf('windows') >= 0) {
7981
dependencies += `,
8082
"react-native-windows": "0.41.0-rc.1"
@@ -96,6 +98,9 @@ ${name};
9698
"license": "",
9799
"peerDependencies": {
98100
${dependencies}
101+
},
102+
"devDependencies": {
103+
${dependencies}
99104
}
100105
}
101106
`;

templates/ios.js

Lines changed: 152 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,69 @@ RCT_EXPORT_MODULE()
7777
objects = {
7878
7979
/* Begin PBXBuildFile section */
80+
289A75F91F7D1C4500E34F27 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 289A75E91F7D1BF800E34F27 /* libReact.a */; };
8081
B3E7B58A1CC2AC0600A0062D /* ${name}.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* ${name}.m */; };
8182
/* End PBXBuildFile section */
8283
84+
/* Begin PBXContainerItemProxy section */
85+
289A75E81F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
86+
isa = PBXContainerItemProxy;
87+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
88+
proxyType = 2;
89+
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
90+
remoteInfo = React;
91+
};
92+
289A75EA1F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
93+
isa = PBXContainerItemProxy;
94+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
95+
proxyType = 2;
96+
remoteGlobalIDString = 2D2A28131D9B038B00D4039D;
97+
remoteInfo = "React-tvOS";
98+
};
99+
289A75EC1F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
100+
isa = PBXContainerItemProxy;
101+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
102+
proxyType = 2;
103+
remoteGlobalIDString = 3D3C059A1DE3340900C268FA;
104+
remoteInfo = yoga;
105+
};
106+
289A75EE1F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
107+
isa = PBXContainerItemProxy;
108+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
109+
proxyType = 2;
110+
remoteGlobalIDString = 3D3C06751DE3340C00C268FA;
111+
remoteInfo = "yoga-tvOS";
112+
};
113+
289A75F01F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
114+
isa = PBXContainerItemProxy;
115+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
116+
proxyType = 2;
117+
remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4;
118+
remoteInfo = cxxreact;
119+
};
120+
289A75F21F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
121+
isa = PBXContainerItemProxy;
122+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
123+
proxyType = 2;
124+
remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4;
125+
remoteInfo = "cxxreact-tvOS";
126+
};
127+
289A75F41F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
128+
isa = PBXContainerItemProxy;
129+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
130+
proxyType = 2;
131+
remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4;
132+
remoteInfo = jschelpers;
133+
};
134+
289A75F61F7D1BF800E34F27 /* PBXContainerItemProxy */ = {
135+
isa = PBXContainerItemProxy;
136+
containerPortal = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
137+
proxyType = 2;
138+
remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
139+
remoteInfo = "jschelpers-tvOS";
140+
};
141+
/* End PBXContainerItemProxy section */
142+
83143
/* Begin PBXCopyFilesBuildPhase section */
84144
58B511D91A9E6C8500147676 /* CopyFiles */ = {
85145
isa = PBXCopyFilesBuildPhase;
@@ -94,6 +154,7 @@ RCT_EXPORT_MODULE()
94154
95155
/* Begin PBXFileReference section */
96156
134814201AA4EA6300B7C361 /* lib${name}.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = lib${name}.a; sourceTree = BUILT_PRODUCTS_DIR; };
157+
289A75DD1F7D1BF800E34F27 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
97158
B3E7B5881CC2AC0600A0062D /* ${name}.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ${name}.h; sourceTree = "<group>"; };
98159
B3E7B5891CC2AC0600A0062D /* ${name}.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ${name}.m; sourceTree = "<group>"; };
99160
/* End PBXFileReference section */
@@ -103,6 +164,7 @@ RCT_EXPORT_MODULE()
103164
isa = PBXFrameworksBuildPhase;
104165
buildActionMask = 2147483647;
105166
files = (
167+
289A75F91F7D1C4500E34F27 /* libReact.a in Frameworks */,
106168
);
107169
runOnlyForDeploymentPostprocessing = 0;
108170
};
@@ -117,12 +179,36 @@ RCT_EXPORT_MODULE()
117179
name = Products;
118180
sourceTree = "<group>";
119181
};
182+
289A75DE1F7D1BF800E34F27 /* Products */ = {
183+
isa = PBXGroup;
184+
children = (
185+
289A75E91F7D1BF800E34F27 /* libReact.a */,
186+
289A75EB1F7D1BF800E34F27 /* libReact.a */,
187+
289A75ED1F7D1BF800E34F27 /* libyoga.a */,
188+
289A75EF1F7D1BF800E34F27 /* libyoga.a */,
189+
289A75F11F7D1BF800E34F27 /* libcxxreact.a */,
190+
289A75F31F7D1BF800E34F27 /* libcxxreact.a */,
191+
289A75F51F7D1BF800E34F27 /* libjschelpers.a */,
192+
289A75F71F7D1BF800E34F27 /* libjschelpers.a */,
193+
);
194+
name = Products;
195+
sourceTree = "<group>";
196+
};
197+
289A75F81F7D1C4500E34F27 /* Frameworks */ = {
198+
isa = PBXGroup;
199+
children = (
200+
);
201+
name = Frameworks;
202+
sourceTree = "<group>";
203+
};
120204
58B511D21A9E6C8500147676 = {
121205
isa = PBXGroup;
122206
children = (
123207
B3E7B5881CC2AC0600A0062D /* ${name}.h */,
124208
B3E7B5891CC2AC0600A0062D /* ${name}.m */,
125209
134814211AA4EA7D00B7C361 /* Products */,
210+
289A75DD1F7D1BF800E34F27 /* React.xcodeproj */,
211+
289A75F81F7D1C4500E34F27 /* Frameworks */,
126212
);
127213
sourceTree = "<group>";
128214
};
@@ -170,13 +256,78 @@ RCT_EXPORT_MODULE()
170256
mainGroup = 58B511D21A9E6C8500147676;
171257
productRefGroup = 58B511D21A9E6C8500147676;
172258
projectDirPath = "";
259+
projectReferences = (
260+
{
261+
ProductGroup = 289A75DE1F7D1BF800E34F27 /* Products */;
262+
ProjectRef = 289A75DD1F7D1BF800E34F27 /* React.xcodeproj */;
263+
},
264+
);
173265
projectRoot = "";
174266
targets = (
175267
58B511DA1A9E6C8500147676 /* ${name} */,
176268
);
177269
};
178270
/* End PBXProject section */
179271
272+
/* Begin PBXReferenceProxy section */
273+
289A75E91F7D1BF800E34F27 /* libReact.a */ = {
274+
isa = PBXReferenceProxy;
275+
fileType = archive.ar;
276+
path = libReact.a;
277+
remoteRef = 289A75E81F7D1BF800E34F27 /* PBXContainerItemProxy */;
278+
sourceTree = BUILT_PRODUCTS_DIR;
279+
};
280+
289A75EB1F7D1BF800E34F27 /* libReact.a */ = {
281+
isa = PBXReferenceProxy;
282+
fileType = archive.ar;
283+
path = libReact.a;
284+
remoteRef = 289A75EA1F7D1BF800E34F27 /* PBXContainerItemProxy */;
285+
sourceTree = BUILT_PRODUCTS_DIR;
286+
};
287+
289A75ED1F7D1BF800E34F27 /* libyoga.a */ = {
288+
isa = PBXReferenceProxy;
289+
fileType = archive.ar;
290+
path = libyoga.a;
291+
remoteRef = 289A75EC1F7D1BF800E34F27 /* PBXContainerItemProxy */;
292+
sourceTree = BUILT_PRODUCTS_DIR;
293+
};
294+
289A75EF1F7D1BF800E34F27 /* libyoga.a */ = {
295+
isa = PBXReferenceProxy;
296+
fileType = archive.ar;
297+
path = libyoga.a;
298+
remoteRef = 289A75EE1F7D1BF800E34F27 /* PBXContainerItemProxy */;
299+
sourceTree = BUILT_PRODUCTS_DIR;
300+
};
301+
289A75F11F7D1BF800E34F27 /* libcxxreact.a */ = {
302+
isa = PBXReferenceProxy;
303+
fileType = archive.ar;
304+
path = libcxxreact.a;
305+
remoteRef = 289A75F01F7D1BF800E34F27 /* PBXContainerItemProxy */;
306+
sourceTree = BUILT_PRODUCTS_DIR;
307+
};
308+
289A75F31F7D1BF800E34F27 /* libcxxreact.a */ = {
309+
isa = PBXReferenceProxy;
310+
fileType = archive.ar;
311+
path = libcxxreact.a;
312+
remoteRef = 289A75F21F7D1BF800E34F27 /* PBXContainerItemProxy */;
313+
sourceTree = BUILT_PRODUCTS_DIR;
314+
};
315+
289A75F51F7D1BF800E34F27 /* libjschelpers.a */ = {
316+
isa = PBXReferenceProxy;
317+
fileType = archive.ar;
318+
path = libjschelpers.a;
319+
remoteRef = 289A75F41F7D1BF800E34F27 /* PBXContainerItemProxy */;
320+
sourceTree = BUILT_PRODUCTS_DIR;
321+
};
322+
289A75F71F7D1BF800E34F27 /* libjschelpers.a */ = {
323+
isa = PBXReferenceProxy;
324+
fileType = archive.ar;
325+
path = libjschelpers.a;
326+
remoteRef = 289A75F61F7D1BF800E34F27 /* PBXContainerItemProxy */;
327+
sourceTree = BUILT_PRODUCTS_DIR;
328+
};
329+
/* End PBXReferenceProxy section */
330+
180331
/* Begin PBXSourcesBuildPhase section */
181332
58B511D71A9E6C8500147676 /* Sources */ = {
182333
isa = PBXSourcesBuildPhase;
@@ -274,7 +425,7 @@ RCT_EXPORT_MODULE()
274425
isa = XCBuildConfiguration;
275426
buildSettings = {
276427
HEADER_SEARCH_PATHS = (
277-
"$(inherited)",
428+
"$(inherited)",
278429
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
279430
"$(SRCROOT)/../../../React/**",
280431
"$(SRCROOT)/../../react-native/React/**",

0 commit comments

Comments
 (0)