Skip to content

Commit f746ead

Browse files
authored
Restore and clarify deployment help links and coverage (#233)
* fix(#215): restore deploy help related links * fix(#215): close raw upload coverage gaps * #215 fix: nomalize command help related links
1 parent 4a996ef commit f746ead

5 files changed

Lines changed: 54 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
1818
### Changed
1919

2020
- `Deploy-NovaPackage` now shows a concise resolved-upload summary before execution, reports progress while multiple artifacts are uploading, and prints a short completion summary with a suggested verification step after successful raw uploads.
21+
- `Get-NovaProjectInfo` now fails with clearer recovery guidance when `-Path` does not exist, points to a file, or the target folder is missing `project.json`.
2122

2223
### Deprecated
2324

RELEASE_NOTE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ This file summarizes the release notes for NovaModuleTools. **UNRELEASED** chang
1414
### Changed
1515

1616
- `Deploy-NovaPackage` now shows clearer terminal feedback during raw package uploads, including a concise pre-flight summary, progress across multiple artifacts, and a short verification hint after success.
17+
- `Get-NovaProjectInfo` now explains how to recover when `-Path` is invalid or the target folder is not a Nova project root.
1718

1819
### Deprecated
1920

2021
### Removed
2122

2223
### Fixed
2324

24-
- PowerShell command help `RELATED LINKS` now use valid help-topic links instead of GitHub blob pages.
25+
- PowerShell command help `RELATED LINKS` now use valid help-topic.
2526

2627
### Security
2728

docs/NovaModuleTools/en-US/Get-NovaProjectInfo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ When you use `-Version`, the command returns only the project version string ins
5050

5151
When you use `-Installed`, the command returns the installed `NovaModuleTools` module name and version string instead of project metadata.
5252

53+
When `-Path` does not resolve to an existing project root folder, or the folder does not contain `project.json`,
54+
the command fails with an actionable error that tells you how to recover.
55+
5356
## EXAMPLES
5457

5558
### EXAMPLE 1
@@ -185,6 +188,9 @@ Returned by default. The object includes project metadata, defaulted build setti
185188

186189
This command throws a clear error when `project.json` is missing or empty.
187190

191+
If `-Path` points to a file or a folder that does not exist, `Get-NovaProjectInfo` tells you to rerun it from a
192+
Nova project root or pass `-Path` to the folder that contains `project.json`.
193+
188194
`-Installed` does not require a project path or a `project.json` file.
189195

190196
## RELATED LINKS

src/private/shared/GetNovaProjectInfoContext.ps1

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,44 @@ function Get-NovaProjectInfoContext {
44
[Parameter(Mandatory)][string]$Path
55
)
66

7-
$projectRoot = (Resolve-Path -LiteralPath $Path).Path
7+
$projectRoot = Resolve-NovaProjectInfoRootPath -Path $Path
88
$projectJson = [System.IO.Path]::Join($projectRoot, 'project.json')
9-
if (-not (Test-Path -LiteralPath $projectJson)) {
10-
Stop-NovaOperation -Message "Not a project folder. project.json not found: $projectJson" -ErrorId 'Nova.Environment.ProjectJsonNotFound' -Category ObjectNotFound -TargetObject $projectJson
11-
}
9+
Assert-NovaProjectJsonPresence -ProjectRoot $projectRoot -ProjectJson $projectJson
1210

1311
return [pscustomobject]@{
1412
ProjectRoot = $projectRoot
1513
ProjectJson = $projectJson
1614
JsonData = Read-ProjectJsonData -ProjectJsonPath $projectJson
1715
}
1816
}
17+
18+
function Resolve-NovaProjectInfoRootPath {
19+
[CmdletBinding()]
20+
param(
21+
[Parameter(Mandatory)][string]$Path
22+
)
23+
24+
try {
25+
$resolvedPath = (Resolve-Path -LiteralPath $Path -ErrorAction Stop).Path
26+
} catch {
27+
Stop-NovaOperation -Message "Project path not found: $Path. Run Get-NovaProjectInfo from a Nova project root or pass -Path to an existing project folder." -ErrorId 'Nova.Environment.ProjectPathNotFound' -Category ObjectNotFound -TargetObject $Path
28+
}
29+
30+
if (-not (Test-Path -LiteralPath $resolvedPath -PathType Container)) {
31+
Stop-NovaOperation -Message "Project path must be a folder: $resolvedPath. Pass -Path to the project root that contains project.json." -ErrorId 'Nova.Environment.ProjectPathNotDirectory' -Category InvalidArgument -TargetObject $resolvedPath
32+
}
33+
34+
return $resolvedPath
35+
}
36+
37+
function Assert-NovaProjectJsonPresence {
38+
[CmdletBinding()]
39+
param(
40+
[Parameter(Mandatory)][string]$ProjectRoot,
41+
[Parameter(Mandatory)][string]$ProjectJson
42+
)
43+
44+
if (-not (Test-Path -LiteralPath $ProjectJson -PathType Leaf)) {
45+
Stop-NovaOperation -Message "project.json not found in project root: $ProjectRoot. Run Get-NovaProjectInfo from a folder that contains project.json or pass -Path to that folder." -ErrorId 'Nova.Environment.ProjectJsonNotFound' -Category ObjectNotFound -TargetObject $ProjectJson
46+
}
47+
}

tests/private/shared/GetNovaProjectInfoContext.Tests.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,19 @@ Describe 'Get-NovaProjectInfoContext' {
1515
Remove-Item -LiteralPath $script:root -Recurse -Force -ErrorAction SilentlyContinue
1616
}
1717

18+
It 'throws a clear error when the project path does not exist' {
19+
{Get-NovaProjectInfoContext -Path (Join-Path $script:root 'missing')} | Should -Throw '*Project path not found:*Run Get-NovaProjectInfo from a Nova project root or pass -Path to an existing project folder.*'
20+
}
21+
22+
It 'throws a clear error when the project path points to a file instead of a folder' {
23+
$filePath = Join-Path $script:root 'project.txt'
24+
Set-Content -LiteralPath $filePath -Value 'content'
25+
26+
{Get-NovaProjectInfoContext -Path $filePath} | Should -Throw '*Project path must be a folder:*Pass -Path to the project root that contains project.json.*'
27+
}
28+
1829
It 'throws when project.json is missing in the given folder' {
19-
{Get-NovaProjectInfoContext -Path $script:root} | Should -Throw
30+
{Get-NovaProjectInfoContext -Path $script:root} | Should -Throw '*project.json not found in project root:*Run Get-NovaProjectInfo from a folder that contains project.json or pass -Path to that folder.*'
2031
}
2132

2233
It 'returns the resolved root, project.json path, and parsed JSON data' {

0 commit comments

Comments
 (0)