ThreadJob icon indicating copy to clipboard operation
ThreadJob copied to clipboard

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

Open daxian-dbw opened this issue 2 years ago • 4 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest version
  • [X] 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:

  • https://github.com/PowerShell/PowerShell/pull/19744#issuecomment-1612133227
  • https://github.com/PowerShell/PowerShell/pull/19744#issuecomment-1629737949

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

daxian-dbw avatar Jul 10 '23 21:07 daxian-dbw

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 https://github.com/PowerShell/PowerShell/pull/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)

kilasuit avatar Jul 28 '23 15:07 kilasuit

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

ThomasNieto avatar Aug 14 '24 20:08 ThomasNieto

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

jshigetomi avatar Sep 23 '24 23:09 jshigetomi

fixed by #42

kilasuit avatar Apr 10 '25 07:04 kilasuit