An opinionated template for Monorepo and best practices for ECMAScript eco-system technologies and projects.
This repo contains several sub-packages each demonstrating best practices in different ECMAScript related technology / scenario.
This repository is meant to be used as a starting point when creating a new monorepo project. The consumption process is currently a manual step by step guide.
-
Clone/Copy/Download this repo.
-
Choose which of the sub-packages templates are relevant to you, and delete the others.
- Note that some sub-packages depend on other sub-packages.
-
Change the
name
fields of the remainingpackages/*/package.json
files to fit your new project. -
Delete the contents of the README.md files in both the root and the sub-packages.
-
Reset the
version
field in the lerna.json to your project's initial version number.- Normally
0.1.0
or0.0.1
.
- Normally
-
Adjust coverage thresholds in the nyc.config.js.
- By default, these are set to 100%.
-
Adjust CONTRIBUTING.md code coverage section.
- To align with the coverage thresholds defined in the nyc.config.js.
- Modify the
cla-assistant
link in the CONTRIBUTING.md legal section.
-
Update the Legal Related files (copyrights/notices/disclaimer).
-
If you kept VSCode extension templates, also adjust the
displayName
andpublisher
fields in theirpackage.json
files to fit your new project. -
If you have not kept any VSCode extensions in your monorepo, remove the root vscode webpack config.
-
Adjust the circle-ci config.yml. There are three possible sections that may need to be removed (and their references):
deploy-npm
--> if your project should not deploy any npm library to npmjs.com.prepare-vsix
anddeploy-gh-releases
--> if your project does not include VSCode extensions.
-
Adjust the .eslintrc.js configuration.
- Remove
overrides
sections for no longer relevant file types:["*.ts"]
--> if your monorepo does not contain any TypeScript sources (including.d.ts
files).["*.vue"]
--> if your monorepo does not contain any vue frontend projects.
- Remove
dev-depedencies
from the root package.json@typescript-eslint/*
--> if your monorepo does not contain any TypeScript projects.eslint-plugin-vue
--> if your monorepo does not contain any vue frontend projects.
- Remove
-
Adjust root TypeScript configurations.
- Remove sub-project references that no longer exist from root ./tsconfig.json.
- If there are no references left in this file, and you do not plan on adding TypeScript projects
to your monorepo:
- Delete the root ./tsconfig.json.
- Delete the root ./tsconfig.base.json.
- Remove the
compile
andcompile:watch
scripts from the root package.json.
-
Adjust lint-staged configurations.
- Look for the
lint-staged
field and its keys in the root package.json. - Remove file patterns that your repo no longer contains (or is expected to contain).
- For example if your monorepo does not contain a Vue frontend sub-package, you may remove the
vue
suffixes.
- For example if your monorepo does not contain a Vue frontend sub-package, you may remove the
- Look for the
In your terminal, navigate to root of the monorepo and:
- execute
yarn
to update the yarn.lock file. - execute
yarn run ci
to test the full build flow.
You may now commit/push your new mono-repo template project to your new git repo and start coding.
Please open an issue on Github.
Contributions are most welcome.
- Please see the Contributing Guide for docs about development flows.
- Before implementing a major contribution please open an issue to discuss your contribution first.
- Last but not least, please consider how your changes would affect both the:
- Root level dev flows (e.g needed adjustment for linting/formatting).
- Root level usage/consumption instructions.