Skip to content

Commit

Permalink
Move server.js and start-server.js to src/frame (#45767)
Browse files Browse the repository at this point in the history
  • Loading branch information
heiskr authored Nov 13, 2023
1 parent 4fd4050 commit 694d38e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-broken-links-github-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
ENABLED_LANGUAGES: en
run: |
node server.js &
node src/frame/server.js &
sleep 5
curl --retry-connrefused --retry 3 -I http://localhost:4000/
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ COPY --chown=node:node src ./src
COPY --chown=node:node .remotejson-cache* ./.remotejson-cache
COPY --chown=node:node data ./data
COPY --chown=node:node next.config.js ./
COPY --chown=node:node server.js ./server.js
COPY --chown=node:node start-server.js ./start-server.js

EXPOSE $PORT

CMD ["node", "server.js"]
CMD ["node", "src/frame/server.js"]

# --------------------------------------------------------------------------------
# PRODUCTION IMAGE - includes all translations
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"default": "./src/*"
}
},
"exports": "./server.js",
"exports": "./src/frame/server.js",
"scripts": {
"build": "next build",
"debug": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon --inspect server.js",
"debug": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon --inspect src/frame/server.js",
"dev": "cross-env npm start",
"fixture-dev": "cross-env ROOT=tests/fixtures npm start",
"fixture-test": "cross-env ROOT=tests/fixtures npm test -- tests/rendering-fixtures",
Expand All @@ -35,14 +35,14 @@
"rest-dev": "node src/rest/scripts/update-files.js",
"show-action-deps": "echo 'Action Dependencies:' && rg '^[\\s|-]*(uses:.*)$' .github -I -N --no-heading -r '$1$2' | sort | uniq | cut -c 7-",
"prestart": "node src/workflows/cmp-files.js package-lock.json .installed.package-lock.json || npm install && cp package-lock.json .installed.package-lock.json",
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon server.js",
"start-all-languages": "cross-env NODE_ENV=development nodemon server.js",
"start-for-playwright": "cross-env ROOT=tests/fixtures TRANSLATIONS_FIXTURE_ROOT=tests/fixtures/translations ENABLED_LANGUAGES=en,ja NODE_ENV=test node server.js",
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon src/frame/server.js",
"start-all-languages": "cross-env NODE_ENV=development nodemon src/frame/server.js",
"start-for-playwright": "cross-env ROOT=tests/fixtures TRANSLATIONS_FIXTURE_ROOT=tests/fixtures/translations ENABLED_LANGUAGES=en,ja NODE_ENV=test node src/frame/server.js",
"sync-rest": "node src/rest/scripts/update-files.js",
"sync-search": "cross-env NODE_OPTIONS='--max_old_space_size=8192' start-server-and-test sync-search-server 4002 sync-search-indices",
"sync-search-ghes-release": "cross-env GHES_RELEASE=1 start-server-and-test sync-search-server 4002 sync-search-indices",
"sync-search-indices": "node src/search/scripts/sync-search-indices.js",
"sync-search-server": "cross-env NODE_ENV=production PORT=4002 MINIMAL_RENDER=true CHANGELOG_DISABLED=true node server.js",
"sync-search-server": "cross-env NODE_ENV=production PORT=4002 MINIMAL_RENDER=true CHANGELOG_DISABLED=true node src/frame/server.js",
"sync-webhooks": "src/rest/scripts/update-files.js -o webhooks",
"test": "cross-env NODE_OPTIONS='--max_old_space_size=4096 --experimental-vm-modules' jest --logHeapUsage",
"test-watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch --notify --notifyMode=change --coverage",
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/tests/scripts/start-server-for-jest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

import { main } from '../../../start-server.js'
import { main } from '#src/frame/start-server.js'

import { PORT, START_JEST_SERVER, isServerHealthy, isPortRunning } from './server-for-jest.js'

Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ since the server won't need to start and stop every time you run tests.
In one terminal, type:

```shell
NODE_ENV=test PORT=4000 node server.js
NODE_ENV=test PORT=4000 node src/frame/server.js
```

In another terminal, type:
Expand Down
2 changes: 1 addition & 1 deletion tests/rendering-fixtures/playwright-rendering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { test, expect } from '@playwright/test'
// In GitHub Actions, we rely on setting the environment variable directly
// but for convenience, for local development, engineers might have a
// .env file that can set environment variable. E.g. ELASTICSEARCH_URL.
// The `start-server.js` script uses dotenv too, but since Playwright
// The `src/frame/start-server.js` script uses dotenv too, but since Playwright
// tests only interface with the server via HTTP, we too need to find
// this out.
dotenv.config()
Expand Down

0 comments on commit 694d38e

Please sign in to comment.