Skip to content

Commit d24e464

Browse files
committed
refactor: better name for example project
closes #26
1 parent 639cab1 commit d24e464

File tree

21 files changed

+77
-71
lines changed

21 files changed

+77
-71
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,10 @@ typings/
6262
# dotenv environment variables file
6363
.env
6464

65+
# android
66+
.gradle
67+
.project
68+
.settings
69+
6570
# generated files
6671
lib/

templates/library/example/$package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "<%= project.slug %>-example",
3+
"description": "Example app for <%= project.slug %>",
34
"version": "0.0.1",
45
"private": true,
56
"scripts": {

templates/library/example/android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import com.android.build.OutputFile
3737
* // bundleInBeta: true,
3838
*
3939
* // whether to disable dev mode in custom build variants (by default only disabled in release)
40-
* // for example: to disable dev mode in the staging build type (if configured)
40+
* // for <%= project.name %>Example: to disable dev mode in the staging build type (if configured)
4141
* devDisabledInStaging: true,
4242
* // The configuration property can be in the following formats
4343
* // 'devDisabledIn${productFlavor}${buildType}'
@@ -64,7 +64,7 @@ import com.android.build.OutputFile
6464
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
6565
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
6666
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
67-
* // for example, you might want to remove it from here.
67+
* // for <%= project.name %>Example, you might want to remove it from here.
6868
* inputExcludes: ["android/**", "ios/**"],
6969
*
7070
* // override which node gets called and with what additional arguments
@@ -100,7 +100,7 @@ def enableProguardInReleaseBuilds = false
100100
/**
101101
* The preferred build flavor of JavaScriptCore.
102102
*
103-
* For example, to use the international variant, you can use:
103+
* For <%= project.name %>Example, to use the international variant, you can use:
104104
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105105
*
106106
* The international variant includes ICU i18n library and necessary data
@@ -128,7 +128,7 @@ android {
128128
}
129129

130130
defaultConfig {
131-
applicationId "com.example"
131+
applicationId "com.<%= project.name %>Example"
132132
minSdkVersion rootProject.ext.minSdkVersion
133133
targetSdkVersion rootProject.ext.targetSdkVersion
134134
versionCode 1

templates/library/example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example">
2+
package="com.<%= project.name %>Example">
33

44
<uses-permission android:name="android.permission.INTERNET" />
55

templates/library/example/android/app/src/main/java/com/example/MainActivity.java renamed to templates/library/example/android/app/src/main/java/com/<%= project.name %>Example/MainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example;
1+
package com.<%= project.name %>Example;
22

33
import com.facebook.react.ReactActivity;
44

@@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity {
1010
*/
1111
@Override
1212
protected String getMainComponentName() {
13-
return "example";
13+
return "<%= project.name %>Example";
1414
}
1515
}

templates/library/example/android/app/src/main/java/com/example/MainApplication.java renamed to templates/library/example/android/app/src/main/java/com/<%= project.name %>Example/MainApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example;
1+
package com.<%= project.name %>Example;
22

33
import android.app.Application;
44
import android.content.Context;
@@ -25,7 +25,7 @@ public boolean getUseDeveloperSupport() {
2525
protected List<ReactPackage> getPackages() {
2626
@SuppressWarnings("UnnecessaryLocalVariable")
2727
List<ReactPackage> packages = new PackageList(this).getPackages();
28-
// Packages that cannot be autolinked yet can be added manually here, for example:
28+
// Packages that cannot be autolinked yet can be added manually here, for <%= project.name %>Example:
2929
// packages.add(new MyReactNativePackage());
3030
packages.add(new <%= project.name %>Package());
3131

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">example</string>
2+
<string name="app_name"><%= project.name %> Example</string>
33
</resources>

templates/library/example/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
rootProject.name = 'example'
1+
rootProject.name = '<%= project.name %>Example'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
33
include ':app'
44

templates/library/example/app.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"name": "example",
3-
"displayName": "example"
4-
}
2+
"name": "<%= project.name %>Example",
3+
"displayName": "<%= project.name %> Example"
4+
}

