Skip to content

Commit

Permalink
feat(react): create react package
Browse files Browse the repository at this point in the history
fixes: #56
  • Loading branch information
Sukaato committed Jan 31, 2025
1 parent e7ea577 commit 3f150c0
Show file tree
Hide file tree
Showing 43 changed files with 7,057 additions and 2,165 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ jobs:
matrix:
package:
- core
- react
- vue
steps:
- uses: actions/checkout@v4
- name: Audit ${{ matrix.package }}
run: npx -w @poppy-ui/${{ matrix.package }} audit-ci@latest --config ./audit-ci.json
shell: bash
shell: bash
58 changes: 58 additions & 0 deletions .github/workflows/build-react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build - React

on:
workflow_call:
push:
branches:
- main
paths:
- packages/react/**
pull_request:
branches:
- main
paths:
- packages/react/**

# When pushing a new commit we should
# cancel the previous test run to not
# consume more runners than we need to.
concurrency:
group: ${{ github.ref }}_build_react
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 20.x
- 22.x
steps:
- uses: actions/checkout@v4

- name: Setup Node v${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install Core
run: npm install -w @poppy-ui/core
shell: bash

- name: Build Core
run: |
npm run build -w @poppy-ui/core --if-present
npm pack -w @poppy-ui/core
PKG=$(ls poppy-ui-core-*.tgz)
mv $PKG poppy-ui-core-${{ matrix.node-version }}.tgz
shell: bash

- name: Install React
run: |
npm install ./poppy-ui-core-${{ matrix.node-version }}.tgz -w @poppy-ui/react
npm install -w @poppy-ui/react
shell: bash

- name: Build
run: npm run build -w @poppy-ui/react --if-present
43 changes: 43 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,49 @@ jobs:
package: core
node-version: ${{ matrix.node-version }}

test-react:
name: React
needs:
- biome
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 20.x
- 22.x
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Prepare
run: |
npm install -w @poppy-ui/core
npm run build -w @poppy-ui/core
npm pack -w @poppy-ui/core
PKG=$(ls poppy-ui-core-*.tgz)
mv $PKG poppy-ui-core-${{ matrix.node-version }}.tgz
shell: bash

- name: Install
run: |
npm install ./poppy-ui-core-${{ matrix.node-version }}.tgz -w @poppy-ui/react
npm install -w @poppy-ui/react
shell: bash

- name: Test
run: npm run test:spec -w @poppy-ui/react --if-present -- --passWithNoTests --coverage
shell: bash

- name: Test e2e
run: npm run test:e2e -w @poppy-ui/react --if-present -- --pass-with-no-tests --reporter github
shell: bash
- uses: ./.github/workflows/actions/test
with:
package: react
node-version: ${{ matrix.node-version }}

test-vue:
name: Vue
needs:
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,16 @@ jobs:
- test
uses: ./.github/workflows/build-vue.yml

build-react:
name: Build - React
needs:
- test
uses: ./.github/workflows/build-react.yml

publish:
needs:
- build-core
- build-react
- build-vue
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -114,7 +121,7 @@ jobs:
npm uninstall @poppy-ui/docs -w @poppy-ui/vue
npm install @poppy-ui/core@${{ steps.bump.outputs.version }} -w @poppy-ui/vue
npm install -D @poppy-ui/docs@${{ steps.bump.outputs.version }} -w @poppy-ui/vue
- name: Publish Vue
run: |
npm run build
Expand All @@ -123,6 +130,19 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Upgrade - React
run: |
npm uninstall @poppy-ui/core -w @poppy-ui/react
npm install @poppy-ui/core@${{ steps.bump.outputs.version }} -w @poppy-ui/react
- name: Publish React
run: |
npm run build
npm publish
working-directory: packages/react
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Push only if the package as been published on registry
- name: Commit & Tag
run: |
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,11 @@ prerender-static.html
# stencil
packages/angular/css/
packages/react/css/
packages/react/src/components.ts
packages/vue/css/
packages/vue/src/components.ts
packages/core/components/
packages/core/css/
packages/core/hydrate/
packages/core/loader/
packages/core/src/components.d.ts
packages/core/src/components-config.d.ts
packages/core/www/
packages/.stencil/

Expand Down
6 changes: 5 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
"ignore": [
"**/package.json",
"**/*.d.ts",
"packages/core/src/components.ts",
"packages/core/src/components-config.ts",
"packages/docs/*",
"packages/react/src/components.ts",
"packages/vue/src/vue-component-lib/utils.ts",
"packages/vue/src/proxies.ts"
"packages/vue/src/components.ts",
"tests/**"
]
},
"assists": {
Expand Down
Loading

0 comments on commit 3f150c0

Please sign in to comment.