Skip to content

Commit 2744c0a

Browse files
committed
refactor: architecture -> arch
1 parent 6085fd6 commit 2744c0a

File tree

11 files changed

+25
-24
lines changed

11 files changed

+25
-24
lines changed

packages/create-react-native-library/src/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ const LANGUAGE_CHOICES: {
133133
},
134134
];
135135

136-
const NEWARCH_DESCRIPTION = 'requires new architecture (experimental)';
137-
const BACKCOMPAT_DESCRIPTION = 'supports new architecture (experimental)';
136+
const NEWARCH_DESCRIPTION = 'requires new arch (experimental)';
137+
const BACKCOMPAT_DESCRIPTION = 'supports new arch (experimental)';
138138

139139
const TYPE_CHOICES: {
140140
title: string;
@@ -444,7 +444,7 @@ async function create(argv: yargs.Arguments<any>) {
444444
}
445445

446446
const moduleType = type.startsWith('view-') ? 'view' : 'module';
447-
const architecture =
447+
const arch =
448448
type === 'module-new' || type === 'view-new'
449449
? 'new'
450450
: type === 'module-mixed' || type === 'view-mixed'
@@ -488,7 +488,7 @@ async function create(argv: yargs.Arguments<any>) {
488488
package_cpp: pack.replace(/\./g, '_'),
489489
identifier: slug.replace(/[^a-z0-9]+/g, '-').replace(/^-/, ''),
490490
native: languages !== 'js',
491-
architecture,
491+
arch,
492492
cpp: languages === 'cpp',
493493
kotlin: languages === 'kotlin-objc' || languages === 'kotlin-swift',
494494
swift: languages === 'java-swift' || languages === 'kotlin-swift',
@@ -541,7 +541,7 @@ async function create(argv: yargs.Arguments<any>) {
541541
type: example,
542542
dest: folder,
543543
projectName: options.project.name,
544-
architecture,
544+
arch,
545545
reactNativeVersion,
546546
});
547547

@@ -561,9 +561,9 @@ async function create(argv: yargs.Arguments<any>) {
561561
await copyDir(NATIVE_COMMON_FILES, folder);
562562

563563
if (moduleType === 'module') {
564-
await copyDir(NATIVE_FILES[`${moduleType}_${architecture}`], folder);
564+
await copyDir(NATIVE_FILES[`${moduleType}_${arch}`], folder);
565565
} else {
566-
await copyDir(NATIVE_FILES[`${moduleType}_${architecture}`], folder);
566+
await copyDir(NATIVE_FILES[`${moduleType}_${arch}`], folder);
567567
}
568568

569569
if (options.project.swift) {
@@ -572,11 +572,11 @@ async function create(argv: yargs.Arguments<any>) {
572572
if (moduleType === 'module') {
573573
await copyDir(OBJC_FILES[`${moduleType}_common`], folder);
574574
} else {
575-
await copyDir(OBJC_FILES[`view_${architecture}`], folder);
575+
await copyDir(OBJC_FILES[`view_${arch}`], folder);
576576
}
577577
}
578578

579-
const templateType = `${moduleType}_${architecture}` as const;
579+
const templateType = `${moduleType}_${arch}` as const;
580580

581581
if (options.project.kotlin) {
582582
await copyDir(KOTLIN_FILES[templateType], folder);

packages/create-react-native-library/src/utils/generateExampleApp.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ export default async function generateExampleApp({
3030
type,
3131
dest,
3232
projectName,
33-
architecture,
33+
arch,
3434
reactNativeVersion = 'latest',
3535
}: {
3636
type: 'expo' | 'native';
3737
dest: string;
3838
projectName: string;
39-
architecture: 'new' | 'mixed' | 'legacy';
39+
arch: 'new' | 'mixed' | 'legacy';
4040
reactNativeVersion?: string;
4141
}) {
4242
const directory = path.join(dest, 'example');
@@ -100,7 +100,7 @@ export default async function generateExampleApp({
100100
);
101101

102102
// If the library is on new architecture, enable new arch for iOS and Android
103-
if (architecture === 'new') {
103+
if (arch === 'new') {
104104
// Android
105105
// Change newArchEnabled=false to newArchEnabled=true in example/android/gradle.properties
106106
const gradleProperties = await fs.readFile(

packages/create-react-native-library/templates/common/$package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
}
157157
]
158158
]
159-
<% if (project.architecture === "new") { -%>
159+
<% if (project.arch === "new") { -%>
160160
},
161161
"codegenConfig": {
162162
"name": "RN<%- project.name -%><%- project.view ? 'View': '' -%>Spec",

packages/create-react-native-library/templates/common/CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To run the example app on iOS:
3434
yarn example ios
3535
```
3636

37-
<% if (project.architecture == 'mixed') { -%>
37+
<% if (project.arch === 'mixed') { -%>
3838
By default, the example is configured to build with the old architecture. To run the example with the new architecture, you can do the following:
3939

4040
1. For Android, run:
@@ -57,7 +57,7 @@ yarn clean
5757
```
5858

5959
<% } -%>
60-
<% if (project.architecture === 'new' || project.architecture == 'mixed') { -%>
60+
<% if (project.arch === 'new' || project.arch === 'mixed') { -%>
6161
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:
6262

6363
```sh
@@ -100,6 +100,7 @@ To edit the Objective-C or Swift files, open `example/ios/<%- project.name -%>Ex
100100
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `<%- project.identifier -%>` under `Android`.
101101

102102
<% } -%>
103+
103104
### Commit message convention
104105

105106
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:

packages/create-react-native-library/templates/common/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { <%- project.name -%>View } from "<%- project.slug -%>";
1818

1919
<<%- project.name -%>View color="tomato" />
2020
```
21-
<% } else if (project.architecture === 'new' && project.module) { -%>
21+
<% } else if (project.arch === 'new' && project.module) { -%>
2222

2323
```js
2424
import { multiply } from '<%- project.slug -%>';

packages/create-react-native-library/templates/common/example/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function App() {
1616
</View>
1717
);
1818
}
19-
<% } else if (project.architecture === 'new' && project.module) { -%>
19+
<% } else if (project.arch === 'new' && project.module) { -%>
2020
const result = multiply(3, 7);
2121

2222
export default function App() {

packages/create-react-native-library/templates/kotlin-library-mixed/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}Package.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import java.util.HashMap
99

1010
class <%- project.name -%>Package : TurboReactPackage() {
1111
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12-
return if (name == <%- project.name -%>Module.NAME) {
12+
return if (name === <%- project.name -%>Module.NAME) {
1313
<%- project.name -%>Module(reactContext)
1414
} else {
1515
null

packages/create-react-native-library/templates/kotlin-library-new/android/src/main/java/com/{%- project.package_dir %}/{%- project.name %}Package.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import java.util.HashMap
99

1010
class <%- project.name -%>Package : TurboReactPackage() {
1111
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12-
return if (name == <%- project.name -%>Module.NAME) {
12+
return if (name === <%- project.name -%>Module.NAME) {
1313
<%- project.name -%>Module(reactContext)
1414
} else {
1515
null

packages/create-react-native-library/templates/native-common/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ android {
8080
targetCompatibility JavaVersion.VERSION_1_8
8181
}
8282

83-
<% if (project.architecture == 'new') { -%>
83+
<% if (project.arch === 'new') { -%>
8484
sourceSets {
8585
main {
8686
if (isNewArchitectureEnabled()) {
@@ -91,7 +91,7 @@ android {
9191
}
9292
}
9393
}
94-
<% } else if (project.architecture == 'mixed') { -%>
94+
<% } else if (project.arch === 'mixed') { -%>
9595
sourceSets {
9696
main {
9797
if (isNewArchitectureEnabled()) {

packages/create-react-native-library/templates/native-common/{%- project.identifier %}.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
1111
s.license = package["license"]
1212
s.authors = package["author"]
1313

14-
s.platforms = { :ios => <%- project.architecture === "new" ? '"11.0"': '"10.0"' -%> }
14+
s.platforms = { :ios => <%- project.arch === "new" ? '"11.0"': '"10.0"' -%> }
1515
s.source = { :git => "<%- repo -%>.git", :tag => "#{s.version}" }
1616

1717
<% if (project.cpp) { -%>
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
3232
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
3333
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
3434
}
35-
<% if(project.architecture === "new" && project.view) { -%>
35+
<% if(project.arch === "new" && project.view) { -%>
3636
s.dependency "React-RCTFabric"
3737
<% } -%>
3838
s.dependency "React-Codegen"

packages/create-react-native-library/templates/objc-library/ios/{%- project.name %}.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ @implementation <%- project.name -%>
44

55
RCT_EXPORT_MODULE()
66

7-
<% if (project.architecture === 'new') { -%>
7+
<% if (project.arch === 'new') { -%>
88
- (NSNumber *)multiply:(double)a b:(double)b {
99
<% if (project.cpp) { -%>
1010
NSNumber *result = @(<%- project.package_cpp -%>::multiply(a, b));

0 commit comments

Comments
 (0)