generated from calimero-network/core-app-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 115e106
Showing
48 changed files
with
26,317 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: setup | ||
description: "Setup - Cache dependencies ⚡ - Install dependencies 🔧" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install pnpm | ||
shell: bash | ||
run: npm install -g pnpm | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
cd ${{ inputs.working-directory }} | ||
pnpm install | ||
- name: Build | ||
shell: bash | ||
run: | | ||
cd ${{ inputs.working-directory }} | ||
pnpm build | ||
inputs: | ||
working-directory: | ||
description: "Working directory" | ||
default: "./app" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Deploy Next.js site to Pages | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
workflow_dispatch: | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
pages: write | ||
|
||
defaults: | ||
run: | ||
working-directory: ./app | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup | ||
uses: ./.github/actions/setup | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
with: | ||
static_site_generator: next | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
name: github-pages | ||
path: ./app/build | ||
|
||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
notify-slack-on-failure: | ||
runs-on: ubuntu-latest | ||
needs: [build, deploy] | ||
if: failure() | ||
steps: | ||
- name: Notify failure | ||
uses: "ravsamhq/[email protected]" | ||
with: | ||
status: failure | ||
notification_title: "Deploy failed on ${{ github.ref_name }} - <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Failure>" | ||
message_format: ":fire: *Deploy Core App Template site to Pages* in <${{ github.server_url }}/${{ github.repository }}/${{ github.ref_name }}|${{ github.repository }}>" | ||
footer: "Linked Repo <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Failure>" | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.DEPLOY_FAIL_SLACK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release WASM app to registry | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- "logic/**" | ||
jobs: | ||
metadata: | ||
name: Build and release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build application | ||
run: | | ||
./logic/build.sh | ||
- name: Install near CLI | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.15.1/near-cli-rs-installer.sh | sh | ||
- name: Release application | ||
env: | ||
NEAR_NETWORK: testnet | ||
NEAR_CREDENTIALS_JSON: ${{ secrets.NEAR_TESTNET_CREDENTIALS_JSON }} | ||
NEAR_CONTRACT_ACCOUNT_ID: "calimero-package-manager.testnet" | ||
run: | | ||
credentials_file="./near-credentials.json" | ||
printf "$NEAR_CREDENTIALS_JSON" > "$credentials_file" | ||
./logic/release.sh \ | ||
"$NEAR_NETWORK" \ | ||
"$(realpath "$credentials_file")" \ | ||
"$NEAR_CONTRACT_ACCOUNT_ID" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/node_modules | ||
.DS_Store | ||
|
||
.idea/ | ||
res/ | ||
data/ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
# Check for changes in the 'app' directory | ||
if git diff --cached --name-only | grep -q '^app/'; then | ||
echo "Running checks for the React app..." | ||
(cd app && pnpm prettier && pnpm lint:fix) | ||
fi | ||
|
||
# Check for changes in the 'logic' directory | ||
if git diff --cached --name-only | grep -q '^logic/'; then | ||
echo "Running checks for the Rust logic..." | ||
(cd logic && cargo test && cargo fmt -- --check) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Core App Template | ||
|
||
## Logic | ||
|
||
```bash title="Terminal" | ||
cd logic | ||
``` | ||
|
||
```bash title="Terminal" | ||
chmod +x ./build.sh | ||
``` | ||
|
||
```bash title="Terminal" | ||
./build.sh | ||
``` | ||
|
||
```bash title="Terminal" | ||
./release.sh ./res/logic.wasm "Test Name123" "0.0.1" "-" "-" "-" calimero-package-manager.testnet | ||
``` | ||
|
||
## App | ||
|
||
```bash title="Terminal" | ||
cd app | ||
``` | ||
|
||
```bash title="Terminal" | ||
pnpm install | ||
``` | ||
|
||
```bash title="Terminal" | ||
pnpm build | ||
``` | ||
|
||
```bash title="Terminal" | ||
pnpm dev | ||
``` | ||
|
||
Open app in browser and connect to running node. | ||
|
||
For more information how to build app check our docs: | ||
https://calimero-network.github.io/build/quickstart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
VITE_APPLICATION_ID="bafa0e4f0794a67bfb8a4c6eca5da2760555a8e0ed889a39b522131b57b7010e" | ||
VITE_NEAR_ENVIRONMENT=testnet | ||
VITE_NODE_URL=http://localhost:2428 | ||
VITE_RPC_PATH=/jsonrpc | ||
VITE_CONTEXT_ID=GSouksxYcyCNS3z3axxoh3YSSzbCoMU84TYxr43Df2DU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { defineConfig } from 'eslint-define-config'; | ||
|
||
export default defineConfig({ | ||
root: true, | ||
env: { | ||
browser: true, | ||
es2020: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
'plugin:react-hooks/recommended', | ||
'react-app', | ||
'plugin:prettier/recommended', | ||
], | ||
ignorePatterns: ['build', '.eslint.config.mjs'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
project: ['./tsconfig.json'], | ||
}, | ||
settings: { | ||
react: { | ||
version: '18.2', | ||
}, | ||
}, | ||
plugins: ['@typescript-eslint', 'react-refresh'], | ||
rules: { | ||
'react/jsx-no-target-blank': 'off', | ||
'react/jsx-uses-react': 'error', | ||
'react/jsx-uses-vars': 'error', | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Getting Started with Create React App | ||
|
||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.\ | ||
You will also see any lint errors in the console. | ||
|
||
### `npm test` | ||
|
||
Launches the test runner in the interactive watch mode.\ | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.\ | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.\ | ||
Your app is ready to be deployed! | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
||
## Learn More | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.svg' { | ||
const content: React.FunctionComponent<React.SVGAttributes<SVGElement>>; | ||
export default content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>App</title> | ||
|
||
<!-- Start Single Page Apps for GitHub Pages --> | ||
<script type="text/javascript"> | ||
// Single Page Apps for GitHub Pages | ||
// MIT License | ||
// https://github.com/rafgraph/spa-github-pages | ||
// This script checks to see if a redirect is present in the query string, | ||
// converts it back into the correct url and adds it to the | ||
// browser's history using window.history.replaceState(...), | ||
// which won't cause the browser to attempt to load the new url. | ||
// When the single page app is loaded further down in this file, | ||
// the correct url will be waiting in the browser's history for | ||
// the single page app to route accordingly. | ||
(function (l) { | ||
if (l.search[1] === '/') { | ||
var decoded = l.search | ||
.slice(1) | ||
.split('&') | ||
.map(function (s) { | ||
return s.replace(/~and~/g, '&'); | ||
}) | ||
.join('?'); | ||
window.history.replaceState( | ||
null, | ||
null, | ||
l.pathname.slice(0, -1) + decoded + l.hash, | ||
); | ||
} | ||
})(window.location); | ||
</script> | ||
<!-- End Single Page Apps for GitHub Pages --> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="./src/index.tsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.