Contributions are always welcome, no matter how large or small.
Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
By participating, you are expected to uphold this Contributor Covenant Code of Conduct. Please report unacceptable behavior to [email protected].
First, fork then clone the repo:
git clone https://github.com/your-username/foreman-js
cd foreman-js
git remote add upstream https://github.com/theforeman/foreman-js
Install dependencies:
npm install
Build all @theforeman
packages:
npm run build
Link all @theforeman
packages to your project (./node_modules/@theforeman
):
npm run link -- --location ../foreman
# also works for plugins
npm run link -- --location ../foreman-tasks
Run test suits to validate the project is working: Notice it will run the test command for each sub-package.
npm test
Run linter to validate the project code:
npm run lint
Run linter to validate your commit message:
npm run lint:commit
- Create a branch:
git checkout -b my-branch
-
Happy Hacking 🎉: Start hacking and creating code changes.
-
Commit your changes:
foreman-js
uses commitizen to create commit messages so it can automatically create semantic releases.
git add .
npm run commit
# answer the questions
Read more about the commit message format at docs/commit-message-format.md
- Push your changes:
git push origin my-branch
- Open this project on GitHub, then click “Compare & pull request”.
- Open the pull request in Github and go to the "Checks" tab.
- Expand
Build tarballs for testing
job and open any of the associated actions. For example, the job for the test package would bebuild-tarball (test)
. - Expand the artifacts dropdown on the top right and download the appropiate artifact. For example, the test package will be titled
foreman-js-test-pr-###.tgz
.
- Alternatively, you can download the zipped tarball directly using the API. Note this different than the link provided in the action. A direct download can be done with a command like this:
Replacing
wget -v -O foreman-js-pr-$PR_NUM.tgz.zip --header "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/theforeman/foreman-js/actions/artifacts/$ARTIFACT_ID/zip
$PR_NUM
with the pull request number,$GITHUB_TOKEN
with your github API token, and$ARTIFACT_ID
with the artifact id in the last part of the artifact URL, found in the action itself. For example, if the artifact link in the action ishttps://github.com/theforeman/foreman-js/suites/1279365382/artifacts/19806792
, the$ARTIFACT_ID
would be19806792
.
- Unzip and copy the unpacked tarball to your development box or the appropiate location. For example:
# download `foreman-js-test-pr-123.tgz.zip` from `artifacts` dropdown on top right of github action or directly using the API.
cd /path/to/download_dir && unzip foreman-js-test-pr-123.tgz.zip # Unzip to get the tarball
scp theforeman-test-4.15.1.tgz vagrant@mydevbox:~ # copy to appropiate development location
- Update the package.json file in foreman or plugin to use the local tarball:
$ cat package.json | grep theforeman-test
"@theforeman/test": "/home/vagrant/theforeman-test-4.15.1.tgz",
rm -rf node_modules && rm package-lock.json
in foreman or plugin.
- This is needed because the version of the package has not changed. Even if it did, the existing package probably still meets the specifications, so we need a fresh install.
npm i
in foreman or plugin.- After a successful npm install, updated versions of packages are now being used. You can use
npm ls
to check the installed version.
# If the PR upgraded jest-cli
$ npm ls jest-cli
[email protected] /home/vagrant/foreman
└─┬ @theforeman/[email protected]
└── [email protected]
Please checkout the roadmap.md
and the open issues.
Also, please watch the repo and respond to questions/bug reports/feature requests, Thanks!