Skip to content

Commit

Permalink
Read ownerOrAuthorName from Raycast built-in API
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore committed Jul 3, 2024
1 parent e5cf044 commit 6195d5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Optional. Options for launch the callback command. It will be used in the callba

- `name` defaults to `environment.commandName`
- `extensionName` defaults to `environment.extensionName`
- `ownerOrAuthorName` defaults to owner or author name
- `ownerOrAuthorName` defaults to `environment.ownerOrAuthorName` or the field in `package.json`
- `type` defaults to `LaunchType.UserInitiated`

You can set it to `false` to disable command callback.
Expand Down
6 changes: 4 additions & 2 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ export const crossLaunchCommand = async (

// eslint-disable-next-line unicorn/prefer-module, @typescript-eslint/no-unsafe-assignment
const pack = readPackageUpSync({cwd: __dirname, normalize: false}) as any;
const ownerOrAuthorName = (pack?.packageJson?.owner ??
pack?.packageJson?.author) as string;
const ownerOrAuthorName =
// The `ownerOrAuthorName` was introduced in @raycast/[email protected]. We use a fallback to support older versions.
environment.ownerOrAuthorName ??
((pack?.packageJson?.owner ?? pack?.packageJson?.author) as string);

if ('ownerOrAuthorName' in options) {
const targetHandle = `${options.ownerOrAuthorName}/${options.extensionName}`;
Expand Down

0 comments on commit 6195d5c

Please sign in to comment.