templates/library/example/ios/example.xcodeproj/project.pbxproj renamed to templates/library/example/ios/<%= project.name %>Example.xcodeproj/project.pbxproj

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
0D1336C0461A88D01186E375 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BCEA90A70F4BEAD7E9FA28B2 /* libPods-example.a */; };
10+
0D1336C0461A88D01186E375 /* libPods-<%= project.name %>Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BCEA90A70F4BEAD7E9FA28B2 /* libPods-<%= project.name %>Example.a */; };
1111
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
1212
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
1313
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
@@ -23,23 +23,23 @@
2323
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
2424
proxyType = 1;
2525
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
26-
remoteInfo = example;
26+
remoteInfo = <%= project.name %>Example;
2727
};
2828
/* End PBXContainerItemProxy section */
2929

3030
/* Begin PBXFileReference section */
3131
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
3232
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
33-
13B07F961A680F5B00A75B9A /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
34-
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = example/AppDelegate.h; sourceTree = "<group>"; };
35-
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = example/AppDelegate.m; sourceTree = "<group>"; };
33+
13B07F961A680F5B00A75B9A /* <%= project.name %>Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = <%= project.name %>Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
34+
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = <%= project.name %>Example/AppDelegate.h; sourceTree = "<group>"; };
35+
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = <%= project.name %>Example/AppDelegate.m; sourceTree = "<group>"; };
3636
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
37-
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = "<group>"; };
38-
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = "<group>"; };
39-
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = example/main.m; sourceTree = "<group>"; };
40-
4D7192F03A36A017E887435B /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = "<group>"; };
41-
871719007ECC5EAD276C345C /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = "<group>"; };
42-
BCEA90A70F4BEAD7E9FA28B2 /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
37+
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = <%= project.name %>Example/Images.xcassets; sourceTree = "<group>"; };
38+
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = <%= project.name %>Example/Info.plist; sourceTree = "<group>"; };
39+
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = <%= project.name %>Example/main.m; sourceTree = "<group>"; };
40+
4D7192F03A36A017E887435B /* Pods-<%= project.name %>Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-<%= project.name %>Example.release.xcconfig"; path = "Target Support Files/Pods-<%= project.name %>Example/Pods-<%= project.name %>Example.release.xcconfig"; sourceTree = "<group>"; };
41+
871719007ECC5EAD276C345C /* Pods-<%= project.name %>Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-<%= project.name %>Example.debug.xcconfig"; path = "Target Support Files/Pods-<%= project.name %>Example/Pods-<%= project.name %>Example.debug.xcconfig"; sourceTree = "<group>"; };
42+
BCEA90A70F4BEAD7E9FA28B2 /* libPods-<%= project.name %>Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-<%= project.name %>Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4343
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
4444
/* End PBXFileReference section */
4545

