This repository was archived by the owner on Mar 22, 2023. It is now read-only.
File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,22 @@ import { __ } from './translate.mjs';
9
9
function main ( ) {
10
10
const [ URL , DATE ] = process . argv . slice ( 2 ) ;
11
11
const POST_PATH = path . resolve ( 'source' , '_posts' ) ;
12
-
12
+
13
13
if ( ! URL ) {
14
- console . error ( `🚨 번역문서의 GitHub raw URL이 필요합니다.` ) ;
14
+ console . error ( `🚨 번역할 nodejs.org의 블로그 글 URL이 필요합니다.` ) ;
15
15
printGuide ( ) ;
16
16
return ;
17
17
}
18
18
19
- if ( isWeeklyUpdate ( URL ) && ! DATE ) {
19
+ const rawURL = URL . replace ( / ^ h t t p s : \/ \/ n o d e j s .o r g ( \/ e n \/ b l o g \/ .+ ?) \/ ? $ / , "https://raw.githubusercontent.com/nodejs/nodejs.org/master/locale$1.md" )
20
+
21
+ if ( isWeeklyUpdate ( rawURL ) && ! DATE ) {
20
22
console . error ( `🚨 주간 뉴스 외에는 url 뒤에 발행 일자를 전달해야 합니다.` ) ;
21
23
printGuide ( ) ;
22
24
return ;
23
25
}
24
26
25
- const fileName = getFileName ( URL , DATE ) ;
27
+ const fileName = getFileName ( rawURL , DATE ) ;
26
28
if ( ! fileName ) {
27
29
console . error ( `🚨 지원하지 않는 형식의 URL입니다.` ) ;
28
30
printGuide ( ) ;
@@ -36,9 +38,9 @@ function main() {
36
38
37
39
const filePath = `${ POST_PATH } /${ fileName } ` ;
38
40
39
- get ( URL , resp => {
41
+ get ( rawURL , resp => {
40
42
resp
41
- . pipe ( transformer ( URL ) )
43
+ . pipe ( transformer ( rawURL ) )
42
44
. pipe ( createWriteStream ( filePath ) ) ;
43
45
44
46
console . log ( `✅ 번역 파일이 생성되었습니다: ${ filePath } ` ) ;
You can’t perform that action at this time.
0 commit comments