diff --git a/README.md b/README.md index 2cae5c5..90a1197 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,6 @@ - [Building for production](#building-for-production) - [Running tests](#running-tests) - [Learn more about NEAR](#learn-more-about-near) -- [Ethereum wallet login](#ethereum-wallet-login) -- [Preparing for production](#preparing-for-production) - [Contributing](#contributing) @@ -38,7 +36,13 @@ pnpm install ### Running the app -First, run the development server: +First, make sure a web4 proxy server is running (see [setup](#running-web4-locally)): + +```bash +pnpm run web4:start:testnet +``` + +Then start the dev server. This will run the app and the express proxy server. ```bash pnpm run dev @@ -56,12 +60,6 @@ pnpm run build pnpm run test ``` -### Load shadcn component - -```bash -pnpm dlx shadcn@latest add -``` - See the full [testing guide](./playwright-tests/README.md). ## Project Structure @@ -100,34 +98,39 @@ To learn more about NEAR, take a look at the following resources: You can check out [the NEAR repository](https://github.com/near) - your feedback and contributions are welcome! -## Running locally +## Running web4 locally 1. Install [mkcert](https://mkcert.dev/). 2. Install local certificate authority (this allows browser to trust self-signed certificates): + ```bash mkcert -install ``` + 3. Create `*.near.page` SSL certificate: + ```bash mkcert "*.near.page" ``` + 4. Run `web4` man-in-the-middle proxy locally: + ```bash IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=mainnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near ``` -5. Setup browser to use [automatic proxy configuration file](https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file) at `http://localhost:8080/` or to use `localhost:8080` as an HTTPS proxy server. - -I had to do: -`sudo sh -c 'echo "127.0.0.1 every.near.page" >> /etc/hosts'` - -and +5. Setup browser to use [automatic proxy configuration file](https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file) at `http://localhost:8080/` or to use `localhost:8080` as an HTTPS proxy server. -`pnpm run dev --host every.near.page` +6. May have to configure hosts on MacOS: +```bash +sudo sh -c 'echo "127.0.0.1 every.near.page" >> /etc/hosts' +``` ## Deploy to web4 +To deploy the main app, go to `/apps/www`, then follow the below: + 1. Build the project ```cmd diff --git a/apps/www/package.json b/apps/www/package.json index 2b11b8c..e5dc465 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -10,8 +10,6 @@ "preview": "vite preview", "nearfs:publish-library:create:car": "ipfs-car pack dist/ --output dist.car", "nearfs:publish-library:upload:car": "node ./node_modules/nearfs/scripts/upload-car.js dist.car", - "web4:start:mainnet": "IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=mainnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near", - "web4:start:testnet": "IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=testnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near", "fmt": "prettier --write '**/*.{js,jsx,ts,tsx,json}'", "fmt:check": "prettier --check '**/*.{js,jsx,ts,tsx,json}'", "test": "npx playwright test", diff --git a/package.json b/package.json index 324c1d2..a9ffc75 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "build": "turbo run build", "clean": "turbo run clean", "dev": "turbo run dev", + "web4:start:mainnet": "IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=mainnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near", + "web4:start:testnet": "IPFS_GATEWAY_URL=https://ipfs.near.social NODE_ENV=testnet WEB4_KEY_FILE=./_wildcard.near.page-key.pem WEB4_CERT_FILE=./_wildcard.near.page.pem npx web4-near", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "lint": "turbo run lint", "test": "turbo run test",