feat(misc): remove dotenv from executors (#18719)
This commit is contained in:
parent
8f6f71ec44
commit
9d5a3830be
@ -144,6 +144,43 @@ describe('Node Applications', () => {
|
|||||||
expect(additionalResult).toContain('Hello Additional World!');
|
expect(additionalResult).toContain('Hello Additional World!');
|
||||||
}, 60000);
|
}, 60000);
|
||||||
|
|
||||||
|
it('should be able to generate an empty application with variable in .env file', async () => {
|
||||||
|
const originalEnvPort = process.env.PORT;
|
||||||
|
const port = 3457;
|
||||||
|
process.env.PORT = `${port}`;
|
||||||
|
const nodeapp = uniq('nodeapp');
|
||||||
|
|
||||||
|
runCLI(
|
||||||
|
`generate @nx/node:app ${nodeapp} --linter=eslint --bundler=webpack --framework=none`
|
||||||
|
);
|
||||||
|
await setMaxWorkers();
|
||||||
|
|
||||||
|
updateFile('.env', `NX_FOOBAR="test foo bar"`);
|
||||||
|
|
||||||
|
updateFile(
|
||||||
|
`apps/${nodeapp}/src/main.ts`,
|
||||||
|
`console.log('foobar: ' + process.env['NX_FOOBAR']);`
|
||||||
|
);
|
||||||
|
|
||||||
|
await runCLIAsync(`build ${nodeapp}`);
|
||||||
|
checkFilesExist(`dist/apps/${nodeapp}/main.js`);
|
||||||
|
|
||||||
|
// check serving
|
||||||
|
const p = await runCommandUntil(
|
||||||
|
`serve ${nodeapp} --port=${port} --watch=false`,
|
||||||
|
(output) => {
|
||||||
|
process.stdout.write(output);
|
||||||
|
return output.includes(`foobar: test foo bar`);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
await promisifiedTreeKill(p.pid, 'SIGKILL');
|
||||||
|
await killPorts(port);
|
||||||
|
} finally {
|
||||||
|
process.env.port = originalEnvPort;
|
||||||
|
}
|
||||||
|
}, 60000);
|
||||||
|
|
||||||
it('should be able to generate an express application', async () => {
|
it('should be able to generate an express application', async () => {
|
||||||
const nodeapp = uniq('nodeapp');
|
const nodeapp = uniq('nodeapp');
|
||||||
const originalEnvPort = process.env.PORT;
|
const originalEnvPort = process.env.PORT;
|
||||||
|
|||||||
@ -36,7 +36,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@phenomnomnominal/tsquery": "~5.0.1",
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
||||||
"detect-port": "^1.5.1",
|
"detect-port": "^1.5.1",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"semver": "7.5.3",
|
"semver": "7.5.3",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"@nx/devkit": "file:../devkit",
|
"@nx/devkit": "file:../devkit",
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import {
|
|||||||
output,
|
output,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { getExecutorInformation } from 'nx/src/command-line/run/executor-utils';
|
import { getExecutorInformation } from 'nx/src/command-line/run/executor-utils';
|
||||||
import 'dotenv/config';
|
|
||||||
import { existsSync, readdirSync, unlinkSync, writeFileSync } from 'fs';
|
import { existsSync, readdirSync, unlinkSync, writeFileSync } from 'fs';
|
||||||
import { basename, dirname, join } from 'path';
|
import { basename, dirname, join } from 'path';
|
||||||
import { getTempTailwindPath } from '../../utils/ct-helpers';
|
import { getTempTailwindPath } from '../../utils/ct-helpers';
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"fast-glob": "3.2.7",
|
"fast-glob": "3.2.7",
|
||||||
"fs-extra": "^11.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import * as chalk from 'chalk';
|
import * as chalk from 'chalk';
|
||||||
import type { ExecutorContext } from '@nx/devkit';
|
import type { ExecutorContext } from '@nx/devkit';
|
||||||
import { cacheDir, joinPathFragments, logger, stripIndents } from '@nx/devkit';
|
import { cacheDir, joinPathFragments, logger, stripIndents } from '@nx/devkit';
|
||||||
|
|||||||
@ -38,7 +38,6 @@
|
|||||||
"@jest/test-result": "^29.4.1",
|
"@jest/test-result": "^29.4.1",
|
||||||
"@phenomnomnominal/tsquery": "~5.0.1",
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"identity-obj-proxy": "3.0.0",
|
"identity-obj-proxy": "3.0.0",
|
||||||
"jest-config": "^29.4.1",
|
"jest-config": "^29.4.1",
|
||||||
"jest-resolve": "^29.4.1",
|
"jest-resolve": "^29.4.1",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import { runCLI } from 'jest';
|
import { runCLI } from 'jest';
|
||||||
import { readConfig, readConfigs } from 'jest-config';
|
import { readConfig, readConfigs } from 'jest-config';
|
||||||
import { utils as jestReporterUtils } from '@jest/reporters';
|
import { utils as jestReporterUtils } from '@jest/reporters';
|
||||||
|
|||||||
@ -38,7 +38,6 @@
|
|||||||
"@svgr/webpack": "^8.0.1",
|
"@svgr/webpack": "^8.0.1",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"copy-webpack-plugin": "^10.2.4",
|
"copy-webpack-plugin": "^10.2.4",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"fs-extra": "^11.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
"ignore": "^5.0.4",
|
"ignore": "^5.0.4",
|
||||||
"semver": "7.5.3",
|
"semver": "7.5.3",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import {
|
import {
|
||||||
ExecutorContext,
|
ExecutorContext,
|
||||||
logger,
|
logger,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import {
|
import {
|
||||||
ExecutorContext,
|
ExecutorContext,
|
||||||
parseTargetString,
|
parseTargetString,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import { ExecutorContext, parseTargetString, runExecutor } from '@nx/devkit';
|
import { ExecutorContext, parseTargetString, runExecutor } from '@nx/devkit';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import {
|
import {
|
||||||
ExecutorContext,
|
ExecutorContext,
|
||||||
parseTargetString,
|
parseTargetString,
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@phenomnomnominal/tsquery": "~5.0.1",
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"fs-extra": "^11.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"@nx/devkit": "file:../devkit",
|
"@nx/devkit": "file:../devkit",
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
|
|
||||||
import type { ExecutorContext } from '@nx/devkit';
|
import type { ExecutorContext } from '@nx/devkit';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@ -37,7 +37,6 @@
|
|||||||
"autoprefixer": "^10.4.9",
|
"autoprefixer": "^10.4.9",
|
||||||
"babel-plugin-transform-async-to-promises": "^0.8.15",
|
"babel-plugin-transform-async-to-promises": "^0.8.15",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"fast-glob": "^3.2.7",
|
"fast-glob": "^3.2.7",
|
||||||
"postcss": "^8.4.14",
|
"postcss": "^8.4.14",
|
||||||
"rollup": "^2.56.2",
|
"rollup": "^2.56.2",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import * as ts from 'typescript';
|
import * as ts from 'typescript';
|
||||||
import * as rollup from 'rollup';
|
import * as rollup from 'rollup';
|
||||||
import * as peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
import * as peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
"migrations": "./migrations.json"
|
"migrations": "./migrations.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"@phenomnomnominal/tsquery": "~5.0.1",
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
||||||
"semver": "7.5.3",
|
"semver": "7.5.3",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { ExecutorContext, logger } from '@nx/devkit';
|
import { ExecutorContext, logger } from '@nx/devkit';
|
||||||
import * as build from '@storybook/core-server';
|
import * as build from '@storybook/core-server';
|
||||||
import { CLIOptions } from '@storybook/types';
|
import { CLIOptions } from '@storybook/types';
|
||||||
import 'dotenv/config';
|
|
||||||
import {
|
import {
|
||||||
pleaseUpgrade,
|
pleaseUpgrade,
|
||||||
storybookConfigExistsCheck,
|
storybookConfigExistsCheck,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { ExecutorContext, logger } from '@nx/devkit';
|
import { ExecutorContext, logger } from '@nx/devkit';
|
||||||
import * as build from '@storybook/core-server';
|
import * as build from '@storybook/core-server';
|
||||||
import 'dotenv/config';
|
|
||||||
import {
|
import {
|
||||||
pleaseUpgrade,
|
pleaseUpgrade,
|
||||||
storybookConfigExistsCheck,
|
storybookConfigExistsCheck,
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import { joinPathFragments, logger } from '@nx/devkit';
|
import { joinPathFragments, logger } from '@nx/devkit';
|
||||||
import { findNodes } from '@nx/js';
|
import { findNodes } from '@nx/js';
|
||||||
import 'dotenv/config';
|
|
||||||
import { existsSync, readFileSync } from 'fs';
|
import { existsSync, readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { gte } from 'semver';
|
import { gte } from 'semver';
|
||||||
|
|||||||
@ -31,7 +31,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@phenomnomnominal/tsquery": "~5.0.1",
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
||||||
"@swc/helpers": "~0.5.0",
|
"@swc/helpers": "~0.5.0",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"enquirer": "~2.3.6",
|
"enquirer": "~2.3.6",
|
||||||
"@nx/devkit": "file:../devkit",
|
"@nx/devkit": "file:../devkit",
|
||||||
"@nx/js": "file:../js",
|
"@nx/js": "file:../js",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import {
|
import {
|
||||||
ExecutorContext,
|
ExecutorContext,
|
||||||
logger,
|
logger,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import { ExecutorContext } from '@nx/devkit';
|
import { ExecutorContext } from '@nx/devkit';
|
||||||
import { createServer, InlineConfig, mergeConfig, ViteDevServer } from 'vite';
|
import { createServer, InlineConfig, mergeConfig, ViteDevServer } from 'vite';
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@
|
|||||||
"copy-webpack-plugin": "^10.2.4",
|
"copy-webpack-plugin": "^10.2.4",
|
||||||
"css-loader": "^6.4.0",
|
"css-loader": "^6.4.0",
|
||||||
"css-minimizer-webpack-plugin": "^5.0.0",
|
"css-minimizer-webpack-plugin": "^5.0.0",
|
||||||
"dotenv": "~16.3.1",
|
|
||||||
"fork-ts-checker-webpack-plugin": "7.2.13",
|
"fork-ts-checker-webpack-plugin": "7.2.13",
|
||||||
"ignore": "^5.0.4",
|
"ignore": "^5.0.4",
|
||||||
"less": "4.1.3",
|
"less": "4.1.3",
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import { ExecutorContext, logger, stripIndents } from '@nx/devkit';
|
import { ExecutorContext, logger, stripIndents } from '@nx/devkit';
|
||||||
import { eachValueFrom } from '@nx/devkit/src/utils/rxjs-for-await';
|
import { eachValueFrom } from '@nx/devkit/src/utils/rxjs-for-await';
|
||||||
import type { Configuration, Stats } from 'webpack';
|
import type { Configuration, Stats } from 'webpack';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user