Sanitize for open-source release
- Replace internal tenant name your-tenant.feishu.cn with your-tenant.feishu.cn - Replace real wiki token with placeholder WikiNodeTokenExample - Parameterize tenant via FEISHU_TENANT env var in feishu-to-md.mjs - Expand .gitignore to cover cookies, auth artifacts, IDE files
This commit is contained in:
+13
-2
@@ -21,14 +21,25 @@ if (!argv[0] || argv[0] === '--help' || argv[0] === '-h') {
|
||||
|
||||
示例:
|
||||
node feishu-to-md.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
||||
node feishu-to-md.mjs WikiNodeTokenExample
|
||||
FEISHU_TENANT=your-tenant node feishu-to-md.mjs WikiNodeTokenExample
|
||||
`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const input = argv[0].trim();
|
||||
const outDir = argv[1] ? resolve(argv[1]) : resolve('./output');
|
||||
const wikiUrl = input.startsWith('http') ? input : `https://your-tenant.feishu.cn/wiki/${input}`;
|
||||
let wikiUrl;
|
||||
if (input.startsWith('http')) {
|
||||
wikiUrl = input;
|
||||
} else {
|
||||
const tenant = process.env.FEISHU_TENANT;
|
||||
if (!tenant) {
|
||||
console.error('❌ 传入纯 token 时需设置 FEISHU_TENANT 环境变量,例如:');
|
||||
console.error(' FEISHU_TENANT=your-tenant node feishu-to-md.mjs <token>');
|
||||
process.exit(1);
|
||||
}
|
||||
wikiUrl = `https://${tenant}.feishu.cn/wiki/${input}`;
|
||||
}
|
||||
|
||||
// lark-cli 命令必须在 outDir 下执行(+media-preview 只接受相对路径)
|
||||
process.chdir(outDir);
|
||||
|
||||
Reference in New Issue
Block a user