🌹 Sharyn
Sharyn is a collection of JavaScript / TypeScript packages that make your life easier and reduce your boilerplate code.
💯 General
- @sharyn/util – Lodash-like utils
- @sharyn/scripts – Helpers to write "NPM scripts" in a JavaScript file
- @sharyn/env – Convenient access and validation of env variables
💻 Development
- @sharyn/prettier – A Prettier configuration
- babel-preset-sharyn – A Babel preset for React and Flow
- eslint-config-sharyn – An ESLint configuration for Babel, React and Flow
⚛️ React
- @sharyn/hooks – Convenient React Hooks
🌐 Web
- @sharyn/browser – Helpers for code that runs in the browser
Getting Started
Depending on your needs, you can install individual modules, like @sharyn/browser.getformfields
, a group of modules, like @sharyn/browser
, or the whole library (which is actually quite small, 379KB on disk, including all its dependencies). That's the simplest way to get started. The library is separated into 2 parts, sharyn
, which goes in your dependencies
, and sharyn-dev
, which goes in your devDependencies
.
npm i sharyn && npm i --save-dev sharyn-dev
# or
yarn add sharyn && yarn add --dev sharyn-dev
Imports
And depending on what packages you chose to install, you have different ways to import
or require
a module:
// If you installed an individual package (note the lowercase name)
import getFormFields from '@sharyn/browser.getformfields'
// If you installed a group of modules
import getFormFields from '@sharyn/browser/getFormFields'
import { getFormFields } from '@sharyn/browser'
// If you installed the whole library
import getFormFields from 'sharyn/browser/getFormFields'
import { getFormFields } from 'sharyn/browser'
import { getFormFields } from 'sharyn'
Note: If you use the from 'sharyn'
syntax, you need to have react
and react-router
installed in your project, since some of the modules included in sharyn
require them.
Also, TypeScript users, remember to have your esModuleInterop
set to true
if you want to import the default exports without having to use the *
syntax.
Credits
By Jonathan Verrecchia (verekia) Github • Twitter • Website – MIT License
Sharyn is a reference to one of my favorite metalcore songs, Rose of Sharyn by Killswitch Engage.
Rose illustration by tiaesther_4360