expo-bbase 1.3.4 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.js +92 -106
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/templates/assets/adaptive-icon.png +0 -0
- package/templates/assets/favicon.png +0 -0
- package/templates/assets/fonts/Nunito-Bold.ttf +0 -0
- package/templates/assets/icon.png +0 -0
- package/templates/assets/splash-icon.png +0 -0
package/README.md
CHANGED
|
@@ -231,6 +231,9 @@ MIT
|
|
|
231
231
|
|
|
232
232
|
## 更新日志
|
|
233
233
|
|
|
234
|
+
### v1.3.5
|
|
235
|
+
- 🔧 **修复 Facebook 登录模块**:移除已废弃的 `expo-facebook`(SDK 54 不再包含),改用 `expo-auth-session` + `expo-web-browser` 实现 Facebook OAuth 登录
|
|
236
|
+
|
|
234
237
|
### v1.3.4
|
|
235
238
|
- 🔧 **目录结构修复**:去除 `src/` 层,模块文件(`modules/`、`api/`、`stores/` 等)与 `app/` 平级
|
|
236
239
|
- 📝 修正 Facebook 登录模块描述(SDK 54 不再支持 `expo-facebook`,改用 `expo-auth-session`)
|
package/dist/index.js
CHANGED
|
@@ -1219,92 +1219,88 @@ var auth_google_default = authGoogleModule;
|
|
|
1219
1219
|
var authFacebookModule = {
|
|
1220
1220
|
id: "auth-facebook",
|
|
1221
1221
|
name: "Facebook \u767B\u5F55",
|
|
1222
|
-
description: "expo-facebook",
|
|
1222
|
+
description: "expo-auth-session + expo-web-browser\uFF08SDK 54 \u4E0D\u518D\u652F\u6301 expo-facebook\uFF09",
|
|
1223
1223
|
defaultChecked: false,
|
|
1224
1224
|
dependencies: {
|
|
1225
|
-
"expo-
|
|
1225
|
+
"expo-auth-session": "~7.0.11",
|
|
1226
|
+
"expo-web-browser": "~15.0.11",
|
|
1227
|
+
"expo-crypto": "~15.0.9"
|
|
1226
1228
|
},
|
|
1227
1229
|
devDependencies: {},
|
|
1228
1230
|
files: [
|
|
1229
1231
|
{
|
|
1230
1232
|
path: "modules/auth/facebook.ts",
|
|
1231
1233
|
content: lines(
|
|
1232
|
-
'import
|
|
1234
|
+
'import { responseTypes } from "expo-auth-session";',
|
|
1235
|
+
'import { makeRedirectUri, useAuthRequest, useAutoDiscovery } from "expo-auth-session";',
|
|
1236
|
+
'import * as WebBrowser from "expo-web-browser";',
|
|
1233
1237
|
"",
|
|
1238
|
+
"// Facebook OAuth \u914D\u7F6E",
|
|
1234
1239
|
"export interface FacebookAuthConfig {",
|
|
1235
|
-
"
|
|
1236
|
-
" appName: string;",
|
|
1240
|
+
" clientId: string; // Facebook App ID",
|
|
1237
1241
|
"}",
|
|
1238
1242
|
"",
|
|
1239
|
-
"
|
|
1240
|
-
"
|
|
1241
|
-
"
|
|
1242
|
-
" appName: config.appName,",
|
|
1243
|
-
" });",
|
|
1244
|
-
"}",
|
|
1243
|
+
"// Facebook OAuth \u7AEF\u70B9",
|
|
1244
|
+
'const FACEBOOK_AUTH_ENDPOINT = "https://www.facebook.com/v18.0/dialog/oauth";',
|
|
1245
|
+
'const FACEBOOK_TOKEN_ENDPOINT = "https://graph.facebook.com/v18.0/oauth/access_token";',
|
|
1245
1246
|
"",
|
|
1246
|
-
"
|
|
1247
|
-
"
|
|
1248
|
-
" userId: string | null;",
|
|
1249
|
-
" userName: string | null;",
|
|
1250
|
-
" error: string | null;",
|
|
1251
|
-
"}> {",
|
|
1252
|
-
" try {",
|
|
1253
|
-
" const result = await Facebook.logInWithReadPermissionsAsync({",
|
|
1254
|
-
' permissions: ["public_profile", "email"],',
|
|
1255
|
-
" });",
|
|
1247
|
+
"// \u786E\u4FDD WebBrowser \u56DE\u8C03\u5B8C\u6210\u65F6\u5173\u95ED",
|
|
1248
|
+
"WebBrowser.maybeCompleteAuthSession();",
|
|
1256
1249
|
"",
|
|
1257
|
-
|
|
1258
|
-
"
|
|
1259
|
-
"
|
|
1260
|
-
"
|
|
1261
|
-
"
|
|
1250
|
+
"/**",
|
|
1251
|
+
" * \u4F7F\u7528 expo-auth-session \u5B9E\u73B0 Facebook \u767B\u5F55",
|
|
1252
|
+
" *",
|
|
1253
|
+
" * \u7528\u6CD5\uFF1A",
|
|
1254
|
+
" * 1. \u5728 Facebook Developer Console \u521B\u5EFA\u5E94\u7528\uFF0C\u83B7\u53D6 App ID",
|
|
1255
|
+
" * 2. \u914D\u7F6E OAuth \u91CD\u5B9A\u5411 URI",
|
|
1256
|
+
" * 3. \u5728\u7EC4\u4EF6\u4E2D\u4F7F\u7528 useFacebookAuth hook",
|
|
1257
|
+
" *",
|
|
1258
|
+
" * \u6CE8\u610F\uFF1ASDK 54 \u4E0D\u518D\u652F\u6301 expo-facebook\uFF0C\u6539\u7528 expo-auth-session",
|
|
1259
|
+
" */",
|
|
1262
1260
|
"",
|
|
1263
|
-
"
|
|
1264
|
-
"
|
|
1265
|
-
"
|
|
1266
|
-
"
|
|
1267
|
-
"
|
|
1268
|
-
"
|
|
1269
|
-
"
|
|
1270
|
-
"
|
|
1271
|
-
"
|
|
1272
|
-
"
|
|
1273
|
-
"
|
|
1274
|
-
|
|
1275
|
-
"
|
|
1261
|
+
"export function useFacebookAuth(config: FacebookAuthConfig) {",
|
|
1262
|
+
" const redirectUri = makeRedirectUri({",
|
|
1263
|
+
" scheme: 'your-app-scheme', // \u66FF\u6362\u4E3A\u4F60\u7684 app scheme",
|
|
1264
|
+
" });",
|
|
1265
|
+
"",
|
|
1266
|
+
" const [request, response, promptAsync] = useAuthRequest(",
|
|
1267
|
+
" {",
|
|
1268
|
+
" clientId: config.clientId,",
|
|
1269
|
+
" scopes: ['public_profile', 'email'],",
|
|
1270
|
+
" redirectUri,",
|
|
1271
|
+
" },",
|
|
1272
|
+
" {",
|
|
1273
|
+
" authorizationEndpoint: FACEBOOK_AUTH_ENDPOINT,",
|
|
1274
|
+
" tokenEndpoint: FACEBOOK_TOKEN_ENDPOINT,",
|
|
1276
1275
|
" }",
|
|
1277
|
-
"
|
|
1278
|
-
|
|
1279
|
-
"
|
|
1280
|
-
" token: null,",
|
|
1281
|
-
" userId: null,",
|
|
1282
|
-
" userName: null,",
|
|
1283
|
-
' error: "Facebook \u767B\u5F55\u5931\u8D25",',
|
|
1284
|
-
" };",
|
|
1285
|
-
" }",
|
|
1276
|
+
" );",
|
|
1277
|
+
"",
|
|
1278
|
+
" return { request, response, promptAsync };",
|
|
1286
1279
|
"}",
|
|
1287
1280
|
"",
|
|
1288
|
-
"
|
|
1289
|
-
"
|
|
1290
|
-
"
|
|
1291
|
-
"
|
|
1292
|
-
|
|
1293
|
-
"
|
|
1281
|
+
"/**",
|
|
1282
|
+
" * \u4ECE Facebook OAuth \u54CD\u5E94\u4E2D\u63D0\u53D6\u7528\u6237\u4FE1\u606F",
|
|
1283
|
+
" */",
|
|
1284
|
+
"export async function getFacebookUserInfo(accessToken: string): Promise<{",
|
|
1285
|
+
" userId: string;",
|
|
1286
|
+
" userName: string;",
|
|
1287
|
+
" email: string | null;",
|
|
1288
|
+
"}> {",
|
|
1289
|
+
" const response = await fetch(",
|
|
1290
|
+
" `https://graph.facebook.com/me?access_token=${accessToken}&fields=id,name,email`",
|
|
1291
|
+
" );",
|
|
1292
|
+
" const userData = await response.json();",
|
|
1293
|
+
"",
|
|
1294
|
+
" return {",
|
|
1295
|
+
" userId: userData.id,",
|
|
1296
|
+
" userName: userData.name,",
|
|
1297
|
+
" email: userData.email ?? null,",
|
|
1298
|
+
" };",
|
|
1294
1299
|
"}"
|
|
1295
1300
|
)
|
|
1296
1301
|
}
|
|
1297
1302
|
],
|
|
1298
|
-
appConfig: {
|
|
1299
|
-
plugins: [
|
|
1300
|
-
[
|
|
1301
|
-
"expo-facebook",
|
|
1302
|
-
{
|
|
1303
|
-
appId: "YOUR_FACEBOOK_APP_ID"
|
|
1304
|
-
}
|
|
1305
|
-
]
|
|
1306
|
-
]
|
|
1307
|
-
}
|
|
1303
|
+
appConfig: {}
|
|
1308
1304
|
};
|
|
1309
1305
|
var auth_facebook_default = authFacebookModule;
|
|
1310
1306
|
|
|
@@ -1723,29 +1719,12 @@ var i18n_default = i18nModule;
|
|
|
1723
1719
|
var animationModule = {
|
|
1724
1720
|
id: "animation",
|
|
1725
1721
|
name: "\u52A8\u753B/\u624B\u52BF",
|
|
1726
|
-
description: "Reanimated 4 + Gesture Handler + Worklets",
|
|
1722
|
+
description: "Reanimated 4 + Gesture Handler + Worklets\uFF08\u5DF2\u9ED8\u8BA4\u5305\u542B\uFF0C\u6B64\u6A21\u5757\u4EC5\u6DFB\u52A0\u5C01\u88C5\u4EE3\u7801\uFF09",
|
|
1727
1723
|
defaultChecked: false,
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
"react-native-gesture-handler": "~2.28.0",
|
|
1731
|
-
"react-native-worklets": "~0.5.1"
|
|
1732
|
-
},
|
|
1724
|
+
// Dependencies are already included in base package.json
|
|
1725
|
+
dependencies: {},
|
|
1733
1726
|
devDependencies: {},
|
|
1734
1727
|
files: [
|
|
1735
|
-
{
|
|
1736
|
-
path: "babel.config.js",
|
|
1737
|
-
content: `module.exports = function (api) {
|
|
1738
|
-
api.cache(true);
|
|
1739
|
-
return {
|
|
1740
|
-
presets: [
|
|
1741
|
-
["babel-preset-expo", { jsxImportSource: "nativewind" }],
|
|
1742
|
-
"nativewind/babel",
|
|
1743
|
-
],
|
|
1744
|
-
plugins: [],
|
|
1745
|
-
};
|
|
1746
|
-
};
|
|
1747
|
-
`
|
|
1748
|
-
},
|
|
1749
1728
|
{
|
|
1750
1729
|
path: "modules/animation/index.ts",
|
|
1751
1730
|
content: lines(
|
|
@@ -1802,9 +1781,6 @@ var animationModule = {
|
|
|
1802
1781
|
)
|
|
1803
1782
|
}
|
|
1804
1783
|
],
|
|
1805
|
-
// When animation module is selected, babel.config.js is overwritten above
|
|
1806
|
-
// to re-enable babel-preset-expo's auto-detection of reanimated/worklets plugins
|
|
1807
|
-
// (since those packages will be installed as dependencies)
|
|
1808
1784
|
babelPlugins: []
|
|
1809
1785
|
};
|
|
1810
1786
|
var animation_default = animationModule;
|
|
@@ -3183,7 +3159,7 @@ SplashScreen.preventAutoHideAsync();
|
|
|
3183
3159
|
export default function RootLayout() {
|
|
3184
3160
|
const colorScheme = useColorScheme();
|
|
3185
3161
|
const [loaded] = useFonts({
|
|
3186
|
-
|
|
3162
|
+
NunitoBold: require("../assets/fonts/Nunito-Bold.ttf"),
|
|
3187
3163
|
});
|
|
3188
3164
|
|
|
3189
3165
|
useEffect(() => {
|
|
@@ -3531,7 +3507,9 @@ export {};
|
|
|
3531
3507
|
"version": "1.0.0",
|
|
3532
3508
|
"orientation": "portrait",
|
|
3533
3509
|
"userInterfaceStyle": "light",
|
|
3510
|
+
"icon": "./assets/icon.png",
|
|
3534
3511
|
"splash": {
|
|
3512
|
+
"image": "./assets/splash-icon.png",
|
|
3535
3513
|
"resizeMode": "contain",
|
|
3536
3514
|
"backgroundColor": "#ffffff"
|
|
3537
3515
|
},
|
|
@@ -3540,11 +3518,19 @@ export {};
|
|
|
3540
3518
|
"bundleIdentifier": "com.${projectName}.app"
|
|
3541
3519
|
},
|
|
3542
3520
|
"android": {
|
|
3521
|
+
"adaptiveIcon": {
|
|
3522
|
+
"foregroundImage": "./assets/adaptive-icon.png",
|
|
3523
|
+
"backgroundColor": "#ffffff"
|
|
3524
|
+
},
|
|
3543
3525
|
"package": "com.${projectName}.app"
|
|
3544
3526
|
},
|
|
3527
|
+
"web": {
|
|
3528
|
+
"favicon": "./assets/favicon.png"
|
|
3529
|
+
},
|
|
3545
3530
|
"plugins": [
|
|
3546
3531
|
"expo-router",
|
|
3547
|
-
"expo-splash-screen"
|
|
3532
|
+
"expo-splash-screen",
|
|
3533
|
+
"react-native-reanimated"
|
|
3548
3534
|
]
|
|
3549
3535
|
}
|
|
3550
3536
|
}
|
|
@@ -3554,25 +3540,14 @@ export {};
|
|
|
3554
3540
|
{
|
|
3555
3541
|
path: "tsconfig.json",
|
|
3556
3542
|
content: `{
|
|
3543
|
+
"extends": "expo/tsconfig.base",
|
|
3557
3544
|
"compilerOptions": {
|
|
3558
|
-
"target": "ESNext",
|
|
3559
|
-
"module": "ESNext",
|
|
3560
|
-
"moduleResolution": "bundler",
|
|
3561
|
-
"lib": ["ESNext"],
|
|
3562
3545
|
"strict": true,
|
|
3563
|
-
"jsx": "react-jsx",
|
|
3564
|
-
"esModuleInterop": true,
|
|
3565
|
-
"skipLibCheck": true,
|
|
3566
|
-
"forceConsistentCasingInFileNames": true,
|
|
3567
|
-
"resolveJsonModule": true,
|
|
3568
|
-
"isolatedModules": true,
|
|
3569
|
-
"noEmit": true,
|
|
3570
3546
|
"paths": {
|
|
3571
3547
|
"@/*": ["./*"]
|
|
3572
3548
|
}
|
|
3573
3549
|
},
|
|
3574
|
-
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
|
|
3575
|
-
"exclude": ["node_modules"]
|
|
3550
|
+
"include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts", "nativewind-env.d.ts"]
|
|
3576
3551
|
}
|
|
3577
3552
|
`
|
|
3578
3553
|
},
|
|
@@ -3583,7 +3558,8 @@ export {};
|
|
|
3583
3558
|
module.exports = {
|
|
3584
3559
|
content: [
|
|
3585
3560
|
"./app/**/*.{js,jsx,ts,tsx}",
|
|
3586
|
-
"./
|
|
3561
|
+
"./components/**/*.{js,jsx,ts,tsx}",
|
|
3562
|
+
"./modules/**/*.{js,jsx,ts,tsx}",
|
|
3587
3563
|
],
|
|
3588
3564
|
presets: [require("nativewind/preset")],
|
|
3589
3565
|
theme: {
|
|
@@ -3647,7 +3623,7 @@ module.exports = withNativeWind(config, { input: "./global.css" });
|
|
|
3647
3623
|
api.cache(true);
|
|
3648
3624
|
return {
|
|
3649
3625
|
presets: [
|
|
3650
|
-
["babel-preset-expo", { jsxImportSource: "nativewind"
|
|
3626
|
+
["babel-preset-expo", { jsxImportSource: "nativewind" }],
|
|
3651
3627
|
"nativewind/babel",
|
|
3652
3628
|
],
|
|
3653
3629
|
plugins: [],
|
|
@@ -3776,7 +3752,7 @@ function generateLoginTabsTemplates(projectName) {
|
|
|
3776
3752
|
"export default function RootLayout() {",
|
|
3777
3753
|
" const colorScheme = useColorScheme();",
|
|
3778
3754
|
" const [loaded] = useFonts({",
|
|
3779
|
-
'
|
|
3755
|
+
' NunitoBold: require("../assets/fonts/Nunito-Bold.ttf"),',
|
|
3780
3756
|
" });",
|
|
3781
3757
|
"",
|
|
3782
3758
|
" useEffect(() => {",
|
|
@@ -4198,10 +4174,14 @@ function generateBasePackageJson(projectName) {
|
|
|
4198
4174
|
"expo-constants": "~18.0.13",
|
|
4199
4175
|
"expo-status-bar": "~3.0.9",
|
|
4200
4176
|
"expo-splash-screen": "~31.0.13",
|
|
4177
|
+
"expo-font": "~14.0.11",
|
|
4201
4178
|
react: "19.1.0",
|
|
4202
4179
|
"react-native": "0.81.5",
|
|
4203
4180
|
"react-native-safe-area-context": "~5.6.0",
|
|
4204
4181
|
"react-native-screens": "~4.16.0",
|
|
4182
|
+
"react-native-reanimated": "~4.1.1",
|
|
4183
|
+
"react-native-worklets": "~0.5.1",
|
|
4184
|
+
"react-native-gesture-handler": "~2.28.0",
|
|
4205
4185
|
nativewind: "^4.1.0",
|
|
4206
4186
|
tailwindcss: "^3.4.0",
|
|
4207
4187
|
"react-native-svg": "^15.8.0"
|
|
@@ -4215,7 +4195,7 @@ function generateBasePackageJson(projectName) {
|
|
|
4215
4195
|
|
|
4216
4196
|
// src/index.ts
|
|
4217
4197
|
var import_execa = require("execa");
|
|
4218
|
-
var CLI_VERSION = "1.
|
|
4198
|
+
var CLI_VERSION = "1.4.0";
|
|
4219
4199
|
var CONFIG_FILE = ".expo-bbase.json";
|
|
4220
4200
|
async function run() {
|
|
4221
4201
|
const program = new import_commander.Command();
|
|
@@ -4342,6 +4322,12 @@ async function createProject(projectName) {
|
|
|
4342
4322
|
await writeFile(filePath, content);
|
|
4343
4323
|
}
|
|
4344
4324
|
}
|
|
4325
|
+
spinner.text = "Copying assets...";
|
|
4326
|
+
const assetsSource = import_path2.default.join(__dirname, "..", "templates", "assets");
|
|
4327
|
+
const assetsTarget = import_path2.default.join(targetDir, "assets");
|
|
4328
|
+
if (import_fs_extra2.default.existsSync(assetsSource)) {
|
|
4329
|
+
import_fs_extra2.default.copySync(assetsSource, assetsTarget);
|
|
4330
|
+
}
|
|
4345
4331
|
spinner.text = "Generating package.json...";
|
|
4346
4332
|
const pkgJson = generateBasePackageJson(projectName);
|
|
4347
4333
|
const allDeps = {};
|