arrow-left

All pages
gitbookPowered by GitBook
1 of 3

Loading...

Loading...

Loading...

Contributing

hashtag
Node and Npm version

When you work on code in this repo, make sure you are using Node 14.x and Npm 7.20.2. Npm > 7 is needed to use npm workspaces, but there is a bug using workspaces in certain situations on Npm > 7.20.2. See here for more info: https://github.com/npm/cli/issues/3637

There are different ways to switch versions of Node/NPM, here is one:

  1. Make sure n is installed

  • The easiest way is npm install -g n.

  • You may prefer to install n with Homebrew: brew install n

  • More info: https://github.com/tj/n#installation

  1. Run npm run use:engine in the root directory. This is a shortcut for n install 14 && npm install -g [email protected]. However, when you use npm run use:engine, the version numbers are automatically read from the root package.json's "engines" key.

hashtag
Linking the Workspaces

The first time you set up the monorepo, run npm install in the root directory. This will automatically link up all the workspaces in the monorepo so that each is depending on the local copies.

hashtag
Linking packages into other projects locally

In the case where you want to link a package from the monorepo into a package from another repo for local development, npm link is still needed. This is only needed when editing packages locally, that aren't all in the same monorepo. See here for more info: https://docs.npmjs.com/cli/v8/commands/npm-link#workspace-usage

If the monorepo is in a directory called frigg, and we want to use the local copy of the logs module in project B while we develop:

Now, the local copy of the logs package is linked into project B's node_modules directory. Any local edits to the logs package will be immeidately available to your local copy of project B

hashtag
Workspaces

https://docs.npmjs.com/cli/v7/using-npm/workspaces

To test all workspaces, you can run npm run test:all in the root directory. This will be useful for local development, but won't catch everything in CI (specifically missing npm modules in a package).

You can run a command in all workspaces like so: npm run lint:fix --workspaces

You can run a command in just one workspace, for example: npm test --workspace=logs

hashtag
Creating a new workspace

To create a new workspace: npm init --workspace=new-package

A good rule of thumb is to name the package based on what it provides. This can help avoid a lot of "utils" packages. Obviously nothing wrong with "utils", "tools," or "helpers" packages per se, but it is often an indication the code can be organized more modularly.

Be sure each package has:

  • a README.md (which is displayed on npmjs.com).

  • a LICENSE.md file (make sure the attribution and date are correct)

  • a package.json file with repository, description, correct license, and other important fields filled in

hashtag
Semver

When fixing a bug or making small tweaks use npm version patch When adding a feature that doesn't alter the public interface to existing features, use npm version minor When making a change that alters the public interface use npm version major.

hashtag
Publishing

After merging or rebasing a branch into main:

hashtag
Unpublishing

72 hours are given to unpublish a version without complications: https://docs.npmjs.com/policies/unpublish

cd frigg
npm link --workspace=logs
cd ../project-b
npm link @friggframework/logs
git checkout main
npm test --workspace=logs
npm version patch --workspace=logs # or major or minor
git commit -am'chore: release' && git push
npm publish --workspace=logs --access public
cd logs
npm unpublish @friggframework/[email protected]
cd ..

Contributor Covenant Code of Conduct

hashtag
Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

hashtag
Our Standards

Examples of behavior that contributes to a positive environment for our community include:

  • Demonstrating empathy and kindness toward other people

  • Being respectful of differing opinions, viewpoints, and experiences

  • Giving and gracefully accepting constructive feedback

Examples of unacceptable behavior include:

  • The use of sexualized language or imagery, and sexual attention or advances of any kind

  • Trolling, insulting or derogatory comments, and personal or political attacks

  • Public or private harassment

hashtag
Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

hashtag
Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

hashtag
Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

hashtag
Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

hashtag
1. Correction

Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

hashtag
2. Warning

Community Impact: A violation through a single incident or series of actions.

Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

hashtag
3. Temporary Ban

Community Impact: A serious violation of community standards, including sustained inappropriate behavior.

Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

hashtag
4. Permanent Ban

Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

Consequence: A permanent ban from any sort of public interaction within the community.

hashtag
Attribution

This Code of Conduct is adapted from the , version 2.1, available at .

Community Impact Guidelines were inspired by .

For answers to common questions about this code of conduct, see the FAQ at . Translations are available at .

Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
  • Focusing on what is best not just for us as individuals, but for the overall community

  • Publishing others' private information, such as a physical or email address, without their explicit permission
  • Other conduct which could reasonably be considered inappropriate in a professional setting

  • Contributor Covenantarrow-up-right
    https://www.contributor-covenant.org/version/2/1/code_of_conduct.htmlarrow-up-right
    Mozilla's code of conduct enforcement ladderarrow-up-right
    https://www.contributor-covenant.org/faqarrow-up-right
    https://www.contributor-covenant.org/translationsarrow-up-right

    PULL_REQUEST_TEMPLATE

    hashtag
    Requirements

    • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.

    • All new code requires tests to ensure against regressions

    hashtag
    Description of the Change

    hashtag
    Alternate Designs

    hashtag
    Benefits

    hashtag
    Possible Drawbacks

    hashtag
    Applicable Issues