-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add config-converter extension #17923
base: main
Are you sure you want to change the base?
Conversation
Congratulations on your new Raycast extension! 🚀 Due to our current reduced availability, the initial review may take up to 10-15 business days Once the PR is approved and merged, the extension will be available on our Store. |
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.
PR Summary
This PR adds a new Config Converter extension that converts JSON objects to shell environment variables, with options for regular and base64-encoded output.
- README.md is too minimal and needs significant expansion to include usage instructions, examples, and proper documentation of the functionality
- Consider wrapping
launchCommand
in try-catch blocks in bothjson2environment.ts
andjson2environmentB64.ts
for better error handling - Could simplify error handling in
processJson.ts
by usingshowFailureToast
from@raycast/utils
instead of manualshowToast
with failure style - Add
subtitle
to both commands inpackage.json
with "Config Converter" to match extension title - Consider adding screenshots in a
metadata
folder since this is a new extension, showing example input/output
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
12 file(s) reviewed, 10 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -0,0 +1 @@ | |||
# Config Converter |
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.
style: README needs more content: description of what the extension does, installation/usage instructions, and examples of JSON to environment variable conversion. See https://developers.raycast.com/basics/prepare-an-extension-for-store#readme
"commands": [ | ||
{ | ||
"name": "json2environment", | ||
"title": "Json2Environment", |
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.
style: Consider adding a subtitle to distinguish between the two commands, e.g. 'Convert JSON to environment variables'
}, | ||
{ | ||
"name": "json2environmentB64", | ||
"title": "Json2Environment - Base64", |
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.
style: Consider adding a subtitle to distinguish between the two commands, e.g. 'Convert JSON to base64-encoded environment variables'
export default async function main() { | ||
await processJson(false); |
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.
style: Consider wrapping processJson call in try/catch for better error handling
export default async function main() { | |
await processJson(false); | |
export default async function main() { | |
try { | |
await processJson(false); | |
} catch (error) { | |
console.error(error); | |
throw error; | |
} |
export function descendJsonObject(obj: any, path?: string) { | ||
const keyValuePairs: KeyValuePair[] = []; | ||
|
||
if (typeof obj !== "object" && path) { |
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.
logic: This condition will return undefined if path is not provided for primitive values. Should be if (typeof obj !== 'object') {
return keyValuePairs; | ||
} | ||
|
||
for (const key in obj) { |
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.
style: for...in loop on objects should check hasOwnProperty to avoid prototype chain properties
for (const key in obj) { | |
for (const key in obj) { | |
if (Object.prototype.hasOwnProperty.call(obj, key)) { |
export interface KeyValuePair { | ||
key: string; | ||
//eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
value: any; |
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.
style: Consider using a more specific type than any
to better type-check JSON values, e.g. string | number | boolean | null | object | Array<unknown>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Description
Screencast
Checklist
npm run build
and tested this distribution build in Raycastassets
folder are used by the extension itselfREADME
are placed outside of themetadata
folder