docs: 支持爱速搭嵌入 (#2391)

This commit is contained in:
吴多益 2021-08-16 15:38:03 +08:00 committed by GitHub
parent 1ae1d4a837
commit e87e050d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -729,6 +729,13 @@ if (fis.project.currentMedia() === 'publish') {
release: '/$1' release: '/$1'
}); });
// 在爱速搭中不用 cfc而是放 amis 目录下的路由接管
let cfcAddress =
'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock';
if (process.env.IS_AISUDA) {
cfcAddress = '/amis/api';
}
ghPages.match('/{examples,docs}/**', { ghPages.match('/{examples,docs}/**', {
preprocessor: function (contents, file) { preprocessor: function (contents, file) {
if (!file.isText() || typeof contents !== 'string') { if (!file.isText() || typeof contents !== 'string') {
@ -739,21 +746,13 @@ if (fis.project.currentMedia() === 'publish') {
.replace( .replace(
/(\\?(?:'|"))((?:get|post|delete|put)\:)?\/api\/mock2?/gi, /(\\?(?:'|"))((?:get|post|delete|put)\:)?\/api\/mock2?/gi,
function (_, qutoa, method) { function (_, qutoa, method) {
return ( return qutoa + (method || '') + `${cfcAddress}/mock2`;
qutoa +
(method || '') +
'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2'
);
} }
) )
.replace( .replace(
/(\\?(?:'|"))((?:get|post|delete|put)\:)?\/api\/sample/gi, /(\\?(?:'|"))((?:get|post|delete|put)\:)?\/api\/sample/gi,
function (_, qutoa, method) { function (_, qutoa, method) {
return ( return qutoa + (method || '') + `${cfcAddress}/sample`;
qutoa +
(method || '') +
'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample'
);
} }
); );
} }