feat: 한국어 우선 쇼케이스 정리
This commit is contained in:
parent
e4087c29f5
commit
2b7fa32b5b
109 changed files with 437 additions and 279 deletions
|
|
@ -8,6 +8,24 @@ const rootDir = path.resolve(__dirname, "..");
|
|||
const chromePath = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
|
||||
const shotsDir = path.join(rootDir, "src", "assets", "shots");
|
||||
|
||||
function requestedSlugs(argv) {
|
||||
const slugs = new Set();
|
||||
for (let index = 2; index < argv.length; index += 1) {
|
||||
const argument = argv[index];
|
||||
if (argument === "--slug") {
|
||||
const slug = argv[index + 1];
|
||||
if (!slug) throw new Error("--slug requires a showcase slug");
|
||||
slugs.add(slug);
|
||||
index += 1;
|
||||
} else if (argument.startsWith("--slug=")) {
|
||||
slugs.add(argument.slice("--slug=".length));
|
||||
} else {
|
||||
throw new Error(`Unknown argument: ${argument}`);
|
||||
}
|
||||
}
|
||||
return slugs;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(shotsDir)) {
|
||||
fs.mkdirSync(shotsDir, { recursive: true });
|
||||
}
|
||||
|
|
@ -94,6 +112,13 @@ const targets = [
|
|||
},
|
||||
];
|
||||
|
||||
const requested = requestedSlugs(process.argv);
|
||||
const slugOf = (target) => path.basename(path.dirname(target.url));
|
||||
const known = new Set(targets.map(slugOf));
|
||||
const unknown = [...requested].filter((slug) => !known.has(slug));
|
||||
if (unknown.length) throw new Error(`Unknown showcase slug(s): ${unknown.join(", ")}`);
|
||||
const selectedTargets = requested.size ? targets.filter((target) => requested.has(slugOf(target))) : targets;
|
||||
|
||||
console.log("📸 Capturing high-resolution screenshots...");
|
||||
|
||||
const shot = (t, url, out) => {
|
||||
|
|
@ -111,7 +136,7 @@ const shot = (t, url, out) => {
|
|||
]);
|
||||
};
|
||||
|
||||
for (const t of targets) {
|
||||
for (const t of selectedTargets) {
|
||||
console.log(`- Capturing ${path.basename(t.out)}`);
|
||||
try {
|
||||
shot(t, t.url, t.out);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue