Skip to content

Commit 1e130ed

Browse files
committed
refactor: move new arch templates to bottom
1 parent 5777760 commit 1e130ed

File tree

2 files changed

+36
-56
lines changed

2 files changed

+36
-56
lines changed

.github/workflows/build-templates.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424
- java-swift
2525
- kotlin-objc
2626
- kotlin-swift
27-
example:
28-
- native
2927
exclude:
3028
- type: module-new
3129
language: java-swift
@@ -50,22 +48,15 @@ jobs:
5048
include:
5149
- type: module-legacy
5250
language: cpp
53-
example: native
5451
- type: module-mixed
5552
language: cpp
56-
example: native
5753
- type: module-new
5854
language: cpp
59-
example: native
6055
- type: library
6156
language: js
62-
example: native
63-
- type: library
64-
language: js
65-
example: expo
6657

6758
concurrency:
68-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.type }}-${{ matrix.language }}-${{ matrix.example }}
59+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.type }}-${{ matrix.language }}
6960
cancel-in-progress: true
7061

7162
steps:
@@ -97,7 +88,7 @@ jobs:
9788
9889
- name: Create library
9990
run: |
100-
WORK_DIR=tmp-${{ matrix.type }}-${{ matrix.language }}-${{ matrix.example }}
91+
WORK_DIR=tmp-${{ matrix.type }}-${{ matrix.language }}
10192
./packages/create-react-native-library/bin/create-react-native-library "$WORK_DIR" \
10293
--slug @bob/react-native-test \
10394
--description test \
@@ -106,8 +97,7 @@ jobs:
10697
--author-url https://test.test \
10798
--repo-url https://test.test \
10899
--type ${{ matrix.type }} \
109-
--languages ${{ matrix.language }} \
110-
--example ${{ matrix.example }}
100+
--languages ${{ matrix.language }}
111101
112102
echo "work_dir=$WORK_DIR" >> $GITHUB_ENV
113103

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

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ type ArgName =
7171
| 'repo-url'
7272
| 'languages'
7373
| 'type'
74-
| 'example'
7574
| 'react-native-version';
7675

7776
type ProjectLanguages =
@@ -91,8 +90,6 @@ type ProjectType =
9190
| 'view-legacy'
9291
| 'library';
9392

94-
type ProjectExample = 'expo' | 'native';
95-
9693
type Answers = {
9794
slug: string;
9895
description: string;
@@ -102,7 +99,6 @@ type Answers = {
10299
repoUrl: string;
103100
languages: ProjectLanguages;
104101
type?: ProjectType;
105-
example?: ProjectExample;
106102
reactNativeVersion?: string;
107103
};
108104

@@ -139,36 +135,48 @@ const LANGUAGE_CHOICES: {
139135
},
140136
];
141137

142-
const TYPE_CHOICES: { title: string; value: ProjectType }[] = [
143-
{
144-
title: 'Turbo module with backward compat (experimental)',
145-
value: 'module-mixed',
146-
},
138+
const NEWARCH_DESCRIPTION = 'requires new architecture (experimental)';
139+
const BACKCOMPAT_DESCRIPTION = 'supports new architecture (experimental)';
140+
141+
const TYPE_CHOICES: {
142+
title: string;
143+
value: ProjectType;
144+
description: string;
145+
}[] = [
147146
{
148-
title: 'Turbo module (experimental)',
149-
value: 'module-new',
147+
title: 'JavaScript library',
148+
value: 'library',
149+
description: 'supports Expo Go and Web',
150150
},
151151
{
152152
title: 'Native module',
153153
value: 'module-legacy',
154+
description: 'bridge for native APIs to JS',
154155
},
155156
{
156-
title: 'Fabric view with backward compat (experimental)',
157-
value: 'view-mixed',
157+
title: 'Native view',
158+
value: 'view-legacy',
159+
description: 'bridge for native views to JS',
158160
},
159161
{
160-
title: 'Fabric view (experimental)',
161-
value: 'view-new',
162+
title: 'Turbo module with backward compat',
163+
value: 'module-mixed',
164+
description: BACKCOMPAT_DESCRIPTION,
162165
},
163-
{ title: 'Native view', value: 'view-legacy' },
164-
{ title: 'JavaScript library', value: 'library' },
165-
];
166-
167-
const EXAMPLE_CHOICES: { title: string; value: ProjectExample }[] = [
168-
{ title: 'JavaScript only (with Expo and Web support)', value: 'expo' },
169166
{
170-
title: 'Native (to use other libraries with native code)',
171-
value: 'native',
167+
title: 'Turbo module',
168+
value: 'module-new',
169+
description: NEWARCH_DESCRIPTION,
170+
},
171+
{
172+
title: 'Fabric view with backward compat',
173+
value: 'view-mixed',
174+
description: BACKCOMPAT_DESCRIPTION,
175+
},
176+
{
177+
title: 'Fabric view',
178+
value: 'view-new',
179+
description: NEWARCH_DESCRIPTION,
172180
},
173181
];
174182

@@ -205,10 +213,6 @@ const args: Record<ArgName, yargs.Options> = {
205213
description: 'Type of library you want to develop',
206214
choices: TYPE_CHOICES.map(({ value }) => value),
207215
},
208-
'example': {
209-
description: 'Type of example app',
210-
choices: EXAMPLE_CHOICES.map(({ value }) => value),
211-
},
212216
'react-native-version': {
213217
description: 'Version of React Native to use, uses latest if not specified',
214218
type: 'string',
@@ -362,12 +366,6 @@ async function create(argv: yargs.Arguments<any>) {
362366
});
363367
},
364368
},
365-
'example': {
366-
type: (_, values) => (values.type === 'library' ? 'select' : null),
367-
name: 'example',
368-
message: 'What type of example app do you want to generate?',
369-
choices: EXAMPLE_CHOICES,
370-
},
371369
};
372370

373371
const {
@@ -379,7 +377,6 @@ async function create(argv: yargs.Arguments<any>) {
379377
repoUrl,
380378
type = 'module-mixed',
381379
languages = type === 'library' ? 'js' : 'java-objc',
382-
example = 'native',
383380
reactNativeVersion,
384381
} = {
385382
...argv,
@@ -456,6 +453,7 @@ async function create(argv: yargs.Arguments<any>) {
456453
? 'mixed'
457454
: 'legacy';
458455

456+
const example = type === 'library' ? 'expo' : 'native';
459457
const project = slug.replace(/^(react-native-|@[^/]+\/)/, '');
460458

461459
let namespace: string | undefined;
@@ -555,15 +553,7 @@ async function create(argv: yargs.Arguments<any>) {
555553

556554
if (languages === 'js') {
557555
await copyDir(JS_FILES, folder);
558-
559-
if (example === 'expo') {
560-
await copyDir(EXPO_FILES, folder);
561-
} else {
562-
await copyDir(
563-
path.join(EXAMPLE_FILES, 'example'),
564-
path.join(folder, 'example')
565-
);
566-
}
556+
await copyDir(EXPO_FILES, folder);
567557
} else {
568558
await copyDir(
569559
path.join(EXAMPLE_FILES, 'example'),

0 commit comments

Comments
 (0)