Skip to content

Commit

Permalink
feat: create-script Vite + React + JS template (#107)
Browse files Browse the repository at this point in the history
* feat: Create Fedimint App script

* feat: polish, update versions, fix tests

* feat: add vite-react JS template

* chore: add changeset

* chore: update package name
  • Loading branch information
alexlwn123 authored Dec 17, 2024
1 parent 4943332 commit 014ea79
Show file tree
Hide file tree
Showing 17 changed files with 844 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .changeset/big-lies-wonder.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@fedimint/create-fedimint-app': patch
'create-fedimint-app': patch
---

Introducing the create-fedimint-app script! Your helper to quickly get started with the fedimint-web-sdk.
5 changes: 5 additions & 0 deletions .changeset/fast-chicken-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-fedimint-app': patch
---

Added Vite + React + JS Template
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"test": "pnpm run test:setup pnpm run test:lib",
"test:setup": "bash testing/setup_test_shell.sh",
"test:coverage": "vitest run --coverage",
"test:lib": "vitest",
"test:create": "vitest --watch=false create-fedimint",
"test:lib": "vitest --project core",
"test:create": "vitest --watch=false --project cli",
"test:ui": "vitest --browser.headless=false --ui",
"format": "prettier --write .",
"watch": "pnpm run --r --parallel --filter \"./packages/**\" watch"
Expand Down
3 changes: 2 additions & 1 deletion packages/create-fedimint-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pnpm create fedimint-app my-fedimint-app --template vite-react-ts

Currently supported template presets include:

- `vite-react-ts` - React + TypeScript template with Fedimint integration
- `vite-react-ts` - Vite + React + TypeScript template with Fedimint integration
- `vite-react` - Vite + React template with Fedimint integration

You can use `.` for the project name to scaffold in the current directory.

Expand Down
2 changes: 1 addition & 1 deletion packages/create-fedimint-app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@fedimint/create-fedimint-app",
"name": "create-fedimint-app",
"type": "module",
"version": "0.0.1",
"main": "index.js",
Expand Down
12 changes: 6 additions & 6 deletions packages/create-fedimint-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
red,
// redBright,
reset,
// yellow,
yellow,
} = colors

// Avoids autoconversion to number of the project name by defining that the args
Expand Down Expand Up @@ -123,11 +123,11 @@ const FRAMEWORKS: Framework[] = [
display: 'TypeScript',
color: blue,
},
// {
// name: 'vite-react',
// display: 'JavaScript',
// color: yellow,
// },
{
name: 'vite-react',
display: 'JavaScript',
color: yellow,
},
// {
// name: 'custom-react-router',
// display: 'React Router v7 ↗',
Expand Down
9 changes: 9 additions & 0 deletions packages/create-fedimint-app/template-vite-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Fedimint + Vite + React + TypeScript Starter

This template provides a minimal setup to get The Fedimint Web SDK working with Vite + React + TypeScript.

## Technologies Used

- core-web: The Fedimint client library for web applications
- Vite: A fast build tool and development server. Check the [`vite.config.ts`](./vite.config.ts) for configurations required for handling wasm.
- React
24 changes: 24 additions & 0 deletions packages/create-fedimint-app/template-vite-react/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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?
12 changes: 12 additions & 0 deletions packages/create-fedimint-app/template-vite-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite Core</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions packages/create-fedimint-app/template-vite-react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "fedimint-vite-react-typescript-starter",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"clean": "rm -rf dist",
"clean:deep": "pnpm run clean && rm -rf node_modules"
},
"dependencies": {
"@fedimint/core-web": "latest",
"react": "19.0.0",
"react-dom": "19.0.0"
},
"devDependencies": {
"@types/react": "19.0.0",
"@types/react-dom": "19.0.0",
"@vitejs/plugin-react": "^4.3.2",
"buffer": "^6.0.3",
"vite": "^5.4.8",
"vite-plugin-wasm": "^3.3.0"
}
}
Loading

0 comments on commit 014ea79

Please sign in to comment.