From 96797d673801628f57dbfdaf8220d101fd29c642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Est=C3=A1cio=20=7C=20stacio=2Eeth?= Date: Thu, 23 Feb 2023 13:35:10 -0800 Subject: [PATCH] feat: add build version and improve build actions (#588) --- .github/actions/setup-node/action.yaml | 3 +- .github/workflows/gh-pages.yml | 41 --------- .github/workflows/pr-tests.yml | 7 +- .github/workflows/release-crx.yaml | 27 ++++++ .../{release.yaml => release-npm.yaml} | 0 .nvmrc | 2 +- package.json | 18 ++-- packages/app/.env.production | 4 + packages/app/env.d.ts | 1 + packages/app/load.envs.js | 17 ++++ packages/app/manifest.config.ts | 19 ++-- packages/app/package.json | 7 +- packages/app/scripts/build.sh | 6 +- packages/app/src/config.ts | 4 + .../CRX/background/actions/createMenu.ts | 20 ---- .../app/src/systems/CRX/background/index.ts | 1 - .../app/src/systems/Core/utils/database.ts | 3 +- .../Sidebar/components/Sidebar/Sidebar.tsx | 21 ++++- packages/app/vite-utils/getVersion.ts | 12 --- packages/app/vite-utils/vite.base.config.ts | 3 - .../docs/contributing/running-locally.mdx | 4 +- packages/docs/package.json | 5 +- pnpm-lock.yaml | 91 +++++++++++++++---- scripts/builds/utils.mjs | 6 +- scripts/gh-pages-preview.mjs | 15 --- turbo.json | 34 ++++++- vercel.json | 3 + 27 files changed, 215 insertions(+), 159 deletions(-) delete mode 100644 .github/workflows/gh-pages.yml create mode 100644 .github/workflows/release-crx.yaml rename .github/workflows/{release.yaml => release-npm.yaml} (100%) create mode 100644 packages/app/.env.production delete mode 100644 packages/app/src/systems/CRX/background/actions/createMenu.ts delete mode 100644 packages/app/vite-utils/getVersion.ts delete mode 100644 scripts/gh-pages-preview.mjs diff --git a/.github/actions/setup-node/action.yaml b/.github/actions/setup-node/action.yaml index be121ef18..59953a5ba 100644 --- a/.github/actions/setup-node/action.yaml +++ b/.github/actions/setup-node/action.yaml @@ -2,10 +2,11 @@ name: "CI setup" inputs: node-version: description: "Node version" - default: 16.15 + default: 18.14.1 pnpm-version: description: "PNPM version" default: latest + runs: using: "composite" steps: diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index 71ca98b46..000000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: GitHub Pages - -on: - release: - types: [published] - workflow_dispatch: - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-node - - - name: Build - env: - CI: false - NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secret.ALGOLIA_APP_ID }} - NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY: ${{ secret.ALGOLIA_SEARCH_API_KEY }} - ALGOLIA_SEARCH_ADMIN_KEY: ${{ secret.ALGOLIA_API_KEY }} - VITE_FUEL_PROVIDER_URL: "https://node-beta-1.fuel.network/graphql" - VITE_FUEL_FAUCET_URL: "https://faucet-beta-1.fuel.network/dispense" - VITE_FAUCET_RECAPTCHA_KEY: "6Ld3cEwfAAAAAMd4QTs7aO85LyKGdgj0bFsdBfre" - VITE_MNEMONIC_WORDS: 12 - DOCS_DIST: ./dist - DOCS_BASE_URL: "/${{ github.event.repository.name }}" - NEXT_PUBLIC_URL: "https://wallet.fuel.network/" - NEXT_PUBLIC_APP_URL: "https://wallet.fuel.network/app/" - NEXT_PUBLIC_WALLET_DOWNLOAD_URL: "https://wallet.fuel.network/app/fuel-wallet.zip" - NEXT_PUBLIC_STORYBOOK_URL: "https://wallet.fuel.network/storybook/" - run: | - pnpm install - pnpm build:preview - - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4.3.3 - with: - clean: true - branch: gh-pages - folder: ./dist diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-tests.yml index 38bd96055..ce0d0ad17 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-tests.yml @@ -36,6 +36,10 @@ jobs: uses: jwalton/gh-find-current-pr@v1 id: findPr + - name: Build libs + run: | + pnpm build:libs + - name: Run Jest Tests run: | pnpm test:ci --outputFile="${{ env.COVERAGE_FILE }}" @@ -77,10 +81,9 @@ jobs: NODE_ENV: test - name: Build Application - run: pnpm build:app + run: pnpm build:test env: NODE_ENV: test - DOCS_DIST: ./dist # E2E tests running with Playwright - name: Install Playwright Browsers diff --git a/.github/workflows/release-crx.yaml b/.github/workflows/release-crx.yaml new file mode 100644 index 000000000..cf4292559 --- /dev/null +++ b/.github/workflows/release-crx.yaml @@ -0,0 +1,27 @@ +name: "Release" + +on: + release: + types: [published] + +jobs: + release-crx: + name: Release Wallet package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-node + + - name: Build Application + run: pnpm build:crx + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./packages/app/dist/fuel-wallet.zip + asset_name: fuel-wallet.zip + asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release-npm.yaml similarity index 100% rename from .github/workflows/release.yaml rename to .github/workflows/release-npm.yaml diff --git a/.nvmrc b/.nvmrc index b6a7d89c6..617bcf916 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +18.14.1 diff --git a/package.json b/package.json index 50a9101c8..f3514b09f 100644 --- a/package.json +++ b/package.json @@ -21,14 +21,15 @@ "./packages/*" ], "scripts": { - "build:preview": "node ./scripts/build-website.mjs", - "build:all": "run-s build:libs build:docs build:app", - "build:libs": "turbo run build --filter=@fuel-wallet/*", - "build:docs": "run-s build:docs-build build:docs-export", - "build:docs-build": "turbo run build --filter=docs", - "build:docs-export": "turbo run export --filter=docs", - "build:app": "turbo run build --filter=app", - "build:app:test": "NODE_ENV=test run-s build:app", + "build:website": "node ./scripts/build-website.mjs", + "build:preview": "turbo run build:preview", + "build:all": "turbo run build:all", + "build:docs": "turbo run build:docs", + "build:web": "turbo run build:web", + "build:crx": "turbo run build:crx", + "build:app": "turbo run build:app", + "build:test": "NODE_ENV=test pnpm build:app", + "build:libs": "turbo run build", "changeset": "changeset", "changeset:empty": "changeset --empty", "changeset:release": "changeset publish --no-git-tag", @@ -39,7 +40,6 @@ "dev:docs": "NODE_ENV=development turbo run dev --filter=docs", "dev:crx": "turbo run dev:crx --parallel", "dev:deps": "./scripts/deps.sh", - "gh:preview": "node ./scripts/gh-pages-preview.mjs", "lint": "run-s lint:check prettier:check", "lint:check": "eslint . --ext .ts,.tsx,.js,.jsx", "lint:fix": "pnpm lint:check --fix", diff --git a/packages/app/.env.production b/packages/app/.env.production new file mode 100644 index 000000000..701b8ebeb --- /dev/null +++ b/packages/app/.env.production @@ -0,0 +1,4 @@ +VITE_FUEL_PROVIDER_URL=https://node-beta-2.fuel.network/graphql +VITE_FUEL_FAUCET_URL=https://faucet-beta-2.fuel.network/ +VITE_MNEMONIC_WORDS=12 +VITE_FAUCET_RECAPTCHA_KEY=6Ld3cEwfAAAAAMd4QTs7aO85LyKGdgj0bFsdBfre \ No newline at end of file diff --git a/packages/app/env.d.ts b/packages/app/env.d.ts index 6e0d823d2..bc0cd5275 100644 --- a/packages/app/env.d.ts +++ b/packages/app/env.d.ts @@ -1,6 +1,7 @@ declare namespace NodeJS { export interface ProcessEnv { VITE_APP_VERSION: string; + VITE_DATABASE_VERSION: string; readonly VITE_FUEL_PROVIDER_URL: string; readonly VITE_FUEL_FAUCET_URL: string; readonly VITE_MNEMONIC_WORDS: string; diff --git a/packages/app/load.envs.js b/packages/app/load.envs.js index 46856d8ac..03af58bc4 100644 --- a/packages/app/load.envs.js +++ b/packages/app/load.envs.js @@ -1,5 +1,16 @@ const { config } = require('dotenv'); const { resolve } = require('path'); +const { readFileSync } = require('fs'); + +function getVersion() { + const packageJson = JSON.parse( + readFileSync(resolve(__dirname, './package.json')).toString() + ); + return { + version: packageJson.version, + database: packageJson.database, + }; +} function getEnvName() { if (process.env.NODE_ENV === 'production') { @@ -31,4 +42,10 @@ function getPublicEnvs() { // make it accessible to the playwirght tests process.env.PORT = process.env.NODE_ENV === 'test' ? 3001 : 3000; +// Export the version to be used on database +// and application level +const versions = getVersion(); +process.env.VITE_APP_VERSION = versions.version; +process.env.VITE_DATABASE_VERSION = versions.database; + module.exports.getPublicEnvs = getPublicEnvs; diff --git a/packages/app/manifest.config.ts b/packages/app/manifest.config.ts index 10b3699e1..d3c5a7da0 100644 --- a/packages/app/manifest.config.ts +++ b/packages/app/manifest.config.ts @@ -1,9 +1,13 @@ import { defineManifest } from '@crxjs/vite-plugin'; +import './load.envs.js'; + export default defineManifest({ manifest_version: 3, name: 'Fuel Wallet', - version: '0.0.1', + version: process.env.VITE_APP_VERSION, + description: + 'The official wallet of the fastest modular execution layer. Fuel Network.', icons: { '16': 'icons/fuel-logo-16.png', '19': 'icons/fuel-logo-19.png', @@ -32,16 +36,5 @@ export default defineManifest({ }, ], host_permissions: [''], - permissions: [ - 'alarms', - 'tabs', - 'activeTab', - 'clipboardWrite', - 'notifications', - 'scripting', - 'storage', - 'unlimitedStorage', - 'webRequest', - 'contextMenus', - ], + permissions: ['alarms', 'tabs', 'clipboardWrite', 'scripting'], }); diff --git a/packages/app/package.json b/packages/app/package.json index 5e2bf3c4d..9b499cf3b 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,10 +1,11 @@ { "name": "app", "private": true, - "version": "0.0.1", + "version": "0.1.0", + "database": "9", "scripts": { - "build": "run-p build:*", - "build:app": "./scripts/build.sh --app=vite", + "build:all": "run-p build:web build:crx build:storybook", + "build:web": "./scripts/build.sh --app=vite", "build:crx": "./scripts/build.sh --app=crx", "build:storybook": "./scripts/build.sh --app=storybook", "dev": "vite", diff --git a/packages/app/scripts/build.sh b/packages/app/scripts/build.sh index 50370e32f..712ce4677 100755 --- a/packages/app/scripts/build.sh +++ b/packages/app/scripts/build.sh @@ -2,11 +2,11 @@ export NODE_ENV=${NODE_ENV:=production} export STORYBOOK_DIST=${STORYBOOK_DIST:=./dist/storybook} if [ "$1" = "--app=vite" ]; then - pnpm ts:check && pnpm vite build --mode $NODE_ENV + pnpm vite build --mode $NODE_ENV fi; if [ "$1" = "--app=crx" ]; then - pnpm ts:check && pnpm vite build --config vite.crx.config.ts --mode $NODE_ENV + pnpm vite build --config vite.crx.config.ts --mode $NODE_ENV fi; if [ "$1" = "--app=storybook" ]; then - pnpm ts:check && pnpm build-storybook -o $STORYBOOK_DIST + pnpm build-storybook -o $STORYBOOK_DIST fi; diff --git a/packages/app/src/config.ts b/packages/app/src/config.ts index b3aa9d13e..1bf1b61f5 100644 --- a/packages/app/src/config.ts +++ b/packages/app/src/config.ts @@ -6,10 +6,14 @@ export const { VITE_FAUCET_RECAPTCHA_KEY, VITE_FUEL_FAUCET_URL, VITE_ADDR_OWNER, + VITE_APP_VERSION, + VITE_DATABASE_VERSION, VITE_CRX, NODE_ENV, } = import.meta.env; +export const APP_VERSION = VITE_APP_VERSION; +export const DATABASE_VERSION = Number(VITE_DATABASE_VERSION); export const DECIMAL_UNITS = 9; export const FORMAT_LANGUAGE = 'en-US'; export const MIN_FRACTION_DIGITS = 1; diff --git a/packages/app/src/systems/CRX/background/actions/createMenu.ts b/packages/app/src/systems/CRX/background/actions/createMenu.ts deleted file mode 100644 index 9f726dbbe..000000000 --- a/packages/app/src/systems/CRX/background/actions/createMenu.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { welcomeLink } from '../../config'; -import { openTab } from '../../utils'; - -import { IS_DEVELOPMENT } from '~/config'; - -if (IS_DEVELOPMENT) { - const menuId = 'open-page'; - chrome.contextMenus.create({ - title: 'Open page', - contexts: ['action'], - id: menuId, - type: 'normal', - visible: true, - }); - chrome.contextMenus.onClicked.addListener((data) => { - if (data.menuItemId === menuId) { - openTab(welcomeLink()); - } - }); -} diff --git a/packages/app/src/systems/CRX/background/index.ts b/packages/app/src/systems/CRX/background/index.ts index 79e0a3649..1f5aac29b 100644 --- a/packages/app/src/systems/CRX/background/index.ts +++ b/packages/app/src/systems/CRX/background/index.ts @@ -1,4 +1,3 @@ import './actions/onInstall'; -import './actions/createMenu'; import './actions/keepAwake'; import './communication'; diff --git a/packages/app/src/systems/Core/utils/database.ts b/packages/app/src/systems/Core/utils/database.ts index 4a8eb7c8d..60b10ab22 100644 --- a/packages/app/src/systems/Core/utils/database.ts +++ b/packages/app/src/systems/Core/utils/database.ts @@ -9,6 +9,7 @@ import type { Table } from 'dexie'; import Dexie from 'dexie'; import 'dexie-observable'; +import { DATABASE_VERSION } from '~/config'; import type { Transaction } from '~/systems/Transaction/types'; export class FuelDB extends Dexie { @@ -21,7 +22,7 @@ export class FuelDB extends Dexie { constructor() { super('FuelDB'); - this.version(9).stores({ + this.version(DATABASE_VERSION).stores({ vaults: `key`, accounts: `&address, &name`, networks: `&id, &url, &name`, diff --git a/packages/app/src/systems/Sidebar/components/Sidebar/Sidebar.tsx b/packages/app/src/systems/Sidebar/components/Sidebar/Sidebar.tsx index e4def9012..2ceaadaad 100644 --- a/packages/app/src/systems/Sidebar/components/Sidebar/Sidebar.tsx +++ b/packages/app/src/systems/Sidebar/components/Sidebar/Sidebar.tsx @@ -1,6 +1,15 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { cssObj } from '@fuel-ui/css'; -import { Icon, Avatar, Flex, Drawer, IconButton, Stack } from '@fuel-ui/react'; +import { + Icon, + Avatar, + Flex, + Drawer, + IconButton, + Stack, + Box, + Text, +} from '@fuel-ui/react'; import { forwardRef } from 'react'; import { Menu } from '..'; @@ -8,6 +17,7 @@ import { useAccounts } from '../../../Account'; import { NetworkScreen, useNetworks } from '../../../Network'; import { sidebarItems } from '../../constants'; +import { APP_VERSION } from '~/config'; import { useOverlay } from '~/systems/Overlay'; function SidebarContent() { @@ -46,6 +56,11 @@ function SidebarContent() { /> + + + Version: {APP_VERSION}{' '} + + ); } @@ -98,4 +113,8 @@ const styles = { top: '$2', right: '$2', }), + version: cssObj({ + padding: '$3 $4', + textAlign: 'center', + }), }; diff --git a/packages/app/vite-utils/getVersion.ts b/packages/app/vite-utils/getVersion.ts deleted file mode 100644 index 753bae945..000000000 --- a/packages/app/vite-utils/getVersion.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { readFileSync } from 'fs'; -import { resolve } from 'path'; - -export const getVersion = () => { - const packageJson: { - version: string; - } = JSON.parse( - readFileSync(resolve(__dirname, '../package.json')).toString() - ); - - return packageJson.version; -}; diff --git a/packages/app/vite-utils/vite.base.config.ts b/packages/app/vite-utils/vite.base.config.ts index 0d76693b7..d90738381 100644 --- a/packages/app/vite-utils/vite.base.config.ts +++ b/packages/app/vite-utils/vite.base.config.ts @@ -6,9 +6,6 @@ import tsconfigPaths from 'vite-tsconfig-paths'; import '../load.envs.js'; -import { getVersion } from './getVersion'; - -process.env.VITE_APP_VERSION = getVersion(); const linkDeps = process.env.LINK_DEPS?.trim().split(' ') || []; // https://vitejs.dev/config/ diff --git a/packages/docs/docs/contributing/running-locally.mdx b/packages/docs/docs/contributing/running-locally.mdx index 6ceda6e99..bb59cea87 100644 --- a/packages/docs/docs/contributing/running-locally.mdx +++ b/packages/docs/docs/contributing/running-locally.mdx @@ -13,8 +13,8 @@ This is a guide that will show you how you can run this project locally if you w This project includes frontend. To begin, install dependencies: -- [Node.js v16.15.0 or latest stable](https://nodejs.org/en/). We recommend using [nvm](https://github.com/nvm-sh/nvm) to install. -- [PNPM v7.1.7 or latest stable](https://pnpm.io/installation/) +- [Node.js 18.14.1 or latest stable](https://nodejs.org/en/). We recommend using [nvm](https://github.com/nvm-sh/nvm) to install. +- [PNPM v7.18.2 or latest stable](https://pnpm.io/installation/) - [Docker v0.8.2 or latest stable](https://docs.docker.com/get-docker/) - [Docker Compose v2.6.0 or latest stable](https://docs.docker.com/get-docker/) diff --git a/packages/docs/package.json b/packages/docs/package.json index fe8bb9414..861f55326 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -3,9 +3,10 @@ "version": "0.0.1", "private": true, "scripts": { + "build:preview": "run-s build:docs export:docs", + "build:docs": "next build", "dev": "next dev -p 3030", - "build": "next build", - "export": "DOCS_DIST=${DOCS_DIST:=dist} && next export -o $DOCS_DIST", + "export:docs": "DOCS_DIST=${DOCS_DIST:=dist} && next export -o $DOCS_DIST", "start": "next start", "lint": "next lint" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7bc33a30..cd460c88c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -184,7 +184,7 @@ importers: '@fuel-ui/config': 0.12.3_typescript@4.9.5 '@fuel-ui/css': 0.12.3 '@fuel-ui/react': 0.12.3_3rmrz26lo2xcg2m7re5kmkpfii - '@fuel-ui/test-utils': 0.12.3_3rmrz26lo2xcg2m7re5kmkpfii + '@fuel-ui/test-utils': 0.12.3_goymjlxrpta5icaoqypsoub72a '@fuel-wallet/sdk': link:../sdk '@fuel-wallet/types': link:../types '@fuel-wallet/xstore': link:../store @@ -477,7 +477,7 @@ importers: uuid: 9.0.0 xstate: 4.35.4 devDependencies: - '@fuel-ui/test-utils': 0.12.3_@types+react@18.0.27 + '@fuel-ui/test-utils': 0.12.3_3stiutgnnbnfnf3uowm5cip22i '@fuel-wallet/config': link:../config '@types/react': 18.0.27 '@types/uuid': 9.0.0 @@ -3430,7 +3430,7 @@ packages: dependencies: '@fuel-ts/math': 0.29.1 '@fuel-ui/css': 0.12.3 - '@fuel-ui/test-utils': 0.12.3_3rmrz26lo2xcg2m7re5kmkpfii + '@fuel-ui/test-utils': 0.12.3_goymjlxrpta5icaoqypsoub72a '@radix-ui/react-accordion': 1.1.0_biqbaboplfbrettd7655fr4n2y '@radix-ui/react-alert-dialog': 1.0.2_5ndqzdd6t4rivxsukjv3i3ak2q '@radix-ui/react-aspect-ratio': 1.0.1_biqbaboplfbrettd7655fr4n2y @@ -3485,7 +3485,7 @@ packages: dependencies: '@fuel-ts/math': 0.29.1 '@fuel-ui/css': 0.12.3 - '@fuel-ui/test-utils': 0.12.3_4k4h4j3b7mix7mbx4dw7fcb6uq + '@fuel-ui/test-utils': 0.12.3_42m3q4uhfkfyjp44k53gseqgja '@radix-ui/react-accordion': 1.1.0_biqbaboplfbrettd7655fr4n2y '@radix-ui/react-alert-dialog': 1.0.2_5ndqzdd6t4rivxsukjv3i3ak2q '@radix-ui/react-aspect-ratio': 1.0.1_biqbaboplfbrettd7655fr4n2y @@ -3540,7 +3540,7 @@ packages: dependencies: '@fuel-ts/math': 0.29.1 '@fuel-ui/css': 0.12.3 - '@fuel-ui/test-utils': 0.12.3_c7qcy4ub4rpcctt7jglj3qg3v4 + '@fuel-ui/test-utils': 0.12.3_h5q4hm4i2eggm7qg7xpzfdcdgq '@radix-ui/react-accordion': 1.1.0_biqbaboplfbrettd7655fr4n2y '@radix-ui/react-alert-dialog': 1.0.2_5ndqzdd6t4rivxsukjv3i3ak2q '@radix-ui/react-aspect-ratio': 1.0.1_biqbaboplfbrettd7655fr4n2y @@ -3590,8 +3590,10 @@ packages: - utf-8-validate dev: false - /@fuel-ui/test-utils/0.12.3_3rmrz26lo2xcg2m7re5kmkpfii: + /@fuel-ui/test-utils/0.12.3_3stiutgnnbnfnf3uowm5cip22i: resolution: {integrity: sha512-h19HeR5wMyYwLazHffHEh1VwcBJ5mlkw+fhlhJ7rY3kLM9q5f3pAXFfWs8GGjdyNXDcuepi7TIaHspjFBxbJMg==} + peerDependencies: + react: '*' peerDependenciesMeta: react: optional: true @@ -3611,7 +3613,7 @@ packages: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 resize-observer-polyfill: 1.5.1 - ts-jest: 29.0.5_zgilbyuumz7xbrerspmrtjuxsi + ts-jest: 29.0.5_jest@29.4.2 transitivePeerDependencies: - '@babel/core' - '@jest/types' @@ -3627,10 +3629,12 @@ packages: - ts-node - typescript - utf-8-validate - dev: false + dev: true - /@fuel-ui/test-utils/0.12.3_4k4h4j3b7mix7mbx4dw7fcb6uq: + /@fuel-ui/test-utils/0.12.3_42m3q4uhfkfyjp44k53gseqgja: resolution: {integrity: sha512-h19HeR5wMyYwLazHffHEh1VwcBJ5mlkw+fhlhJ7rY3kLM9q5f3pAXFfWs8GGjdyNXDcuepi7TIaHspjFBxbJMg==} + peerDependencies: + react: '*' peerDependenciesMeta: react: optional: true @@ -3668,8 +3672,10 @@ packages: - utf-8-validate dev: false - /@fuel-ui/test-utils/0.12.3_@types+react@18.0.27: + /@fuel-ui/test-utils/0.12.3_goymjlxrpta5icaoqypsoub72a: resolution: {integrity: sha512-h19HeR5wMyYwLazHffHEh1VwcBJ5mlkw+fhlhJ7rY3kLM9q5f3pAXFfWs8GGjdyNXDcuepi7TIaHspjFBxbJMg==} + peerDependencies: + react: '*' peerDependenciesMeta: react: optional: true @@ -3689,7 +3695,7 @@ packages: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 resize-observer-polyfill: 1.5.1 - ts-jest: 29.0.5_jest@29.4.2 + ts-jest: 29.0.5_zgilbyuumz7xbrerspmrtjuxsi transitivePeerDependencies: - '@babel/core' - '@jest/types' @@ -3705,10 +3711,12 @@ packages: - ts-node - typescript - utf-8-validate - dev: true + dev: false - /@fuel-ui/test-utils/0.12.3_c7qcy4ub4rpcctt7jglj3qg3v4: + /@fuel-ui/test-utils/0.12.3_h5q4hm4i2eggm7qg7xpzfdcdgq: resolution: {integrity: sha512-h19HeR5wMyYwLazHffHEh1VwcBJ5mlkw+fhlhJ7rY3kLM9q5f3pAXFfWs8GGjdyNXDcuepi7TIaHspjFBxbJMg==} + peerDependencies: + react: '*' peerDependenciesMeta: react: optional: true @@ -3748,14 +3756,16 @@ packages: /@fuel-ui/test-utils/0.12.3_typescript@4.9.5: resolution: {integrity: sha512-h19HeR5wMyYwLazHffHEh1VwcBJ5mlkw+fhlhJ7rY3kLM9q5f3pAXFfWs8GGjdyNXDcuepi7TIaHspjFBxbJMg==} + peerDependencies: + react: '*' peerDependenciesMeta: react: optional: true dependencies: '@testing-library/dom': 8.20.0 '@testing-library/jest-dom': 5.16.5 - '@testing-library/react': 13.4.0_biqbaboplfbrettd7655fr4n2y - '@testing-library/react-hooks': 8.0.1_biqbaboplfbrettd7655fr4n2y + '@testing-library/react': 13.4.0_react-dom@18.2.0 + '@testing-library/react-hooks': 8.0.1_react-dom@18.2.0 '@testing-library/user-event': 14.4.3_yxlyej73nftwmh2fiao7paxmlm identity-obj-proxy: 3.0.0 jest: 29.4.2 @@ -3765,7 +3775,7 @@ packages: jest-matcher-utils: 29.4.2 jest-transform-stub: 2.0.0 react: 18.2.0 - react-dom: 18.2.0_react@18.2.0 + react-dom: 18.2.0 resize-observer-polyfill: 1.5.1 ts-jest: 29.0.5_gelezmms3va3pnkofxaadhcvma transitivePeerDependencies: @@ -9338,7 +9348,7 @@ packages: react-dom: 18.2.0_react@18.2.0 react-error-boundary: 3.1.4_react@18.2.0 - /@testing-library/react-hooks/8.0.1_biqbaboplfbrettd7655fr4n2y: + /@testing-library/react-hooks/8.0.1_react-dom@18.2.0: resolution: {integrity: sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g==} engines: {node: '>=12'} peerDependencies: @@ -9357,9 +9367,8 @@ packages: optional: true dependencies: '@babel/runtime': 7.20.7 - react: 18.2.0 - react-dom: 18.2.0_react@18.2.0 - react-error-boundary: 3.1.4_react@18.2.0 + react-dom: 18.2.0 + react-error-boundary: 3.1.4 dev: true /@testing-library/react/13.4.0_biqbaboplfbrettd7655fr4n2y: @@ -9380,6 +9389,24 @@ packages: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 + /@testing-library/react/13.4.0_react-dom@18.2.0: + resolution: {integrity: sha512-sXOGON+WNTh3MLE9rve97ftaZukN3oNf2KjDy7YTx6hcTO2uuLHuCGynMDhFwGw/jYf4OJ2Qk0i4i79qMNNkyw==} + engines: {node: '>=12'} + peerDependencies: + react: '*' + react-dom: '*' + peerDependenciesMeta: + react: + optional: true + react-dom: + optional: true + dependencies: + '@babel/runtime': 7.20.7 + '@testing-library/dom': 8.20.0 + '@types/react-dom': 18.0.10 + react-dom: 18.2.0 + dev: true + /@testing-library/user-event/13.5.0_yxlyej73nftwmh2fiao7paxmlm: resolution: {integrity: sha512-5Kwtbo3Y/NowpkbRuSepbyMFkZmHgD+vPzYB/RJ4oxt5Gj/avFFBYjhw27cqSVPVw/3a67NK1PbiIr9k4Gwmdg==} engines: {node: '>=10', npm: '>=6'} @@ -20327,6 +20354,18 @@ packages: - supports-color dev: true + /react-dom/18.2.0: + resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} + peerDependencies: + react: '*' + peerDependenciesMeta: + react: + optional: true + dependencies: + loose-envify: 1.4.0 + scheduler: 0.23.0 + dev: true + /react-dom/18.2.0_react@18.2.0: resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} peerDependencies: @@ -20357,6 +20396,18 @@ packages: react-is: 17.0.2 dev: true + /react-error-boundary/3.1.4: + resolution: {integrity: sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA==} + engines: {node: '>=10', npm: '>=6'} + peerDependencies: + react: '*' + peerDependenciesMeta: + react: + optional: true + dependencies: + '@babel/runtime': 7.20.7 + dev: true + /react-error-boundary/3.1.4_react@18.2.0: resolution: {integrity: sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA==} engines: {node: '>=10', npm: '>=6'} diff --git a/scripts/builds/utils.mjs b/scripts/builds/utils.mjs index af90ffa91..a9c8d358b 100644 --- a/scripts/builds/utils.mjs +++ b/scripts/builds/utils.mjs @@ -53,8 +53,6 @@ export async function runPnpmCmd(cmds) { export async function buildWebsite() { fs.rmSync(DIST_FOLDER, { recursive: true, force: true }); - await runPnpmCmd(['build:libs', '--force', '--no-cache']); - await runPnpmCmd(['build:docs-build', '--force', '--no-cache']); - await runPnpmCmd(['build:docs-export', '--force', '--no-cache']); - await runPnpmCmd(['build:app', '--force', '--no-cache']); + await runPnpmCmd(['build:preview', '--force', '--no-cache']); + await runPnpmCmd(['build:all', '--force', '--no-cache']); } diff --git a/scripts/gh-pages-preview.mjs b/scripts/gh-pages-preview.mjs deleted file mode 100644 index 5134b1178..000000000 --- a/scripts/gh-pages-preview.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import { join } from 'path'; - -import { setEnv, runPnpmCmd, buildWebsite } from './builds/utils.mjs'; - -process.env.DOCS_BASE_URL = '/fuels-wallet'; - -async function main() { - const { DOCS_BASE_URL } = process.env; - const DIST_FOLDER = join(process.cwd(), 'dist'); - await buildWebsite(); - await runPnpmCmd(['http-server', DIST_FOLDER, '-o', DOCS_BASE_URL, '-c-1']); -} - -setEnv(); -main(); diff --git a/turbo.json b/turbo.json index 439faa191..099b154e6 100644 --- a/turbo.json +++ b/turbo.json @@ -1,17 +1,41 @@ { + "$schema": "https://turbo.build/schema.json", + "globalDependencies": [".env", ".env.production", ".env.test"], + "globalEnv": ["NODE_ENV"], "pipeline": { + "ts:check": { + "dependsOn": [] + }, "build": { + "dependsOn": ["^ts:check"], + "outputs": ["dist/**"] + }, + "build:docs": { "dependsOn": ["^build"], "outputs": ["dist/**"] }, - "export": { - "dependsOn": [] + "build:crx": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] }, - "ts:check": { - "dependsOn": [] + "build:web": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + }, + "build:app": { + "dependsOn": ["^build:web", "^build:crx"], + "outputs": ["dist/**", "dist-crx/**"] + }, + "build:all": { + "dependsOn": ["^build"], + "outputs": ["dist/**"] + }, + "build:preview": { + "dependsOn": ["^build"], + "outputs": ["./dist/"] }, "test": { - "dependsOn": ["ts:check"] + "dependsOn": [] }, "test:e2e": { "dependsOn": [] diff --git a/vercel.json b/vercel.json index 8b57b7849..af527bfca 100644 --- a/vercel.json +++ b/vercel.json @@ -1,4 +1,7 @@ { + "$schema": "https://openapi.vercel.sh/vercel.json", + "installCommand": "pnpm install", + "buildCommand": "pnpm build:website", "outputDirectory": "./dist", "github": { "silent": true