Skip to content

Commit 37d5b0e

Browse files
authored
feat: Update npm scripts and documentation for build and start commands (#412)
* Update npm scripts and documentation for build and start commands * Update build:web script to include dependency installation
1 parent e93c11b commit 37d5b0e

4 files changed

Lines changed: 31 additions & 29 deletions

File tree

.actor/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ COPY . ./
5454

5555

5656
# Run the image.
57-
CMD npm run start:prod --silent
57+
CMD npm run start --silent

AGENTS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,10 @@ We use **4 spaces** for indentation (configured in `.editorconfig`).
342342

343343
### Development commands
344344

345-
- `npm run start:dev` - Start development server (uses `tsx` for direct TypeScript execution)
346-
- `npm run build` - Build TypeScript to JavaScript
345+
- `npm run start` - Start standby server (uses `tsx` for direct TypeScript execution)
346+
- `npm run dev` - Alias for `npm run start`
347+
- `npm run build` - Build TypeScript and UI widgets
348+
- `npm run build:web` - Build UI widgets only
347349
- `npm run lint` - Run ESLint
348350
- `npm run lint:fix` - Fix ESLint issues automatically
349351
- `npm run type-check` - Type check without building

DEVELOPMENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ The MCP server uses UI widgets from the `src/web/` directory that need to be bui
5454
See the [OpenAI Apps SDK documentation](https://developers.openai.com/apps-sdk) for background on MCP Apps and widgets.
5555

5656
```bash
57-
npm run build-all
57+
npm run build
5858
```
5959

60-
This command builds the `src/web/` internal project, then runs `npm run build`, and copies the widgets into the `dist/` directory.
60+
This command builds the core project and the `src/web/` widgets, then copies the widgets into the `dist/` directory.
6161

6262
If you only want to work on the React UI widgets, all widget code lives in the self-contained `src/web/` React project. The widgets (MCP Apps) are rendered based on the structured output returned by MCP tools. If you need to add specific data to a widget, you will need to modify the corresponding MCP tool's output since widgets can only render data returned by the MCP tool call result.
6363

6464
> **Important (UI mode):** Widget rendering is enabled only when the server runs in UI mode. Use the `ui=openai` query parameter (e.g., `/mcp?ui=openai`) or set `UI_MODE=openai`. Currently, `openai` is the only supported `ui` value.
6565
66-
> **Important:** After changing widgets, you must rebuild the project with `npm run build-all` to refresh the React widgets in the `dist/` directory.
66+
> **Important:** After changing widgets, you must rebuild the project with `npm run build` to refresh the React widgets in the `dist/` directory.
6767
6868
### Running the MCP server locally
6969

7070
Start the MCP server locally using:
7171

7272
```bash
73-
APIFY_TOKEN='your-apify-token' npm run start:standby
73+
APIFY_TOKEN='your-apify-token' npm run start
7474
```
7575

7676
This will spawn the MCP server at port `3001`.

package.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,28 @@
7979
"typescript-eslint": "^8.23.0",
8080
"vitest": "^3.0.8"
8181
},
82-
"scripts": {
83-
"start": "npm run start:dev",
84-
"start:prod": "node dist/main.js",
85-
"start:dev": "tsx src/main.ts",
86-
"start:standby": "APIFY_META_ORIGIN=\"STANDBY\" npm run start:dev",
87-
"lint": "eslint .",
88-
"lint:fix": "eslint . --fix",
89-
"check": "npm run type-check && npm run lint:fix",
90-
"build": "tsc -b src",
91-
"build-all": "cd src/web && npm run build && cd ../.. && npm run build",
92-
"postbuild": "mkdir -p dist/web && (cp -r src/web/dist dist/web/ 2>/dev/null || :)",
93-
"build:watch": "tsc -b src -w",
94-
"check:widgets": "tsx scripts/check-widgets.ts",
95-
"type-check": "tsc --noEmit",
96-
"test": "npm run test:unit",
97-
"test:unit": "vitest run tests/unit",
98-
"test:integration": "npm run build && vitest run tests/integration",
99-
"clean": "tsc -b src --clean && rm -rf dist/web",
100-
"evals:create-dataset": "tsx evals/create-dataset.ts",
101-
"evals:run": "tsx evals/run-evaluation.ts",
102-
"evals:workflow": "tsx evals/workflows/run-workflow-evals.ts"
103-
},
82+
"scripts": {
83+
"start": "npm run start:standby",
84+
"dev": "npm run start:standby",
85+
"start:standby": "APIFY_META_ORIGIN=\"STANDBY\" tsx src/main.ts",
86+
"build": "npm run build:core && npm run build:web",
87+
"build:core": "tsc -b src",
88+
"build:watch": "tsc -b src -w",
89+
"build:web": "npm --prefix src/web install && npm --prefix src/web run build",
90+
"postbuild": "mkdir -p dist/web && (cp -r src/web/dist dist/web/ 2>/dev/null || :)",
91+
"clean": "tsc -b src --clean && rm -rf dist/web",
92+
"lint": "eslint .",
93+
"lint:fix": "eslint . --fix",
94+
"type-check": "tsc -p tsconfig.json --noEmit",
95+
"check": "npm run type-check && npm run lint",
96+
"check:widgets": "tsx scripts/check-widgets.ts",
97+
"test": "npm run test:unit",
98+
"test:unit": "vitest run tests/unit",
99+
"test:integration": "npm run build && vitest run tests/integration",
100+
"evals:create-dataset": "tsx evals/create-dataset.ts",
101+
"evals:run": "tsx evals/run-evaluation.ts",
102+
"evals:workflow": "tsx evals/workflows/run-workflow-evals.ts"
103+
},
104104
"author": "Apify",
105105
"license": "MIT"
106106
}

0 commit comments

Comments
 (0)