@@ -55,7 +55,7 @@
5555
isa = PBXFrameworksBuildPhase;
5656
buildActionMask = 2147483647;
5757
files = (
58-
0D1336C0461A88D01186E375 /* libPods-example.a in Frameworks */,
58+
0D1336C0461A88D01186E375 /* libPods-<%= project.name %>Example.a in Frameworks */,
5959
);
6060
runOnlyForDeploymentPostprocessing = 0;
6161
};
@@ -84,7 +84,7 @@
8484
name = "Supporting Files";
8585
sourceTree = "<group>";
8686
};
87-
13B07FAE1A68108700A75B9A /* example */ = {
87+
13B07FAE1A68108700A75B9A /* <%= project.name %>Example */ = {
8888
isa = PBXGroup;
8989
children = (
9090
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
@@ -95,14 +95,14 @@
9595
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
9696
13B07FB71A68108700A75B9A /* main.m */,
9797
);
98-
name = example;
98+
name = <%= project.name %>Example;
9999
sourceTree = "<group>";
100100
};
101101
1CFFDEF7170271C97B8B7E5A /* Pods */ = {
102102
isa = PBXGroup;
103103
children = (
104-
871719007ECC5EAD276C345C /* Pods-example.debug.xcconfig */,
105-
4D7192F03A36A017E887435B /* Pods-example.release.xcconfig */,
104+
871719007ECC5EAD276C345C /* Pods-<%= project.name %>Example.debug.xcconfig */,
105+
4D7192F03A36A017E887435B /* Pods-<%= project.name %>Example.release.xcconfig */,
106106
);
107107
name = Pods;
108108
path = Pods;
@@ -112,7 +112,7 @@
112112
isa = PBXGroup;
113113
children = (
114114
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
115-
BCEA90A70F4BEAD7E9FA28B2 /* libPods-example.a */,
115+
BCEA90A70F4BEAD7E9FA28B2 /* libPods-<%= project.name %>Example.a */,
116116
);
117117
name = Frameworks;
118118
sourceTree = "<group>";
@@ -127,7 +127,7 @@
127127
83CBB9F61A601CBA00E9B192 = {
128128
isa = PBXGroup;
129129
children = (
130-
13B07FAE1A68108700A75B9A /* example */,
130+
13B07FAE1A68108700A75B9A /* <%= project.name %>Example */,
131131
832341AE1AAA6A7D00B99B32 /* Libraries */,
132132
83CBBA001A601CBA00E9B192 /* Products */,
133133
2D16E6871FA4F8E400B85C8A /* Frameworks */,
@@ -141,17 +141,17 @@
141141
83CBBA001A601CBA00E9B192 /* Products */ = {
142142
isa = PBXGroup;
143143
children = (
144-
13B07F961A680F5B00A75B9A /* example.app */,
144+
13B07F961A680F5B00A75B9A /* <%= project.name %>Example.app */,
145145
);
146146
name = Products;
147147
sourceTree = "<group>";
148148
};
149149
/* End PBXGroup section */
150150

151151
/* Begin PBXNativeTarget section */
152-
13B07F861A680F5B00A75B9A /* example */ = {
152+
13B07F861A680F5B00A75B9A /* <%= project.name %>Example */ = {
153153
isa = PBXNativeTarget;
154-
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */;
154+
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "<%= project.name %>Example" */;
155155
buildPhases = (
156156
CCCC07BCAFDEF1FCADC0D0C9 /* [CP] Check Pods Manifest.lock */,
157157
FD10A7F022414F080027D42C /* Start Packager */,
@@ -164,9 +164,9 @@
164164
);
165165
dependencies = (
166166
);
167-
name = example;
168-
productName = example;
169-
productReference = 13B07F961A680F5B00A75B9A /* example.app */;
167+
name = <%= project.name %>Example;
168+
productName = <%= project.name %>Example;
169+
productReference = 13B07F961A680F5B00A75B9A /* <%= project.name %>Example.app */;
170170
productType = "com.apple.product-type.application";
171171
};
172172
/* End PBXNativeTarget section */
@@ -193,7 +193,7 @@
193193
};
194194
};
195195
};
196-
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */;
196+
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "<%= project.name %>Example" */;
197197
compatibilityVersion = "Xcode 3.2";
198198
developmentRegion = English;
199199
hasScannedForEncodings = 0;
@@ -206,7 +206,7 @@
206206
projectDirPath = "";
207207
projectRoot = "";
208208
targets = (
209-
13B07F861A680F5B00A75B9A /* example */,
209+
13B07F861A680F5B00A75B9A /* <%= project.name %>Example */,
210210
);
211211
};
212212
/* End PBXProject section */
@@ -289,7 +289,7 @@
289289
outputFileListPaths = (
290290
);
291291
outputPaths = (
292-
"$(DERIVED_FILE_DIR)/Pods-example-checkManifestLockResult.txt",
292+
"$(DERIVED_FILE_DIR)/Pods-<%= project.name %>Example-checkManifestLockResult.txt",
293293
);
294294
runOnlyForDeploymentPostprocessing = 0;
295295
shellPath = /bin/sh;
@@ -360,7 +360,7 @@
360360
/* Begin PBXTargetDependency section */
361361
00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
362362
isa = PBXTargetDependency;
363-
target = 13B07F861A680F5B00A75B9A /* example */;
363+
target = 13B07F861A680F5B00A75B9A /* <%= project.name %>Example */;
364364
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
365365
};
366366
/* End PBXTargetDependency section */
@@ -372,47 +372,47 @@
372372
13B07FB21A68108700A75B9A /* Base */,
373373
);
374374
name = LaunchScreen.xib;
375-
path = example;
375+
path = <%= project.name %>Example;
376376
sourceTree = "<group>";
377377
};
378378
/* End PBXVariantGroup section */
379379

