Coder Social home page Coder Social logo

github-actions-playground's Introduction

☁️ Salesforce DX Project Starter Kit

GitHub CI Quality Gate Status codecov FOSSA Status

About the project

The repository provides a template for Salesforce DX projects which includes an initial configuration of Prettier, Linter rules, git hooks and unit tests as well as useful VS Code settings.

Prerequisites

To use this template, the Node version specified in the package.json and the latest version of the Salesforce CLI should already be installed.

Getting started

To get the template up and running, you need to clone the repository and open it with VS Code, install all the recommended extensions and run the following command to install all required dependencies:

npm install

After that you need to authorize an org for which you want to develop. In VS Code this can be done by pressing Command + Shift + P, enter "sfdx", and select SFDX: Authorize an Org.

Alternatively you can also run the following command from the command line:

sf org login web

Code scaffolding

To generate new components in VS Code, press Command + Shift + P, enter "sfdx create", and select what you want to create, e.g. SFDX: Create Lightning Web Component.

Alternatively you can also create all components from the command line, e.g.:

cd force-app/main/default/lwc
sf lightning generate component --type lwc -n helloWorld -d force-app/main/default/lwc

Code quality

Git hooks

The project includes client-side pre-commit git hooks using husky and lint-staged. After installing all project dependencies, Prettier, Linter and unit tests are automatically executed before each commit.

Prettier

Run Prettier to check all files for formatting issues:

npm run prettier

Linter

Linting LWC and Aura

Run ESLint to check for linting issues:

npm run lint

Linting Apex code

Use the recommended extension Apex PMD to check manually for Apex linting issues.

Unit tests

Execute LWC unit tests with Jest

To execute all unit tests only once run:

npm run test:unit

To execute all unit tests in watch mode for development run:

npm run test:unit:watch

To execute all unit tests with generated code coverage run:

npm run test:unit:coverage

Local development

LWC development server

Lightning Web Components can be developed locally without the need to push them to an org first. To set up local development you only need to authorize an org and install the development server.

The local development server and its configuration are provided by a Salesforce CLI plugin that can be installed as follows:

sf plugins install @salesforce/lwc-dev-server

To start the server on http://localhost:3333 and access all components of the project run:

npm run server:lwc

Debugging

To debug and troubleshoot Lightning Web Components, in addition to enabling Debug Mode in Salesforce, you should also configure the following settings in Chrome Dev Tools:

  • Enable custom formatters under Settings --> Preferences

  • User the Ignore List to ignore framework code while troubleshooting. Add the following two patterns under Settings --> Ignore List:

    • /aura_prod.*.js$
    • /components/.*.js$

Read more about Salesforce DX development

github-actions-playground's People

Contributors

svierk avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.