Skip to content

Commit ef58f27

Browse files
committed
feat(expo): add support for expo projects
1 parent c73408f commit ef58f27

File tree

5 files changed

+125
-28
lines changed

5 files changed

+125
-28
lines changed

.npmignore

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
config.json
2+
config.example.json
3+
*.zip
4+
*.tgz
5+
6+
plugin/src
7+
8+
# OSX
9+
#
10+
.DS_Store
11+
12+
# XDE
13+
.expo/
14+
15+
# VSCode
16+
.vscode/
17+
jsconfig.json
18+
19+
# Xcode
20+
#
21+
build/
22+
*.pbxuser
23+
!default.pbxuser
24+
*.mode1v3
25+
!default.mode1v3
26+
*.mode2v3
27+
!default.mode2v3
28+
*.perspectivev3
29+
!default.perspectivev3
30+
xcuserdata
31+
*.xccheckout
32+
*.moved-aside
33+
DerivedData
34+
*.hmap
35+
*.ipa
36+
*.xcuserstate
37+
project.xcworkspace
38+
39+
# Android/IJ
40+
#
41+
.classpath
42+
.cxx
43+
.gradle
44+
.idea
45+
.project
46+
.settings
47+
local.properties
48+
android.iml
49+
50+
# Cocoapods
51+
#
52+
example/ios/Pods
53+
example/ios/Podfile.lock
54+
55+
# Ruby
56+
example/vendor/
57+
58+
# node.js
59+
#
60+
node_modules/
61+
npm-debug.log
62+
yarn-debug.log
63+
yarn-error.log
64+
65+
# BUCK
66+
buck-out/
67+
\.buckd/
68+
android/app/libs
69+
android/keystores/debug.keystore
70+
71+
# Expo
72+
.expo/
73+
74+
# Turborepo
75+
.turbo/
76+
77+
# generated by bob
78+
lib/
79+
80+
# exclude development files
81+
scripts/
82+
tsconfig.build.json
83+
tsconfig.json
84+
lefthook.yml
85+
ejs-config.example.json
86+
deploy.sh
87+
babel.config.js
88+
CONTRIBUTING.md
89+
CODE_OF_CONDUCT.md
90+
ci-template.ejs
91+
example/node_modules
92+
example.yarn.lock
93+
example/ios/build
94+
example/ios/Pods
95+
example/ios/podfile.lock
96+
lib/typescript/example
97+
ios/build
98+
android/build
99+
android/gradle
100+
android/gradlew
101+
android/gradlew.bat
102+
android/local.properties
103+
example/android/build
104+
example/android/app/build
105+
example/android/local.properties
106+
**/__tests__/
107+
**/__fixtures__/*
108+
**/__mocks__/*
109+
**/.*

index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,16 @@
77
"types": "lib/typescript/index.d.ts",
88
"react-native": "src/index",
99
"source": "src/index",
10-
"files": [
11-
"src",
12-
"lib",
13-
"android",
14-
"ios",
15-
"cpp",
16-
"example",
17-
"*.podspec",
18-
"!lib/typescript/example",
19-
"!ios/build",
20-
"!android/build",
21-
"!android/gradle",
22-
"!android/gradlew",
23-
"!android/gradlew.bat",
24-
"!android/local.properties",
25-
"!**/__tests__",
26-
"!**/__fixtures__",
27-
"!**/__mocks__",
28-
"!**/.*"
29-
],
3010
"scripts": {
3111
"typecheck": "tsc --noEmit",
3212
"lint": "eslint \"**/*.{js,ts,tsx}\"",
3313
"prepack": "bob build",
3414
"release": "release-it",
3515
"example": "yarn --cwd example",
3616
"bootstrap": "yarn example && yarn install && yarn example pods",
37-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
17+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
18+
"build:plugin": "tsc --build plugin"
19+
3820
},
3921
"keywords": [
4022
"react-native",
@@ -65,14 +47,15 @@
6547
"devDependencies": {
6648
"@react-native-community/eslint-config": "^3.0.2",
6749
"@release-it/conventional-changelog": "^5.0.0",
50+
"@tsconfig/node-lts": "^20.1.1",
6851
"@types/react": "17.0.21",
6952
"@types/react-native": "0.70.0",
70-
"@tsconfig/node-lts": "^20.1.1",
7153
"del-cli": "^5.0.0",
7254
"eslint": "^8.4.1",
7355
"eslint-config-prettier": "^8.5.0",
7456
"eslint-plugin-prettier": "^4.0.0",
7557
"expo": "^50.0.8",
58+
"expo-module-scripts": "^3.4.1",
7659
"pod-install": "^0.1.0",
7760
"prettier": "^2.0.5",
7861
"react": "18.1.0",
@@ -85,9 +68,9 @@
8568
"@types/react": "17.0.21"
8669
},
8770
"peerDependencies": {
71+
"expo": ">=47.0.0",
8872
"react": "*",
89-
"react-native": "*",
90-
"expo": ">=47.0.0"
73+
"react-native": "*"
9174
},
9275
"peerDependenciesMeta": {
9376
"expo": {

plugin/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
withProjectBuildGradle,
77
} from '@expo/config-plugins';
88

9+
// @ts-ignore
910
import { PluginConfigType } from './pluginConfig';
1011

1112
const { createBuildGradlePropsConfigPlugin } = AndroidConfig.BuildProperties;
@@ -74,6 +75,12 @@ const withRnTalsecApp: ConfigPlugin<PluginConfigType> = (config, props) => {
7475
return config;
7576
};
7677

77-
const pkg = require('freerasp-react-native/package.json');
78+
let pkg: { name: string; version?: string } = {
79+
name: 'freerasp-react-native',
80+
};
81+
try {
82+
const freeraspPkg = require('freerasp-react-native/package.json');
83+
pkg = freeraspPkg;
84+
} catch {}
7885

7986
export default createRunOncePlugin(withRnTalsecApp, pkg.name, pkg.version);

plugin/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
2-
"extends": "@tsconfig/node-lts/tsconfig",
2+
"extends": "expo-module-scripts/tsconfig.plugin",
33
"compilerOptions": {
44
"outDir": "build",
55
"rootDir": "src",
6-
"declaration": true
76
},
87
"include": ["./src"]
98
}

0 commit comments

Comments
 (0)