Compare commits
4 Commits
c2a99e1ad3
...
f1a66437cb
Author | SHA1 | Date | |
---|---|---|---|
f1a66437cb | |||
4d8b899edd | |||
836ac90fb3 | |||
f7e29875c6 |
36
cli.py
36
cli.py
@ -4,17 +4,24 @@ import argparse
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from typing import List, Union
|
||||||
|
|
||||||
|
def cmdExecute(command: List[str], verbose = False, head_msg: Union[str,None] = None ,msg: Union[str,None] = None):
|
||||||
|
msg = msg or " ".join(command)
|
||||||
|
head_msg = head_msg or "cmd execute: "
|
||||||
|
if verbose:
|
||||||
|
print(head_msg, msg)
|
||||||
|
p = subprocess.run(command)
|
||||||
|
p.check_returncode()
|
||||||
|
|
||||||
def updateIssue(issuePath: str, verbose = False):
|
def updateIssue(issuePath: str, verbose = False):
|
||||||
if verbose:
|
cmd = ["deno", "run","--no-check", "-A","tools/getIssue.ts", "--path",issuePath]
|
||||||
print("get issues")
|
cmdExecute(cmd, verbose, "update issue:")
|
||||||
p = subprocess.run(["deno", "run", "-A","tools/getIssue.ts", "--path",issuePath])
|
|
||||||
p.check_returncode()
|
|
||||||
|
|
||||||
def printDocument(issuePath:str, outDir:str, watch = False, verbose = False):
|
def printDocument(issuePath:str, outDir:str, watch = False, verbose = False):
|
||||||
if verbose:
|
if verbose:
|
||||||
print("build document")
|
print("build document : issuePath(", issuePath, ") to ", outDir)
|
||||||
cmd = ["deno", "run", "-A","tools/printDocument.ts", "--issue_path", issuePath, "--outDir", outDir]
|
cmd = ["deno", "run","--no-check" ,"-A","tools/printDocument.ts", "--issue_path", issuePath, "--outDir", outDir]
|
||||||
if watch:
|
if watch:
|
||||||
cmd.append("--watch")
|
cmd.append("--watch")
|
||||||
p = subprocess.run(cmd)
|
p = subprocess.run(cmd)
|
||||||
@ -35,6 +42,8 @@ def build(args):
|
|||||||
if args.update_issues:
|
if args.update_issues:
|
||||||
updateIssue(issuePath, args.verbose)
|
updateIssue(issuePath, args.verbose)
|
||||||
printDocument(issuePath, args.outDir, args.watch, args.verbose)
|
printDocument(issuePath, args.outDir, args.watch, args.verbose)
|
||||||
|
cmd = ["mdbook", "build"]
|
||||||
|
cmdExecute(cmd, args.verbose)
|
||||||
|
|
||||||
def serve(args):
|
def serve(args):
|
||||||
"""serve the documentation and reload on changes"""
|
"""serve the documentation and reload on changes"""
|
||||||
@ -74,6 +83,11 @@ def buildPdf(args):
|
|||||||
parser.add_argument('--outDir', default="build/doc.pdf", help='output directory')
|
parser.add_argument('--outDir', default="build/doc.pdf", help='output directory')
|
||||||
parser.add_argument('--browser-path', help='path to the browser')
|
parser.add_argument('--browser-path', help='path to the browser')
|
||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
|
if os.path.exists(args.outDir):
|
||||||
|
if args.verbose:
|
||||||
|
print("remove old file")
|
||||||
|
os.remove(args.outDir)
|
||||||
|
|
||||||
absPath = os.path.normpath(os.path.join( os.getcwd(),'book' , 'print.html' )).replace('\\', '/')
|
absPath = os.path.normpath(os.path.join( os.getcwd(),'book' , 'print.html' )).replace('\\', '/')
|
||||||
url = f"file://{absPath}"
|
url = f"file://{absPath}"
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
@ -83,15 +97,9 @@ def buildPdf(args):
|
|||||||
if args.browser_path:
|
if args.browser_path:
|
||||||
cmd.append("--chromeDir")
|
cmd.append("--chromeDir")
|
||||||
cmd.append(args.browser_path)
|
cmd.append(args.browser_path)
|
||||||
if args.verbose:
|
cmdExecute(cmd, args.verbose, "print pdf:")
|
||||||
print("cmd: ", " ".join(cmd))
|
|
||||||
p = subprocess.run(cmd)
|
|
||||||
p.check_returncode()
|
|
||||||
cmd = ["java", "-jar", "tools/pdfbox-app-2.0.26.jar", "PDFMerger", "cover.pdf", args.outDir, args.outDir]
|
cmd = ["java", "-jar", "tools/pdfbox-app-2.0.26.jar", "PDFMerger", "cover.pdf", args.outDir, args.outDir]
|
||||||
if args.verbose:
|
cmdExecute(cmd, args.verbose, "merge pdf:")
|
||||||
print("merge cmd: ", " ".join(cmd))
|
|
||||||
p = subprocess.run(cmd)
|
|
||||||
p.check_returncode()
|
|
||||||
|
|
||||||
commandList = {
|
commandList = {
|
||||||
'build': build,
|
'build': build,
|
||||||
|
@ -16,7 +16,7 @@ import "https://deno.land/std@0.136.0/dotenv/load.ts";
|
|||||||
*/
|
*/
|
||||||
export async function getIssues(repo: string, token: string): Promise<Issue[]> {
|
export async function getIssues(repo: string, token: string): Promise<Issue[]> {
|
||||||
//check https://docs.github.com/en/rest/reference/issues#list-repository-issues
|
//check https://docs.github.com/en/rest/reference/issues#list-repository-issues
|
||||||
const res = await fetch(`https://api.github.com/repos/${repo}/issues?per_page=100&labels=feature`, {
|
const res = await fetch(`https://api.github.com/repos/${repo}/issues?per_page=100&labels=feature&state=all`, {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/vnd.github.v3+json',
|
Accept: 'application/vnd.github.v3+json',
|
||||||
Authorization: `Token ${token}`
|
Authorization: `Token ${token}`
|
||||||
|
@ -49,27 +49,6 @@ async function printDoc(param: printDocParam, option?: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function readAndPrint(args: {
|
|
||||||
issue_path?: string,
|
|
||||||
outDir?: string,
|
|
||||||
targets: string[],
|
|
||||||
}) {
|
|
||||||
const c = await readContent(args.issue_path);
|
|
||||||
const issues = JSON.parse(c) as Issue[];
|
|
||||||
issues.sort((a, b) => a.number - b.number);
|
|
||||||
for (const target of args.targets) {
|
|
||||||
await printDoc({
|
|
||||||
target: target,
|
|
||||||
data: {
|
|
||||||
issues
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, {
|
|
||||||
outDir: args.outDir
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const parsedArg = argParse(Deno.args);
|
const parsedArg = argParse(Deno.args);
|
||||||
const { issue_path, outDirArg, w, watch } = parsedArg;
|
const { issue_path, outDirArg, w, watch } = parsedArg;
|
||||||
@ -109,8 +88,12 @@ async function main() {
|
|||||||
const targets = ["SUMMARY.md", "overall.md", "specific.md", "intro.md", "support.md"];
|
const targets = ["SUMMARY.md", "overall.md", "specific.md", "intro.md", "support.md"];
|
||||||
|
|
||||||
const targetsR = await Promise.all(targets.map(async (t) => {
|
const targetsR = await Promise.all(targets.map(async (t) => {
|
||||||
return await createReactive(() => {
|
return await createReactive(async () => {
|
||||||
return readAndPrint({ issue_path, outDir, targets:[t] });
|
await printDoc({
|
||||||
|
target: t, data: {
|
||||||
|
issues: issuesR.value
|
||||||
|
}
|
||||||
|
}, { outDir: outDir });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
### 2.1.6. 메모리 제약사항(Memory constraints)
|
### 2.1.6. 메모리 제약사항(Memory constraints)
|
||||||
|
|
||||||
서버는 2GB에서 정상 작동해야 한다.
|
서버는 2GB 메모리 환경에서 정상 작동해야 한다.
|
||||||
|
|
||||||
### 2.1.7. 운영(Operations)
|
### 2.1.7. 운영(Operations)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user