From 38f82409bdddd7c0d4c807094f0d86354d422593 Mon Sep 17 00:00:00 2001 From: monoid Date: Wed, 20 Apr 2022 21:58:10 +0900 Subject: [PATCH] feat: overall template --- tools/printDocument.ts | 67 +++++++++++++++++++++ tools/template/overall.md.eta | 107 ++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 tools/printDocument.ts create mode 100644 tools/template/overall.md.eta diff --git a/tools/printDocument.ts b/tools/printDocument.ts new file mode 100644 index 0000000..8b0d5b5 --- /dev/null +++ b/tools/printDocument.ts @@ -0,0 +1,67 @@ + +import {Issue} from "./githubType.ts"; +import {readAll} from "https://deno.land/std@0.135.0/streams/mod.ts" +import {parse as argParse} from "https://deno.land/std@0.135.0/flags/mod.ts"; +import {normalize, join as pathJoin, fromFileUrl} from "https://deno.land/std@0.135.0/path/mod.ts"; +import * as Eta from "https://deno.land/x/eta/mod.ts"; + + +function printOverall(issues: Issue[]){ + const table = new Map(); + issues.forEach((x)=>{ + const category = x.title.split(":")[0]; + if(!category) return; + let c = table.get(category) + if(!c){ + c = [] + table.set(category,c); + } + c.push(x); + }) + let index = 1; + for (const [c,issues] of table) { + console.log(`### 2.2.${index++} ${c} Operation\n`); + let subIndex = 1; + for (const i of issues) { + console.log(`${subIndex++}. #${i.number} ${i.title}`); + } + console.log(""); + } +} + +function printContent(issues: Issue[]){ + console.log(issues.map(i => `## (${i.number}) ${i.title}\n${i.body}`).join("\n\n")); +} + +async function readContent(path?: string):Promise{ + let content = "[]"; + if(path){ + content = await Deno.readTextFile(path); + } + else if(!Deno.isatty(Deno.stdin.rid)){ + const decoder = new TextDecoder(undefined, {ignoreBOM:true}); + const buf = await readAll(Deno.stdin); + content = decoder.decode(buf); + } + return content; +} + +if(import.meta.main){ + const url = new URL(import.meta.url) + url.pathname = normalize(pathJoin(url.pathname,"..","template")); + const path = fromFileUrl(url); + console.log(path); + Eta.configure({views: path}); + let args = argParse(Deno.args); + const c = await readContent(args.path); + const issues = JSON.parse(c) as Issue[]; + if(args.overall){ + const c = await Eta.renderFile("overall.md.eta",{ + issues: issues.sort((a,b)=>a.number-b.number) + }); + console.log(c); + } + else{ + printContent(issues); + } +} \ No newline at end of file diff --git a/tools/template/overall.md.eta b/tools/template/overall.md.eta new file mode 100644 index 0000000..e22008d --- /dev/null +++ b/tools/template/overall.md.eta @@ -0,0 +1,107 @@ +# 2. 전체 시스템 개요(Overall description) + +### 2.1. 제품 관점(Product perspective) + +### 2.1.1. 시스템 인터페이스(System interfaces) + +본 시스템은 Cross-platform 소프트웨어이다. 다음과 같은 브라우저가 원활히 실행될 수 있는 시스템에서 동작 할 수 있다. +- Chrome 버전 61 이상 +- Firefox 버전 60 이상 +- Edge 버전 79 이상 +- Safari 버전 11 이상 +- Chrome for Android 버전 100 이상 +- Samsung internet 버전 8.2 이상 + +### 2.1.2. 사용자 인터페이스(User interfaces) + +웹으로 동작하는 GUI이다. 키보드와 마우스, 터치 인터페이스로 동작할 수 있다. GUI의 디자인은 Material Design이나 Metro Design 같이 플랫한 디자인을 추구한다. + +### 2.1.3. 하드웨어 인터페이스(Hardware interfaces) + +해당되지 않음. + +### 2.1.4. 소프트웨어 인터페이스(Software interfaces) + +이 프로젝트의 결과물은 클립보드를 통해서 여러 타입의 데이터를 import/export한다. + +### 2.1.5. 통신 인터페이스(Communications interfaces) + +해당되지 않음. + +### 2.1.6. 메모리 제약사항(Memory constraints) + +해당되지 않음. + +### 2.1.7. 운영(Operations) + +해당되지 않음. + +### 2.1.8. 사이트 적용 요건(Site adaption requirements) + +해당되지 않음. + +## 2.2. 제품 기능(Product functions) + +본 프로젝트의 결과물은 다음과 같은 기능을 수행한다. + +<% + const table = new Map(); + it.issues.forEach((x)=>{ + const category = x.title.split(":")[0]; + if(!category) return; + let c = table.get(category) + if(!c){ + c = []; + table.set(category,c); + } + c.push(x); + }) + let index = 1; + for (const [c,issues] of table) { +%><%= `### 2.2.${index++} ${c} Operation\n\n` %><% + let subIndex = 1; + for (const i of issues) { +%><%=`${subIndex++}. #${i.number} ${i.title}\n` %><% + } +%> + +<% + } +%> + +### 2.2.8 비기능적 기능 +- Docker 배포 +- .env 설정 +- 첫 로드후 로딩 0.5s 이내 +- 동시 편집 이용자 5명 이내 +- 1000 RPS 정도 버티기 + +## 2.3. 사용자 특성(User characteristics) + +사용자는 기본적인 GUI 조작을 할 줄 알며 인터넷 사용을 원활히 할 수 있고 기본적인 영어를 읽고 쓸 줄 알며, markdown을 작성할 수 있는 사용자로 한정한다. 일반적으로 13세 이상 65세 이하의 사람을 사용자로 가정한다. + +## 2.4. 제약사항(Constraints) + +이 프로젝트는 MIT License로 개발되고 있으므로 라이브러리의 라이센스도 신경을 쓴다. + +> - 개발자의 선택을 제한할 모든 항목에 관한 일반적인 설명을 제공해야 한다. +> - 포함되는 내용 +> 1. Regulatory plocies +> 1. Hardware limitations (e.g., signal timing requirements) +> 1. Interfaces to other applications +> 1. Parallel operation +> 1. Audit functions +> 1. Control functions +> 1. Higher-order language requirements +> 1. Signal handshake protocols(e.g., XON-XOFF, ACK-NACK) +> 1. Reliability requirements +> 1. Criticality of the application +> 1. Safety and security considerations + +## 2.5. 가정 및 의존성(Assumptions and dependencies) + +해당되지 않음. + +## 2.6. 단계별 요구사항(Apportioning of requirements) + +해당되지 않음. \ No newline at end of file