-
Notifications
You must be signed in to change notification settings - Fork 36
10. Contribute
If you want to enhance Accenture SFMC DevTools you are welcome to fork the repo and create a pull request. Please understand that we will have to conduct a code review before accepting your changes.
Instead of installing Accenture SFMC DevTools as an npm dependency from our git repo, we recommend cloning our repo and then linking it locally:
Assuming you cloned Accenture SFMC DevTools into C:\repos\sfmc-devtools\
(or ~/repos/sfmc-devtools/
on Mac):
- Open a terminal in your repo folder (
repos/sfmc-devtools/
) - Execute
npm install
to download all the dependencies. - Execute
npx husky install
to enable our git hooks. - Execute
npm install -g "C:\repos\sfmc-devtools"
(this installs mcdev globally on your computer based on your cloned repo folder. Any changes you make in there will take immediate effect without the need for publishing or re-installing it).
This should tell npm to create a symlink to your cloned local directory, allowing you to see updates you make in your mcdev repo instantly.
To test your new global developer setup, run mcdev --version
in CLI which should return the current version (e.g. 4.2.0
). Then, go into your mcdev repo and update the version with the suffix -dev
, e.g. to 4.2.0-dev
and then run mcdev --version
again to verify that your change propagates instantly.
Not recommended: Alternatively, you can install it locally only by opening a terminal in your project directory and executing
npm install --save-dev "C:\repos\sfmc-devtools"
To run the local version you need to prepend "npx" before your commands, e.g.npx mcdev --version
Note: On MacOS you might need to prepend sudo
to elevate your command.
Local vs. Global developer installation:
If you use Accenture SFMC DevTools in your team it is recommended to install your developer version globally, while the project's package.json should point to our Git repo in its devDependency section. Otherwise, other team members would have trouble due to potentially different paths.
If you do need to install it locally, make sure you don't commit your project's package.json with this change or you might break mcdev for other developers in your team who either didn't clone the Accenture SFMC DevTools repo or stored it in a different directory.
Warning: local installation (leading to the use of npx) causes issues when spaces are used in keys/names and is therefore not recommended. You will also make setting up projects much harder if you choose the local installation as you cannot use
mcdev init
to automatically setup your entire project.
The following explains how you could install it locally for certain edge cases:
- Create a new folder for your upcoming SFMC project. Let's assume you named it
MyProject/
Note: It is best practice to create a separate project folder for each of your client projects to avoid accidentally overwriting the wrong BU.
- Now, open a command line interface (CLI) for that folder.
- In Windows, you can easily do that by pressing SHIFT + Right-click into that folder and then selecting the option "Open PowerShell window here".
- Alternatively, you could use any other CLI. We recommend opting for Visual Studio Code's "Terminal" as you can benefit from this later.
- Your CLI prompt should look something like
PS C:\repos\MyProject>
on Windows or~/repos/MyProject/
on Mac.
- Initialize your new SFMC project by running
npm init
.Note: npm is the "package manager" of Node.js and we use it to bundle Accenture SFMC DevTools together with other tools.
If you are not familiar with node-projects or npm yet, we found this blog post on nodesource.com to be helpful for beginners. In short, a package manager provides you with an easy name-based way of installing and updating tools you want to use as a team and ensuring that you are all using the same version.
- Afterwards, install Accenture SFMC DevTools by running
npm install --save-dev mcdev
- If you get an error, please see the (troubleshooting)[/Accenture/sfmc-devtools/wiki/4.-Troubleshooting] section.
When completed run mcdev --version
and it will show you which version you installed (e.g. 4.2.0
).
-
start
: Main entry point -
mcdev
: alias forstart
-
build
: Runs documentation and linting scripts -
debug
: start debugging session -
docs
: Generates jsdocs API documentation as markdown -
lint
: Runs eslint with autofix and prettier -
test
: Runs mocha tests - outdated
Copyright (c) 2020-2024 Accenture. MIT licensed. Main contributors: Jörn Berkefeld, Doug Midgley