=================
- NodeJS version 8.x.x (to install and manage NodeJS see https://github.com/coreybutler/nvm-windows for Windows or https://github.com/creationix/nvm for MacOS/Linux)
- Yarn (install it globally with
npm install --global yarn
)
-
Clone this repository to your local machine and follow instructions here to configure it properly: https://learninghub.osf.digital/mod/page/view.php?id=1792
-
Run
yarn install
to install all of the local dependancies -
Run
yarn run webpack:dev
to start watching for file changes and compile JS and SCSS files when that happens -
Run
yarn run lint
to run all the code linters or run:yarn run lint:js-server
to run only the server side JS linteryarn run lint:js-client
to run only the client side JS linteryarn run lint:scss
to run only the SCSS linter
-
Create dw.json file in the root of the project: { "hostname": "your-sandbox-hostname.demandware.net", "username": "yourlogin", "password": "yourpwd", "code-version": "version_to_upload_to" }
Install the Prophet extension into Visual Studio Code. It requires a valid dw.json file at the root that is configured for the sandbox to upload.
Create a launch.json file inside of a hidden directory named .vscode:
{
"configurations": [
{
"type": "prophet",
"request": "launch",
"name": "SFRA Debugger",
"hostname": "your-sandbox-hostname.demandware.net",
"username": "yourlogin",
"password": "yourpwd",
"codeversion": "version_to_upload_to",
"cartridgeroot": "full_path_to_local_folder",
"workspaceroot": "${workspaceRoot}"
}
]
}
Visual Studio Code is recommended to be used along with the following plugins:
- SonarLint - To help you detect and fix quality issues as you write code. Like a spell checker, SonarLint squiggles flaws so they can be fixed before committing code.
- Prettier - To help you easily format and prettify your code (make sure you set
"prettier.tabWidth": 4
before you start using it) - Document This - To help you with writing JSDoc for your code
- CMD + Shift + P -> Format Document
- Select the text you want to Prettify and CMD + Shift + P -> Format Selection
- Path Intellisense - To help you autocomplete paths and filenames
- vscode-icons - To make your VSC explorer a bit nicer
- Create a feature branch from the develop branch (
feature/TASK-NR
) - Make sure all your comits have proper commit message (
[TASK-NR] Commit description
) - When creating your pull request make sure it has:
- A proper title (use the following naming convention
[TASK-NR] Pull request title
) - A brief description of what the pull request does
- (optional) Screen shots
- A proper title (use the following naming convention
- Your code should pass the automation process:
- Lint your code:
yarn run lint
should run withouth errors - Build your code:
yarn run webpack:dev
should run withouth errors
- Lint your code:
Why the code structure here is different from the official one at https://github.com/SalesforceCommerceCloud
- Our cartridges structure make it easier to work with webpack
- Our cartridges structure is easier to organize and makes more sense for SG developers
- Github structure forces that each dev clones code in exactly the same way, same structure, same folders or it might break webpack
- Github structure is prone to dependency inconsistencies since each cartridge has its own repo and package.json