Skip to content
Permalink
Browse files

chore: remove automatic dotenv insertion

  • Loading branch information...
manekinekko committed Aug 13, 2019
1 parent 6bcc8df commit a51f6afb907efbe0584c2dad4a32836d4540151f
Showing with 6 additions and 14 deletions.
  1. +1 −1 package.json
  2. +2 −12 schematics/install/index.spec.ts
  3. +3 −1 schematics/install/index.ts
@@ -8,7 +8,7 @@
"test": "jest",
"precommit": "lint-staged",
"prettier": "prettier src/**/*.ts --write && git status",
"build": " npm run build:lib && npm run build:schematics",
"build": "npm run build:lib && npm run build:schematics && npm test",
"build:lib": "tsc -p tsconfig.json",
"build:schematics": "tsc -p tsconfig.schematics.json",
"prepublish:npm": "npm run build",
@@ -161,11 +161,11 @@ describe('Running nest add @nestjs/azure-storage in a clean project', () => {
expect(fileContent).toContain('AZURE_STORAGE_ACCOUNT=testing');
});

it(`should add the require('dotenv') call in src/main.ts`, () => {
it(`should not add the require('dotenv') call in src/main.ts`, () => {
runner.runSchematic('nest-add', azureOptions, tree);

const fileContent = tree.readContent('/src/main.ts');
expect(fileContent).toContain(
expect(fileContent).not.toContain(
`if (process.env.NODE_ENV !== 'production') require('dotenv').config();`,
);
});
@@ -237,16 +237,6 @@ describe('Running nest add @nestjs/azure-storage in a complex project', () => {
}).toThrow('Could not read package.json.');
});

it('should throw if missing src/main.ts', () => {
tree.create('/package.json', JSON.stringify({}));

expect(() => {
runner.runSchematic('nest-add', azureOptions, tree);
}).toThrow(
'Could not locate "src/main.ts". Make sure to provide the correct --mainFileName argument.',
);
});

it('should throw if missing src/app.module.ts', () => {
tree.create('/package.json', JSON.stringify({}));
tree.create('/src/main.ts', MAIN_FILE);
@@ -59,7 +59,9 @@ export default function(options: AzureOptions): Rule {
chain([
addDependenciesAndScripts(),
addDotEnvConfig(options),
addDotEnvCall(options),
// Note: we are going to let the user decide where and how they
// would like to insert this line in their app.
// addDotEnvCall(options),
updateGitIgnore(options),
addAzureStorageModuleToImports(options),
]),

0 comments on commit a51f6af

Please sign in to comment.
You can’t perform that action at this time.