@vandebron/windmolen
TypeScript icon, indicating that this package has built-in type declarations

18.2.0 • Public • Published

logo


Netlify Status

How to install

Run the following command using npm

npm install @vandebron/windmolen

If you prefer Yarn, use the following command instead

yarn add @vandebron/windmolen

Demo

A storybook reference of the component library can be found here windmolen.netlify.com . Hosted on Netlify.

Usage

Import the CSS file

Note: it is necessary to do this step otherwise the styles will not be applied, you can import it into the project entry point.

import '@vandebron/windmolen/dist/index.css';

Now you can import the components that you want to use:

import { Container, H1, Paragraph } '@vandebron/windmolen';

Development

Link another repository for live testing

It can be very helpful to see your changes to Windmolen components directly reflected in another project you're working on. To set this up you should follow the following steps.

  1. Set this package folder as source for your yarn symlink connection
yarn link
  1. Go to the project where you'd like to consume this package and run:
yarn link @vandebron/windmolen
  1. And finally, start the Windmolen bundler in watch mode
yarn start

Note:

this can be unlinked again with yarn unlink and yarn unlink @vandebron/windmolen

Additional note:

After replacing webpack with Vite there may be issues when sym-linking Windmolen with the apps projects within the Vandebron monorepo. If you encounter issues and you are not seeing your changes you can try the following:

  1. Go to apps/config/vite.config.base.ts in the Vandebron monorepo.
  2. Update the fs.allow array. Add the relative path to your local Windmolen repository as a new entry. For instance, if you have both Windmolen and the monorepo repositories contained within the same root folder, the path will look like '../../../windmolen'.
  3. Add a new property optimizeDeps to the root level of config: optimizeDeps: { include: ['@vandebron/windmolen'] }
  4. Make sure you do not commit these changes!. They must be reset once you have finished your testing.

Work on Storybook stories

When changing stories in Storybook you might want to see your changes reflected directly. To do so run the Storybook development server that will run locally with

yarn storybook

Tests and verification

The repository knows three methods to guard code quality.

  1. yarn types - will initiate a TS compiler typecheck
  2. yarn lint - will analyze the code based on the set linting rules
  3. yarn test - will start the Jest test runner, which mostly works with automatically generated tests

All of these stages are invoked before any git push and can also be triggered manually with the command

yarn verify

Publishing

Storybook

Storybook is automatically build based on the HEAD version on the master branch. Any push made there will trigger a new build on Netlify.

Windmolen

To publish a new version of the Windmolen package, first merge your branch to master. Next, pull master on your local machine and then run the following commands:

# Use the appropriate version bump. See https://semver.org/ for details
./deploy.py (major|minor|patch)

# You will require publishing rights on NPM for this
npm publish

git push && git push --tags

Alpha or Beta releases

If you want to deploy an Alpha or Beta version do the following:

npm version prerelease --preid=(alpha|beta)
npm publish --tag (alpha|beta)

For example, if you want to bump the version from 3.2.0 to an alpha release of the next patch version (i.e. 3.2.1), you would do the following:

npm version prerelease --preid=alpha
npm publish --tag alpha

Creating a new icon

To create a new icon you must follow these steps:

Exporting from Figma

  1. Find the icon in the 'Design System' file on Figma
    • From a design, you can follow a link to the design system from the 'Inspect' tab in the right side bar
  2. Select the icon in the libary
    • Make sure you have selected the most upper layer of the icon
  3. In the sidebar on the right, select the 'Export' tab and export to SVG
    • You can use the preview to see if you selected the right thing

Optimizing SVG

  1. Go to https://jakearchibald.github.io/svgomg/
  2. Click on Paste markup and paste the SVG code
  3. Enable the "Prefer viewBox to width/height" feature in the menu on the right side of the page
    • The viewBox attribute was previously added manually, this is not necessary when the aforementioned feature is enabled
  4. The icon will be rendered, click on the Copy as text button (it's above the download button)
  5. Go to your prefered text editor and paste the code
  6. Change all fill= and stroke= attributes that have a specific color to currentColor, so that the final result is e.g. fill="currentColor".
    • Leave any attribute that is set to none, for example stroke="none" since that part of the image is probably meant to be empty

Adding the icon to the project

  1. Create a new SVG file inside src/assets/icons, remember that the icon's name will be the name that you will use after to use it. (p.s: my-new-icon.svg will be <Icon name="my-new-icon" />)
  2. Run the following command to convert the SVG icons into react components.
node scripts/convert-icons.js
  1. Update src/components/Icon/icons.ts using the name of the new icon.

Readme

Keywords

none

Package Sidebar

Install

npm i @vandebron/windmolen

Weekly Downloads

630

Version

18.2.0

License

MIT

Unpacked Size

6.92 MB

Total Files

669

Last publish

Collaborators

  • jgf5013
  • denys-vandebron
  • arnav_vandebron
  • vdb-benlynch
  • jdvdb
  • arnestaphorsiusvdb
  • matthijsbon
  • jorgvandebron
  • rogierkoppejan
  • rasimkanca
  • lauraaao
  • vdbdigital