Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions packages/junior/src/cli/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,35 @@ function writeVercelJson(targetDir: string): void {
);
}

function writeGitHubWorkflow(targetDir: string): void {
const workflowDir = path.join(targetDir, ".github", "workflows");
fs.mkdirSync(workflowDir, { recursive: true });
fs.writeFileSync(
path.join(workflowDir, "ci.yml"),
`name: CI

on:
push:
branches: [main]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
Comment thread
cursor[bot] marked this conversation as resolved.
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm check
- run: pnpm build
`,
);
}

export async function runInit(
dir: string,
log: (line: string) => void = console.log,
Expand Down Expand Up @@ -84,6 +113,7 @@ export async function runInit(
version: "0.1.0",
private: true,
type: "module",
packageManager: "pnpm@10",
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
scripts: {
dev: "vite dev",
check: "junior check",
Expand Down Expand Up @@ -158,6 +188,7 @@ SENTRY_ORG_SLUG=
writeNitroConfig(target);
writeViteConfig(target);
writeVercelJson(target);
writeGitHubWorkflow(target);

log(`Created ${name} at ${target}`);
log("");
Expand Down
11 changes: 11 additions & 0 deletions packages/junior/tests/unit/cli/init-cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ describe("init cli", () => {
expect(fs.existsSync(path.join(target, "app", "DESCRIPTION.md"))).toBe(
true,
);
expect(
fs.existsSync(path.join(target, ".github", "workflows", "ci.yml")),
).toBe(true);

const workflow = fs.readFileSync(
path.join(target, ".github", "workflows", "ci.yml"),
"utf8",
);
expect(workflow).toContain("pnpm check");
expect(workflow).toContain("pnpm build");
expect(workflow).toContain("pnpm install --frozen-lockfile");

const vercelConfig = JSON.parse(
fs.readFileSync(path.join(target, "vercel.json"), "utf8"),
Expand Down
Loading