Skip to content

Commit

Permalink
fix: omit deleted files from log message (#3144)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas authored Aug 12, 2021
1 parent 7195ad9 commit 526ac01
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/commands/functions/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,17 @@ const scaffoldFromTemplate = async function (context, flags, args, functionsDir)
const vars = { name }
let functionPackageJson

// These files will not be part of the log message because they'll likely
// be removed before the command finishes.
const omittedFromOutput = new Set(['.netlify-function-template.js', 'package.json', 'package-lock.json'])
const createdFiles = await copy(pathToTemplate, functionPath, vars)
createdFiles.forEach((filePath) => {
if (filePath.endsWith('.netlify-function-template.js')) return
context.log(`${NETLIFYDEVLOG} ${chalk.greenBright('Created')} ${filePath}`)
const filename = path.basename(filePath)

if (!omittedFromOutput.has(filename)) {
context.log(`${NETLIFYDEVLOG} ${chalk.greenBright('Created')} ${filePath}`)
}

fs.chmodSync(path.resolve(filePath), TEMPLATE_PERMISSIONS)
if (filePath.includes('package.json')) {
functionPackageJson = path.resolve(filePath)
Expand Down

1 comment on commit 526ac01

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 331 MB

Please sign in to comment.