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

feat: make vite the default create-fuels template #3048

Merged
merged 39 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8f2a204
feat: make vite the default `create-fuels` template
Dhaiwat10 Aug 28, 2024
b076359
update lockfile
Dhaiwat10 Aug 28, 2024
273b79f
add vite to glossary
Dhaiwat10 Aug 28, 2024
cadc049
remove test files from guide
Dhaiwat10 Aug 28, 2024
4ca4ece
enable pr release
Dhaiwat10 Aug 28, 2024
70e9e6f
fix forc formatting
Dhaiwat10 Aug 28, 2024
f1a08d1
run integration tests
Dhaiwat10 Aug 29, 2024
4811461
Merge branch 'master' into dp/vite-default
Dhaiwat10 Aug 29, 2024
00882b3
update test file
Dhaiwat10 Aug 29, 2024
f863b04
Merge branch 'dp/vite-default' of https://github.com/FuelLabs/fuels-t…
Dhaiwat10 Aug 29, 2024
5a257c1
update default in integration test
Dhaiwat10 Aug 29, 2024
59e1337
add dist to ignore
Dhaiwat10 Aug 29, 2024
8074740
Merge branch 'master' into dp/vite-default
Dhaiwat10 Aug 29, 2024
a4441af
ignore dest files properly in test
Dhaiwat10 Aug 30, 2024
d84a42b
another failing test
Dhaiwat10 Aug 30, 2024
bffff44
Merge branch 'master' into dp/vite-default
Dhaiwat10 Sep 2, 2024
f78beb3
fix lockfile conflicts
Dhaiwat10 Sep 2, 2024
2ff8628
enable pr release
Dhaiwat10 Sep 2, 2024
237491e
fix failing test
Dhaiwat10 Sep 2, 2024
46a6863
try skipping first test
Dhaiwat10 Sep 2, 2024
58e9b81
add a check to see if node is running
Dhaiwat10 Sep 2, 2024
97cccec
log out contract ids
Dhaiwat10 Sep 2, 2024
da35645
increase time allowed for loading
Dhaiwat10 Sep 2, 2024
93f4939
chore: rebuild
danielbate Sep 3, 2024
c1c300c
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into dp…
danielbate Sep 3, 2024
346fa17
chore: increase integration test dev server timeout and expose logs
danielbate Sep 3, 2024
4770e7a
chore: disable other UI test
danielbate Sep 3, 2024
f9ff349
chore: clean node
danielbate Sep 3, 2024
f05196e
chore: remove redundant lgos
danielbate Sep 3, 2024
08cd910
chore: kill ports after integration tests
danielbate Sep 3, 2024
acc4c27
chore: disable integration test
danielbate Sep 3, 2024
e6f3a2c
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into dp…
danielbate Sep 3, 2024
4138c1a
disable pr release
Dhaiwat10 Sep 3, 2024
bac3a2a
chore: use next tag
danielbate Sep 3, 2024
cb68dcd
chore: use next tag
danielbate Sep 3, 2024
da00e72
remove debugging code
Dhaiwat10 Sep 3, 2024
ae7568f
Merge branch 'master' into dp/vite-default
Dhaiwat10 Sep 3, 2024
4699159
Merge branch 'master' into dp/vite-default
Dhaiwat10 Sep 3, 2024
9686f2a
Merge branch 'master' into dp/vite-default
Dhaiwat10 Sep 3, 2024
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
5 changes: 5 additions & 0 deletions .changeset/odd-coats-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-fuels": patch
---

feat: make vite the default `create-fuels` template
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ jobs:
- name: Run tests (with published version)
run: pnpm test:integration
env:
PUBLISHED_NPM_TAG: next
PUBLISHED_NPM_TAG: pr-3048
danielbate marked this conversation as resolved.
Show resolved Hide resolved

- name: Run UI tests (with published version)
run: sh ./scripts/tests-ui-integration.sh
env:
PUBLISHED_NPM_TAG: next
PUBLISHED_NPM_TAG: pr-3048
danielbate marked this conversation as resolved.
Show resolved Hide resolved

e2e:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions apps/create-fuels-counter-guide/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NEXT_PUBLIC_FUEL_NODE_PORT=4000
NEXT_PUBLIC_DAPP_ENVIRONMENT=local
VITE_FUEL_NODE_PORT=4000
VITE_DAPP_ENVIRONMENT=local
1 change: 0 additions & 1 deletion apps/create-fuels-counter-guide/.eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions apps/create-fuels-counter-guide/.eslintrc.json

This file was deleted.

52 changes: 21 additions & 31 deletions apps/create-fuels-counter-guide/.gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

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

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
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?

.fuels

