Skip to content

Commit

Permalink
Merge branch 'main' into change-dapp-kit-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
davidecarpini authored Mar 28, 2024
2 parents 13e0672 + 409fa32 commit 15be440
Show file tree
Hide file tree
Showing 104 changed files with 11,838 additions and 6,362 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ tsup.config.ts
**/test/**
vite.config.ts
scripts/prepare-packages.ts
tests/e2e
2 changes: 1 addition & 1 deletion .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Build React App
run: |
yarn install:all
yarn build
yarn gh-pages-build
- name: Setup Pages
uses: actions/configure-pages@v2
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: E2E Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.head_ref || github.ref_name }}-e2e-test
cancel-in-progress: true

jobs:
e2e-tests:
runs-on: ubuntu-latest
name: E2E Tests

steps:
- name: Install Stable Chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Install Stable chromedriver
uses: nanasess/setup-chromedriver@v2

- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: 'yarn'

- name: Install
run: yarn install:all

- name: Run E2E Tests
run: yarn test:e2e:ci
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ yarn-error.log*

.idea
.vscode
.parcel-cache
.parcel-cache

.reports
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ensure a smooth collaboration, please follow these guidelines:

## Submitting a Bug Report

- Search the [issue tracker](https://github.com/vechainfoundation/vechain-dapp-kit/issues) to ensure that the bug has
- Search the [issue tracker](https://github.com/vechain/vechain-dapp-kit/issues) to ensure that the bug has
not been reported already.
- If the bug has not been reported, create a new issue with a descriptive title and a clear description of the bug.

Expand All @@ -29,4 +29,4 @@ ensure a smooth collaboration, please follow these guidelines:
## Reporting Issues

If you encounter any issues or have suggestions,
please [open an issue](https://github.com/vechainfoundation/vechain-dapp-kit/issues) on GitHub.
please [open an issue](https://github.com/vechain/vechain-dapp-kit/issues) on GitHub.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,32 @@ yarn build

---

### E2E Testing

We utilize Cucumber.js with Selenium for end-to-end (E2E) testing. To conduct these tests, you'll require the ChromeDriver. Here's how to install it:

**On Mac:**

```shell
brew install chromedriver
cd "$(dirname "$(which chromedriver)")"
xattr -d com.apple.quarantine chromedriver
```

Once installed, you can run tests in the browser using:

```bash
yarn test:e2e
```

Alternatively, you can run headless tests directly in the console using:

```bash
yarn test:e2e:headless
```

---

## Further Documentation & Usage

- Please refer to [Vechain Docs](https://docs.vechain.org/developer-resources/sdks-and-providers) for more information
Expand Down
8 changes: 7 additions & 1 deletion examples/sample-angular-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const Config = require('@vechain/repo-config');

module.exports = Config.EslintLibrary;
module.exports = {
...Config.EslintLibrary,
rules: {
'no-constant-binary-expression': 'off',
'eslint-comments/disable-enable-pair': 'off',
},
};
21 changes: 21 additions & 0 deletions examples/sample-angular-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:18-alpine

WORKDIR /app

COPY package.json .

RUN apk add git

RUN yarn

RUN yarn global add @angular/cli

RUN yarn global add serve

COPY . .

RUN yarn build

EXPOSE 5004

CMD [ "serve", "dist/easy-angular", "-p", "5004"]
8 changes: 0 additions & 8 deletions examples/sample-angular-app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/assets/img/favicon/favicon.ico",
"src/assets"
],
"styles": [],
"scripts": []
},
Expand Down Expand Up @@ -92,10 +88,6 @@
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/assets/img/favicon/favicon.ico",
"src/assets"
],
"styles": [],
"scripts": []
}
Expand Down
8 changes: 5 additions & 3 deletions examples/sample-angular-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"private": true,
"scripts": {
"add-page": "ng g m pages/page-name --routing && ng g component pages/page-name --skip-tests",
"build": "ng build --configuration development --base-href '/vechain-dapp-kit/angular/'",
"build": "ng build --configuration development",
"clean": "rm -rf dist .turbo .angular",
"dev": "ng serve",
"dev": "ng serve --port 5004",
"gh-pages-build": "ng build --configuration development --base-href '/vechain-dapp-kit/angular/'",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
"preview": "ng serve --port 5004",
"purge": "yarn clean; rm -rf node_modules",
"watch": "ng build --watch --configuration development"
},
Expand Down Expand Up @@ -49,7 +51,7 @@
"@angular/compiler-cli": "^16.1.0",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"@vechain/repo-config": "https://github.com/vechainfoundation/repo-config#v0.0.1",
"@vechain/repo-config": "https://github.com/vechain/repo-config#v0.0.1",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
Expand Down
19 changes: 18 additions & 1 deletion examples/sample-angular-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,25 @@ export class AppComponent implements OnInit {
// -------------------------------------------------------------------------------

public ngOnInit(): void {
// custom button configuration
const walletConnectOptions = {
projectId: 'a0b855ceaf109dbc8426479a4c3d38d8',
metadata: {
name: 'Sample VeChain dApp',
description: 'A sample VeChain dApp',
url: window.location.origin,
icons: [`${window.location.origin}/images/logo/my-dapp.png`],
},
};

const vechainDAppKitOptions = {
nodeUrl: 'https://testnet.vechain.org/',
genesis: 'test',
walletConnectOptions,
usePersistence: true,
};
DAppKitUI.configure(vechainDAppKitOptions);

// custom button configuration
const customButton = document.getElementById('custom-button');
if (customButton) {
const handleConnected = (address: string | null): void => {
Expand Down
26 changes: 0 additions & 26 deletions examples/sample-angular-app/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,6 @@
<base href="/" />

<meta name="viewport" content="width=device-width, initial-scale=1" />

<link
rel="icon"
type="image/x-icon"
href="./assets/img/favicon/favicon.ico"
/>

<!-- NOTE RealFavIconGenerator -->
<link
rel="apple-touch-icon"
sizes="180x180"
href="assets/img/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="assets/img/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="assets/img/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="assets/img/favicon/manifest.json" />
<link
rel="mask-icon"
href="assets/img/favicon/safari-pinned-tab.svg"
Expand Down
20 changes: 0 additions & 20 deletions examples/sample-angular-app/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
import { DAppKitUI } from '@vechain/dapp-kit-ui';
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent, {
providers: [],
// eslint-disable-next-line no-console
}).catch((err) => console.error(err));

const walletConnectOptions = {
projectId: 'a0b855ceaf109dbc8426479a4c3d38d8',
metadata: {
name: 'Sample VeChain dApp',
description: 'A sample VeChain dApp',
url: window.location.origin,
icons: [`${window.location.origin}/images/logo/my-dapp.png`],
},
};

const vechainDAppKitOptions = {
nodeUrl: 'https://testnet.vechain.org/',
genesis: 'test',
walletConnectOptions,
usePersistence: true,
};

DAppKitUI.configure(vechainDAppKitOptions);
8 changes: 7 additions & 1 deletion examples/sample-angular-app/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
Expand Down Expand Up @@ -52,5 +54,9 @@ import 'zone.js'; // Included with Angular CLI.
*/

