2

We are in the process of moving from Org based development to Source code based development. We are using VSCode, GitHub and Jenkins. The steps that we followed are

  1. Create an empty GitHub repo and create a branch our of it.
  2. Clone the empty repo (branch) to my VSCode
  3. Create a SFDX project in VSCode.
  4. Connect to the Org (Sandbox) and pull all code.
  5. Push just apex classes, pages and components alone to GitHub. We really dont want to push anything else to GitHub
  6. Now if i change the code in VSCode, i can push it back to GitHub and the Jenkins deploys to Sandbox.

The question that i have is, if another developer wants to work on the same branch, i am not sure how to set it up in their VSCode. I tried just to clone from the branch but then VSCode is not recognizing that as a salesforce project at all.

Any options?

Here is the folder struture

enter image description here Thanks

  • 1
    What's your folder structure look like in github? Does it have the manifest folder and sfdx-project.json file in the repository? – Kris Goncalves Dec 19 '19 at 19:09
  • 2
    Continuous integration works best when you version control as much as possible. Consider expanding beyond the code-based components. And like Kris said, you need the project infrastructure committed to Git. – David Reed Dec 19 '19 at 19:38
  • @KrisGoncalves - Yes. We are syncing mainfest folder and sfdx-project.json file. We are just syncing classes, pages, components alone. – Muthukumar Dec 19 '19 at 20:14
  • @KrisGoncalves Our project structure is Contract config build.xml build.properties ant-salesforce.jar force-app\main\default classes aura triggers manifest package.xml sfdx-project.json – Muthukumar Dec 19 '19 at 20:21
  • It would be helpful to add that folder structure (or a screenshot) with an edit to your post. – Kris Goncalves Dec 19 '19 at 20:37
0

Why the use of VSCode should be mandatory to work with your project? I don't think there is the need and even so, there is no need to enforce it at repository level. Usually, your repository structure should depends only on metadata version that you chosen and it should not depends on editor of choice, OS and so on.

In this particular case, in order to work on the project, one should only need to

  1. Clone the repo
  2. Init a sfdx project, or a force code project, or any other project using the tool of choice (as long as compatible).
  3. Start working

All the config files relative to editor, plugins, configs and so on should be put in the git ignore file. Note that you should also put in the .gitignore file configs that contains sensible data like passwords. This is valid also if your repository is private.

Last suggestion: if you don't want to version a metadata, don't put it in your package.xml file. Otherwise your repository will soon be impossible to manage.

  • Thanks. VSCode is the recommended IDE for Salesforce development and hence we started using it. Also the part i am missing here is the init a sfdx project or a force code project. How does a cloned project from GIT Repo/branch to any IDE knows that its a sfdx project or force code project. Thats the part i am not clear on how to achieve. – Muthukumar Dec 20 '19 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.