Expand Down
2 changes: 1 addition & 1 deletion apps/create-fuels-counter-guide/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-fuels`](https://github.com/FuelLabs/fuels-ts/tree/master/packages/create-fuels).
This is a [Vite](https://vitejs.dev/) project bootstrapped with [`create-fuels`](https://github.com/FuelLabs/fuels-ts/tree/master/packages/create-fuels).

## Getting Started

Expand Down
26 changes: 26 additions & 0 deletions apps/create-fuels-counter-guide/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config({
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
ignores: ['dist'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
})
6 changes: 4 additions & 2 deletions apps/create-fuels-counter-guide/fuels.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
// #region fuels-config-file-env
import { createConfig } from 'fuels';
import dotenv from 'dotenv';
import { NODE_URL } from '@/lib';
import { NODE_URL } from './src/lib';

dotenv.config({
path: ['.env.local', '.env'],
});

// If your node is running on a port other than 4000, you can set it here
const fuelCorePort = +(process.env.NEXT_PUBLIC_FUEL_NODE_PORT as string) || 4000;
const fuelCorePort = +(process.env.VITE_FUEL_NODE_PORT as string) || 4000;

export default createConfig({
workspace: './sway-programs', // Path to your Sway workspace
output: './src/sway-api', // Where your generated types will be saved
fuelCorePort,
providerUrl: NODE_URL,
fuelCorePath: 'fuels-core',
forcPath: 'fuels-forc',
});
// #endregion fuels-config-file-env
16 changes: 16 additions & 0 deletions apps/create-fuels-counter-guide/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/fuel.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fuel dApp</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
6 changes: 0 additions & 6 deletions apps/create-fuels-counter-guide/next.config.js

This file was deleted.

26 changes: 18 additions & 8 deletions apps/create-fuels-counter-guide/package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
{
"name": "create-fuels-counter-guide",
"version": "0.1.0",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"original:dev": "next dev",
"original:build": "next build",
"test": "vitest",
"original:dev": "vite",
"original:build": "tsc -b && vite build",
"original:start": "next start",
"original:lint": "next lint",
"original:lint": "eslint .",
"fuels:build": "fuels build",
"fuels:dev": "fuels dev",
"postbuild": "run-s fuels:build original:build"
},
"dependencies": {
"@fuels/connectors": "^0.26.0",
"@fuels/react": "^0.26.0",
"fuels": "workspace:*",
"@tanstack/react-query": "^5.52.1",
"@tanstack/react-router": "^1.48.1",
"fuels": "workspace:*",
"@wagmi/connectors": "^5.1.8",
"@wagmi/core": "^2.13.4",
"dotenv": "^16.4.5",
"next": "14.2.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
"react-use": "^17.5.1"
},
"devDependencies": {
"@eslint/js": "^9.9.1",
"@tanstack/router-plugin": "^1.47.0",
"@types/node": "^22.2.0",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-config-next": "14.2.7",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.11",
"globals": "^15.9.0",
"postcss": "^8",
"tailwindcss": "^3.4.10",
"typescript": "~5.4.5"
"typescript": "~5.4.5",
"typescript-eslint": "^8.0.0",
"vite": "^5.4.2",
"vitest": "^1.6.0"
}
}
4 changes: 2 additions & 2 deletions apps/create-fuels-counter-guide/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
}
85 changes: 0 additions & 85 deletions apps/create-fuels-counter-guide/src/app/layout.tsx

This file was deleted.

15 changes: 5 additions & 10 deletions apps/create-fuels-counter-guide/src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import toast, { Toaster } from "react-hot-toast";
import { Link } from "./Link";
import { Button } from "./Button";
import { CURRENT_ENVIRONMENT, NODE_URL, TESTNET_FAUCET_LINK } from "@/lib";
import { CURRENT_ENVIRONMENT, NODE_URL, TESTNET_FAUCET_LINK } from "../lib";
import { useConnectUI, useDisconnect } from "@fuels/react";
import { WalletDisplay } from "./WalletDisplay";
import { useBrowserWallet } from "@/hooks/useBrowserWallet";
import { useActiveWallet } from "@/hooks/useActiveWallet";
import { useFaucet } from "@/hooks/useFaucet";
import Head from "next/head";
import { useBrowserWallet } from "../hooks/useBrowserWallet";
import { useActiveWallet } from "../hooks/useActiveWallet";
import { useFaucet } from "../hooks/useFaucet";
import { bn } from "fuels";

export const Layout = ({ children }: { children: React.ReactNode }) => {
Expand Down Expand Up @@ -73,12 +72,8 @@ export const Layout = ({ children }: { children: React.ReactNode }) => {

return (
<>
<Head>
<title>Fuel App</title>
<link rel="icon" href="/fuel.ico" />
</Head>
<Toaster />
<div className="flex flex-col">
<div className="flex flex-col bg-black text-white">
<nav className="flex justify-between items-center p-4 bg-black text-white gap-6">
<Link href="/">Home</Link>

Expand Down
8 changes: 5 additions & 3 deletions apps/create-fuels-counter-guide/src/components/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Link as ReactRouterLink } from "@tanstack/react-router";

export const Link = ({
href,
children,
Expand All @@ -10,12 +12,12 @@ export const Link = ({
target?: string;
}) => {
return (
<a
href={href}
<ReactRouterLink
to={href}
className={`text-fuel-green hover:underline ${className}`}
target={target}
>
{children}
</a>
</ReactRouterLink>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import toast from "react-hot-toast";
import { useActiveWallet } from "@/hooks/useActiveWallet";
import { useActiveWallet } from "../hooks/useActiveWallet";

const getTruncatedAddress = (address: string) => {
return address.slice(0, 6) + "..." + address.slice(-4);
Expand Down
Loading
Loading