agora-toolchain 3.10.0-alpha → 3.10.0-beta
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/package.json +2 -1
- package/presets/karma.conf.js +2 -1
- package/presets/webpack.prod.js +8 -2
- package/scripts/pack-client-app.js +136 -48
- package/scripts/pack-client-sdk.js +30 -1
- package/tools/karma-options.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-toolchain",
|
|
3
|
-
"version": "3.10.0-
|
|
3
|
+
"version": "3.10.0-beta",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agora-tc-transpile": "./scripts/transpile.js",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"karma": "^6.4.2",
|
|
61
61
|
"karma-chrome-launcher": "^3.2.0",
|
|
62
62
|
"karma-jasmine": "^5.1.0",
|
|
63
|
+
"karma-spec-reporter": "^0.0.36",
|
|
63
64
|
"karma-webpack": "^5.0.0",
|
|
64
65
|
"mini-css-extract-plugin": "^2.9.1",
|
|
65
66
|
"postcss-loader": "^8.1.1",
|
package/presets/karma.conf.js
CHANGED
|
@@ -6,6 +6,7 @@ const cwd = process.cwd();
|
|
|
6
6
|
|
|
7
7
|
const pattern = opts.file ?? '**/*.test.ts';
|
|
8
8
|
const singleRun = opts.singleRun ?? false;
|
|
9
|
+
const useSpecReporter = opts.spec ?? false;
|
|
9
10
|
const fakeMedia = opts.fakeMedia ?? false;
|
|
10
11
|
const headless = opts.headless ?? false;
|
|
11
12
|
|
|
@@ -84,7 +85,7 @@ module.exports = (config) => {
|
|
|
84
85
|
// test results reporter to use
|
|
85
86
|
// possible values: 'dots', 'progress'
|
|
86
87
|
// available reporters: https://www.npmjs.com/search?q=keywords:karma-reporter
|
|
87
|
-
reporters: ['progress'],
|
|
88
|
+
reporters: [useSpecReporter ? 'spec' : 'progress'],
|
|
88
89
|
|
|
89
90
|
// web server port
|
|
90
91
|
port: 9876,
|
package/presets/webpack.prod.js
CHANGED
|
@@ -233,9 +233,15 @@ module.exports = createConfig = ({ entry, analyze, out = 'dist' }) => {
|
|
|
233
233
|
to: resolveCwd('dist/extensions'),
|
|
234
234
|
noErrorOnMissing: true,
|
|
235
235
|
},
|
|
236
|
-
// meeting-manager.js
|
|
236
|
+
// js files (init.js and meeting-manager.js) - 复制到 dist/js/ 目录(HTML 引用的位置)
|
|
237
237
|
{
|
|
238
|
-
from: resolveAtBaseModule('public/
|
|
238
|
+
from: resolveAtBaseModule('public/js'),
|
|
239
|
+
to: resolveCwd('dist/js'),
|
|
240
|
+
noErrorOnMissing: true,
|
|
241
|
+
},
|
|
242
|
+
// 同时也在根目录保留 meeting-manager.js(向后兼容,如果有其他代码引用)
|
|
243
|
+
{
|
|
244
|
+
from: resolveAtBaseModule('public/js/meeting-manager.js'),
|
|
239
245
|
to: resolveCwd('dist/meeting-manager.js'),
|
|
240
246
|
noErrorOnMissing: true,
|
|
241
247
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const builder = require('electron-builder');
|
|
3
|
+
const fs = require('fs');
|
|
3
4
|
const path = require('path');
|
|
4
5
|
const { platform, arch, cpp } = require('../tools/pack-options');
|
|
5
6
|
const { notarizeMac } = require('../tools/notarize');
|
|
@@ -13,6 +14,100 @@ const targetPlatform = platform;
|
|
|
13
14
|
|
|
14
15
|
const targetArch = arch;
|
|
15
16
|
|
|
17
|
+
// 读取 package.json 获取版本号
|
|
18
|
+
const packageJsonPath = resolveCwd('package.json');
|
|
19
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
20
|
+
const originalVersion = packageJson.version;
|
|
21
|
+
let builderVersion = packageJson.version;
|
|
22
|
+
let jobNumber = '0';
|
|
23
|
+
|
|
24
|
+
// Windows 和 Linux 平台不支持预发布版本号(如 3.7.8-rc.2),需要转换为标准版本号
|
|
25
|
+
if (targetPlatform === 'win32' || targetPlatform === 'linux') {
|
|
26
|
+
// 移除预发布标识符(-rc.2, -beta.1 等)
|
|
27
|
+
const baseVersion = builderVersion.split('-')[0];
|
|
28
|
+
// 获取 job 号(从环境变量)
|
|
29
|
+
jobNumber = process.env.BUILD_NUMBER || process.env.JOB_NUMBER || '0';
|
|
30
|
+
|
|
31
|
+
// 版本号格式: major.minor.patch.jobNumber
|
|
32
|
+
builderVersion = `${baseVersion}.${jobNumber}`;
|
|
33
|
+
|
|
34
|
+
console.log(`${targetPlatform} Platform version number from ${originalVersion} Convert to ${builderVersion}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 调试输出
|
|
38
|
+
console.log('Platform:', targetPlatform);
|
|
39
|
+
console.log('Arch input:', arch);
|
|
40
|
+
console.log('Target arch:', arch);
|
|
41
|
+
console.log('Builder.Arch enum:', builder.Arch);
|
|
42
|
+
console.log('Builder.Arch[arch]:', builder.Arch[targetArch]);
|
|
43
|
+
|
|
44
|
+
// 获取平台特定的 Native 库资源配置
|
|
45
|
+
function getNativeLibsResources() {
|
|
46
|
+
const platformConfigs = {
|
|
47
|
+
win32: {
|
|
48
|
+
from: resolveBase('public/electron-native-libs/win/'),
|
|
49
|
+
to: 'Libs',
|
|
50
|
+
},
|
|
51
|
+
darwin: {
|
|
52
|
+
from: resolveBase('public/electron-native-libs/mac/'),
|
|
53
|
+
to: 'Frameworks',
|
|
54
|
+
},
|
|
55
|
+
linux: {
|
|
56
|
+
from: resolveBase('public/electron-native-libs/linux/'),
|
|
57
|
+
to: 'lib',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return platformConfigs[targetPlatform] ? [platformConfigs[targetPlatform]] : [];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 获取通用资源配置(JS Bundle 模式)
|
|
65
|
+
function getCommonResources() {
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
from: path.join(resolveModule('fcr-ui-scene'), 'public/assets/electron/sound_effects/'),
|
|
69
|
+
to: 'assets/sound_effects/',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
from: path.join(resolveModule('fcr-ui-scene'), 'public/assets/electron/images/'),
|
|
73
|
+
to: 'assets/images/',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
from: path.join(resolveModule('fcr-ui-scene'), 'public/assets/electron/videos/'),
|
|
77
|
+
to: 'assets/videos/',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 获取文件打包配置
|
|
83
|
+
function getFilesConfig() {
|
|
84
|
+
if (cpp) {
|
|
85
|
+
// Native Bundle 模式:排除不需要的文件
|
|
86
|
+
return [
|
|
87
|
+
'!**/node_modules/agora-electron-sdk/**/*',
|
|
88
|
+
'!**/artifactory_deps/**/*',
|
|
89
|
+
'!**/mac-release/**/*',
|
|
90
|
+
'!**/node_modules/fcr-ui-scene/release/**/*',
|
|
91
|
+
'!**/node_modules/fcr-ui-scene/src/**/*',
|
|
92
|
+
'!**/node_modules/agora-rte-sdk/src/**/*',
|
|
93
|
+
'!**/node_modules/agora-ui-foundation/src/**/*',
|
|
94
|
+
'!**/node_modules/agora-foundation/src/**/*',
|
|
95
|
+
'!**/node_modules/fcr-ui-scene/linux-release/**/*',
|
|
96
|
+
'!**/node_modules/fcr-ui-scene/linux-release-x64/**/*',
|
|
97
|
+
];
|
|
98
|
+
} else {
|
|
99
|
+
// JS Bundle 模式
|
|
100
|
+
return [
|
|
101
|
+
'**/*',
|
|
102
|
+
'!**/artifactory_deps/**/*',
|
|
103
|
+
'!**/mac-release/**/*',
|
|
104
|
+
// 交叉编译时排除平台特定的原生模块构建文件
|
|
105
|
+
'!**/node_modules/extract-file-icon/build/**/*',
|
|
106
|
+
'!**/node_modules/node-window-manager/build/**/*',
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
16
111
|
// Let's get that intellisense working
|
|
17
112
|
/**
|
|
18
113
|
* @type {import('electron-builder').Configuration}
|
|
@@ -26,9 +121,11 @@ const options = {
|
|
|
26
121
|
schemes: ['fcr-meeting'],
|
|
27
122
|
},
|
|
28
123
|
|
|
29
|
-
// "store
|
|
124
|
+
// "store" | "normal" | "maximum". - For testing builds, use 'store' to reduce build time significantly.
|
|
30
125
|
compression: isDebug ? 'store' : 'normal',
|
|
31
126
|
removePackageScripts: true,
|
|
127
|
+
buildVersion: builderVersion,
|
|
128
|
+
buildNumber: jobNumber,
|
|
32
129
|
|
|
33
130
|
afterSign: async (context) => {
|
|
34
131
|
// Mac releases require hardening+notarization: https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution
|
|
@@ -46,47 +143,8 @@ const options = {
|
|
|
46
143
|
output: resolveCwd('release'),
|
|
47
144
|
buildResources: resolveCwd('installer/resources'),
|
|
48
145
|
},
|
|
49
|
-
extraResources: cpp
|
|
50
|
-
|
|
51
|
-
? [
|
|
52
|
-
{
|
|
53
|
-
from: resolveBase('public/electron-native-libs/win/'),
|
|
54
|
-
to: 'Libs',
|
|
55
|
-
},
|
|
56
|
-
]
|
|
57
|
-
: [
|
|
58
|
-
{
|
|
59
|
-
from: resolveBase('public/electron-native-libs/mac/'),
|
|
60
|
-
to: 'Frameworks',
|
|
61
|
-
},
|
|
62
|
-
]
|
|
63
|
-
: [
|
|
64
|
-
// 内置资源
|
|
65
|
-
{
|
|
66
|
-
from: path.join(resolveModule('fcr-ui-scene'), 'public/assets/electron/sound_effects/'),
|
|
67
|
-
to: 'assets/sound_effects/',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
from: path.join(resolveModule('fcr-ui-scene'), 'public/assets/electron/images/'),
|
|
71
|
-
to: 'assets/images/',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
from: path.join(resolveModule('fcr-ui-scene'), 'public/assets/electron/videos/'),
|
|
75
|
-
to: 'assets/videos/',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
files: cpp
|
|
79
|
-
? ['!**/node_modules/agora-electron-sdk/**/*',
|
|
80
|
-
'!**/artifactory_deps/**/*',
|
|
81
|
-
'!**/mac-release/**/*',
|
|
82
|
-
'!**/node_modules/fcr-ui-scene/release/**/*',
|
|
83
|
-
'!**/node_modules/fcr-ui-scene/src/**/*',
|
|
84
|
-
'!**/node_modules/agora-rte-sdk/src/**/*',
|
|
85
|
-
'!**/node_modules/agora-ui-foundation/src/**/*',
|
|
86
|
-
'!**/node_modules/agora-foundation/src/**/*',
|
|
87
|
-
|
|
88
|
-
]
|
|
89
|
-
: ['**/*', '!**/artifactory_deps/**/*', '!**/mac-release/**/*'],
|
|
146
|
+
extraResources: cpp ? getNativeLibsResources() : getCommonResources(),
|
|
147
|
+
files: getFilesConfig(),
|
|
90
148
|
win: {
|
|
91
149
|
icon: resolveCwd('installer/icons/favicon.png'),
|
|
92
150
|
target: 'nsis',
|
|
@@ -95,6 +153,20 @@ const options = {
|
|
|
95
153
|
shortcutName: 'FcrMeeting',
|
|
96
154
|
installerIcon: resolveCwd('installer/icons/favicon.ico'),
|
|
97
155
|
},
|
|
156
|
+
linux: {
|
|
157
|
+
icon: resolveCwd('installer/icons/favicon.png'),
|
|
158
|
+
target: [
|
|
159
|
+
{
|
|
160
|
+
target: 'AppImage',
|
|
161
|
+
// arch: [arch],
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
// category: 'Development',
|
|
165
|
+
// maintainer: 'Agora.io <support@agora.io>',
|
|
166
|
+
},
|
|
167
|
+
appImage: {
|
|
168
|
+
artifactName: '${name}.${ext}',
|
|
169
|
+
},
|
|
98
170
|
mac: {
|
|
99
171
|
target: 'dmg',
|
|
100
172
|
icon: resolveCwd('installer/icons/favicon.png'),
|
|
@@ -128,18 +200,34 @@ const options = {
|
|
|
128
200
|
},
|
|
129
201
|
};
|
|
130
202
|
|
|
131
|
-
//
|
|
203
|
+
// 创建构建目标
|
|
204
|
+
function createBuildTargets() {
|
|
205
|
+
// if (targetPlatform === 'linux') {
|
|
206
|
+
// // Linux 构建时直接使用配置中的 target,避免 Arch 枚举问题
|
|
207
|
+
// return Platform.LINUX.createTarget();
|
|
208
|
+
// }
|
|
209
|
+
const platformTargets = {
|
|
210
|
+
win32: () => Platform.WINDOWS.createTarget(['nsis'], [builder.Arch[targetArch]]),
|
|
211
|
+
darwin: () => Platform.MAC.createTarget(['dmg'], [builder.Arch[targetArch]]),
|
|
212
|
+
linux: () => Platform.LINUX.createTarget(['AppImage'], [builder.Arch[targetArch]]),
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const createTarget = platformTargets[targetPlatform] || platformTargets.darwin;
|
|
216
|
+
return createTarget();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const targets = createBuildTargets();
|
|
220
|
+
|
|
221
|
+
// 执行构建
|
|
132
222
|
builder
|
|
133
223
|
.build({
|
|
134
|
-
targets
|
|
135
|
-
targetPlatform === 'win32'
|
|
136
|
-
? Platform.WINDOWS.createTarget(['nsis'], ...targetArch.map((arch) => builder.Arch[arch]))
|
|
137
|
-
: Platform.MAC.createTarget(['dmg'], ...targetArch.map((arch) => builder.Arch[arch])),
|
|
224
|
+
targets,
|
|
138
225
|
config: options,
|
|
139
226
|
publish: 'never',
|
|
140
227
|
})
|
|
141
228
|
.then((result) => {
|
|
142
|
-
console.log(
|
|
229
|
+
console.log('Build completed successfully:');
|
|
230
|
+
console.log(JSON.stringify(result, null, 2));
|
|
143
231
|
})
|
|
144
232
|
.catch((error) => {
|
|
145
233
|
console.error(error);
|
|
@@ -5,10 +5,12 @@ const path = require('path');
|
|
|
5
5
|
const crypto = require('crypto');
|
|
6
6
|
const { platform, arch, main: _mainScript } = require('../tools/pack-options');
|
|
7
7
|
const { resolveCwd } = require('../tools/paths');
|
|
8
|
+
const { notarizeMac } = require('../tools/notarize');
|
|
8
9
|
|
|
9
10
|
const Platform = builder.Platform;
|
|
10
11
|
const AES_KEY = 'FCRUISCENE';
|
|
11
12
|
const AES_ALGORITHM = 'aes-256-ecb';
|
|
13
|
+
const isDebug = false; // 生产构建
|
|
12
14
|
|
|
13
15
|
function getAesKey() {
|
|
14
16
|
return crypto.createHash('sha256').update(AES_KEY).digest();
|
|
@@ -78,6 +80,13 @@ const builderOptions = {
|
|
|
78
80
|
removePackageScripts: true,
|
|
79
81
|
buildVersion: builderVersion,
|
|
80
82
|
buildNumber: jobNumber,
|
|
83
|
+
|
|
84
|
+
afterSign: async (context) => {
|
|
85
|
+
// Mac releases require hardening+notarization: https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution
|
|
86
|
+
if (!isDebug && context.electronPlatformName === 'darwin') {
|
|
87
|
+
await notarizeMac(context);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
81
90
|
nodeGypRebuild: false,
|
|
82
91
|
buildDependenciesFromSource: false,
|
|
83
92
|
extraMetadata: {
|
|
@@ -149,6 +158,26 @@ const builderOptions = {
|
|
|
149
158
|
shortcutName: 'FcrMeeting',
|
|
150
159
|
installerIcon: resolveCwd('installer/icons/favicon.ico'),
|
|
151
160
|
},
|
|
161
|
+
appImage: {
|
|
162
|
+
artifactName: '${name}.${ext}',
|
|
163
|
+
},
|
|
164
|
+
linux: {
|
|
165
|
+
icon: resolveCwd('installer/icons/favicon.png'),
|
|
166
|
+
target: [
|
|
167
|
+
{
|
|
168
|
+
target: 'AppImage',
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
category: 'Utility',
|
|
172
|
+
desktop: {
|
|
173
|
+
Name: packageJson.productName || packageJson.name,
|
|
174
|
+
Comment: packageJson.description || '',
|
|
175
|
+
Icon: 'favicon',
|
|
176
|
+
Terminal: false,
|
|
177
|
+
Type: 'Application',
|
|
178
|
+
Categories: 'Utility;',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
152
181
|
mac: {
|
|
153
182
|
target: 'dmg',
|
|
154
183
|
icon: resolveCwd('installer/icons/favicon.png'),
|
|
@@ -280,7 +309,7 @@ async function packWithElectronBuilder() {
|
|
|
280
309
|
} else if (targetPlatform === 'win32') {
|
|
281
310
|
targets = Platform.WINDOWS.createTarget(['nsis'], [builder.Arch[targetArch]]);
|
|
282
311
|
} else if (targetPlatform === 'linux') {
|
|
283
|
-
targets = Platform.LINUX.createTarget();
|
|
312
|
+
targets = Platform.LINUX.createTarget(['AppImage'], [builder.Arch[targetArch]]);
|
|
284
313
|
}
|
|
285
314
|
|
|
286
315
|
try {
|
package/tools/karma-options.js
CHANGED
|
@@ -3,6 +3,7 @@ const { program } = require('commander');
|
|
|
3
3
|
const opts = program
|
|
4
4
|
.option('--file <file>', 'Specify an UT to run')
|
|
5
5
|
.option('--single-run', 'Run tests once and exit', false)
|
|
6
|
+
.option('--spec', 'Use spec reporter for detailed test output', false)
|
|
6
7
|
.option('--fake-media', 'Use fake media devices in browser tests', false)
|
|
7
8
|
.option('--headless', 'Run browser tests in headless mode', false)
|
|
8
9
|
.parse(process.argv)
|