Skip to content

Commit c8bf0c3

Browse files
committed
wip
1 parent 0441bdd commit c8bf0c3

File tree

16 files changed

+159
-112
lines changed

16 files changed

+159
-112
lines changed

packages/platform-ios/template/ios/Podfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
# Resolve react_native_pods.rb with node to allow for hoisting
2-
require Pod::Executable.execute_command('node', ['-p',
3-
'require.resolve(
4-
"react-native/scripts/react_native_pods.rb",
5-
{paths: [process.argv[1]]},
6-
)', __dir__]).strip
1+
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
72

83
platform :ios, min_ios_version_supported
94
prepare_react_native_project!
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
11
# plugin-expo-config-plugins
2-
3-
This library was generated with [Nx](https://nx.dev).
4-
5-
## Building
6-
7-
Run `nx build plugin-expo-config-plugins` to build the library.
8-
9-
## Running unit tests
10-
11-
Run `nx test plugin-expo-config-plugins` to execute the unit tests via [Vitest](https://vitest.dev/).

packages/plugin-expo-config-plugins/eslint.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
{
22
"name": "@rnef/plugin-expo-config-plugins",
3-
"version": "0.2.0",
3+
"version": "0.8.2",
44
"type": "module",
55
"exports": {
66
"types": "./dist/src/index.d.ts",
7-
"import": "./dist/src/index.js"
7+
"default": "./dist/src/index.js"
88
},
99
"files": [
1010
"dist",
1111
"src",
1212
"template"
1313
],
1414
"scripts": {
15-
"publish:npm": "npm publish --access restricted",
15+
"build": "tsc -p tsconfig.lib.json",
16+
"dev": "tsc -p tsconfig.lib.json --watch",
17+
"publish:npm": "npm publish --access public",
1618
"publish:verdaccio": "npm publish --registry http://localhost:4873 --userconfig ../../.npmrc"
1719
},
1820
"dependencies": {
19-
"@rnef/tools": "^0.2.0",
20-
"@expo/config-plugins": "^9.0.15",
21+
"@rnef/tools": "^0.8.2",
22+
"@expo/config-plugins": "^10.1.2",
2123
"tslib": "^2.3.0"
2224
},
2325
"devDependencies": {
24-
"@rnef/config": "^0.2.0"
26+
"@rnef/config": "^0.8.2"
2527
},
2628
"publishConfig": {
27-
"access": "restricted"
29+
"access": "public"
2830
}
2931
}

packages/plugin-expo-config-plugins/project.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/plugin-expo-config-plugins/src/lib/ExpoConfigPlugins.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
2-
31
// '@expo/config-plugins' is a CommonJS module, which may not support all
42
// module.exports as named exports. CommonJS modules can always be imported via
53
// the default export.
6-
import ExpoConfigPlugins from "@expo/config-plugins";
4+
import ExpoConfigPlugins from '@expo/config-plugins';
75

86
const { BaseMods, evalModsAsync, withPlugins } = ExpoConfigPlugins;
97

packages/plugin-expo-config-plugins/src/lib/apply.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import * as fs from 'node:fs/promises';
32
import { withPlugins } from './ExpoConfigPlugins.js';
43
import { compileModsAsync } from './plugins/modCompiler.js';
@@ -17,12 +16,18 @@ export async function applyConfigPlugins({
1716
}
1817

1918
const content = await fs.readFile(appJsonPath, { encoding: 'utf-8' });
20-
const { plugins, ...config } = JSON.parse(content);
21-
if (!Array.isArray(plugins) || plugins.length === 0) {
19+
const { expo, ...rest } = JSON.parse(content);
20+
const appJsonConfig = expo || rest;
21+
22+
if (
23+
!Array.isArray(appJsonConfig.plugins) ||
24+
appJsonConfig.plugins.length === 0
25+
) {
2226
return;
2327
}
28+
2429
return compileModsAsync(
25-
withPlugins(withInternal(config, info), plugins),
30+
withPlugins(withInternal(appJsonConfig, info), appJsonConfig.plugins),
2631
info
2732
);
2833
}

packages/plugin-expo-config-plugins/src/lib/pluginExpoConfigPlugins.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ export const pluginExpoConfigPlugins =
1313
(api: PluginApi): PluginOutput => {
1414
api.registerCommand({
1515
name: 'apply-config-plugins',
16-
description: 'Starts Metro dev server.',
16+
description: 'Applies config plugins to the project.',
1717
action: async (args: ConfigPluginsArgs) => {
1818
const packageJsonPath = path.join(api.getProjectRoot(), 'package.json');
1919
const content = fs.readFileSync(packageJsonPath, 'utf-8');
20-
2120
if (!content.includes('"@expo/config-plugins"')) {
2221
return;
2322
}

packages/plugin-expo-config-plugins/src/lib/plugins/modCompiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const withDefaultBaseMods: typeof expoWithDefaultBaseMods = (config, props) => {
1818
return config;
1919
};
2020

21-
export const compileModsAsync: typeof expoCompileModsAsync = (
21+
export const compileModsAsync: typeof expoCompileModsAsync = async (
2222
config,
2323
props
2424
) => {
2525
if (props.introspect === true) {
26-
console.warn('`introspect` is not supported by react-native-test-app');
26+
console.warn('`introspect` is not supported');
2727
}
2828

2929
config = withDefaultBaseMods(config);

packages/plugin-expo-config-plugins/src/lib/plugins/withAndroidBaseMods.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
import { BaseMods } from "../ExpoConfigPlugins.js";
33
import { makeFilePathModifier } from "../provider.js";
4+
import type { AndroidModFileProviders } from "../types.js";
45

56
const modifyFilePath = makeFilePathModifier(
67
// @todo rewrite template finding and copying logic
@@ -10,8 +11,7 @@ const modifyFilePath = makeFilePathModifier(
1011
// https://github.com/expo/expo/blob/sdk-51/packages/%40expo/config-plugins/src/plugins/withAndroidBaseMods.ts
1112
const expoProviders = BaseMods.getAndroidModFileProviders();
1213

13-
/** @type {typeof expoProviders} */
14-
const defaultProviders = {
14+
const defaultProviders: AndroidModFileProviders = {
1515
dangerous: expoProviders.dangerous,
1616
finalized: expoProviders.finalized,
1717
manifest: modifyFilePath(
@@ -44,12 +44,12 @@ const defaultProviders = {
4444
mainActivity: modifyFilePath(
4545
expoProviders.mainActivity,
4646
// @todo rewrite template finding and copying logic
47-
"app/src/main/java/com/app76/MainActivity.kt"
47+
"app/src/main/java/com/appconfigplugins/MainActivity.kt"
4848
),
4949
mainApplication: modifyFilePath(
5050
expoProviders.mainApplication,
5151
// @todo rewrite template finding and copying logic
52-
"app/src/main/java/com/app76/MainApplication.kt"
52+
"app/src/main/java/com/appconfigplugins/MainApplication.kt"
5353
),
5454
};
5555

0 commit comments

Comments
 (0)