Skip to content

Commit

Permalink
add sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
YairLevi committed Feb 13, 2024
1 parent 6291299 commit ba1b3ca
Show file tree
Hide file tree
Showing 14 changed files with 5,415 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sdk/react/.changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
13 changes: 13 additions & 0 deletions sdk/react/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [
["./packages/react"]
],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
17 changes: 17 additions & 0 deletions sdk/react/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI
on:
push:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x

- run: npm install
- run: npm run lint && npm run build
32 changes: 32 additions & 0 deletions sdk/react/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish
on:
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x

- run: npm install
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions sdk/react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist/
.idea
.vscode/
1 change: 1 addition & 0 deletions sdk/react/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
27 changes: 27 additions & 0 deletions sdk/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div style="display: flex; flex-direction: column; align-items: center">
<h1>NPM Package Template</h1>
<img src="https://raw.githubusercontent.com/npm/logos/cc343d8c50139f645d165aedfe4d375240599fd1/npm%20logo/npm-logo-red.svg" alt="drawing" width="200"/>
</div>

This is a template for creating a typescript package and publishing it on NPM, utilizing GitHub Actions and changesets as an easy CI/CD pipeline.

## Prerequisites

**NPM Account and access token** -
- Go to the NPM website and create an account.
- Go to "Access Tokens" and create a Classic Token, with Automation permissions.
- Go to your package repository, and add that token as a secret, under the name "NPM_TOKEN"

**Git** - To use changesets during your development, you must have Git installed on your computer.

**NodeJS and NPM** - Don't forget to have Node installed with NPM. You can change the workflows in the `.github/workflows` folder if you have another package manager.

---

## Usage

After making any amount of changes, run `npx changeset` and create a changeset (This is just a markdown file describing the changes you made.)

When changes are being applied to the main branch, changeset will create a PR for versioning only! Approve that PR, and it will automatically publish to NPM.

For more information, go to the main changesets docs.
3 changes: 3 additions & 0 deletions sdk/react/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function example() {
return true
}
Loading

0 comments on commit ba1b3ca

Please sign in to comment.