Common Helpers
Node.js module to expose Apolitical's common helper functions
How do I get set up?
Requirements
Requires the following to run:
Initial setup
Clone repository:
git clone git@gitlab.com:apolitical/modules/common-helpers.git
Install dependencies:
yarn install
Run tests:
yarn test
Linking with yalc
This creates a symbolic link (symlink) that allows you to use your changes locally in other repos, rather than having to publish to npm to test
- Run
yarn global add yalc
- this is a global install on your computer - In common-helpers, run
yalc publish
- In the repo you want to link to, run
yalc link @apolitical/common-helpers
- Each time you make a change in Common Helpers, you can run
yalc push
in common-helpers repo and these changes should reflect in the linked repo. If changes do not show up, tryyalc publish --push
- Add
.yalc/
andyalc.lock
to your.gitignore
file if it is not already there. This is just for local development, we don't want to commit yalc files.
If you are not seeing your changes come through in the repo you want to link, try running yalc add @apolitical/common-helpers
. Note, this will change the package.json
file to point at the yalc version of this package and you'll have to undo this before committing.
** Note **
When you're done, you can run a regular yarn install @apolitical/common-helpers
in the linked repo to overwrite the yalc version, or run yalc remove @apolitical/common-helpers
in the linked repo.
Double check that the package in your linked repo's package.json
is pointing to @apolitical/common-helpers
. yalc link
should not touch the package.json
, but it's wise to double check.
Some information about imageResizing helper function
- This function takes two argument: filepath, desiredSize. The desiredSize value must be one of the following: 310x495, 240x366, 456x320, 60x60, 100x100, 310x155, 200x150, 425x425, 310x350, 650x280, 310x220.