feat: 한국어 우선 쇼케이스 정리
This commit is contained in:
parent
e4087c29f5
commit
2b7fa32b5b
109 changed files with 437 additions and 279 deletions
|
|
@ -13,6 +13,24 @@ const root = path.resolve(here, "..");
|
|||
const shots = path.join(root, "src", "assets", "shots");
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const CHROME = [
|
||||
"C:/Program Files/Google/Chrome/Application/chrome.exe",
|
||||
"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
||||
|
|
@ -44,6 +62,12 @@ const JOBS = [
|
|||
},
|
||||
];
|
||||
|
||||
const requested = requestedSlugs(process.argv);
|
||||
const known = new Set(JOBS.map((job) => job.slug));
|
||||
const unknown = [...requested].filter((slug) => !known.has(slug));
|
||||
if (unknown.length) throw new Error(`Unknown showcase slug(s): ${unknown.join(", ")}`);
|
||||
const selectedJobs = requested.size ? JOBS.filter((job) => requested.has(job.slug)) : JOBS;
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: CHROME,
|
||||
headless: "new",
|
||||
|
|
@ -56,7 +80,7 @@ const browser = await puppeteer.launch({
|
|||
defaultViewport: { width: 1440, height: 900 },
|
||||
});
|
||||
|
||||
for (const job of JOBS) {
|
||||
for (const job of selectedJobs) {
|
||||
const page = await browser.newPage();
|
||||
await page.setCacheEnabled(false);
|
||||
const file = path.join(root, "public/work", job.slug, "index.html");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue