统一三端桥接层职责命名
微信小程序 host-bridge 与 shell 文件改为职责命名 移动壳 host-bridge 与 shell 文件改为职责命名 更新原生壳结构门禁、微信 smoke 和宿主壳文档
This commit is contained in:
@@ -8,49 +8,49 @@ const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
|
||||
const productionShellRoots = ['apps/mobile-shell', 'apps/desktop-shell'];
|
||||
const expectedWechatHostBridgeFiles = [
|
||||
'wechatHostBridgePayment.js',
|
||||
'wechatHostBridgePayment.test.js',
|
||||
'wechatHostBridgeShareGrid.js',
|
||||
'wechatHostBridgeShareGrid.test.js',
|
||||
'wechatHostBridgeSubscribeMessage.js',
|
||||
'wechatHostBridgeSubscribeMessage.test.js',
|
||||
'wechatHostBridgeWebView.js',
|
||||
'wechatHostBridgeWebView.test.js',
|
||||
'payment.js',
|
||||
'payment.test.js',
|
||||
'shareGrid.js',
|
||||
'shareGrid.test.js',
|
||||
'subscribeMessage.js',
|
||||
'subscribeMessage.test.js',
|
||||
'webView.js',
|
||||
'webView.test.js',
|
||||
];
|
||||
const expectedWechatShellFiles = [
|
||||
'wechatShellPayment.js',
|
||||
'wechatShellPayment.test.js',
|
||||
'wechatShellShareGrid.js',
|
||||
'wechatShellShareGrid.test.js',
|
||||
'wechatShellSubscribeMessage.js',
|
||||
'wechatShellSubscribeMessage.test.js',
|
||||
'wechatShellWebView.js',
|
||||
'wechatShellWebView.test.js',
|
||||
'payment.js',
|
||||
'payment.test.js',
|
||||
'shareGrid.js',
|
||||
'shareGrid.test.js',
|
||||
'subscribeMessage.js',
|
||||
'subscribeMessage.test.js',
|
||||
'webView.js',
|
||||
'webView.test.js',
|
||||
];
|
||||
const expectedMobileHostBridgeFiles = [
|
||||
'mobileHostBridge.test.ts',
|
||||
'mobileHostBridge.ts',
|
||||
'mobileHostBridgeFiles.ts',
|
||||
'mobileHostBridgeProtocol.ts',
|
||||
'mobileHostBridgeShare.ts',
|
||||
'bridge.test.ts',
|
||||
'bridge.ts',
|
||||
'files.ts',
|
||||
'protocol.ts',
|
||||
'share.ts',
|
||||
];
|
||||
const expectedMobileShellFiles = [
|
||||
'MobileShellApp.tsx',
|
||||
'mobileShellDeepLink.test.ts',
|
||||
'mobileShellDeepLink.ts',
|
||||
'mobileShellLifecycle.test.ts',
|
||||
'mobileShellLifecycle.ts',
|
||||
'mobileShellNavigation.test.ts',
|
||||
'mobileShellNavigation.ts',
|
||||
'mobileShellNetwork.test.ts',
|
||||
'mobileShellNetwork.ts',
|
||||
'mobileShellRuntime.ts',
|
||||
'mobileShellSafeArea.test.ts',
|
||||
'mobileShellSafeArea.ts',
|
||||
'mobileShellUrl.test.ts',
|
||||
'mobileShellUrl.ts',
|
||||
'mobileShellWebViewPolicy.test.ts',
|
||||
'mobileShellWebViewPolicy.ts',
|
||||
'ShellApp.tsx',
|
||||
'deepLink.test.ts',
|
||||
'deepLink.ts',
|
||||
'lifecycle.test.ts',
|
||||
'lifecycle.ts',
|
||||
'navigation.test.ts',
|
||||
'navigation.ts',
|
||||
'network.test.ts',
|
||||
'network.ts',
|
||||
'runtime.ts',
|
||||
'safeArea.test.ts',
|
||||
'safeArea.ts',
|
||||
'url.test.ts',
|
||||
'url.ts',
|
||||
'webViewPolicy.test.ts',
|
||||
'webViewPolicy.ts',
|
||||
];
|
||||
const expectedDesktopHostBridgeRustFiles = [
|
||||
'files.rs',
|
||||
@@ -225,13 +225,13 @@ function assertHostBridgeLayerLayout() {
|
||||
'wechat host bridge files',
|
||||
);
|
||||
|
||||
const wechatShellFiles = fs
|
||||
const wechatShellLayerFiles = fs
|
||||
.readdirSync('miniprogram/shell', { withFileTypes: true })
|
||||
.filter((entry) => entry.isFile())
|
||||
.map((entry) => entry.name)
|
||||
.sort();
|
||||
assertSameList(
|
||||
wechatShellFiles,
|
||||
wechatShellLayerFiles,
|
||||
expectedWechatShellFiles,
|
||||
'wechat shell files',
|
||||
);
|
||||
@@ -266,19 +266,19 @@ function assertHostBridgeLayerLayout() {
|
||||
'mobile host bridge files',
|
||||
);
|
||||
|
||||
const mobileShellFiles = fs
|
||||
const mobileShellLayerFiles = fs
|
||||
.readdirSync('apps/mobile-shell/src/shell', { withFileTypes: true })
|
||||
.filter((entry) => entry.isFile())
|
||||
.map((entry) => entry.name)
|
||||
.sort();
|
||||
assertSameList(
|
||||
mobileShellFiles,
|
||||
mobileShellLayerFiles,
|
||||
expectedMobileShellFiles,
|
||||
'mobile shell bridge files',
|
||||
);
|
||||
|
||||
const mobileAppSource = fs.readFileSync('apps/mobile-shell/App.tsx', 'utf8');
|
||||
if (!mobileAppSource.includes("import MobileShellApp from './src/shell/MobileShellApp';")) {
|
||||
if (!mobileAppSource.includes("import ShellApp from './src/shell/ShellApp';")) {
|
||||
throw new Error('mobile shell App.tsx must import from apps/mobile-shell/src/shell');
|
||||
}
|
||||
if (mobileAppSource.includes('./src/host-bridge/')) {
|
||||
|
||||
@@ -54,13 +54,13 @@ if (failures.length > 0) {
|
||||
console.log('\n[wechat-miniprogram-auth-smoke] 通过');
|
||||
|
||||
function checkMiniProgramShell() {
|
||||
const shellPath = join(repoRoot, 'miniprogram', 'shell', 'wechatShellWebView.js');
|
||||
const webViewBridgePath = join(repoRoot, 'miniprogram', 'host-bridge', 'wechatHostBridgeWebView.js');
|
||||
const shellPath = join(repoRoot, 'miniprogram', 'shell', 'webView.js');
|
||||
const webViewBridgePath = join(repoRoot, 'miniprogram', 'host-bridge', 'webView.js');
|
||||
const pagePath = join(repoRoot, 'miniprogram', 'pages', 'web-view', 'index.js');
|
||||
const shellTemplatePath = join(repoRoot, 'miniprogram', 'pages', 'web-view', 'index.wxml');
|
||||
const authServiceTestPath = join(repoRoot, 'src', 'services', 'authService.test.ts');
|
||||
|
||||
ensureNeedles(pagePath, ["require('../../shell/wechatShellWebView')"]);
|
||||
ensureNeedles(pagePath, ["require('../../shell/webView')"]);
|
||||
ensureNeedles(shellPath, [
|
||||
'/api/auth/wechat/miniprogram-login',
|
||||
'/api/auth/wechat/bind-phone',
|
||||
|
||||
@@ -9,13 +9,13 @@ const shellScriptPath = join(
|
||||
repoRoot,
|
||||
'miniprogram',
|
||||
'shell',
|
||||
'wechatShellWebView.js',
|
||||
'webView.js',
|
||||
);
|
||||
const webViewHostBridgePath = join(
|
||||
repoRoot,
|
||||
'miniprogram',
|
||||
'host-bridge',
|
||||
'wechatHostBridgeWebView.js',
|
||||
'webView.js',
|
||||
);
|
||||
|
||||
type MiniProgramPage = {
|
||||
@@ -65,7 +65,7 @@ function loadWebViewPage(
|
||||
},
|
||||
...configOverrides,
|
||||
},
|
||||
'../host-bridge/wechatHostBridgeWebView': webViewBridge,
|
||||
'../host-bridge/webView': webViewBridge,
|
||||
}) as {
|
||||
createWechatWebViewPage: () => Record<string, unknown>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user