generated from coulomb/repo-seed
76 lines
2.1 KiB
Python
76 lines
2.1 KiB
Python
from pathlib import Path
|
|
|
|
|
|
def write_readme_only_repo(root: Path) -> Path:
|
|
repo = root / "readme-only"
|
|
repo.mkdir()
|
|
(repo / "README.md").write_text(
|
|
"# Readme Only\n\nThis repository describes a planned interface.\n",
|
|
encoding="utf-8",
|
|
)
|
|
return repo
|
|
|
|
|
|
def write_python_cli_repo(root: Path) -> Path:
|
|
repo = root / "python-cli"
|
|
repo.mkdir()
|
|
(repo / "README.md").write_text("# Python CLI\n", encoding="utf-8")
|
|
(repo / "requirements.txt").write_text("click\npytest\n", encoding="utf-8")
|
|
(repo / "cli.py").write_text(
|
|
"import click\n\n"
|
|
"@click.command()\n"
|
|
"def main():\n"
|
|
" click.echo('ok')\n",
|
|
encoding="utf-8",
|
|
)
|
|
(repo / "tests").mkdir()
|
|
(repo / "tests" / "test_cli.py").write_text(
|
|
"def test_cli(): pass\n",
|
|
encoding="utf-8",
|
|
)
|
|
return repo
|
|
|
|
|
|
def write_misleading_docs_repo(root: Path) -> Path:
|
|
repo = root / "misleading-docs"
|
|
repo.mkdir()
|
|
(repo / "README.md").write_text(
|
|
"# Misleading Docs\n\nClaims to provide payments and search, but has no code.\n",
|
|
encoding="utf-8",
|
|
)
|
|
return repo
|
|
|
|
|
|
def write_javascript_typescript_package_repo(root: Path) -> Path:
|
|
repo = root / "js-ts-package"
|
|
repo.mkdir()
|
|
(repo / "README.md").write_text(
|
|
"# JS TS Package\n\nExposes browser and API package code.\n",
|
|
encoding="utf-8",
|
|
)
|
|
(repo / "package.json").write_text(
|
|
'{"dependencies":{"react":"latest","vite":"latest"},'
|
|
'"devDependencies":{"vitest":"latest"}}',
|
|
encoding="utf-8",
|
|
)
|
|
(repo / "src").mkdir()
|
|
(repo / "src" / "api").mkdir()
|
|
(repo / "src" / "api" / "routes.ts").write_text(
|
|
"export function routeRequest(input: Request): Response {\n"
|
|
" return new Response('ok')\n"
|
|
"}\n",
|
|
encoding="utf-8",
|
|
)
|
|
(repo / "src" / "api" / "routes.spec.ts").write_text(
|
|
"import { describe, it } from 'vitest'\n"
|
|
"describe('routes', () => { it('works', () => {}) })\n",
|
|
encoding="utf-8",
|
|
)
|
|
return repo
|
|
|
|
|
|
def write_empty_repo(root: Path) -> Path:
|
|
repo = root / "empty-repo"
|
|
repo.mkdir()
|
|
return repo
|