|
| 1 | +name: CLI test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: Test on ${{ matrix.os }} |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 16 | + steps: |
| 17 | + - name: Checkout Repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Set up Node.js |
| 21 | + uses: actions/setup-node@v3 |
| 22 | + with: |
| 23 | + node-version: 22 |
| 24 | + |
| 25 | + - name: Install Dependencies |
| 26 | + run: npm install --save-dev create-frontend-component |
| 27 | + |
| 28 | + - name: Run CLI to init config |
| 29 | + run: npx create-frontend-component init:vue3 |
| 30 | + |
| 31 | + - name: Run CLI to generate a component |
| 32 | + run: npx create-frontend-component test-component --type molecules --flavour default |
| 33 | + |
| 34 | + - name: Verify Generated Files (Linux/macOS) |
| 35 | + if: matrix.os != 'windows-latest' |
| 36 | + run: | |
| 37 | + test -d src/components/molecules/test-component && echo "Component directory exists" |
| 38 | + test -f src/components/molecules/test-component/test-component.vue && echo "Vue file exists" |
| 39 | + test -f src/components/molecules/test-component/test-component.stories.mdx && echo "MDX file exists" |
| 40 | +
|
| 41 | + - name: Verify Generated Files (Windows) |
| 42 | + if: matrix.os == 'windows-latest' |
| 43 | + shell: pwsh |
| 44 | + run: | |
| 45 | + if (!(Test-Path "src/components/molecules/test-component" -PathType Container)) { exit 1 } |
| 46 | + if (!(Test-Path "src/components/molecules/test-component/test-component.vue")) { exit 1 } |
| 47 | + if (!(Test-Path "src/components/molecules/test-component/test-component.stories.mdx")) { exit 1 } |
| 48 | +
|
| 49 | + - name: Cleanup (Linux/macOS) |
| 50 | + if: matrix.os != 'windows-latest' |
| 51 | + run: rm -rf src/components/molecules/test-component |
| 52 | + |
| 53 | + - name: Cleanup (Windows) |
| 54 | + if: matrix.os == 'windows-latest' |
| 55 | + shell: pwsh |
| 56 | + run: Remove-Item -Recurse -Force src/components/molecules/test-component |
0 commit comments