From 9c6fd80df73d1708edc278673fd9111ab9a2ff7e Mon Sep 17 00:00:00 2001 From: Eric Kwoka <43540491+ekwoka@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:45:10 +0400 Subject: [PATCH] :construction_worker: Updates Github Actions --- .github/workflows/test-pr.yml | 130 ++++------------------------- packages/alpinets/package.json | 2 +- packages/mask/tests/x-mask.test.ts | 4 + 3 files changed, 20 insertions(+), 116 deletions(-) diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index b100a1e..88f30a7 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -17,49 +17,11 @@ jobs: - uses: actions/checkout@v4 - name: Gather package directories id: ls - run: echo "packages=[$(ls -d packages/* | sed 's/[^[:alnum:]]/\\&/g' | sed 's/.*/"&",/' | tr -d '\n' | sed '$s/,$//')]" >> $GITHUB_OUTPUT - - cache-modules: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v2.4.0 - name: Install pnpm - id: pnpm-install - with: - version: latest - standalone: true - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - pnpm store path - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup pnpm cache - with: - path: | - ${{ steps.pnpm-cache.outputs.STORE_PATH }} - ${{ '**/node_modules' }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: Install Dependencies - shell: bash - run: pnpm i - - - name: Prune Store - shell: bash - run: pnpm store prune + run: echo "packages=[$(ls -d packages/* | sed 's/packages\///' | sed 's/[^[:alnum:]]/\\&/g' | sed 's/.*/"&",/' | tr -d '\n' | sed '$s/,$//')]" >> $GITHUB_OUTPUT Lint: runs-on: ubuntu-latest - needs: [collection-packages, cache-modules] + needs: [collection-packages] strategy: matrix: package: ${{ fromJSON(needs.collection-packages.outputs.packages) }} @@ -67,45 +29,24 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2.4.0 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: version: latest standalone: true - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - pnpm store path - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Restore cached Modules - uses: actions/cache/restore@v3 - with: - path: | - ${{ steps.pnpm-cache.outputs.STORE_PATH }} - ${{ '**/node_modules' }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: Install Dependencies - shell: bash - run: pnpm i + run_install: true - name: Lint - run: pnpm run -C ${{ matrix.package }} lint:check + run: pnpm --filter @alpinets/${{matrix.package}} lint:check - name: Type Check - run: pnpm run -C ${{ matrix.package }} lint:types + run: pnpm --filter @alpinets/${{matrix.package}} lint:types continue-on-error: true # AlpineTS is still not fully typed Test: runs-on: ubuntu-latest - needs: [collection-packages, cache-modules] + needs: [collection-packages] strategy: matrix: package: ${{ fromJSON(needs.collection-packages.outputs.packages) }} @@ -113,41 +54,20 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2.4.0 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: version: latest standalone: true - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - pnpm store path - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Restore cached Modules - uses: actions/cache/restore@v3 - with: - path: | - ${{ steps.pnpm-cache.outputs.STORE_PATH }} - ${{ '**/node_modules' }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: Install Dependencies - shell: bash - run: pnpm i + run_install: true - name: Test - run: pnpm run -C ${{ matrix.package }} test --run --reporter=verbose + run: pnpm --filter @alpinets/${{matrix.package}} test --run --reporter=verbose Build: runs-on: ubuntu-latest - needs: [collection-packages, cache-modules] + needs: [collection-packages] strategy: matrix: package: ${{ fromJSON(needs.collection-packages.outputs.packages) }} @@ -155,36 +75,16 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2.4.0 + - uses: pnpm/action-setup@v4 name: Install pnpm id: pnpm-install with: version: latest - run_install: false - - - name: Get pnpm store directory - id: pnpm-cache - shell: bash - run: | - pnpm store path - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Restore cached Modules - uses: actions/cache/restore@v3 - with: - path: | - ${{ steps.pnpm-cache.outputs.STORE_PATH }} - ${{ '**/node_modules' }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: Install Dependencies - shell: bash - run: pnpm i + standalone: true + run_install: true - name: Build Package - run: pnpm run -C ${{ matrix.package }} -r build + run: pnpm --filter @alpinets/${{matrix.package}} -r build check-success: runs-on: ubuntu-latest diff --git a/packages/alpinets/package.json b/packages/alpinets/package.json index b02a772..b717e92 100644 --- a/packages/alpinets/package.json +++ b/packages/alpinets/package.json @@ -1,5 +1,5 @@ { - "name": "alpinets", + "name": "@alpinets/alpinets", "version": "0.0.1", "description": "The rugged, minimal TypeScript framework", "author": "Eric Kwoka (https://thekwoka.net/)", diff --git a/packages/mask/tests/x-mask.test.ts b/packages/mask/tests/x-mask.test.ts index 5452e84..1964a12 100644 --- a/packages/mask/tests/x-mask.test.ts +++ b/packages/mask/tests/x-mask.test.ts @@ -64,14 +64,17 @@ describe('x-mask', () => { ); await type('input', '12'); expect($('input').value).toBe('(12'); + // @ts-expect-error Tapping into untyped internals expect(Alpine.$data($('input')).value).toBe('(12'); await type('input', '123'); expect($('input').value).toBe('(123) '); + // @ts-expect-error Tapping into untyped internals expect(Alpine.$data($('input')).value).toBe('(123) '); await type('input', '1234567890'); expect($('input').value).toBe('(123) 456-7890'); + // @ts-expect-error Tapping into untyped internals expect(Alpine.$data($('input')).value).toBe('(123) 456-7890'); }); it('masks initial x-model value', async () => { @@ -84,6 +87,7 @@ describe('x-mask', () => { `, ); expect($('input').value).toBe('(123) 456-7890'); + // @ts-expect-error Tapping into untyped internals expect(Alpine.$data($('input')).value).toBe('(123) 456-7890'); }); it('does nothing with falsy input', async () => {