Skip to content

Commit 4ec8b1b

Browse files
committed
Update config to run frontend locally
1 parent 08769d6 commit 4ec8b1b

File tree

6 files changed

+23
-45
lines changed

6 files changed

+23
-45
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ Here are some commands you can run:
3737

3838
| Command | Description |
3939
| --- | --- |
40-
| yarn amo | Start the dev server/proxy (for amo) using data from Docker. _This is not currently working. See [issue-7196][]_. |
40+
| yarn amo:olympia | Start the dev server/proxy (for amo) using data from a local addons-server environment. |
4141
| yarn amo:dev | Start the dev server/proxy (for amo) using data from the dev server (https://addons-dev.allizom.org/) |
4242
| yarn amo:dev-https | Same as `amo:dev` but with HTTPS, available at: https://example.com:3000/. [Read about setting up this environment](docs/moz-addon-manager.md#developing-with-a-local-https-server-recommended) |
43-
| yarn amo:no-proxy | Start the dev server without a proxy (for amo) using data from Docker |
4443
| yarn amo:stage | Start the dev server/proxy (for amo) using data from the staging server (https://addons.allizom.org/) |
4544
| yarn build | Build the app. |
4645
| yarn build-ci | Run the `build` and `bundlesize` npm scripts. |
@@ -388,6 +387,5 @@ curl https://addons-dev.allizom.org/__version__
388387
- Unit tests with high coverage (aiming for 100%)
389388

390389
[bundlesize]: https://github.com/siddharthkp/bundlesize
391-
[issue-7196]: https://github.com/mozilla/addons-frontend/issues/7196
392390
[jest]: https://jestjs.io/docs/en/getting-started.html
393391
[prettier]: https://prettier.io/

bin/proxy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ const useHttpsForDev = process.env.USE_HTTPS_FOR_DEV;
1919
const protocol = useHttpsForDev ? 'https' : 'http';
2020

2121
const apiHost = config.get('proxyApiHost', null) || config.get('apiHost');
22-
const frontendHost = `${protocol}://${config.get('serverHost')}:${config.get('serverPort')}`;
22+
const serverPort = parseInt(config.get('serverPort'), 10);
23+
const frontendHost = `${protocol}://${config.get('serverHost')}:${serverPort}`;
2324

2425
log.info(`apiHost: ${apiHost}`);
2526
log.info(`frontendHost: ${frontendHost}`);
@@ -94,7 +95,7 @@ proxy.on('error', (error, req, res) => {
9495
});
9596

9697
const host = useHttpsForDev ? process.env.SERVER_HOST : 'localhost';
97-
const port = parseInt(config.get('proxyPort', '3333'), 10);
98+
const port = parseInt(config.get('proxyPort'), 10);
9899

99100
log.info(`🚦 Proxy running at ${protocol}://${host}:${port}`);
100101
server.listen(port);

config/development-local.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This config should be used with a local addons-server setup.
2+
module.exports = {
3+
apiHost: 'http://olympia.test',
4+
proxyApiHost: 'http://olympia.test',
5+
proxyPort: 4000,
6+
webpackServerPort: 4001,
7+
mozillaUserId: 10968,
8+
CSP: false,
9+
enableNodeStatics: true,
10+
};

config/development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = {
3838

3939
enableStrictMode: true,
4040

41-
serverPort: 3000,
41+
serverPort: 3333,
4242
webpackServerHost,
4343
webpackServerPort,
4444
webpackHost,

config/uitests.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
"bundlesize": "bundlesize",
1616
"extract-locales": "better-npm-run extract-locales",
1717
"clean": "rimraf './dist/*!(.gitkeep)' './webpack-assets.json' './src/locale/**(!.gitkeep)'",
18-
"amo": "better-npm-run amo",
1918
"amo:dev": "better-npm-run amo:dev",
2019
"amo:dev-https": "better-npm-run amo:dev-https",
21-
"amo:ui-tests": "better-npm-run amo:ui-tests",
22-
"amo:no-proxy": "better-npm-run amo:no-proxy",
20+
"amo:olympia": "better-npm-run amo:olympia",
2321
"amo:stage": "better-npm-run amo:stage",
22+
"amo:ui-tests": "npm run amo:olympia",
2423
"eslint": "eslint .",
2524
"flow": "flow",
2625
"flow:check": "flow check",
@@ -52,8 +51,11 @@
5251
"NODE_PATH": "./:./src"
5352
}
5453
},
55-
"amo": {
56-
"command": "better-npm-run start-dev-proxy"
54+
"amo:olympia": {
55+
"command": "better-npm-run start-dev-proxy",
56+
"env": {
57+
"NODE_APP_INSTANCE": "local"
58+
}
5759
},
5860
"amo:dev": {
5961
"command": "better-npm-run start-dev-proxy",
@@ -71,18 +73,6 @@
7173
"WEBPACK_SERVER_HOST": "example.com"
7274
}
7375
},
74-
"amo:ui-tests": {
75-
"command": "better-npm-run start-dev-proxy",
76-
"env": {
77-
"NODE_ENV": "production"
78-
}
79-
},
80-
"amo:no-proxy": {
81-
"command": "better-npm-run start-dev",
82-
"env": {
83-
"PROXY_ENABLED": "false"
84-
}
85-
},
8676
"amo:stage": {
8777
"command": "better-npm-run start-dev-proxy",
8878
"env": {
@@ -115,8 +105,7 @@
115105
"ENABLE_PIPING": "true",
116106
"NODE_ENV": "development",
117107
"NODE_ICU_DATA": "./node_modules/full-icu",
118-
"NODE_PATH": "./:./src",
119-
"SERVER_PORT": "3333"
108+
"NODE_PATH": "./:./src"
120109
}
121110
},
122111
"node": {

0 commit comments

Comments
 (0)