Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | /** * Setup CI/CD pipeline files */ import { writeFile, mkdir } from 'fs/promises'; // import path from 'path'; async function setupCI() { // Create .github/workflows directory await mkdir('.github/workflows', { recursive: true }); // CI workflow const ciWorkflow = `name: CI on: push: branches: [main, develop] pull_request: branches: [main, develop] concurrency: group: \${{ github.workflow }}-\${{ github.ref }} cancel-in-progress: true jobs: test: name: Test (Node \${{ matrix.node-version }}) runs-on: ubuntu-latest strategy: matrix: node-version: [20, 22] steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup pnpm uses: pnpm/action-setup@v4 with: version: 10 - name: Setup Node.js \${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: \${{ matrix.node-version }} cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Lint code run: pnpm lint - name: Check formatting run: pnpm format:check - name: Type check run: pnpm typecheck - name: Build packages run: pnpm build - name: Run unit tests run: pnpm test:unit - name: Run integration tests run: pnpm test:integration - name: Security audit run: pnpm security:audit build: name: Build and Analyze runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup pnpm uses: pnpm/action-setup@v4 with: version: 10 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Production build run: pnpm perf:build - name: Bundle analysis run: pnpm perf:analyze - name: Upload bundle analysis uses: actions/upload-artifact@v4 with: name: bundle-analysis path: bundle-analysis.json `; // Release workflow const releaseWorkflow = `name: Release on: push: branches: [main] jobs: release: name: Release runs-on: ubuntu-latest permissions: contents: write id-token: write issues: write repository-projects: write deployments: write packages: write pull-requests: write steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup pnpm uses: pnpm/action-setup@v4 with: version: 10 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build packages run: pnpm perf:build - name: Run tests run: pnpm test - name: Create Release Pull Request or Publish id: changesets uses: changesets/action@v1 with: publish: pnpm release title: 'chore: release packages' commit: 'chore: release packages' env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: \${{ secrets.NPM_TOKEN }} `; // Write workflow files await writeFile('.github/workflows/ci.yml', ciWorkflow); await writeFile('.github/workflows/release.yml', releaseWorkflow); console.log('✅ CI/CD workflows created successfully!'); console.log(' - .github/workflows/ci.yml'); console.log(' - .github/workflows/release.yml'); } // Run setup setupCI().catch(console.error); |