Repository navigation
Restore Harper Pro branding in CLI and installer output, lost since 5.1.0-beta.1 #997
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
Draft
kriszyp
wants to merge
5
commits into
main
Choose a base branch
from
kris/runtime-product-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+62
−12
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f07d436
Brand Harper Pro's CLI and installer output from package.json product…
kriszyp 3c5ad0c
Update core to name the running product from package.json productName
kriszyp 97191cb
Check the CLI output and only the reachable manifests in the Harper P…
kriszyp 78f0db4
Bound the spawned commands in the Harper Pro product-name test
kriszyp 2ae030f
Update core to brand the missing-pid-file stop warning and component …
kriszyp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule core
updated
30 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Core names the product from the nearest package.json above its packageUtils.js; a shipped | ||
| // manifest on that path (e.g. dist/core/package.json) would silently rebrand Harper Pro as "Harper". | ||
| import assert from 'node:assert/strict'; | ||
| import { execFileSync } from 'node:child_process'; | ||
| import { createRequire } from 'node:module'; | ||
| import { mkdtempSync, rmSync } from 'node:fs'; | ||
| import { tmpdir } from 'node:os'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { dirname, join } from 'node:path'; | ||
|
|
||
| const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); | ||
|
|
||
| describe('Harper Pro product name', () => { | ||
| it('is the PRODUCT_NAME of the compiled core', () => { | ||
| const { PRODUCT_NAME } = createRequire(import.meta.url)(join(REPO_ROOT, 'dist/core/utility/packageUtils.js')); | ||
| assert.equal(PRODUCT_NAME, 'Harper Pro'); | ||
| }); | ||
|
|
||
| it('names the product in the CLI output', function () { | ||
| this.timeout(30_000); | ||
| const home = mkdtempSync(join(tmpdir(), 'harper-pro-help-')); | ||
| try { | ||
| const output = execFileSync(process.execPath, [join(REPO_ROOT, 'dist/bin/harper.js'), 'help'], { | ||
| encoding: 'utf8', | ||
| env: { ...process.env, HOME: home }, | ||
| timeout: 25_000, | ||
| }); | ||
| assert.match(output, /harper will simply run Harper Pro \(in the foreground\)/); | ||
| } finally { | ||
| rmSync(home, { recursive: true, force: true, maxRetries: 5 }); | ||
| } | ||
| }); | ||
|
|
||
| it('is not shadowed by a package.json the published core resolves first', function () { | ||
| this.timeout(60_000); | ||
| const [{ files }] = JSON.parse( | ||
| execFileSync('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], { | ||
| cwd: REPO_ROOT, | ||
| encoding: 'utf8', | ||
| timeout: 55_000, | ||
| }) | ||
| ); | ||
| const lookupPath = [ | ||
| 'dist/core/utility/package.json', | ||
| 'dist/core/package.json', | ||
| 'dist/package.json', | ||
| 'core/utility/package.json', | ||
| 'core/package.json', | ||
| ]; | ||
| assert.deepEqual( | ||
| files.map(({ path }) => path).filter((path) => lookupPath.includes(path)), | ||
| [] | ||
| ); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows,
npmis a command/batch file (npm.cmd) rather than a direct binary executable. CallingexecFileSync('npm', ...)directly without a shell on Windows will result in anENOENTerror. To ensure cross-platform compatibility for the test suite, we should resolve the correct command name based on the platform.