Skip to content

Commit

Permalink
Merge pull request #26 from AElfProject/release/v0.1.7
Browse files Browse the repository at this point in the history
refactor: Monorepo, tools, Components.
  • Loading branch information
hzz780 authored Aug 7, 2024
2 parents 0a2e4ef + 2500ea0 commit 32d22a6
Show file tree
Hide file tree
Showing 457 changed files with 12,651 additions and 184 deletions.
41 changes: 36 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
/node_modules
/yarn.lock
/dist
package-lock.json
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
coverage
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# dotenv environment variable files
*.env
*.env.development.local
*.env.test.local
*.env.production.local
*.env.local

# lock
*-lock.yarl
*-lock.json

apps/aelf-template/.next
1 change: 0 additions & 1 deletion .local

This file was deleted.

125 changes: 31 additions & 94 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,50 @@
Creates the aelf application with one command.
# create-aelf-dapp

If something doesn’t work, please [file an issue](https://github.com/AElfProject/create-aelf-dapp/issues/new).
## Quick Start the template

# 1. Quick Overview
Please turn to ./apps/create-aelf-dapp/REAME.md for more information.

```bash
yarn create aelf-dapp my-aelf-dapp
# If you encounter problems, you can try "npm create aelf-dapp my-aelf-dapp"
npm create aelf-dapp my-aelf-dapp
cd my-aelf-dapp
yarn dev
```

Then open http://localhost:3000/ to see your app.

# 2. Create a Dapp

## 2.1 Prepare

1. Node > = 20: It is recommended to install Node 20 or higher on the local development machine. You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.
2. Yarn: You also need to install Yarn on your local development machine.

## 2.2 Quick start

### 2.2.1 Development
## Quick Start the applications

Install dependencies
```bash
yarn create aelf-dapp [appName]
yarn dev # Development Environment
# default: http://localhost:3000
pnpm install
```

#### 2.2.1.1 example

start the applications
```bash
# 1. create
$ yarn create aelf-dapp aelf-dapp

⭐️ Hi,welcome to create your project by create-aelf-dapp
false
/Users/hzz780/workspace/practice/npmInitYarnCreate/aelf-dapp
create aelf-dapp/package.json
create aelf-dapp/._tests__/page.test.jsx
create aelf-dapp/.DS_Store
# ......(omit)

✨ File Generate Done /Users/hzz780/workspace/practice/npmInitYarnCreate/aelf-dapp

yarn install v1.22.21
warning ../../../../package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

🎉 Successfully generated your project.
✨ Done in 22.65s.

# 2. run
$ yarn dev
yarn run v1.22.21
warning ../../../../package.json: No license field
$ next dev
▲ Next.js 14.2.3
- Local: http://localhost:3000
- Environments: .env.development
- Experiments (use with caution):
· instrumentationHook

✓ Starting...
# 3005 dev template & all demos
pnpm run -C apps/aelf-template dev
# 3006 socket
pnpm run -C apps/server-socket-io dev
# 3007 chaingpt
pnpm run -C apps/server-chaingpt start:dev
```

### 2.2.2 Publish

#### 2.2.2.1 Local testing

build
```bash
yarn build
yarn start
# independent
pnpm run -C packages/request-all-in-one build
lerna run build --scope request-all-in-one
# all
pnpm run build # pnpm recursive run build
lerna run build
```

#### 2.2.2.2 Vercel released

1. Register https://sentry.io/ Create a new project.
1. Get SENTRY_AUTH_TOKEN at https://[your organization name] sentry.io/settings/auth-tokens/
2. Get the DSN at https://[your organization name] sentry.io/settings/projects/[your project name]/keys/
> For more details, please refer to: https://docs.sentry.io/cli/configuration
2. Register https://vercel.com/ and start a new project associated with our repo.
1. Configure Environment Variables, add key SENTRY_AUTH_TOKEN, value is the value of the SENTRY_AUTH_TOKEN obtained in the above steps

4. When pushing or submitting PR, the project will automatically compile and publish
> For more details, please refer to: https://vercel.com
# 3. What’s Included?

1. Support for Vercel Publishing: A proven ability to publish on the [Vercel](https://vercel.com/) service for free and quickly for startups.
2. Everything included with [create-next-app](https://nextjs.org/docs/app/api-reference/create-next-app): Next(App Router), React, TSX, ES6, TypeScript, Tailwind, ESLint。
3. Integrated aelf on-chain solution:
1. Wallet integration solution [aelf-web-login](https://github.com/AElfProject/aelf-web-login): evoke plug-in wallet/APP wallet wallet, call contract to read on-chain data or initiate on-chain transactions.
2. Aelf-web3.js sdk: Create wallets, read and write data on the chain, etc.
4. UI solution: aelf-design that fits the aelf theme and commonly used framework ant-design.
5. Common tools
1. Data Analysis: Analysis
2. Anomaly Monitoring: Sentry
3. Unit test tool: Jest
4. Status management tool: RTK
5. Git action configuration: The default action contains lint and test.
6. Use cases: In the path/demos, there are a series of common use cases
publish to npm
```bash
lerna publish
```

# 4. LICENSE
Create aelf dapp is open source software licensed as MIT.
rm node_modules
```bash
# Remove the node_modules directory from all packages
lerna clean
rm -rf node_modules/
```

File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions apps/aelf-template/.github/workflows/jestTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Test by jest

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Your node version, default 20 in 2024

- name: Install Dependencies
run: yarn

- name: Run Test
run: yarn test
32 changes: 32 additions & 0 deletions apps/aelf-template/.github/workflows/nextLint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Next Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Your node version, default 20 in 2024

- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
run: yarn

- name: Run ESLint
run: yarn lint
41 changes: 41 additions & 0 deletions apps/aelf-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

/.idea/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# Sentry Config File
.env.sentry-build-plugin
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions apps/aelf-template/appsettings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export const APP_SETTINGS: IAppSettings = {
"openTelemetry": {
"serviceName": "create-aelf-dapp",
"serviceVersion": "v1.0",
// https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
"collectorEndpoint": "http://localhost:8093/v1/traces",
"tracerName": "create-aelf-dapp-tracer",
ignoreUrls: [
/localhost:8093\/sockjs-node/,
/localhost:8093\/monitoring/,
/localhost:8093\/__nextjs_original-stack-frame/,
],
propagateTraceHeaderCorsUrls: [
// /.*/,
"https://httpbin.org"
],
},
"chainGPT": {
// For vercel: key, secret, etc. get from .env
"apiKey": process.env.CHAINGPT_API_KEY as string,
},
"sentry": {
// For vercel: key, secret, etc. get from .env
"dsn": {
"server": process.env.SENTRY_SERVER_DSN as string,
"edge": process.env.SENTRY_EDGE_DSN as string,
"client": process.env.SENTRY_CLIENT_DSN as string
}
}
};

export interface IAppSettings {
openTelemetry: {
serviceName: string;
serviceVersion: string;
collectorEndpoint: string;
tracerName: string;
ignoreUrls: RegExp[];
propagateTraceHeaderCorsUrls: (string | RegExp)[];
};
chainGPT: {
apiKey: string;
};
sentry: {
dsn: {
server: string;
edge: string;
client: string;
};
};
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 32d22a6

Please sign in to comment.