@zajno/common

2.3.7 • Public • Published

Zajno's Toolbox

Coverage Status

This is a library with a useful utils/helpers to share across our projects.

Doesn't pretend to be useful in outer world because probably everything is invented, tested and released to NPM already.

The motivation to have this – just to control and organize some shared code that we ever wanted to write by ourselves.

...and other more or less noteworthy stuff.

The source code is written in TypeScript, and intended to be used in TS project, so no built JS sources included.

Usage

It can be used a git submodule if you're brave enough, but it's possible to use it as npm package (kinda) as well. In your project:

  1. Install from NPM:
npm i @zajno/common

tslib is the only peer dependency.

  1. In your code, use each module separately:
import logger, { ILogger } from '@zajno/common/logger';

Note on imports in v1

Previously one had to import from like @zajno/common/lib/logger since compiling had been doing at postinstall time so Typescript with its config was a peer dependency. Currently it's not the case and this packages is provided with build artifacts (js + d.ts + source maps); so no need to include /lib part in imports anymore.

Although install time has been decreased, the main downside is that sources are built being targeted on CommonJS & ES2019+ (for now!). This might be not always suitable and/or optimal for all build setups.

Local development

If you plan to update the sources while using it in your project, we'd recommend using yalc. It does some magic to allow both using it in your project and updating it.

The flow will look like the following. [1] – operations made on this project, [2] – operations made on dependant project.

  1. install yalc globally
  2. [1] fork (if you're outside Zajno) and clone this project, do npm i
  3. [1] run yalc publish --private
  4. [2] run yalc add @zajno/common && npm i
  5. [1] make changes in local copy, run tests etc.
  6. [1] run some magic: npm run push:local – this should deliver your updated copy to local project(s) [2]
  7. [2] notice the changes in your project, repeat 5-7 until you're done
  8. [2] to cleanup, run yalc remove @zajno/common or just yalc remove --all
  9. [1] push your changes after making sure it's OK, we'd say thank you for a PR!
  10. [2] re-add the package into your project or specify tag/commit (e.g. npm upgrade @zajno/common)

Readme

Keywords

none

Package Sidebar

Install

npm i @zajno/common

Weekly Downloads

293

Version

2.3.7

License

MIT

Unpacked Size

527 kB

Total Files

431

Last publish

Collaborators

  • idudinov