mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-01-12 16:53:19 +08:00
fix: updated package.json and package-lock.json
This commit is contained in:
2437
package-lock.json
generated
2437
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_ENV=development STACKS_BLOCKCHAIN_API_DB=pg STACKS_CHAIN_ID=0x80000000 ts-node-transpile-only src/index.ts",
|
||||
"dev:watch": "cross-env NODE_ENV=development STACKS_BLOCKCHAIN_API_DB=pg nodemon -e ts -x 'ts-node-transpile-only src/index.ts'",
|
||||
"dev:integrated": "npm run devenv:build && concurrently npm:dev npm:devenv:deploy",
|
||||
"dev:integrated": "npm run build && npm run devenv:build && concurrently npm:dev npm:devenv:deploy",
|
||||
"dev:follower": "npm run devenv:build && concurrently npm:dev npm:devenv:follower",
|
||||
"test": "cross-env NODE_ENV=development jest --config ./jest.config.js --coverage --runInBand",
|
||||
"test:rosetta": "cross-env NODE_ENV=development jest --config ./jest.config.rosetta.js --coverage --runInBand",
|
||||
@@ -21,9 +21,10 @@
|
||||
"test:integration:microblocks": "npm run devenv:deploy:pg -- -d && cross-env NODE_ENV=development jest --config ./jest.config.microblocks.js --coverage --no-cache --runInBand; npm run devenv:stop:pg",
|
||||
"test:integration:tokens": "npm run devenv:deploy -- -d && cross-env NODE_ENV=development jest --config ./jest.config.tokens.js --coverage --no-cache --runInBand; npm run devenv:stop",
|
||||
"git-info": "echo \"$(git rev-parse --abbrev-ref HEAD)\n$(git log -1 --pretty=format:%h)\n$(git describe --tags --abbrev=0)\" > ./.git-info",
|
||||
"build": "npm run git-info && rimraf ./lib && tsc -p tsconfig.build.json",
|
||||
"build": "npm run git-info && npm run build:api-documentation && rimraf ./lib && tsc -p tsconfig.build.json",
|
||||
"build:tests": "tsc -p tsconfig.json",
|
||||
"build:docs": "npm i --prefix docs && npm run build --prefix docs && npm i --prefix client && npm run generate:docs --prefix client",
|
||||
"build:api-documentation": "npm i --prefix docs && npm run build --prefix docs",
|
||||
"start": "node ./lib/index.js",
|
||||
"lint": "npm run lint:eslint && npm run lint:prettier",
|
||||
"lint:unused-exports": "ts-unused-exports tsconfig.json --ignoreFiles=src/migrations/*",
|
||||
@@ -140,13 +141,11 @@
|
||||
"source-map-support": "^0.5.19",
|
||||
"split2": "^3.2.2",
|
||||
"strict-event-emitter-types": "^2.0.0",
|
||||
"swagger-ui-express": "^4.3.0",
|
||||
"ts-unused-exports": "^7.0.3",
|
||||
"typescript": "^4.4.2",
|
||||
"uuid": "^8.0.0",
|
||||
"winston": "^3.2.1",
|
||||
"ws": "^7.4.6",
|
||||
"yamljs": "^0.3.0",
|
||||
"zone-file": "^2.0.0-beta.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -173,9 +172,7 @@
|
||||
"@types/source-map-support": "^0.5.3",
|
||||
"@types/split2": "^2.1.6",
|
||||
"@types/supertest": "^2.0.9",
|
||||
"@types/swagger-ui-express": "^4.1.3",
|
||||
"@types/uuid": "^7.0.3",
|
||||
"@types/yamljs": "^0.2.31",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||
"@typescript-eslint/parser": "^4.31.0",
|
||||
"concurrently": "^6.4.0",
|
||||
|
||||
@@ -24,7 +24,7 @@ import { createRosettaMempoolRouter } from './routes/rosetta/mempool';
|
||||
import { createRosettaBlockRouter } from './routes/rosetta/block';
|
||||
import { createRosettaAccountRouter } from './routes/rosetta/account';
|
||||
import { createRosettaConstructionRouter } from './routes/rosetta/construction';
|
||||
import { isProdEnv, logError, logger, LogLevel, waiter } from '../helpers';
|
||||
import { apiDocumentationUrl, isProdEnv, logError, logger, LogLevel, waiter } from '../helpers';
|
||||
import { createWsRpcRouter } from './routes/ws/ws-rpc';
|
||||
import { createSocketIORouter } from './routes/ws/socket-io';
|
||||
import { createBurnchainRouter } from './routes/burnchain';
|
||||
@@ -43,9 +43,7 @@ import { createStatusRouter } from './routes/status';
|
||||
import { createTokenRouter } from './routes/tokens/tokens';
|
||||
import { createFeeRateRouter } from './routes/fee-rate';
|
||||
import { setResponseNonCacheable } from './controllers/cache-controller';
|
||||
import * as swaggerUi from 'swagger-ui-express';
|
||||
import * as yaml from 'yamljs';
|
||||
const swaggerDocument = yaml.load('docs/openapi.yaml');
|
||||
import * as path from 'path';
|
||||
|
||||
export interface ApiServer {
|
||||
expressApp: express.Express;
|
||||
@@ -152,8 +150,16 @@ export async function startApiServer(opts: {
|
||||
res.redirect(`/extended/v1/status`);
|
||||
});
|
||||
|
||||
if (!isProdEnv) {
|
||||
app.use('/doc', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||
// in case env is not production and url is not provided
|
||||
if (apiDocumentationUrl) {
|
||||
app.use('/doc', (req, res) => {
|
||||
res.redirect(apiDocumentationUrl ?? '');
|
||||
});
|
||||
} else if (!isProdEnv) {
|
||||
app.use('/doc', (req, res) => {
|
||||
const apiDocumentationPath = path.join(__dirname + '../../../docs/.tmp/index.html');
|
||||
res.sendFile(apiDocumentationPath);
|
||||
});
|
||||
}
|
||||
|
||||
// Setup extended API v1 routes
|
||||
|
||||
@@ -25,6 +25,7 @@ export const isProdEnv =
|
||||
process.env.NODE_ENV === 'prod' ||
|
||||
!process.env.NODE_ENV ||
|
||||
(!isTestEnv && !isDevEnv);
|
||||
export const apiDocumentationUrl = process.env.API_DOCS_URL;
|
||||
export const isReadOnlyMode = parseArgBoolean(process.env['STACKS_READ_ONLY_MODE']);
|
||||
|
||||
export const APP_DIR = __dirname;
|
||||
|
||||
Reference in New Issue
Block a user