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

chore: remove redundant packages and add nodejs example #19

Merged
merged 11 commits into from
Mar 26, 2024
5 changes: 5 additions & 0 deletions .changeset/clever-otters-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuels/connectors": patch
---

ci: remove redundant packages from the umbrella `@fuels/connectors` package
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{ "repo": "FuelLabs/fuel-connectors" }
],
"commit": false,
"fixed": [["@fuel-connectors/*"]],
"fixed": [["@fuels/connectors", "@fuel-connectors/*"]],
"linked": [],
"access": "public",
"baseBranch": "main",
Expand Down
8 changes: 8 additions & 0 deletions .changeset/gentle-eggs-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@fuel-connectors/fuel-development-wallet": patch
"@fuel-connectors/fuelet-wallet": patch
"@fuel-connectors/fuel-wallet": patch
"@fuels/connectors": patch
---

chore: update fuels to latest version (0.78.0)
35 changes: 35 additions & 0 deletions .github/workflows/update-sdk-cron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check SDK updates

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
update-version:
runs-on: buildjet-4vcpu-ubuntu-2204
strategy:
matrix:
tag: ['latest'] # Currently only "latest" tag is available across all packages

steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master

- name: Checking updates
uses: FuelLabs/github-actions/update-sdk@master
with:
branch: main
changeset: true
packages: fuels,@fuels/react,@fuels/ts-config,@fuels/tsup-config
npm-tag: ${{ matrix.tag }}
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"**/*.(js|jsx|ts|tsx|md|json|mdx|html|css)": [
"**/*.(js|jsx|ts|tsx|json|mdx|html|css)": [
"biome check --apply-unsafe --diagnostic-level=error --max-diagnostics=1000"
]
}
19 changes: 19 additions & 0 deletions examples/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "nodejs",
"private": true,
"version": "0.0.0",
"main": "./src/index.ts",
"scripts": {
"build": "tsup",
"dev": "tsx watch src/index.ts"
},
"dependencies": {
"@fuels/connectors": "workspace:*",
"fuels": "0.78.0"
},
"devDependencies": {
"tsx": "4.7.1",
"tsup": "8.0.2",
"typescript": "5.4.3"
}
}
37 changes: 37 additions & 0 deletions examples/nodejs/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { FuelWalletConnector } from '@fuels/connectors';
import { Fuel, Mnemonic, WalletManager } from 'fuels';

const main = async () => {
// Mnemonic
const WALLET_PASSWORD = 'Qwe1234567$';
const mnemonic = Mnemonic.generate(16);

// Vault with initial account
const manager = new WalletManager();
await manager.unlock(WALLET_PASSWORD);
await manager.addVault({
title: '@fuels/connectors',
type: 'mnemonic',
secret: mnemonic,
});

// Adding second account
await manager.addAccount({ vaultId: 0 });

// Listing accounts
const accounts = manager.getAccounts();
console.log('mnenomic\n', mnemonic, '\n\naccounts');
console.log(accounts.map((ac) => ac.address.toString()));

// Listing available connectors
const fuel = new Fuel({
connectors: [new FuelWalletConnector()], // Build and check "dist" to confirm only this connector was bundled
});
const connectors = await fuel.connectors();
console.log(
'\navailable connectors\n',
connectors.map((c) => c.name),
);
};

main();
8 changes: 8 additions & 0 deletions examples/nodejs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "."
},
"exclude": ["dist"]
}
11 changes: 11 additions & 0 deletions examples/nodejs/tsup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import baseConfig from '@fuels/tsup-config';
import { defineConfig } from 'tsup';

