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
6 changes: 3 additions & 3 deletions packages/twilio-run/__tests__/templating/filesystem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ test('installation with an existing dot-env file', async () => {
expect(writeFile).toHaveBeenCalledWith(
join('testing', '.env'),
'# Comment\n' +
'FOO=BAR\n' +
'\n\n' +
'# Variables for function ".env"\n' + // This seems to be a bug but is the output.
'FOO=BAR\n' +
'\n\n' +
'# Variables for function "example"\n' +
'# ---\n' +
'HELLO=WORLD\n',
'utf8'
Expand Down
1 change: 1 addition & 0 deletions packages/twilio-run/src/templating/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export async function getTemplateFiles(
return (
file.name === 'package.json' ||
file.name === '.env' ||
file.name === '.env.example' ||
file.name === 'README.md'
);
})
Expand Down
6 changes: 3 additions & 3 deletions packages/twilio-run/src/templating/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { install, InstallResult } from 'pkg-install';
import {
downloadFile,
fileExists,
mkdir,
readFile,
writeFile,
mkdir,
} from '../utils/fs';
import { logger } from '../utils/logger';
import { TemplateFileInfo } from './data';
Expand Down Expand Up @@ -154,14 +154,14 @@ export async function writeFiles(
path.join(assetsTargetDir, file.directory, file.name)
),
};
} else if (file.type === '.env') {
} else if (file.type === '.env' || file.type === '.env.example') {
return {
title: 'Configuring Environment Variables in .env',
task: async (ctx: any) => {
const output = await writeEnvFile(
file.content,
targetDir,
file.name
namespace
);
ctx.env = output;
},
Expand Down