Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 🎉 Partial setup #11

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target/
target/
.env*
19 changes: 19 additions & 0 deletions clients/arcade/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
};
26 changes: 26 additions & 0 deletions clients/arcade/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*storybook.log
20 changes: 20 additions & 0 deletions clients/arcade/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
],
core: {
builder: "@storybook/builder-vite", // 👈 The builder enabled here.
},
framework: {
name: "@storybook/react-vite",
options: {},
},
};
export default config;
12 changes: 12 additions & 0 deletions clients/arcade/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { create } from '@storybook/theming';
import { addons } from '@storybook/manager-api';

const theme = create({
base: 'dark',
brandTitle: 'Cartridge',
brandUrl: 'https://cartridge.gg',
});

addons.setConfig({
theme,
});
14 changes: 14 additions & 0 deletions clients/arcade/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
34 changes: 34 additions & 0 deletions clients/arcade/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: [
"./tsconfig.json",
"./tsconfig.node.json",
"./tsconfig.app.json",
],
tsconfigRootDir: __dirname,
},
};
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
17 changes: 17 additions & 0 deletions clients/arcade/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/libs/utils"
}
}
33 changes: 33 additions & 0 deletions clients/arcade/dojo.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import slot from "../../contracts/manifest_slot.json";

const {
VITE_PUBLIC_NODE_URL,
VITE_PUBLIC_TORII,
VITE_PUBLIC_MASTER_ADDRESS,
VITE_PUBLIC_MASTER_PRIVATE_KEY,
VITE_PUBLIC_ACCOUNT_CLASS_HASH,
VITE_PUBLIC_FEE_TOKEN_ADDRESS,
VITE_PUBLIC_SLOT,
} = import.meta.env;

export type Config = ReturnType<typeof dojoConfig>;

export function dojoConfig() {
return {
rpcUrl: VITE_PUBLIC_NODE_URL || "http://localhost:5050",
toriiUrl: VITE_PUBLIC_TORII || "http://0.0.0.0:8080",
masterAddress:
VITE_PUBLIC_MASTER_ADDRESS ||
"0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03",
masterPrivateKey:
VITE_PUBLIC_MASTER_PRIVATE_KEY ||
"0x1800000000300000180000000000030000000000003006001800006600",
accountClassHash:
VITE_PUBLIC_ACCOUNT_CLASS_HASH ||
"0x05400e90f7e0ae78bd02c77cd75527280470e2fe19c54970dd79dc37a9d3645c",
feeTokenAddress:
VITE_PUBLIC_FEE_TOKEN_ADDRESS ||
"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
manifest: VITE_PUBLIC_SLOT ? slot : slot,
};
}
20 changes: 20 additions & 0 deletions clients/arcade/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Azeret+Mono:ital,wght@0,100..900;1,100..900&family=Bodoni+Moda:ital,opsz,wght@0,6..96,400..900;1,6..96,400..900&display=swap"
rel="stylesheet"
/>

<title>Arcade</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
83 changes: 83 additions & 0 deletions clients/arcade/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"name": "arcade",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@cartridge/connector": "0.5.1",
"@cartridge/controller": "0.5.1",
"@dojoengine/core": "1.0.1",
"@dojoengine/react": "1.0.1",
"@dojoengine/recs": "^2.0.13",
"@dojoengine/sdk": "^1.0.2",
"@dojoengine/state": "1.0.1",
"@dojoengine/torii-client": "1.0.1",
"@dojoengine/utils": "1.0.1",
"@fortawesome/fontawesome-svg-core": "^6.7.1",
"@fortawesome/free-brands-svg-icons": "^6.7.1",
"@fortawesome/free-solid-svg-icons": "^6.7.1",
"@fortawesome/react-fontawesome": "^0.2.2",
"@radix-ui/react-scroll-area": "^1.2.1",
"@radix-ui/react-slider": "^1.2.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.0",
"@starknet-react/chains": "^3.1.0",
"@starknet-react/core": "^3.6.0",
"@tanstack/react-query": "^5.51.15",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"framer-motion": "^11.3.19",
"get-starknet-core": "^4.0.0",
"graphql-request": "^7.1.0",
"lucide-react": "^0.416.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.0.1",
"starknet": "^6.11.0",
"tailwind-merge": "^2.4.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.6.1",
"@storybook/addon-essentials": "^8.2.6",
"@storybook/addon-interactions": "^8.2.6",
"@storybook/addon-links": "^8.2.6",
"@storybook/addon-onboarding": "^8.2.6",
"@storybook/addons": "^7.6.17",
"@storybook/blocks": "^8.2.6",
"@storybook/builder-vite": "^8.2.6",
"@storybook/manager-api": "^8.4.5",
"@storybook/react": "^8.2.6",
"@storybook/react-vite": "^8.2.6",
"@storybook/test": "^8.2.6",
"@storybook/theming": "^8.4.5",
"@types/node": "^20.14.12",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"create": "link:@storybook/theming/create",
"eslint": "^9.15.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-storybook": "^0.11.1",
"postcss": "^8.4.49",
"prop-types": "^15.8.1",
"storybook": "^8.2.6",
"tailwindcss": "^3.4.15",
"typescript": "^5.2.2",
"vite": "^5.3.4",
"vite-plugin-svgr": "^4.2.0"
},
"packageManager": "[email protected]+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
}
Loading