Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: new architecture (v3) with components #1

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3

Expand All @@ -25,6 +23,9 @@ jobs:

- run: bun run lint:prettier

# needed for `lint:ts`
- run: bun run build:web

- run: bun run lint:ts

# needed for `commitlint`
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: release PR

on:
push:
branches:
- main

jobs:
create:
runs-on: ubuntu-latest
outputs:
pr: ${{ steps.release.outputs.pr }}
steps:
- id: release
uses: google-github-actions/release-please-action@v3
with:
command: manifest
token: ${{ secrets.SECURITY_INTEGRATIONS_PAT }}

format:
runs-on: ubuntu-latest
needs: release-pr
if: needs.release-pr.outputs.pr
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
ref: '${{ fromJSON(needs.release-pr.outputs.pr).headBranchName }}'
token: ${{ secrets.SECURITY_INTEGRATIONS_PAT }}

- uses: oven-sh/setup-bun@v1

- run: bun i --frozen-lockfile

- run: bun run format

- name: ammend release-please's commit
run: |
git config user.name '$GITHUB_ACTOR'
git config user.email '[email protected]'
git commit -a --amend --no-edit
git push -f -u origin HEAD
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on: pull_request
jobs:
unit:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3

Expand Down
9 changes: 9 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"packages/preact": "2.0.0",
"packages/qwik": "2.0.0",
"packages/react": "2.0.0",
"packages/react-native": "2.0.0",
"packages/solid": "2.0.0",
"packages/svelte": "2.0.0",
"packages/vue/vue3": "2.0.0"
}
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contributing

## Folder structure and workspaces

- `examples`: examples for merchants to use as inspiration
- `packages`: components built with Mitosis
- `server`: Checkout server in Astro, PCI compliant
- `stories`: Storybook for developing/testing components, currently uses React
- `web`: components written in Mitosis

## Dependencies

1. Install [Bun](https://bun.sh)
2. Run `bun i` on a terminal

That's it 😄

### Running locally

```sh
bun start
```

Automatically starts `components`, `stories`, and `server`.
Opens `stories` and `server` on the browser.

### Other scripts

Look at `package.json#scripts` for a complete list.
Use with:

```sh
bun run <script>
```
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Primer.io and affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Primer Checkout Web

v3 Web components.

## Merchants

Look at the folder `/examples` for example integration apps with our Web SDK, to use for inspiration or as starting point for yours.
Look at the folder `/examples` for example apps and servers, to use for learning, inspiration, or as starting point for yours.

## Contributors

Look at `CONTRIBUTING.md`.
Binary file modified bun.lockb
Binary file not shown.
26 changes: 3 additions & 23 deletions examples/features/cobadged/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
# Cobadged
# Co-badged cards

In this example we integrate Primer's Web SDK v2 headless with co-badged cards.
## TODO

It uses [Astro](https://astro.build) as the base tool, but feel free to build your website and server however you'd like.

## Running on your browser

[Click here to immediately launch it on your browser](https://stackblitz.com/github/primer-io/checkout-web/tree/main/examples/cobadged).

Once it's open, make sure to:

1. Create a new file `.env` and copy contents from `.env.example` into it
2. Get an `API_KEY` from your Primer Dashboard and paste it there
- Example: `API_KEY=1234-foo-bar-4321`

## Running locally

1. Install [Bun](https://bun.sh)
2. Run `bun install` on a terminal
3. Follow the same instructions described on the section above about the `API_KEY`
4. Execute the following script on a terminal window:
```sh
bun start
```
Migrate from v2
6 changes: 0 additions & 6 deletions examples/features/cobadged/astro.config.mjs

This file was deleted.

17 changes: 0 additions & 17 deletions examples/features/cobadged/package.json

This file was deleted.

45 changes: 0 additions & 45 deletions examples/features/cobadged/src/api/primer.ts

This file was deleted.

1 change: 0 additions & 1 deletion examples/features/cobadged/src/env.d.ts

This file was deleted.

Loading