revert: remove unused script modifications

This commit is contained in:
DragonnZhang 2026-02-10 14:34:36 +08:00
parent e29aab478e
commit 2a432b18f7
3 changed files with 43 additions and 47 deletions

View file

@ -14,7 +14,6 @@ import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { execSync } from 'node:child_process';
import { copyRecursiveSync } from './copy_bundle_assets.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@ -70,6 +69,24 @@ const localesSourceDir = path.join(
const localesDestDir = path.join(distDir, 'locales');
if (fs.existsSync(localesSourceDir)) {
// Recursive copy function
function copyRecursiveSync(src, dest) {
const stats = fs.statSync(src);
if (stats.isDirectory()) {
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest, { recursive: true });
}
const entries = fs.readdirSync(src);
for (const entry of entries) {
const srcPath = path.join(src, entry);
const destPath = path.join(dest, entry);
copyRecursiveSync(srcPath, destPath);
}
} else {
fs.copyFileSync(src, dest);
}
}
copyRecursiveSync(localesSourceDir, localesDestDir);
console.log('Copied locales folder');
} else {
@ -90,6 +107,24 @@ const extensionExamplesDir = path.join(
const extensionExamplesDestDir = path.join(distDir, 'examples');
if (fs.existsSync(extensionExamplesDir)) {
// Recursive copy function
function copyRecursiveSync(src, dest) {
const stats = fs.statSync(src);
if (stats.isDirectory()) {
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest, { recursive: true });
}
const entries = fs.readdirSync(src);
for (const entry of entries) {
const srcPath = path.join(src, entry);
const destPath = path.join(dest, entry);
copyRecursiveSync(srcPath, destPath);
}
} else {
fs.copyFileSync(src, dest);
}
}
copyRecursiveSync(extensionExamplesDir, extensionExamplesDestDir);
console.log('Copied extension examples folder');
} else {
@ -98,28 +133,6 @@ if (fs.existsSync(extensionExamplesDir)) {
);
}
// Copy insight templates directory
console.log('Copying insight templates...');
const insightTemplatesDir = path.join(
rootDir,
'packages',
'cli',
'src',
'services',
'insight',
'templates',
);
const destTemplatesDir = path.join(distDir, 'templates');
if (fs.existsSync(insightTemplatesDir)) {
copyRecursiveSync(insightTemplatesDir, destTemplatesDir);
console.log('Copied insight templates to dist/');
} else {
console.warn(
`Warning: Insight templates directory not found at ${insightTemplatesDir}`,
);
}
// Copy package.json from root and modify it for publishing
console.log('Creating package.json for distribution...');
const rootPackageJson = JSON.parse(
@ -138,15 +151,7 @@ const distPackageJson = {
bin: {
qwen: 'cli.js',
},
files: [
'cli.js',
'vendor',
'*.sb',
'README.md',
'LICENSE',
'locales',
'templates',
],
files: ['cli.js', 'vendor', '*.sb', 'README.md', 'LICENSE', 'locales'],
config: rootPackageJson.config,
dependencies: {},
optionalDependencies: {