Skip to content

Commit

Permalink
feat: add uploadkit, website and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
devinxl committed Jan 8, 2024
0 parents commit e0c5b8e
Show file tree
Hide file tree
Showing 233 changed files with 18,053 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .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)
16 changes: 16 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"example-nextjs-with-rainbowkit",
"example-nextjs-with-walletkit",
"example-vite-with-walletkit",
"website"
]
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.next
dist
**/*.md
12 changes: 12 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
env: { browser: true, es2020: true, node: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
plugins: ['react-refresh'],
rules: {},
};
72 changes: 72 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Bug Report
description: File a bug/issue
title: '[bug]'
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! The more info you provide, the more we can help you.
- type: input
attributes:
label: Greenfield UploadKit Version
description: What version of Greenfield UploadKit are you using?
placeholder: 1.0.0
validations:
required: true

- type: input
attributes:
label: '@bnb-chain/greenfield-js-sdk Version'
description: What version of @bnb-chain/greenfield-js-sdk are you using?
placeholder: 1.0.0
validations:
required: true

- type: input
attributes:
label: '@bnb-chain/reed-solomon Version'
description: What version of @bnb-chain/reed-solomon are you using?
placeholder: 1.0.0
validations:
required: true

- type: input
attributes:
label: '@bnb-chain/greenfield-cosmos-types Version'
description: What version of @bnb-chain/greenfield-cosmos-types are you using?
placeholder: 1.0.0
validations:
required: true

- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: false

- type: textarea
attributes:
label: Expected behavior
description: A concise description of what you expected to happen.
validations:
required: false

- type: textarea
attributes:
label: Steps to reproduce
description: Steps or code snippets to reproduce the behavior.
validations:
required: false

- type: textarea
attributes:
label: Anything else?
description: |
Browser info? Screenshots? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Description

<!--- Describe your changes in detail -->

## Issue ticket number and link

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the code style of this project.
- [ ] I have updated changeset
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
25 changes: 25 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'setup'
description: Prepare the environment

runs:
using: composite
steps:
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false

- name: Setup pnpm config
shell: bash
run: pnpm config set store-dir .pnpm-store

- name: Install dependencies
shell: bash
run: pnpm install
38 changes: 38 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy docs
on:
push:
branches:
- main
- alpha

jobs:
release:
name: deploy docs
if: github.repository == 'node-real/greenfield-uploadkit'
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Build docs
run: pnpm build:docs

- name: Redirect
run: |
mkdir -p ./website/dist/website/dist
cat << EOF > "./website/dist/website/dist/index.html"
<script>window.location.href='https://github.com/node-real/greenfield-uploadkit</script>
EOF
- name: Deploy docs
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./website/dist
branch: 'docs'
clean: true
force: true
44 changes: 44 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release
on:
push:
branches:
- main
- alpha
- 0.x
- 0.x-alpha

jobs:
release:
name: release
if: github.repository == 'node-real/greenfield-uploadkit'
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Build packages
run: pnpm build

- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create and publish versions
uses: changesets/action@v1
with:
version: pnpm ci:version
publish: pnpm ci:publish
commit: 'chore: update versions'
title: 'chore: update versions'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
build
dist-ssr
*.local
.next

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.npmrc
.pnpm-store
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'*.{js,jsx,ts,tsx}': ['prettier --write', 'eslint --fix'],
'*.{html,md,mdx}': 'prettier --write',
};
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.next
dist
**/*.md
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"arrowParens": "always",
"printWidth": 100,
"proseWrap": "always",
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2
}
56 changes: 56 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Greenfield UploadKit Contribution Guide

Thanks for your interest in contributing to Greenfield UploadKit! Please take a moment to review this document before submitting a pull request.

## Prerequisites

This project relies on [`nodejs`](https://nodejs.org/en), and uses [`pnpm`](https://pnpm.io) as a package manager, make sure you have them installed:

- [node.js](https://nodejs.org/en/) v16 or higher
- [npm](https://pnpm.io) v8 or higher

Then simply clone the repository and enter the directory:

```sh
git clone https://github.com/node-real/greenfield-uploadkit.git
git cd greenfield-uploadkit
```

## Development environment

Install the dependencies and start the local development environment:

```sh
pnpm install
pnpm dev
```

In default, this will run a [vite example](./packages/uploadkit/dev), you can use this example for development and debugging. Any changes in `packages/uploadkit` will trigger a refresh.

## Coding standards

We use `eslint` and our code formatting rules are defined in [.eslintrc.cjs](./.eslintrc.cjs), you can check your code by running:

```sh
pnpm lint
```

Besides, before committing, git hook will automatically run eslint to check and fix errors.

## Tests

Any changes need a test, please make sure all your changes are tested before committing.

## Reporting a bug

Just submit an issue though [github issue page](https://github.com/node-real/greenfield-uploadkit/issues).

## Release notes

A complete development workflow like following:

1. Create a new branch out of `main` branch
2. Make some changes, fix bugs or add new features
3. Run `pnpm changeset` to create a new changeset
4. Commit the code, code review is required, after code review, we can merge the code to `main` branch
5. Then [github action](https://github.com/node-real/greenfield-uploadkit/actions) will automatically execute and create a new [release PR](https://github.com/node-real/greenfield-uploadkit/pulls), merge this PR, a new version will be released
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) 2023 node-real

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.
Loading

0 comments on commit e0c5b8e

Please sign in to comment.