Files
AppFlowy-Web/scripts/create-symlink.cjs
Kilu.He f6a8c83015 feat: support calendar (#56)
* chore: modified title sync

* chore: replace console.log to console.debug

* feat: add FullCalendar dependencies and improve code organization

* chore: update view name bugs

* chore: support no date row

* chore: layout by created time and modified time

* chore: adjust time

* chore: pnpm install

* chore: fix something
2025-09-09 12:07:59 +08:00

44 lines
1.3 KiB
JavaScript

const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const sourcePath = process.argv[2];
const targetPath = process.argv[3];
// ensure source and target paths are provided
if (!sourcePath || !targetPath) {
console.error(chalk.red('source and target paths are required'));
process.exit(1);
}
const fullSourcePath = path.resolve(sourcePath);
const fullTargetPath = path.resolve(targetPath);
// ensure source path exists
if (!fs.existsSync(fullSourcePath)) {
console.error(chalk.red(`source path does not exist: ${fullSourcePath}`));
process.exit(1);
}
// ensure target path exists
if (!fs.existsSync(fullTargetPath)) {
console.error(chalk.red(`target path does not exist: ${fullTargetPath}`));
process.exit(1);
}
if (fs.existsSync(fullTargetPath)) {
// unlink existing symlink
console.debug(chalk.yellow(`unlinking existing symlink: `) + chalk.blue(`${fullTargetPath}`));
fs.unlinkSync(fullTargetPath);
}
// create symlink
fs.symlink(fullSourcePath, fullTargetPath, 'junction', (err) => {
if (err) {
console.error(chalk.red(`error creating symlink: ${err.message}`));
process.exit(1);
}
console.debug(chalk.green(`symlink created: `) + chalk.blue(`${fullSourcePath}`) + ' -> ' + chalk.blue(`${fullTargetPath}`));
});