fix(core): Fix the problem of Windows system building error (#16653)

This commit is contained in:
luka
2025-06-25 15:58:00 +08:00
committed by GitHub
parent d382070e3f
commit 297d3001c0
3 changed files with 58 additions and 1 deletions

View File

@@ -8,7 +8,8 @@
"dev": "pnpm run watch",
"typecheck": "tsc --noEmit",
"copy-nodes-json": "node ../../nodes-base/scripts/copy-nodes-json.js .",
"build": "tsup --tsconfig tsconfig.build.json && pnpm copy-nodes-json && tsc-alias -p tsconfig.build.json && cp utils/tokenizer/*.json dist/utils/tokenizer/ && pnpm n8n-copy-static-files && pnpm n8n-generate-metadata",
"copy-tokenizer-json": "node scripts/copy-tokenizer-json.js .",
"build": "tsup --tsconfig tsconfig.build.json && pnpm copy-nodes-json && tsc-alias -p tsconfig.build.json && pnpm copy-tokenizer-json && pnpm n8n-copy-static-files && pnpm n8n-generate-metadata",
"format": "biome format --write .",
"format:check": "biome ci .",
"lint": "eslint nodes credentials utils --quiet",
@@ -148,6 +149,7 @@
"@types/pg": "^8.11.6",
"@types/sanitize-html": "^2.11.0",
"@types/temp": "^0.9.1",
"fast-glob": "catalog:",
"n8n-core": "workspace:*",
"tsup": "catalog:"
},

View File

@@ -0,0 +1,21 @@
const glob = require('fast-glob');
const fs = require('fs');
const path = require('path');
function copyTokenizerJsonFiles(baseDir) {
// Make sure the target directory exists
const targetDir = path.resolve(baseDir, 'dist', 'utils', 'tokenizer');
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir, { recursive: true });
}
// Copy all tokenizer JSON files
const files = glob.sync('utils/tokenizer/*.json', { cwd: baseDir });
for (const file of files) {
const sourcePath = path.resolve(baseDir, file);
const targetPath = path.resolve(baseDir, 'dist', file);
fs.copyFileSync(sourcePath, targetPath);
console.log(`Copied: ${file} -> dist/${file}`);
}
}
copyTokenizerJsonFiles(process.argv[2] || '.');