Skip to content

Commit

Permalink
chore: refactor build output structure
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Jul 27, 2023
1 parent c624814 commit c7f5884
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- process exits after health check fails for more than `HEALTHCHECK_FAIL_THRESHOLD_MS` (default 60s)
- upgrade codebase to ESM
- bump Blockfrost SDK (memory leak in deriveAddress) and other dependencies
- refactored build step, entrypoint is now `dist/server.js` (previously `dist/src/server.js`)

### Removed
- `ts-node-dev` (`yarn dev` no longer auto reloads on code change)
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rec {
mkdir -p $out/bin
cat <<EOF > $out/bin/${name}
#!${pkgs.runtimeShell}
${pkgs.nodejs-18_x}/bin/node --require "$out/libexec/source/.pnp.cjs" $out/libexec/source/dist/src/server.js
${pkgs.nodejs-18_x}/bin/node --require "$out/libexec/source/.pnp.cjs" $out/libexec/source/dist/server.js
EOF
chmod +x $out/bin/${name}
'';
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "2.0.0",
"scripts": {
"prebuild": "yarn clean",
"build": "yarn clean && tsc && cp package.json dist/",
"build": "yarn clean && tsc",
"clean": "rimraf dist",
"dev": "NODE_ENV=development yarn build && yarn node ./dist/src/server.js",
"dev": "NODE_ENV=development yarn build && yarn node ./dist/server.js",
"lint": "eslint ./src/**/*.ts",
"start": "yarn build && yarn node ./dist/src/server.js",
"start:profiler": "yarn build && NODE_ENV=production yarn node --prof ./dist/src/server.js",
"test-performance": "yarn ts-node-dev ./scripts/performance/index.ts",
"start": "yarn build && yarn node ./dist/server.js",
"start:profiler": "yarn build && NODE_ENV=production yarn node --prof ./dist/server.js",
"test-performance": "yarn build && yarn node ./dist/scripts/performance/index.ts",
"test": "BLOCKFROST_PROJECT_ID='none' vitest",
"coverage": "vitest run --coverage",
"type-check": "tsc --project tsconfig.json"
Expand Down Expand Up @@ -59,6 +59,6 @@
"node": ">=16"
},
"type": "module",
"main": "dist/src/server.js",
"main": "dist/server.js",
"packageManager": "[email protected]"
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ALL_SEED } from './constants.js';
import { deriveAddressesForXpub, generateRandomAccounts, randomIntFromInterval } from './utils.js';
import { WebsocketClient } from '../../src/utils/websocket-client.js';
import { WebsocketClient } from '../../utils/websocket-client.js';

interface TestSuiteMetrics {
accounts: number;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/health.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ALL_SEED } from '../../scripts/performance/constants.js';
import { ALL_SEED } from '../scripts/performance/constants.js';
import { WebsocketClient } from './websocket-client.js';

export const healthCheck = async (url: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/websocket-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import WebSocket from 'ws';
import { Deferred } from '../../scripts/performance/utils.js';
import { Deferred } from '../scripts/performance/utils.js';
import { MESSAGES } from '../constants/index.js';

export class WebsocketClient {
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"outDir": "dist",
"target": "ES2021",
"module": "node16",
"rootDir": "src",
"moduleResolution": "node16",
"declaration": false,
"isolatedModules": true,
Expand All @@ -21,5 +22,6 @@
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
},
"include": ["src/**/*"]
}

0 comments on commit c7f5884

Please sign in to comment.