Git Product home page Git Product logo

toolbox's Introduction

Toolbox

A library of reusable React components for iFixit.

npm Build Status Code Coverage

https://ifixit.design

Installation

npm install @ifixit/toolbox

Development Setup

# Clone the repo
git clone https://github.com/iFixit/toolbox.git
cd toolbox

# Install the dependencies
npm install

# Start the styleguide dev server
npm start

Code Style

Toolbox adheres to the Airbnb Javascript Style Guide. Code style and quality are enforced by ESLint and Prettier. You can format your code with the lint:fix script:

npm run lint:fix

Commit Message Format

Toolbox adheres to the Conventional Commits Specification for commit messages. Running npm run cm instead of git commit will guide you through the commit process.

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

The header is mandatory and the scope of the header is optional.

Type

Must be one of the following:

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
  • build: Changes that affect the build system or external dependencies
  • ci: Change to our CI configuration file and scripts

Scope

The scope could be anything specifying place of the commit change. For example Icon, Tab, SearchInput, etc...

Remember that scope is entirely optional. Only include a scope if the commit message doesn't stand on it's own outside the context of a pull request.

Subject

The subject contains succinct description of the change:

  • Use the imperative, present tense: "Change" not "Changed" nor "Changes"
  • Use sentence case: "Some message" not "some message" nor "Some Message"
  • Do not include a dot (.) at the end

Body

Just as in the subject, use the imperative, present tense: "Change" not "Changed" nor "Changes". The body should include the motivation for the change and contrast this with previous behavior.

Footer

The footer should contain any information about Breaking Changes and is also the place to reference GitHub issues that this commit closes.

Breaking Changes should start with the word BREAKING CHANGE: with a space or two newlines. The rest of the commit message is then used for this.

Examples

Here are examples of the release types that will be generated based on a commit messages:

Commit message Release type
fix(pencil): Stop graphite breaking when too much pressure applied Patch Release
feat(pencil): Add 'graphiteWidth' option Minor Feature Release
perf(pencil): Remove graphiteWidth option

BREAKING CHANGE: The graphiteWidth option has been removed.
The default graphite width of 10mm is always used for performance reasons.
Major Breaking Release

Why?

semantic-release uses commit messages to determine the type of changes in the codebase since the last release. Using these formalized conventions for commit messages allows semantic-release to automatically determine the next semantic version number, generate a changelog and publish to npm automatically.

Testing

Toolbox uses Jest for testing. Learn more about testing React with Jest here: Jest โ€“ Testing React Apps

How do I run the tests?

To run the test suite, use one of the following npm scripts:

# Run the test suite
npm test

# Run the test suite in watch mode (recommended during development)
npm run test:watch

# Update Jest snapshots
npm run test:update

# Run the test suite and generate a code coverage report
npm run test:coverage

Where should I place new tests?

Place *.test.jsx files in the same directory as the corresponding component. Example:

src/
  Icon/
    Icon.jsx
    Icon.test.jsx
    ...

Deploying

We use NPM to publish Toolbox with semantic versioning. A publish happens automatically each time a commit is pushed to Master (does not work on an amended commit).

toolbox's People

Contributors

addison-grant avatar andrewjpiro avatar archive64 avatar colebemis avatar copperwall avatar danielbeardsley avatar dependabot[bot] avatar lexahall avatar sterlinghirsh avatar tvillarete avatar tvler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

dhmacs akimjc

toolbox's Issues

Replace glamorous with styled-components

swap-glamorous-for-styled-components

Problem

We have since backed the other horse in this race and placed many bets on it. Let's take glamorous behind the barn and put it down.

style-components is the golden cache horse.

Glamorous has been deprecated, and we have standardized on styled-components. Since it's based on some deprecated features of React, this is blocking us from upgrading React.

Do This

Replace all the use cases of Glamorous in this repo with styled-components and drop the dependency. This includes any updates to our jest tests.

Connects https://github.com/iFixit/ifixit/issues/31530

0.0.0-development to 1.1.1 change

I am not sure why the version used to be set to 0.0.0-development in the package.json file. I accidentally changed it when I was publishing the package. The last commit on master didn't update NPM, and I'm not sure why.

d52ef41#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L3-R3

I don't know if it needs to be set back to 0.0.0-development.

@sterlinghirsh, I wonder if you have any ideas about why it was set to 0.0.0-development before, and if we need to change it back for some reason.

Multiple Instance of Glamor

Background

When importing toolbox components in the ifixit repo, we cannot use glamorous to add additional styling. This is because we create an instance of glamor in this package and you can't have multiple instances of it. More details on this issue here threepointone/glamor#290

Do This

Export the instance of glamorous that we create here. This will allow us to use the same instance in the ifixit repo by importing it from the toolbox.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.