Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release a proxy module of ThreadJob that points to Microsoft.PowerShell.ThreadJob #30

Open
3 tasks done
daxian-dbw opened this issue Jul 10, 2023 · 3 comments
Open
3 tasks done

Comments

@daxian-dbw
Copy link
Member

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

Given that the Microsoft.PowerShell.ThreadJob is going to replace the ThreadJob going forward, a proxy module of ThreadJob should be released to PowerShell Gallery to point to Microsoft.PowerShell.ThreadJob and to warn about deprecation of ThreadJob.

Here is the decision from PowerShell Committe:

Create a new version of the ThreadJob module which proxies to the new Microsoft.PowerShell.ThreadJob module

  • the proxy should include a warning message that the ThreadJob module will be deprecated and removed in PS 7.6

I agree it would make sense to have the ThreadJob module on PSGallery also indicate being deprecated and using Microsoft.PowerShell.ThreadJob instead. In that case, I would also agree that proxy module would be done outside of this PR and repo since it's published to PSGallery. It would make sense to have that proxy developed in https://github.com/powershell/threadjob

Expected behavior

A proxy module of ThreadJob to be published to PowerShell Gallery, to call out it's being deprecated.

Actual behavior

N/A

Error details

No response

Environment data

N/A

Version

N/A

Visuals

No response

@kilasuit
Copy link

This is perhaps more work than I would expect is needed as a module author to do when renaming a module.

Personally my plan for this would have been

  • release a v2.0.4 of the ThreadJob module, which is functionally just v2.0.3
    • Amending the psm1 to include a verbose message on import giving a simple deprecation notice of Warning - This module has been renamed to Microsoft.PowerShell.ThreadJob and future enhancements will come under that new module. Please update accordingly as this module will not be available as part of PowerShell 7.6 onwards
    • I'd also follow this suggestion for helping future discoverability of Module Name Changes and add new tags to the PSD1 for the v2.0.4 release
    • As there isn't currently a way already to auto redirect users either on the PowerShell Gallery or as part of PowerShellGet / PSResourceGet, discuss about hiding ThreadJob Module on the Gallery (would still allow it to be returned from PowerShellGet`PSResourceGetas this would then show theMicrosoft.PowerShell.ThreadJobmodule more prominantly. Also discuss can that module be prioritised in search results forThreadJob` which I don't think it can be right now.
  • I'd then release Microsoft.PowerShell.ThreadJob v2.1.1 with a minor amendment to the tags of the psd1 & release notes as per the above comment
  • Then I'd look at amending the PR in Include the newer Microsoft.PowerShell.ThreadJob module - fixes #19742 PowerShell#19744 to the v.2.0.4 version of ThreadJob as well as adding the v.2.1.1 of Microsoft.PowerShell.ThreadJob

ProxyModules are great but I personally think use of one in this instance is perhaps more work than needed, though as shown above there is also need for additional work in the gallery and other tooling too (which I'll raise about now)

@ThomasNieto
Copy link

I went ahead and created the proxy module. It has a required dependency on Microsoft.PowerShell.ThreadJob and includes two aliases to forward calls to the new module. A warning is included if the old module is imported.

@daxian-dbw how would you like the code to be merged in order to publish the updated module with the proxy/alias?

ThreadJob.psd1

@{
RootModule = 'ThreadJob.psm1'
ModuleVersion = '3.0.0'
GUID = '0e7b895d-2fec-43f7-8cae-11e8d16f6e40'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = '(c) Microsoft Corporation. All rights reserved.'
Description = 'ThreadJob module has been renamed to Microsoft.PowerShell.ThreadJob.'
PowerShellVersion = '5.1'
RequiredModules = @('Microsoft.PowerShell.ThreadJob')
FunctionsToExport = @()
CmdletsToExport = @()
AliasesToExport = @('Start-ThreadJob', 'ThreadJob\Start-ThreadJob')
PrivateData = @{
    PSData = @{
      LicenseUri = 'https://github.com/PowerShell/ThreadJob/blob/master/LICENSE'
      ProjectUri = 'https://github.com/PowerShell/ThreadJob'
    }
  }
}

ThreadJob.psm1

Write-Warning -Message "The ThreadJob has been renamed to Microsoft.PowerShell.ThreadJob. ThreadJob module will no longer be included with PowerShell as of 7.x"

Set-Alias -Name Start-ThreadJob -Value Microsoft.PowerShell.ThreadJob\Start-ThreadJob
Set-Alias -Name ThreadJob\Start-ThreadJob -Value Microsoft.PowerShell.ThreadJob\Start-ThreadJob

Export-ModuleMember -Alias Start-ThreadJob, ThreadJob\Start-ThreadJob

@jshigetomi
Copy link

@ThomasNieto Thanks for this! I will incorporate this and publish it using Microsoft's new guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants