amtrack / sfdx-plugin-source-read

sfdx plugin to read Metadata via CRUD Metadata API
36 stars 4 forks source link

Add Option for Choosing Output Directory #88

Closed Alfystar closed 4 months ago

Alfystar commented 7 months ago

Description: Currently, there is no option to choose the output directory, which limits the flexibility of the project.

Motivation: Users often need to organize the generated files in a specific way. Adding the ability to select the output directory would provide more flexibility for users integrating the project with other processes or projects.

Thank you for considering this request. I'm available for further details or clarifications if needed.

Alfystar commented 7 months ago

Forgive me, I have a question but I would avoid an issue to ask it:

In my scenario, we use sf-cli both locally and on a bamboo pipeline, inside the package.json we put the various npm dependencies, in the devDependencies key.

I noticed that, locally, after executing the installation commands you write in README, the following information appeared automatically inside package.json:

 ...
 "dependencies": {
   "sfdx-plugin-source-read": "^1.2.0"
 },
 ...

As far as you know, is there a command that allows you to also update your sf plugin to be called by the pipeline at the begining?

Currently, for prettier (other tool) we already use

npm install --yes

And it takes the data from package.json. So... is it enough to make sf install the latest version of your plugin if an update comes out? Or do you have to have it installed "manually" on the pipeline agent every time?

Thanks in advance Emanuele

Alfystar commented 4 months ago

@amtrack Any new about the output directory option? Also target-org option can help

amtrack commented 4 months ago

@Alfystar

Any new about the output directory option?

I currently don't plan to implement a --output-dir flag myself.

My personal experience with the --output-dir of the official sf project retrieve start command is not really good. And I don't want to deal with those problems.


Also target-org option can help

The --target-org flag already exists:

sf force source read --help                                            
Read Metadata using the CRUD Metadata API

USAGE
  $ sf force source read -o <value> [--json] [-m <value>] [-p <value>]

FLAGS
  -m, --metadata=<value>    comma-separated list of metadata component names
                            Example: 'RecordType:Account.Business,Profile:Admin'
  -o, --target-org=<value>  (required) [default: test-yi7xt1f1tzo8@example.com] Username or alias of the target org.
  -p, --sourcepath=<value>  comma-separated list of source file paths to retrieve
                            Example: 'force-app/main/default/objects/Account/recordTypes/Business.recordType-meta.xml,force
                            -app/main/default/profiles/Admin.profile-meta.xml'

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Read Metadata using the CRUD Metadata API

  Read Metadata using the CRUD Metadata API

EXAMPLES
  $ sf force source read -m "Profile:Admin"

  $ sf force source read -m "RecordType:Account.Business"

  $ sf force source read -p force-app/main/default/objects/Account/recordTypes/Business.recordType-meta.xml
Alfystar commented 4 months ago

Ok, thanks for the quick reply For the output dir I "solved" in a homemade way

I rename the profile folder and move it outside the main/default directory, then I recreate it and fill with empty files on it. Then I start your tool. At the end, I just move the folder and restore the other one.

Anyway you are right, I'm actually seeing that output-dir sometimes gets in trouble 😅