Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions @app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"private": true,
"version": "0.0.0",
"scripts": {
"build": "cd src && cross-env NODE_ENV=production NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" next build",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"build": "cd src && cross-env NODE_ENV=production NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" next build",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"@ant-design/icons": "^5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion @app/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"build": "tsc -b",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"@ant-design/icons": "^5.0.1",
Expand Down
11 changes: 6 additions & 5 deletions @app/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ various places in the app, for example:
## Environmental variables

In order to support multiplatform and docker development in the same repository,
we use `node -r @app/config/env path/to/code` to run various parts of the
project. `node -r` requires a specific module before running the main script; in
this case we're requiring [@app/config/env.js](./env.js) which sources the
settings from `.env` in the root folder and then builds some derivative
environmental variables from them. This is a fairly advanced technique.
we use `node --require @app/config/env path/to/code` to run various parts of the
project. `node --require` requires a specific module before running the main
script; in this case we're requiring [@app/config/env.js](./env.js) which
sources the settings from `.env` in the root folder and then builds some
derivative environmental variables from them. This is a fairly advanced
technique.
2 changes: 1 addition & 1 deletion @app/config/env.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* Use via `node -r @app/config/env path/to/file.js` */
/* Use via `node --require @app/config/env path/to/file.js` */
require("dotenv").config({ path: `${__dirname}/../../.env` });
require("./extra");
2 changes: 1 addition & 1 deletion @app/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"dotenv": "^16.0.3"
Expand Down
4 changes: 2 additions & 2 deletions @app/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"private": true,
"version": "0.0.0",
"scripts": {
"gm": "cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" graphile-migrate",
"gm": "cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" graphile-migrate",
"migrate": "yarn gm migrate",
"watch": "yarn gm watch",
"commit": "yarn gm commit",
"uncommit": "yarn gm uncommit",
"reset": "yarn gm reset",
"dump": "yarn gm migrate && yarn gm reset --shadow --erase && yarn gm migrate --shadow --forceActions",
"wipe-if-demo": "./scripts/wipe-if-demo",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"cross-env": "^7.0.3",
Expand Down
4 changes: 2 additions & 2 deletions @app/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"private": true,
"version": "0.0.0",
"scripts": {
"cy": "cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" cypress",
"cy": "cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" cypress",
"open": "yarn cy open",
"run": "yarn cy run",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest --passWithNoTests"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest --passWithNoTests"
},
"devDependencies": {
"cross-env": "^7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion @app/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "yarn codegen && tsc -b",
"watch": "yarn codegen --watch",
"codegen": "graphql-codegen --config codegen.yml",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"@apollo/client": "3.6.10",
Expand Down
2 changes: 1 addition & 1 deletion @app/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc -b",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"@apollo/client": "3.6.10",
Expand Down
8 changes: 4 additions & 4 deletions @app/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"version": "0.0.0",
"scripts": {
"build": "tsc -b",
"start": "node -r @app/config/env dist/index.js",
"dev": "nodemon --signal SIGINT --watch 'dist/**/*.js' -x \"node --inspect=9678 -r @app/config/env -r source-map-support/register\" dist/index.js",
"schema:export": "ts-node -r @app/config/env scripts/schema-export.ts",
"start": "node --require @app/config/env dist/index.js",
"dev": "nodemon --signal SIGINT --watch 'dist/**/*.js' -x \"node --inspect=9678 --require @app/config/env --require source-map-support/register\" dist/index.js",
"schema:export": "ts-node --require @app/config/env scripts/schema-export.ts",
"cloudflare:import": "(echo \"export const cloudflareIps: string[] = [\"; (curl -Ls https://www.cloudflare.com/ips-v4 | sort | sed -e \"s/^/ \\\"/\" -e \"s/$/\\\",/\"); echo \"];\") > src/cloudflare.ts",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"@app/client": "0.0.0",
Expand Down
6 changes: 3 additions & 3 deletions @app/worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"private": true,
"version": "0.0.0",
"scripts": {
"gw": "cd dist && cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" graphile-worker --crontab ../crontab",
"dev": "cd dist && cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env --inspect=9757\" graphile-worker --crontab ../crontab --watch",
"gw": "cd dist && cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" graphile-worker --crontab ../crontab",
"dev": "cd dist && cross-env NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env --inspect=9757\" graphile-worker --crontab ../crontab --watch",
"build": "tsc -b",
"start": "yarn gw",
"install-db-schema": "mkdirp dist && yarn gw --schema-only",
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} -r @app/config/env\" jest"
"test": "cross-env NODE_ENV=test NODE_OPTIONS=\"${NODE_OPTIONS:-} --require @app/config/env\" jest"
},
"dependencies": {
"@app/config": "0.0.0",
Expand Down
Loading