Skip to content

Commit

Permalink
feat: remove module and view mixed templates
Browse files Browse the repository at this point in the history
  • Loading branch information
atlj committed Jun 11, 2024
1 parent 6b638e3 commit d46f0e1
Show file tree
Hide file tree
Showing 21 changed files with 5 additions and 378 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- module-mixed
- module-new
- view-legacy
- view-mixed
- view-new
- view-module-mixed
language:
Expand All @@ -39,11 +38,9 @@ jobs:
- type: module-new
language: kotlin-swift
- type: module-mixed
language: kotlin-swift
- type: view-new
language: kotlin-swift
- type: view-mixed
language: kotlin-swift
- type: view-module-mixed
language: kotlin-swift
include:
Expand Down
28 changes: 4 additions & 24 deletions packages/create-react-native-library/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ const NATIVE_COMMON_EXAMPLE_FILES = path.resolve(
const NATIVE_FILES = {
module_legacy: path.resolve(__dirname, '../templates/native-library-legacy'),
module_new: path.resolve(__dirname, '../templates/native-library-new'),
module_mixed: path.resolve(__dirname, '../templates/native-library-mixed'),
view_legacy: path.resolve(__dirname, '../templates/native-view-legacy'),
view_mixed: path.resolve(__dirname, '../templates/native-view-mixed'),
view_new: path.resolve(__dirname, '../templates/native-view-new'),
view_module_mixed: path.resolve(
__dirname,
Expand All @@ -53,7 +51,6 @@ const NATIVE_FILES = {
const OBJC_FILES = {
module_common: path.resolve(__dirname, '../templates/objc-library'),
view_legacy: path.resolve(__dirname, '../templates/objc-view-legacy'),
view_mixed: path.resolve(__dirname, '../templates/objc-view-mixed'),
view_new: path.resolve(__dirname, '../templates/objc-view-new'),
view_module_mixed: path.resolve(
__dirname,
Expand All @@ -64,9 +61,7 @@ const OBJC_FILES = {
const KOTLIN_FILES = {
module_legacy: path.resolve(__dirname, '../templates/kotlin-library-legacy'),
module_new: path.resolve(__dirname, '../templates/kotlin-library-new'),
module_mixed: path.resolve(__dirname, '../templates/kotlin-library-mixed'),
view_legacy: path.resolve(__dirname, '../templates/kotlin-view-legacy'),
view_mixed: path.resolve(__dirname, '../templates/kotlin-view-mixed'),
view_new: path.resolve(__dirname, '../templates/kotlin-view-new'),
view_module_mixed: path.resolve(
__dirname,
Expand Down Expand Up @@ -98,7 +93,6 @@ type ProjectType =
| 'module-legacy'
| 'module-new'
| 'module-mixed'
| 'view-mixed'
| 'view-new'
| 'view-legacy'
| 'library'
Expand Down Expand Up @@ -128,8 +122,6 @@ const LANGUAGE_CHOICES: {
types: [
'module-legacy',
'module-new',
'module-mixed',
'view-mixed',
'view-new',
'view-legacy',
'view-module-mixed',
Expand Down Expand Up @@ -163,7 +155,7 @@ const TYPE_CHOICES: {
{
title: 'Fabric view and Turbo module with backward compat',
value: 'view-module-mixed',
description: NEWARCH_DESCRIPTION,
description: BACKCOMPAT_DESCRIPTION,
},
{
title: 'JavaScript library',
Expand All @@ -180,21 +172,11 @@ const TYPE_CHOICES: {
value: 'view-legacy',
description: 'bridge for native views to JS',
},
{
title: 'Turbo module with backward compat',
value: 'module-mixed',
description: BACKCOMPAT_DESCRIPTION,
},
{
title: 'Turbo module',
value: 'module-new',
description: NEWARCH_DESCRIPTION,
},
{
title: 'Fabric view with backward compat',
value: 'view-mixed',
description: BACKCOMPAT_DESCRIPTION,
},
{
title: 'Fabric view',
value: 'view-new',
Expand Down Expand Up @@ -488,7 +470,7 @@ async function create(argv: yargs.Arguments<any>) {
authorEmail,
authorUrl,
repoUrl,
type = 'module-mixed',
type = 'view-module-mixed',
languages = type === 'library' ? 'js' : 'kotlin-objc',
example: hasExample,
reactNativeVersion,
Expand Down Expand Up @@ -556,9 +538,7 @@ async function create(argv: yargs.Arguments<any>) {
const arch =
type === 'module-new' || type === 'view-new'
? 'new'
: type === 'module-mixed' ||
type === 'view-mixed' ||
type === 'view-module-mixed'
: type === 'module-mixed' || type === 'view-module-mixed'
? 'mixed'
: 'legacy';

Expand Down Expand Up @@ -706,7 +686,7 @@ async function create(argv: yargs.Arguments<any>) {
await copyDir(NATIVE_COMMON_EXAMPLE_FILES, folder);
}

if (moduleType === 'view_module') {
if (arch === 'mixed') {
// View module doesn't have legacy or a new arch only version.
await copyDir(NATIVE_FILES['view_module_mixed'], folder);
await copyDir(OBJC_FILES['view_module_mixed'], folder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ It is configured to use the local version of the library, so any changes you mak
<% if (project.native) { -%>
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/<%- project.name -%>Example.xcworkspace` in XCode and find the source files at `Pods > Development Pods > <%- project.slug -%>`.

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `<%- project.identifier -%>` under `Android`.
To edit the the Kotlin files, open `example/android` in Android studio and find the source files at `<%- project.identifier -%>` under `Android`.

<% } -%>
You can use various commands from the root directory to work with the project.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit d46f0e1

Please sign in to comment.