[setup] add redme to template module
This commit is contained in:
@@ -14,6 +14,7 @@ if (!componentName) {
|
|||||||
const folderPath = path.join(componentFolderPath, componentName);
|
const folderPath = path.join(componentFolderPath, componentName);
|
||||||
const componentFilePath = path.join(folderPath, `${componentName}.ts`);
|
const componentFilePath = path.join(folderPath, `${componentName}.ts`);
|
||||||
const testFile = path.join(folderPath, `${componentName}.test.ts`);
|
const testFile = path.join(folderPath, `${componentName}.test.ts`);
|
||||||
|
const readmeFile = path.join(folderPath, `readme.md`);
|
||||||
const indexPath = path.join(folderPath, "index.ts");
|
const indexPath = path.join(folderPath, "index.ts");
|
||||||
|
|
||||||
if (!fs.existsSync(folderPath)) {
|
if (!fs.existsSync(folderPath)) {
|
||||||
@@ -43,6 +44,7 @@ describe("${componentName}", () => {
|
|||||||
});
|
});
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
fs.writeFileSync(testFile, testContent);
|
fs.writeFileSync(testFile, testContent);
|
||||||
|
|
||||||
const indexContent = `import { ${componentName} } from "./${componentName}";
|
const indexContent = `import { ${componentName} } from "./${componentName}";
|
||||||
@@ -52,5 +54,42 @@ export default ${componentName};
|
|||||||
|
|
||||||
fs.writeFileSync(indexPath, indexContent);
|
fs.writeFileSync(indexPath, indexContent);
|
||||||
|
|
||||||
|
const readmeContent = `# ${componentName}
|
||||||
|
|
||||||
|
## описание задачи
|
||||||
|
|
||||||
|
## тест кейсы
|
||||||
|
|
||||||
|
## текстовое описание решения
|
||||||
|
|
||||||
|
## ассимптотическая оценка
|
||||||
|
|
||||||
|
| Description | Estimation |
|
||||||
|
| ----------- | ---------- |
|
||||||
|
| time: | O(n) |
|
||||||
|
| mem: | O(n) |
|
||||||
|
|
||||||
|
## time
|
||||||
|
|
||||||
|
| Description | Time |
|
||||||
|
| ------------------------------------------- | ----- |
|
||||||
|
| анализ и сбор информации | 00:00 |
|
||||||
|
| обдумываение решения и формулировка решения | 00:00 |
|
||||||
|
| имплементация | 00:00 |
|
||||||
|
| исправление ошибок | 00:00 |
|
||||||
|
| полное время затраченое на решение | 00:00 |
|
||||||
|
|
||||||
|
## журнал ошибок
|
||||||
|
|
||||||
|
## code
|
||||||
|
|
||||||
|
### typescript
|
||||||
|
|
||||||
|
ts
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
fs.writeFileSync(readmeFile, readmeContent);
|
||||||
|
|
||||||
console.log(`Component ${componentName} created successfully at ${folderPath}`);
|
console.log(`Component ${componentName} created successfully at ${folderPath}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user