Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit 7627b0c

Browse files
committed
feat: root level CONTRIBUTING.md
1 parent 6bb4995 commit 7627b0c

File tree

3 files changed

+117
-3
lines changed

3 files changed

+117
-3
lines changed

CONTRIBUTING.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Contribution Guide
2+
3+
This is the common top-level contribution guide for this monorepo.
4+
A sub-package **may** have an additional CONTRIBUTING.md file if needed.
5+
6+
## Legal
7+
8+
All contributors must sign the DCO
9+
10+
- https://cla-assistant.io/SAP-samples/ecmascript-monorepo-template
11+
12+
This is managed automatically via https://cla-assistant.io/ pull request voter.
13+
14+
## Development Environment
15+
16+
### pre-requisites
17+
18+
- [Yarn](https://yarnpkg.com/lang/en/docs/install/) >= 1.4.2
19+
- A [Long-Term Support version](https://nodejs.org/en/about/releases/) of node.js
20+
- (optional) [commitizen](https://github.com/commitizen/cz-cli#installing-the-command-line-tool) for managing commit messages.
21+
22+
### Initial Setup
23+
24+
The initial setup is trivial:
25+
26+
- clone this repo
27+
- `yarn`
28+
29+
### Commit Messages format.
30+
31+
This project enforces the [conventional-commits][conventional_commits] commit message formats.
32+
The possible commits types prefixes are limited to those defined by [conventional-commit-types][commit_types].
33+
This promotes a clean project history and enabled automatically generating a changelog.
34+
35+
The commit message format will be inspected both on a git pre-commit hook
36+
and during the central CI build and will **fail the build** if issues are found.
37+
38+
It is recommended to use `git cz` to construct valid conventional commit messages.
39+
40+
- requires [commitizen](https://github.com/commitizen/cz-cli#installing-the-command-line-tool) to be installed.
41+
42+
[commit_types]: https://github.com/commitizen/conventional-commit-types/blob/master/index.json
43+
[conventional_commits]: https://www.conventionalcommits.org/en/v1.0.0/
44+
45+
### Formatting.
46+
47+
[Prettier](https://prettier.io/) is used to ensure consistent code formatting in this repository.
48+
This is normally transparent as it automatically activated in a pre-commit hook using [lint-staged](https://github.com/okonet/lint-staged).
49+
However, this does mean that dev flows that do not use a full dev env (e.g editing directly on github)
50+
may result in voter failures due to formatting errors.
51+
52+
### Compiling
53+
54+
Use the following npm scripts at the repo's **root** to compile **all** the TypeScript sub-packages.
55+
56+
- `yarn compile`
57+
- `yarn compile:watch` (will watch files for changes and re-compile as needed)
58+
59+
These scripts may also be available inside the sub-packages. However, it is recommended to
60+
use the top-level compilation scripts to avoid forgetting to (re-)compile a sub-package's dependency.
61+
62+
### Testing
63+
64+
[Mocha][mocha] and [Chai][chai] are used for unit-testing and [Istanbul/Nyc][istanbul] for coverage reports.
65+
66+
[mocha]: https://mochajs.org/
67+
[chai]: https://www.chaijs.com
68+
[istanbul]: https://istanbul.js.org/
69+
70+
- To run the tests execute `yarn test` in a specific sub-package.
71+
- To run the tests with **coverage** run `yarn coverage` in a specific sub-package.
72+
73+
### Code Coverage
74+
75+
100%\* Code Coverage is enforced for all productive code in this mono repo.
76+
77+
- Specific statements/functions may be [excluded][ignore_coverage] from the report.
78+
- However, the reason for each exclusion must be documented.
79+
80+
[ignore_coverage]: https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
81+
82+
### Full Build
83+
84+
To run the full **C**ontinuous **I**ntegration build run `yarn ci` in either the top-level package or a specific subpackage.
85+
86+
### Release Life-Cycle.
87+
88+
This monorepo uses Lerna's [Fixed/Locked][lerna-mode] which means all the sub-packages share the same version number.
89+
90+
[lerna-mode]: https://github.com/lerna/lerna#fixedlocked-mode-default
91+
92+
### Release Process
93+
94+
Performing a release requires push permissions to the repository.
95+
96+
- Ensure you are on the default branch and synced with origin.
97+
- `yarn run release:version`
98+
- Follow the lerna CLI instructions.
99+
- Track the newly pushed **tag** (`/^v[0-9]+(\.[0-9]+)*/`) build in the build system
100+
until successful completion.
101+
- Inspect the newly artifacts published on npmjs.com / Github Releases / other relevant release targets.

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@ The consumption process is currently a **manual** step by step guide.
2626
- Note that some sub-packages depend on other sub-packages.
2727
1. Change the `name` fields of the remaining `packages/*/package.json` files to fit your new project.
2828

29+
1. Delete the **contents** of the README.md files in both the root and the sub-packages.
30+
2931
1. Reset the `version` field in the [lerna.json](./lerna.json) to your project's **initial** version number.
3032

3133
- Normally `0.1.0` or `0.0.1`.
3234

3335
1. Adjust **coverage thresholds** in the [nyc.config.js](./nyc.config.js).
3436
- By default, these are set to **100%**.
37+
1. Adjust [CONTRIBUTING.md code coverage section](./CONTRIBUTING.md#code-coverage).
38+
- To align with the **coverage thresholds** defined in the [nyc.config.js](./nyc.config.js).
39+
- Modify the `cla-assistant` link in the [CONTRIBUTING.md legal section](./CONTRIBUTING.md#legal).
3540
1. Update the Legal Related files (copyrights/notices/disclaimer).
36-
3741
- [./.reuse/dep5](./.reuse/dep5)
3842
- [./LICENSES](./LICENSES)
3943
- [./LICENSE](./LICENSE)
@@ -45,6 +49,13 @@ The consumption process is currently a **manual** step by step guide.
4549
1. If you kept VSCode extension templates, also adjust the `displayName` and `publisher` fields
4650
in their `package.json` files to fit your new project.
4751
1. If you have not kept any VSCode extensions in your monorepo, remove the [root vscode webpack config](./webpack.config.vscode.base.js).
52+
53+
1. Adjust the [circle-ci config.yml](./.circleci/config.yml).
54+
There are three possible sections that may need to be removed (and their references):
55+
56+
- `deploy-npm` --> if your project should not deploy any npm library to npmjs.com.
57+
- `prepare-vsix` and `deploy-gh-releases` --> if your project does not include VSCode extensions.
58+
4859
1. Adjust the [.eslintrc.js](./.eslintrc.js) configuration.
4960

5061
- Remove `overrides` sections for no longer relevant file types:
@@ -55,12 +66,14 @@ The consumption process is currently a **manual** step by step guide.
5566
- `eslint-plugin-vue` --> if your monorepo does not contain any vue frontend projects.
5667

5768
1. Adjust root TypeScript configurations.
69+
5870
- Remove sub-project references that no longer exist from [root ./tsconfig.json](./tsconfig.json).
5971
- If there are no references left in this file, and you do not plan on adding TypeScript projects
6072
to your monorepo:
6173
- Delete the [root ./tsconfig.json](./tsconfig.json).
6274
- Delete the [root ./tsconfig.base.json](./tsconfig.base.json).
6375
- Remove the `compile` and `compile:watch` scripts from the [root package.json](./packages).
76+
6477
1. Adjust lint-staged configurations.
6578
- Look for the `lint-staged` field and its keys in the [root package.json](./package.json).
6679
- Remove file patterns that your repo no longer contains (or is expected to contain).
@@ -81,7 +94,7 @@ Please open an [issue](https://github.com/SAP-samples/ecmascript-monorepo-templa
8194

8295
## Contributing
8396

84-
Contributions are very welcome.
97+
Contributions are most welcome.
8598
Please see the [Templates Contributing Guide](TBD).
8699

87100
## License

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"scripts": {
1010
"postinstall": "patch-package",
11-
"release:version": "lerna version && yarn run cirlce:release",
11+
"release:version": "lerna version",
1212
"release:publish": "lerna publish from-git --yes",
1313
"ci": "npm-run-all format:validate lint:validate legal:* ci:subpackages coverage:merge",
1414
"ci:subpackages": "lerna run ci",

0 commit comments

Comments
 (0)