export default defineConfig((options) => ({
...baseConfig(options, { withReact: false }),
entry: ['src/index.ts'],
noExternal: ['@fuels/connectors'],
minify: false,
splitting: true,
metafile: true,
}));
12 changes: 6 additions & 6 deletions examples/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
"dependencies": {
"@fuels/connectors": "workspace:*",
"@fuels/react": "0.17.0",
"@tanstack/react-query": "5.28.4",
"fuels": "0.77.0",
"@tanstack/react-query": "5.28.8",
"fuels": "0.78.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@tanstack/react-query-devtools": "5.28.4",
"@types/react": "18.2.67",
"@tanstack/react-query-devtools": "5.28.8",
"@types/react": "18.2.71",
"@types/react-dom": "18.2.22",
"@vitejs/plugin-react": "4.2.1",
"typescript": "5.4.2",
"vite": "5.1.6"
"typescript": "5.4.3",
"vite": "5.2.6"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"prepare": "husky"
},
"devDependencies": {
"@biomejs/biome": "1.6.1",
"@biomejs/biome": "1.6.3",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@fuels/ts-config": "0.17.0",
Expand All @@ -28,7 +28,7 @@
"compare-versions": "6.1.0",
"husky": "9.0.11",
"lint-staged": "15.2.2",
"turbo": "1.12.5",
"turbo": "1.13.0",
"vitest": "1.4.0"
},
"packageManager": "pnpm@8.9.0",
Expand Down
10 changes: 4 additions & 6 deletions packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,22 @@
"types": "./dist/index.d.ts"
}
},
"files": ["dist"],
"scripts": {
"build": "tsup",
"build:watch": "tsup --watch",
"ts:check": "tsc --noEmit"
},
"peerDependencies": {
"fuels": ">=0.77.0"
},
"dependencies": {
"json-rpc-2.0": "1.7.0"
"fuels": ">=0.78.0"
},
"devDependencies": {
"@fuel-connectors/fuel-development-wallet": "workspace:*",
"@fuel-connectors/fuel-wallet": "workspace:*",
"@fuel-connectors/fuelet-wallet": "workspace:*",
"fuels": "0.77.0",
"fuels": "0.78.0",
"terser": "5.29.2",
"tsup": "8.0.2",
"typescript": "5.4.2"
"typescript": "5.4.3"
}
}
2 changes: 1 addition & 1 deletion packages/connectors/tsup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig } from 'tsup';
export default defineConfig((options) => ({
...baseConfig(options, { withReact: false }),
entry: ['src/index.ts'],
external: ['fuels', 'json-rpc-2.0'],
external: ['fuels'],
noExternal: [
'@fuel-connectors/fuel-development-wallet',
'@fuel-connectors/fuel-wallet',
Expand Down
8 changes: 4 additions & 4 deletions packages/fuel-development-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"test": "vitest"
},
"peerDependencies": {
"fuels": ">=0.77.0"
"fuels": ">=0.78.0"
},
"devDependencies": {
"@fuel-connectors/fuel-wallet": "workspace:*",
"fuels": "0.77.0",
"fuels": "0.78.0",
"tsup": "8.0.2",
"typescript": "5.4.2",
"undici": "6.9.0",
"typescript": "5.4.3",
"undici": "6.10.1",
"web-streams-polyfill": "4.0.0"
}
}
8 changes: 4 additions & 4 deletions packages/fuel-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
"test": "vitest"
},
"peerDependencies": {
"fuels": ">=0.77.0"
"fuels": ">=0.78.0"
},
"dependencies": {
"json-rpc-2.0": "1.7.0"
},
"devDependencies": {
"events": "3.3.0",
"fuels": "0.77.0",
"fuels": "0.78.0",
"tsup": "8.0.2",
"typescript": "5.4.2",
"undici": "6.9.0",
"typescript": "5.4.3",
"undici": "6.10.1",
"web-streams-polyfill": "4.0.0"
}
}
8 changes: 4 additions & 4 deletions packages/fuelet-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"test": "vitest"
},
"peerDependencies": {
"fuels": ">=0.77.0"
"fuels": ">=0.78.0"
},
"devDependencies": {
"@fuel-connectors/fuel-wallet": "workspace:*",
"fuels": "0.77.0",
"fuels": "0.78.0",
"tsup": "8.0.2",
"typescript": "5.4.2",
"undici": "6.9.0",
"typescript": "5.4.3",
"undici": "6.10.1",
"web-streams-polyfill": "4.0.0"
}
}
Loading
Loading