import '@angular/localize/init';
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(window as any).global = window;
global.Buffer = global.Buffer || require('buffer').Buffer;
(window as any).process = {
env: { DEBUG: undefined },
version: '', // to avoid undefined.slice error
};
17 changes: 17 additions & 0 deletions examples/sample-next-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18-alpine

WORKDIR /app

COPY package.json .

RUN yarn

RUN npm install -g [email protected]

COPY . .

RUN yarn build

EXPOSE 5002

CMD [ "yarn", "start" ]
9 changes: 8 additions & 1 deletion examples/sample-next-app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
const basePath = process.env.BASE_PATH ?? '';

/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
basePath,
env: {
basePath,
},
};

module.exports = nextConfig;
5 changes: 3 additions & 2 deletions examples/sample-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"build": "next build",
"clean": "rm -rf .next dist .turbo",
"dev": "next dev",
"purge": "yarn clean; rm -rf node_modules",
"start": "next start"
"gh-pages-build": "BASE_PATH='/vechain-dapp-kit/next' next build",
"preview": "next start -- -p 5002",
"purge": "yarn clean; rm -rf node_modules"
},
"dependencies": {
"@vechain/dapp-kit": "*",
Expand Down
15 changes: 15 additions & 0 deletions examples/sample-react-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:18-alpine

WORKDIR /app

COPY package.json .

RUN yarn

COPY . .

RUN yarn build

EXPOSE 5001

CMD [ "yarn", "preview" ]
7 changes: 5 additions & 2 deletions examples/sample-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
"private": true,
"type": "module",
"scripts": {
"build": "tsc && vite build",
"build": "tsc && vite build --mode=development",
"clean": "rm -rf dist .turbo",
"dev": "vite",
"gh-pages-build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"preview": "vite preview --mode=development",
"purge": "yarn clean; rm -rf node_modules",
"test": "vitest"
},
"dependencies": {
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@vechain/dapp-kit": "*",
"@vechain/dapp-kit-react": "*",
"@vechain/dapp-kit-ui": "*",
Expand All @@ -21,6 +23,7 @@
"vite": "^5.0.12"
},
"devDependencies": {
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.10.0",
Expand Down
Loading

0 comments on commit 15be440

Please sign in to comment.