380380
/* Begin XCBuildConfiguration section */
381381
13B07F941A680F5B00A75B9A /* Debug */ = {
382382
isa = XCBuildConfiguration;
383-
baseConfigurationReference = 871719007ECC5EAD276C345C /* Pods-example.debug.xcconfig */;
383+
baseConfigurationReference = 871719007ECC5EAD276C345C /* Pods-<%= project.name %>Example.debug.xcconfig */;
384384
buildSettings = {
385385
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
386386
CURRENT_PROJECT_VERSION = 1;
387387
DEAD_CODE_STRIPPING = NO;
388-
INFOPLIST_FILE = example/Info.plist;
388+
INFOPLIST_FILE = <%= project.name %>Example/Info.plist;
389389
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
390390
OTHER_LDFLAGS = (
391391
"$(inherited)",
392392
"-ObjC",
393393
"-lc++",
394394
);
395-
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
396-
PRODUCT_NAME = example;
395+
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.<%= project.name %>Example.$(PRODUCT_NAME:rfc1034identifier)";
396+
PRODUCT_NAME = <%= project.name %>Example;
397397
VERSIONING_SYSTEM = "apple-generic";
398398
};
399399
name = Debug;
400400
};
401401
13B07F951A680F5B00A75B9A /* Release */ = {
402402
isa = XCBuildConfiguration;
403-
baseConfigurationReference = 4D7192F03A36A017E887435B /* Pods-example.release.xcconfig */;
403+
baseConfigurationReference = 4D7192F03A36A017E887435B /* Pods-<%= project.name %>Example.release.xcconfig */;
404404
buildSettings = {
405405
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
406406
CURRENT_PROJECT_VERSION = 1;
407-
INFOPLIST_FILE = example/Info.plist;
407+
INFOPLIST_FILE = <%= project.name %>Example/Info.plist;
408408
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
409409
OTHER_LDFLAGS = (
410410
"$(inherited)",
411411
"-ObjC",
412412
"-lc++",
413413
);
414-
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
415-
PRODUCT_NAME = example;
414+
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.<%= project.name %>Example.$(PRODUCT_NAME:rfc1034identifier)";
415+
PRODUCT_NAME = <%= project.name %>Example;
416416
VERSIONING_SYSTEM = "apple-generic";
417417
};
418418
name = Release;
@@ -519,7 +519,7 @@
519519
/* End XCBuildConfiguration section */
520520

521521
/* Begin XCConfigurationList section */
522-
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */ = {
522+
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "<%= project.name %>Example" */ = {
523523
isa = XCConfigurationList;
524524
buildConfigurations = (
525525
13B07F941A680F5B00A75B9A /* Debug */,
@@ -528,7 +528,7 @@
528528
defaultConfigurationIsVisible = 0;
529529
defaultConfigurationName = Release;
530530
};
531-
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */ = {
531+
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "<%= project.name %>Example" */ = {
532532
isa = XCConfigurationList;
533533
buildConfigurations = (
534534
83CBBA201A601CBA00E9B192 /* Debug */,

0 commit comments

Comments
 (0)