Skip to content

Create build-nodejs.yml #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Update copyDist.js
  • Loading branch information
ne7359 authored Jan 18, 2025
commit 8bce0356be34d3c0c868bae81430ec71ac3b70cf
15 changes: 8 additions & 7 deletions nodejs/copyDist.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
// Import required modules
// 新添加用于支持DS源适配猫影视
// 导入所需模块
import fs from 'fs';
import path from 'path';
import { execSync } from 'child_process';

// Check if the destination path is provided
// 检查是否提供了目标路径
if (process.argv.length < 3) {
console.error('Usage: node script.js <destination_path>');
process.exit(1);
}

// Get the destination path from command-line arguments
// 从命令行参数获取目标路径
const destinationPath = process.argv[2];

// Resolve paths
// 解析路径
const distPath = path.resolve(process.cwd(), 'dist');
const targetPath = path.resolve(destinationPath);

// Check if dist directory exists
// 检查dist目录是否存在
if (!fs.existsSync(distPath)) {
console.error(`Source directory does not exist: ${distPath}`);
process.exit(1);
}

// Check if target directory exists
// 检查目标目录是否存在
if (!fs.existsSync(targetPath)) {
console.error(`Target directory does not exist: ${targetPath}`);
process.exit(1);
}

// Copy files from dist to target
// 将文件从dist复制到目标
const copyFiles = (srcDir, destDir) => {
const entries = fs.readdirSync(srcDir, { withFileTypes: true });

Expand Down