Skip to content

Build-Module can produce invalid module without raising error #101

Open
@daviesj

Description

@daviesj

In at least two cases, Build-Module produces a module which cannot be imported and does not generate an error:

  • When you have a valid Build.psd1 and manifest but no source .ps1 files, Build-Module creates the output folder and the output manifest, but no .psm1.
  • When you have certain syntax errors (such as mismatched braces or misspelled function), Build-Module produces a .psm1 that will fail to import and does not complain about it.

It would be helpful if the tool responsible for building a script module could avoid producing output which cannot be imported and report an error when it is unable to do so.

If I were designing a build tool like this:

  • In the case of no source files, it would produce an error message and no output would be created. Another option would be to generate an empty .psm1 file if there is some reason for wanting to be able to generate a manifest even when there are no source files. An empty .psm1 can still be imported.
  • When there are syntax errors that would prevent the output module from being imported, it would report the errors, including source file and location, and generate no output.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions