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

Fix build script #145

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions _api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This repository contains scripts to deploy static files from the `_api/dist` dir

### Usage

Set the `ROOT_DIR` environment variable to specify the network type (e.g., `testnets`, `devnets`).
Set the `NETWORK_DIR` environment variable to specify the network type (e.g., `testnets`, `devnets`).

Run the script:

Expand All @@ -21,5 +21,5 @@ pnpm build
or

```sh
ROOT_DIR=testnets pnpm build
NETWORK_DIR=testnets pnpm build
```
1 change: 1 addition & 0 deletions _api/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"type": "module",
"scripts": {
"build": "tsx src/main.ts"
},
Expand Down
6 changes: 5 additions & 1 deletion _api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
*/

import * as path from "path"
import * as url from "url"
import { copyDirectory, deleteDirectory, getFilePathsInDirectory } from "./utils"
import { updateUrlsInDirectory, createUrlReplacer } from "./replaceUrls"
import { aggregateChainData } from "./aggregateChains"
import { optimizeImages } from "./optimizeImages"

const rootDir = process.env.ROOT_DIR || ""
const __filename = url.fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const rootDir = process.env.NETWORK_DIR || ""
const srcDir = path.resolve(__dirname, "../..", rootDir)
const distDir = path.resolve(__dirname, "../dist")

Expand Down
3 changes: 2 additions & 1 deletion _api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "@tsconfig/recommended/tsconfig.json"
"extends": "@tsconfig/recommended/tsconfig.json",
"compilerOptions": { "module": "ESNext" }
}
Loading