代码拉取完成,页面将自动刷新
同步操作将从 林耿城/amis-editor 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const bosSDK = require('bce-sdk-js');
const fs = require('fs');
const walk = require('fs-walk');
const path = require('path');
const tokenFile = process.argv[2] || '~/bos.credentials';
if (!fs.existsSync(tokenFile)) {
console.error(tokenFile + ' does not exists!');
process.exit(1);
}
const config = JSON.parse(fs.readFileSync(tokenFile, 'utf-8'));
const client = new bosSDK.BosClient(config);
const bucketName = config.bucket || 'bce-cdn';
const prefix = 'fex/';
async function main() {
const folder = 'gh-pages';
const productName = 'amis-editor-gh-pages';
if (!fs.existsSync(folder)) {
throw new Error('文件夹不存在');
}
if (!productName) {
throw new Error('请指定产品名称');
}
const promises = [];
walk.walkSync(folder, (basedir, filename, stat) => {
if (stat.isDirectory() || /\.html$/.test(filename)) {
return;
}
const relativePath = path.relative(folder, basedir);
const objectName = path.join(prefix, productName, relativePath, filename);
promises.push(() =>
client
.putObjectFromFile(bucketName, objectName, path.join(basedir, filename))
.then(() => console.log(` ==> ${objectName}`), res => console.error(res))
);
});
if (!promises.length) {
console.log('Nothing need to upload');
}
return promises.reduce((preview, current) => {
return preview.then(current);
}, Promise.resolve());
}
main()
.then(() => console.log('Done!'))
.catch(e => console.error(e.message, e.stack));
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。