From 5dbd904009ede4cc952fc7f8cbafebf6b12d81a1 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 14 Oct 2022 09:41:15 -0700 Subject: [PATCH] fix(run): allow for loading of env files to be skipped (#3375) --- CHANGELOG.md | 6 + commands/run/README.md | 6 + commands/run/command.js | 5 + commands/run/index.js | 1 + commands/version/package.json | 2 +- core/lerna/package.json | 4 +- core/lerna/schemas/lerna-schema.json | 7 + e2e/tests/lerna-run/lerna-run-nx-env-files.ts | 122 ++++++++++++++ package-lock.json | 157 +++++++++++------- package.json | 4 +- website/docs/features/run-tasks.md | 6 + 11 files changed, 258 insertions(+), 62 deletions(-) create mode 100644 e2e/tests/lerna-run/lerna-run-nx-env-files.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 12efaadc14..2210eb19a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,12 @@ Simply run `lerna add-caching` and follow the instructions in order to generate You can learn more about the configuration it generates here: https://lerna.js.org/docs/concepts/task-pipeline-configuration +### Automatic loading of .env files in `lerna run` with the new task-runner implementation + +By default the modern task runner powered by Nx will automatically load `.env` files for you. You can set `--load-env-files` to false if you want to disable this behavior for any reason. + +For more details about what `.env` files will be loaded by default please see: https://nx.dev/recipes/environment-variables/define-environment-variables + ### Obselete options in `lerna run` with the new task-runner implementation There are certain legacy options for `lerna run` which are no longer applicable to the modern task-runner. Please see full details about those flags, and the reason behind their obselence, here: diff --git a/commands/run/README.md b/commands/run/README.md index bd1cbf8452..4e1553d012 100644 --- a/commands/run/README.md +++ b/commands/run/README.md @@ -111,6 +111,12 @@ current working directory. $ lerna run build --profile --profile-location=logs/profile/ ``` +### `--load-env-files` + +By default the modern task runner powered by Nx will automatically load .env files for you. You can set `--load-env-files` to false if you want to disable this behavior for any reason. + +For more details about what `.env` files will be loaded by default please see: https://nx.dev/recipes/environment-variables/define-environment-variables + ### `useNx=false` By setting `useNx` to `false` you can use the legacy task running implementations in `lerna` (`p-map` and `p-queue`) instead of using the default modern task runner implementation powered by [Nx](https://nx.dev). diff --git a/commands/run/command.js b/commands/run/command.js index 0a78af2515..95864d6139 100644 --- a/commands/run/command.js +++ b/commands/run/command.js @@ -78,6 +78,11 @@ exports.builder = (yargs) => { describe: "When useNx is not false, show verbose output from dependent tasks.", type: "boolean", }, + "load-env-files": { + group: "Command Options:", + describe: "When useNx is not false, automatically load .env files", + type: "boolean", + }, }); return filterOptions(yargs); diff --git a/commands/run/index.js b/commands/run/index.js index 412c2257bf..75a6aae308 100644 --- a/commands/run/index.js +++ b/commands/run/index.js @@ -311,6 +311,7 @@ class RunCommand extends Command { const extraOptions = { excludeTaskDependencies: mimicLernaDefaultBehavior, + loadDotEnvFiles: this.options.loadEnvFiles ?? true, }; return { targetDependencies, options, extraOptions }; diff --git a/commands/version/package.json b/commands/version/package.json index 3e73980512..a38c9c01f0 100644 --- a/commands/version/package.json +++ b/commands/version/package.json @@ -48,7 +48,7 @@ "@lerna/run-topologically": "file:../../utils/run-topologically", "@lerna/temp-write": "file:../../utils/temp-write", "@lerna/validation-error": "file:../../core/validation-error", - "@nrwl/devkit": ">=14.8.1 < 16", + "@nrwl/devkit": ">=14.8.6 < 16", "chalk": "^4.1.0", "dedent": "^0.7.0", "load-json-file": "^6.2.0", diff --git a/core/lerna/package.json b/core/lerna/package.json index 1107200a1e..4ea10466f6 100644 --- a/core/lerna/package.json +++ b/core/lerna/package.json @@ -59,11 +59,11 @@ "@lerna/publish": "file:../../commands/publish", "@lerna/run": "file:../../commands/run", "@lerna/version": "file:../../commands/version", - "@nrwl/devkit": ">=14.8.1 < 16", + "@nrwl/devkit": ">=14.8.6 < 16", "import-local": "^3.0.2", "inquirer": "^8.2.4", "npmlog": "^6.0.2", - "nx": ">=14.8.1 < 16", + "nx": ">=14.8.6 < 16", "typescript": "^3 || ^4" } } diff --git a/core/lerna/schemas/lerna-schema.json b/core/lerna/schemas/lerna-schema.json index 606ef66172..642a6435fc 100644 --- a/core/lerna/schemas/lerna-schema.json +++ b/core/lerna/schemas/lerna-schema.json @@ -911,6 +911,9 @@ "skipNxCache": { "$ref": "#/$defs/commandOptions/run/skipNxCache" }, + "loadEnvFiles": { + "$ref": "#/$defs/commandOptions/run/loadEnvFiles" + }, "npmClient": { "$ref": "#/$defs/globals/npmClient" @@ -1644,6 +1647,10 @@ "skipNxCache": { "type": "boolean", "description": "During `lerna run`, when true, skip the nx cache." + }, + "loadEnvFiles": { + "type": "boolean", + "description": "During `lerna run`, when false, skip loading of environment variables from .env files." } }, "version": { diff --git a/e2e/tests/lerna-run/lerna-run-nx-env-files.ts b/e2e/tests/lerna-run/lerna-run-nx-env-files.ts new file mode 100644 index 0000000000..909e25c771 --- /dev/null +++ b/e2e/tests/lerna-run/lerna-run-nx-env-files.ts @@ -0,0 +1,122 @@ +import { remove, writeFile } from "fs-extra"; +import { Fixture } from "../../utils/fixture"; +import { normalizeCommandOutput, normalizeEnvironment } from "../../utils/snapshot-serializer-utils"; + +expect.addSnapshotSerializer({ + serialize(str: string) { + return normalizeCommandOutput(normalizeEnvironment(str)); + }, + test(val: string) { + return val != null && typeof val === "string"; + }, +}); + +describe("lerna-run-nx-env-files", () => { + let fixture: Fixture; + + beforeEach(async () => { + fixture = await Fixture.create({ + name: "lerna-run-nx-env-files", + packageManager: "npm", + initializeGit: true, + runLernaInit: true, + installDependencies: true, + /** + * Because lerna run involves spawning further child processes, the tests would be too flaky + * if we didn't force deterministic terminal output by appending stderr to stdout instead + * of interleaving them. + */ + forceDeterministicTerminalOutput: true, + }); + + await writeFile(fixture.getWorkspacePath(".env"), `SOMETHING_IN_ENV_FILE=some_value_here`, "utf-8"); + + await fixture.lerna("create package-1 -y"); + await fixture.addScriptsToPackage({ + packagePath: "packages/package-1", + scripts: { + "log-env-var": "echo $SOMETHING_IN_ENV_FILE", + }, + }); + }); + afterEach(() => fixture.destroy()); + + describe("without nx enabled", () => { + it("should log an empty value", async () => { + // Enable legacy task runner + await fixture.overrideLernaConfig({ + useNx: false, + }); + + const output = await fixture.lerna("run log-env-var -- --silent"); + + expect(output.combinedOutput).toMatchInlineSnapshot(` + + lerna notice cli v999.9.9-e2e.0 + lerna info Executing command in 1 package: "npm run log-env-var --silent" + lerna info run Ran npm script 'log-env-var' in 'package-X' in X.Xs: + lerna success run Ran npm script 'log-env-var' in 1 package in X.Xs: + lerna success - package-X + + `); + }); + }); + + describe("with nx enabled", () => { + it("should log a value by default", async () => { + await fixture.addNxJsonToWorkspace(); + + const output = await fixture.lerna("run log-env-var -- --silent"); + + expect(output.combinedOutput).toMatchInlineSnapshot(` + + > Lerna (powered by Nx) Nx didn't recognize the following args: loadDotEnvFiles + + When using '--' all executor args have to be defined after '--'. + + + > package-X:log-env-var --silent + + > package-X@0.0.0 log-env-var + > echo $SOMETHING_IN_ENV_FILE "--silent" + some_value_here --silent + + + + > Lerna (powered by Nx) Successfully ran target log-env-var for project package-X + + + lerna notice cli v999.9.9-e2e.0 + + `); + }); + + it("should log an empty value when --load-env-files=false", async () => { + await fixture.addNxJsonToWorkspace(); + + const output = await fixture.lerna("run log-env-var --load-env-files=false -- --silent"); + + expect(output.combinedOutput).toMatchInlineSnapshot(` + + > Lerna (powered by Nx) Nx didn't recognize the following args: loadDotEnvFiles + + When using '--' all executor args have to be defined after '--'. + + + > package-X:log-env-var --silent + + > package-X@0.0.0 log-env-var + > echo $SOMETHING_IN_ENV_FILE "--silent" + --silent + + + + > Lerna (powered by Nx) Successfully ran target log-env-var for project package-X + + + lerna notice cli v999.9.9-e2e.0 + + `); + }); + }); +}); diff --git a/package-lock.json b/package-lock.json index a3518a5df8..c74dbbc527 100644 --- a/package-lock.json +++ b/package-lock.json @@ -84,7 +84,7 @@ "@actions/core": "^1.8.2", "@actions/github": "^5.0.3", "@lerna-test/helpers": "file:helpers", - "@nrwl/devkit": "14.8.1", + "@nrwl/devkit": "14.8.6", "@nrwl/nx-cloud": "14.7.0", "@types/fs-extra": "^9.0.13", "@types/is-ci": "^2.0.0", @@ -111,7 +111,7 @@ "node-jq": "^2.3.3", "normalize-newline": "^3.0.0", "normalize-path": "^3.0.0", - "nx": "14.8.1", + "nx": "14.8.6", "path-key": "^3.1.1", "prettier": "^2.2.1", "tacks": "1.2.6", @@ -422,7 +422,7 @@ "@lerna/run-topologically": "file:../../utils/run-topologically", "@lerna/temp-write": "file:../../utils/temp-write", "@lerna/validation-error": "file:../../core/validation-error", - "@nrwl/devkit": ">=14.8.1 < 16", + "@nrwl/devkit": ">=14.8.6 < 16", "chalk": "^4.1.0", "dedent": "^0.7.0", "load-json-file": "^6.2.0", @@ -550,11 +550,11 @@ "@lerna/publish": "file:../../commands/publish", "@lerna/run": "file:../../commands/run", "@lerna/version": "file:../../commands/version", - "@nrwl/devkit": ">=14.8.1 < 16", + "@nrwl/devkit": ">=14.8.6 < 16", "import-local": "^3.0.2", "inquirer": "^8.2.4", "npmlog": "^6.0.2", - "nx": ">=14.8.1 < 16", + "nx": ">=14.8.6 < 16", "typescript": "^3 || ^4" }, "bin": { @@ -2985,17 +2985,17 @@ } }, "node_modules/@nrwl/cli": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/@nrwl/cli/-/cli-14.8.1.tgz", - "integrity": "sha512-s2hKgfYXW77BFzpbm2zV5vb+L0Ke4G7tXXHAH6Y+OKBgMOKO8I0eceVF/tvQ1xNzwSBJSP7/pk1Bm6y1jx0V/Q==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/@nrwl/cli/-/cli-14.8.6.tgz", + "integrity": "sha512-R4udxekMd4jhoRPEksJu+224DocOIrAqenFo0D2R36epE5FaCnZQX7xg+b3TjRbdS10e426i4D9LuXdQmP5jJg==", "dependencies": { - "nx": "14.8.1" + "nx": "14.8.6" } }, "node_modules/@nrwl/devkit": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/@nrwl/devkit/-/devkit-14.8.1.tgz", - "integrity": "sha512-fyelIwzFQwf2UyBLDftKxzytqp4D0zw57uQ6fnw4FZ+oOYmnraEn7B9INqu9HGjSo234QhB8l/VUGcvXp6CTwA==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/@nrwl/devkit/-/devkit-14.8.6.tgz", + "integrity": "sha512-+3KqohOKeUuyS176jrwY0yeB3E2IFQ3jMkS0KizzsHGsZWdZbQ2WQ46hZ0/bvRh9Efl8CAg6n4fUWR0BXUePMA==", "dependencies": { "@phenomnomnominal/tsquery": "4.1.1", "ejs": "^3.1.7", @@ -3054,11 +3054,11 @@ } }, "node_modules/@nrwl/tao": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/@nrwl/tao/-/tao-14.8.1.tgz", - "integrity": "sha512-4HfYTollo0njRkFOhm94rmlI7Dra7OC53jMQu0LYc7hZ6rNhb1TVNlf1cu54bQaGs/EW9l0tlBJbWYV66NUX+g==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/@nrwl/tao/-/tao-14.8.6.tgz", + "integrity": "sha512-CByqrsfSJeonOd7TLAHP8bRYNWgDksxA7j+yncSzgQnFLEbZdJGG/AqqIovx8g6g2v0JS+nRgGC+w5UPf04UrQ==", "dependencies": { - "nx": "14.8.1" + "nx": "14.8.6" }, "bin": { "tao": "index.js" @@ -4503,8 +4503,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "node_modules/at-least-node": { "version": "1.0.0", @@ -5729,7 +5728,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -6605,7 +6603,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true, "engines": { "node": ">=0.4.0" } @@ -8327,7 +8324,6 @@ "version": "1.15.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", - "dev": true, "funding": [ { "type": "individual", @@ -12665,7 +12661,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, "engines": { "node": ">= 0.6" } @@ -12674,7 +12669,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "dependencies": { "mime-db": "1.52.0" }, @@ -13477,17 +13471,18 @@ "dev": true }, "node_modules/nx": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/nx/-/nx-14.8.1.tgz", - "integrity": "sha512-9fDmK+W6HCOpNrGPllbYdAxpXCEhbSHrO3rWd9th/m393Rc12UrP+QvV8GR8uKOti8A8vSKIT2tQpME0Xf3Xww==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/nx/-/nx-14.8.6.tgz", + "integrity": "sha512-QLU3sip/g3JdNO8n5Nw2esN+0G26Jsy3u1LlrB9Giu4zf/+KsfN8CcXMbEVqOnPR1FkCS52xliaq7IBQfvvMQA==", "hasInstallScript": true, "dependencies": { - "@nrwl/cli": "14.8.1", - "@nrwl/tao": "14.8.1", + "@nrwl/cli": "14.8.6", + "@nrwl/tao": "14.8.6", "@parcel/watcher": "2.0.4", "@yarnpkg/lockfile": "^1.1.0", "@yarnpkg/parsers": "^3.0.0-rc.18", "@zkochan/js-yaml": "0.0.6", + "axios": "^1.0.0", "chalk": "4.1.0", "chokidar": "^3.5.1", "cli-cursor": "3.1.0", @@ -13533,6 +13528,29 @@ } } }, + "node_modules/nx/node_modules/axios": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz", + "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/nx/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/nx/node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -14451,6 +14469,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -20014,7 +20037,7 @@ "@lerna/run-topologically": "file:../../utils/run-topologically", "@lerna/temp-write": "file:../../utils/temp-write", "@lerna/validation-error": "file:../../core/validation-error", - "@nrwl/devkit": ">=14.8.1 < 16", + "@nrwl/devkit": ">=14.8.6 < 16", "chalk": "^4.1.0", "dedent": "^0.7.0", "load-json-file": "^6.2.0", @@ -20315,17 +20338,17 @@ } }, "@nrwl/cli": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/@nrwl/cli/-/cli-14.8.1.tgz", - "integrity": "sha512-s2hKgfYXW77BFzpbm2zV5vb+L0Ke4G7tXXHAH6Y+OKBgMOKO8I0eceVF/tvQ1xNzwSBJSP7/pk1Bm6y1jx0V/Q==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/@nrwl/cli/-/cli-14.8.6.tgz", + "integrity": "sha512-R4udxekMd4jhoRPEksJu+224DocOIrAqenFo0D2R36epE5FaCnZQX7xg+b3TjRbdS10e426i4D9LuXdQmP5jJg==", "requires": { - "nx": "14.8.1" + "nx": "14.8.6" } }, "@nrwl/devkit": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/@nrwl/devkit/-/devkit-14.8.1.tgz", - "integrity": "sha512-fyelIwzFQwf2UyBLDftKxzytqp4D0zw57uQ6fnw4FZ+oOYmnraEn7B9INqu9HGjSo234QhB8l/VUGcvXp6CTwA==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/@nrwl/devkit/-/devkit-14.8.6.tgz", + "integrity": "sha512-+3KqohOKeUuyS176jrwY0yeB3E2IFQ3jMkS0KizzsHGsZWdZbQ2WQ46hZ0/bvRh9Efl8CAg6n4fUWR0BXUePMA==", "requires": { "@phenomnomnominal/tsquery": "4.1.1", "ejs": "^3.1.7", @@ -20376,11 +20399,11 @@ } }, "@nrwl/tao": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/@nrwl/tao/-/tao-14.8.1.tgz", - "integrity": "sha512-4HfYTollo0njRkFOhm94rmlI7Dra7OC53jMQu0LYc7hZ6rNhb1TVNlf1cu54bQaGs/EW9l0tlBJbWYV66NUX+g==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/@nrwl/tao/-/tao-14.8.6.tgz", + "integrity": "sha512-CByqrsfSJeonOd7TLAHP8bRYNWgDksxA7j+yncSzgQnFLEbZdJGG/AqqIovx8g6g2v0JS+nRgGC+w5UPf04UrQ==", "requires": { - "nx": "14.8.1" + "nx": "14.8.6" } }, "@octokit/auth-token": { @@ -21518,8 +21541,7 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "at-least-node": { "version": "1.0.0", @@ -22470,7 +22492,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -23169,8 +23190,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "delegates": { "version": "1.0.0", @@ -24514,8 +24534,7 @@ "follow-redirects": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", - "dev": true + "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" }, "forever-agent": { "version": "0.6.1", @@ -27361,11 +27380,11 @@ "@lerna/publish": "file:../../commands/publish", "@lerna/run": "file:../../commands/run", "@lerna/version": "file:../../commands/version", - "@nrwl/devkit": ">=14.8.1 < 16", + "@nrwl/devkit": ">=14.8.6 < 16", "import-local": "^3.0.2", "inquirer": "^8.2.4", "npmlog": "^6.0.2", - "nx": ">=14.8.1 < 16", + "nx": ">=14.8.6 < 16", "typescript": "^3 || ^4" } }, @@ -27912,14 +27931,12 @@ "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" }, "mime-types": { "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "requires": { "mime-db": "1.52.0" } @@ -28535,16 +28552,17 @@ "dev": true }, "nx": { - "version": "14.8.1", - "resolved": "https://registry.npmjs.org/nx/-/nx-14.8.1.tgz", - "integrity": "sha512-9fDmK+W6HCOpNrGPllbYdAxpXCEhbSHrO3rWd9th/m393Rc12UrP+QvV8GR8uKOti8A8vSKIT2tQpME0Xf3Xww==", + "version": "14.8.6", + "resolved": "https://registry.npmjs.org/nx/-/nx-14.8.6.tgz", + "integrity": "sha512-QLU3sip/g3JdNO8n5Nw2esN+0G26Jsy3u1LlrB9Giu4zf/+KsfN8CcXMbEVqOnPR1FkCS52xliaq7IBQfvvMQA==", "requires": { - "@nrwl/cli": "14.8.1", - "@nrwl/tao": "14.8.1", + "@nrwl/cli": "14.8.6", + "@nrwl/tao": "14.8.6", "@parcel/watcher": "2.0.4", "@yarnpkg/lockfile": "^1.1.0", "@yarnpkg/parsers": "^3.0.0-rc.18", "@zkochan/js-yaml": "0.0.6", + "axios": "^1.0.0", "chalk": "4.1.0", "chokidar": "^3.5.1", "cli-cursor": "3.1.0", @@ -28575,6 +28593,26 @@ "yargs-parser": "21.0.1" }, "dependencies": { + "axios": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz", + "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -29242,6 +29280,11 @@ "ipaddr.js": "1.9.1" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", diff --git a/package.json b/package.json index 351ea3dc59..417daf6a76 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "@actions/core": "^1.8.2", "@actions/github": "^5.0.3", "@lerna-test/helpers": "file:helpers", - "@nrwl/devkit": "14.8.1", + "@nrwl/devkit": "14.8.6", "@nrwl/nx-cloud": "14.7.0", "@types/fs-extra": "^9.0.13", "@types/is-ci": "^2.0.0", @@ -139,7 +139,7 @@ "node-jq": "^2.3.3", "normalize-newline": "^3.0.0", "normalize-path": "^3.0.0", - "nx": "14.8.1", + "nx": "14.8.6", "path-key": "^3.1.1", "prettier": "^2.2.1", "tacks": "1.2.6", diff --git a/website/docs/features/run-tasks.md b/website/docs/features/run-tasks.md index 4ba8b488bd..b4de8b90a0 100644 --- a/website/docs/features/run-tasks.md +++ b/website/docs/features/run-tasks.md @@ -70,3 +70,9 @@ Learn more [here](../api-reference/commands). For more control over the order tasks are executed, edit the [Task Pipeline Configuration](../concepts/task-pipeline-configuration). To speed up your task execution, learn how to [Cache Task Results](./cache-tasks) and [Distribute Task Execution](./distribute-tasks) + +## Automatic loading of .env files + +By default the modern task runner powered by Nx will automatically load `.env` files for you. You can set `--load-env-files` to false if you want to disable this behavior for any reason. + +For more details about what `.env` files will be loaded by default please see: https://nx.dev/recipes/environment-variables/define-environment-variables