Skip to content
Open

upgrade #24821

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions hack/flatten-and-resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,22 @@
const fs = require('fs');
const path = require('path');

const PUBLIC_DIR = path.resolve(process.argv[2] || 'public');
const inputDir = process.argv[2] ?? 'public';
const PUBLIC_DIR = path.resolve(process.cwd(), inputDir);

if (!fs.existsSync(PUBLIC_DIR)) {
console.error(`Error: Directory ${PUBLIC_DIR} does not exist`);
try {
const stat = fs.statSync(PUBLIC_DIR);

if (!stat.isDirectory()) {
console.error(`Error: ${PUBLIC_DIR} is not a directory`);
process.exit(1);
}
} catch (err) {
if (err.code === 'ENOENT') {
console.error(`Error: Directory ${PUBLIC_DIR} does not exist`);
} else {
console.error(`Error accessing ${PUBLIC_DIR}:`, err.message);
}
process.exit(1);
}

Expand Down