Skip to content

Commit

Permalink
remove bunx
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsleydon committed Feb 22, 2024
1 parent 43d7af2 commit 2840085
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ COPY --from=prerelease /usr/src/app/package.json .

# run the app
USER bun
CMD ["sh", "-c", "bunx squid-typeorm-migration apply && bun lib/main.js"]
CMD ["sh", "-c", "npx squid-typeorm-migration apply && node lib/main.js"]
Binary file modified bun.lockb
Binary file not shown.
22 changes: 14 additions & 8 deletions commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"commands": {
"clean": {
"description": "delete all build artifacts",
"cmd": ["bunx", "rimraf", "lib"]
"cmd": ["npx", "--yes", "rimraf", "lib"]
},
"build": {
"description": "Build the squid project",
"deps": ["clean"],
"cmd": ["tsc", "--project", "tsconfig.build.json"]
"cmd": ["tsc", "-p", "tsconfig.build.json"]
},
"up": {
"description": "Start a PG database",
Expand All @@ -29,7 +29,7 @@
},
"migration:clean": {
"description": "Clean the migrations folder",
"cmd": ["bunx", "rimraf", "./db/migrations"]
"cmd": ["npx", "--yes", "rimraf", "./db/migrations"]
},
"migration": {
"deps": ["build"],
Expand All @@ -47,12 +47,12 @@
"process": {
"description": "Load .env and start the squid processor",
"deps": ["build", "migration:apply"],
"cmd": ["bun", "lib/main.js"]
"cmd": ["node", "--require=dotenv/config", "lib/main.js"]
},
"process:prod": {
"description": "Start the squid processor",
"deps": ["migration:apply"],
"cmd": ["bun", "lib/main.js"],
"cmd": ["node", "lib/main.js"],
"hidden": true
},
"serve": {
Expand All @@ -74,17 +74,23 @@
]
},
"check-updates": {
"cmd": ["bunx", "npm-check-updates", "--filter=/subsquid/", "--upgrade"],
"cmd": [
"npx",
"--yes",
"npm-check-updates",
"--filter=/subsquid/",
"--upgrade"
],
"hidden": true
},
"bump": {
"description": "Bump @subsquid packages to the latest versions",
"deps": ["check-updates"],
"cmd": ["bun", "i", "-f"]
"cmd": ["npm", "i", "-f"]
},
"open": {
"description": "Open a local browser window",
"cmd": ["bunx", "--yes", "opener"]
"cmd": ["npx", "--yes", "opener"]
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@subsquid/typeorm-migration": "^1.3.0",
"@subsquid/typeorm-store": "^1.2.6",
"date-fns": "^3.3.1",
"dotenv": "^16.4.5",
"lodash": "^4.17.21",
"patch-package": "^8.0.0",
"pg": "^8.11.3",
Expand Down
13 changes: 0 additions & 13 deletions patches/prom-client+14.2.0.patch

This file was deleted.

14 changes: 7 additions & 7 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
export const INITIAL_BLOCK = 3000000

export const TO_BLOCK =
Bun.env.TO_BLOCK != null ? parseInt(Bun.env.TO_BLOCK) : undefined
process.env.TO_BLOCK != null ? parseInt(process.env.TO_BLOCK) : undefined

export const BASE_POOL_ACCOUNT =
'42qnPyfw3sbWMGGtTPPc2YFNZRKPGXswRszyQQjGs2FDxdim'

export const RPC_ENDPOINT =
Bun.env.RPC_ENDPOINT || 'https://khala-rpc.dwellir.com'
process.env.RPC_ENDPOINT || 'https://khala-rpc.dwellir.com'

export const ENABLE_SNAPSHOT = Bun.env.ENABLE_SNAPSHOT === '1'
export const ENABLE_SNAPSHOT = process.env.ENABLE_SNAPSHOT === '1'

export const FORCE_REFRESH_IDENTITY = Bun.env.FORCE_REFRESH_IDENTITY === '1'
export const FORCE_REFRESH_IDENTITY = process.env.FORCE_REFRESH_IDENTITY === '1'

export const CLEAR_WITHDRAWAL_DATE =
typeof Bun.env.CLEAR_WITHDRAWAL_DATE === 'string'
? new Date(Bun.env.CLEAR_WITHDRAWAL_DATE)
typeof process.env.CLEAR_WITHDRAWAL_DATE === 'string'
? new Date(process.env.CLEAR_WITHDRAWAL_DATE)
: undefined

export const CLEAR_WITHDRAWAL_THRESHOLD =
Bun.env.CLEAR_WITHDRAWAL_THRESHOLD || '0.01'
process.env.CLEAR_WITHDRAWAL_THRESHOLD || '0.01'
7 changes: 5 additions & 2 deletions src/loadInitialState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from 'assert'
import fs from 'fs'
import path from 'path'
import {BigDecimal} from '@subsquid/big-decimal'
import {groupBy} from 'lodash'
Expand Down Expand Up @@ -107,9 +108,11 @@ interface InitialState {
}

const loadInitialState = async (ctx: Ctx): Promise<void> => {
const initialState: InitialState = await Bun.file(
const data = fs.readFileSync(
path.resolve(__dirname, `../initial_state/${INITIAL_BLOCK}.json`),
).json()
'utf8',
)
const initialState: InitialState = JSON.parse(data)
const updatedTime = new Date(initialState.timestamp)
const globalState = new GlobalState({
id: '0',
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ [email protected]:
resolved "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz"
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==

dotenv@^16.0.3, dotenv@^16.3.1:
dotenv@^16.0.3, dotenv@^16.3.1, dotenv@^16.4.5:
version "16.4.5"
resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz"
integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==
Expand Down

0 comments on commit 2840085

Please sign in to comment.