Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 749dd54

Browse files
scaffold accepts original URL instead raw URL (#1102)
* scaffold accepts original URL instead raw URL Signed-off-by: Outsider <[email protected]> * Update bin/scaffold.mjs Co-authored-by: marocchino <[email protected]> Co-authored-by: marocchino <[email protected]>
1 parent 61d866e commit 749dd54

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: bin/scaffold.mjs

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ import { __ } from './translate.mjs';
99
function main() {
1010
const [URL, DATE] = process.argv.slice(2);
1111
const POST_PATH = path.resolve('source', '_posts');
12-
12+
1313
if (!URL) {
14-
console.error(`🚨 번역문서의 GitHub raw URL이 필요합니다.`);
14+
console.error(`🚨 번역할 nodejs.org의 블로그 글 URL이 필요합니다.`);
1515
printGuide();
1616
return;
1717
}
1818

19-
if (isWeeklyUpdate(URL) && !DATE) {
19+
const rawURL = URL.replace(/^https:\/\/nodejs.org(\/en\/blog\/.+?)\/?$/, "https://raw.githubusercontent.com/nodejs/nodejs.org/master/locale$1.md")
20+
21+
if (isWeeklyUpdate(rawURL) && !DATE) {
2022
console.error(`🚨 주간 뉴스 외에는 url 뒤에 발행 일자를 전달해야 합니다.`);
2123
printGuide();
2224
return;
2325
}
2426

25-
const fileName = getFileName(URL, DATE);
27+
const fileName = getFileName(rawURL, DATE);
2628
if (!fileName) {
2729
console.error(`🚨 지원하지 않는 형식의 URL입니다.`);
2830
printGuide();
@@ -36,9 +38,9 @@ function main() {
3638

3739
const filePath = `${POST_PATH}/${fileName}`;
3840

39-
get(URL, resp => {
41+
get(rawURL, resp => {
4042
resp
41-
.pipe(transformer(URL))
43+
.pipe(transformer(rawURL))
4244
.pipe(createWriteStream(filePath));
4345

4446
console.log(`✅ 번역 파일이 생성되었습니다: ${filePath}`);

0 commit comments

Comments
 (0)