Splaxi / PSNotification

Small module that enables you to call any kind of HTTP endpoint
MIT License
0 stars 0 forks source link

:bug: fix casing of module in PowerShell Gallery #15

Open FH-Inway opened 1 year ago

FH-Inway commented 1 year ago

This module is listed as psnotification (all lower case) in PowerShell Gallery: https://www.powershellgallery.com/packages/psnotification

On unix environments (at least Ubuntu), this causes issues with the Import-Module cmdlet, resulting in this error message: "The specified module 'psnotification' was not loaded because no valid module file was found in any module directory."

See also https://github.com/PowerShell/PowerShell/issues/17342

Background: I'm playing around with GitHub Codespaces and the d365fo.tools and d365fo.integrations modules to see what it would take to be able to develop or use them there. One issue is the dependency on PSNotification, which cannot be loaded if a cmdlet is called that uses it.

Splaxi commented 1 year ago

You're very deep into the mechanics of things these days! 🤘🔥

Let's make it work - so we can learn to utilize the Codespaces offering...

FH-Inway commented 1 year ago

Actually for the d365fo modules, this is no longer an issue, because both modules do not make use of PSNotification. So it can be removed as a required module in both. I also found a workaround where a script is executed on Codespaces container creation that installs psnotification and then renames the installation folder to PSNotification :smile: Still would be a good idea to republish it on the gallery in case others want to make use of the module on a unix environment.

LaurentDardenne commented 10 months ago

A note about this

then renames the installation folder to PSNotification

This is the name of the Nuget package which is used as the directory name by Install-Module (or Install-PSResource) :

VERBOSE: DownloadPackage' - name='psnotification', version='0.5.3',destination='/tmp/1189672495/psnotification.0.5.3/psnotification.0.5.3.nupkg', uri='[https://www.powershellgallery.com/api/v2](https://www.powershellgallery.com/api/v2/package/psnotification/0.5.3)

It's the package that needs to be fixed I think, the manifest and module name have different case :

image

According to the traces, Import-module looks for manifest or module names identical to the install path: image

Publish-Module and Install-Module do no control (warning) on these points.

Splaxi commented 10 months ago

@FH-Inway

Didn't we conclude that we could remove this dependency?

LaurentDardenne commented 10 months ago

One last remark. I didn't know how to reproduce this scenario, but by checking the first publication of the module in PSGallery ( FileList ) we see that it is is made with a lowercase name.

And that name won't change.

FH-Inway commented 10 months ago

Didn't we conclude that we could remove this dependency?

@Splaxi We did and already removed it from d365fo.tools and d365fo.integrations. Still would be good to publish the PSNotification module to the PSGallery with the fixed name (e.g. matching casing).

@LaurentDardenne Maybe you can tell us how you came upon this issue or how you are using the PSNotification module? The issue can be reproduced by importing the module on a unix environment (e.g. a Github codespace).

LaurentDardenne commented 10 months ago

Actually I'm working on this module (Github Action).

I'm having a lot of trouble with some scenarios using a lowercase package name, so I searched the Powershell repository and found, among others, on the issue cited in the beginning of this thread. I took the liberty of making my contribution to try to understand how this problem occurs.