@zajno/common 2.0.5 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,12 +27,14 @@ Prior to v2 some part of this library were depending on [MobX](https://mobx.js.o
27
27
 
28
28
  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:
29
29
 
30
- 1. Install from NPM
30
+ 1. Install from NPM w/ yarn
31
31
 
32
32
  ```
33
33
  yarn add @zajno/common
34
34
  ```
35
35
 
36
+ [`tslib`](https://www.npmjs.com/package/tslib) is the only peer dependency.
37
+
36
38
  2. In your code, use each module separately:
37
39
 
38
40
  ```typescript
@@ -43,6 +45,8 @@ import logger, { ILogger } from '@zajno/common/logger';
43
45
 
44
46
  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.
45
47
 
48
+ Although install time has been decreased, the main downside is that sources are built being targeted on [ES2019 & CommonJS](./tsconfig.json#L13-L14) (for now!). This might be not always suitable and/or optimal for all build setups.
49
+
46
50
  ## Local development
47
51
 
48
52
  If you plan to update the sources while using it in your project, we'd recommend using [`yalc`](https://www.npmjs.com/package/yalc). It does some magic to allow both using it in your project and updating it.
@@ -63,4 +67,4 @@ The flow will look like the following. [1] – operations made on this project,
63
67
  ## Challenges & TODOs
64
68
 
65
69
  1. This library should be and will be updated frequently. When and how to integrate these changes? For small projects that would not be required, but for long-running ones the strategy would be essential.
66
- 2. It needs [more] tests.
70
+ 2. It needs (more) tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zajno/common",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Zajno's re-usable utilities for JS/TS projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,10 +16,10 @@
16
16
  "build": "tsc -P tsconfig.build.json",
17
17
  "build:clean": "rimraf ./lib && yarn build",
18
18
  "build:w": "yarn build --watch",
19
- "publish:local": "yalc push --replace --update",
19
+ "publish:local": "yarn build-for-publish && yarn copy-for-publish && cd lib && yalc push --replace --update",
20
+ "publish:from-lib": "yarn build-for-publish && yarn copy-for-publish && cd lib && yarn publish",
20
21
  "build-for-publish": "yarn build:clean && yarn lint && yarn test",
21
22
  "copy-for-publish": "cpy package.json LICENSE README.md lib/",
22
- "publish-from-lib": "yarn build-for-publish && yarn copy-for-publish && cd lib && yarn publish",
23
23
  "lint": "eslint \"src/**/*.ts?(x)\"",
24
24
  "test": "yarn jest --clearCache && yarn jest"
25
25
  },
package/types/index.d.ts CHANGED
@@ -12,4 +12,5 @@ export declare type NestedPick<T, K extends any[]> = K extends Array<never> ? T
12
12
  export declare type Mutable<T> = {
13
13
  -readonly [P in keyof T]: T[P];
14
14
  };
15
+ export declare type LengthArray<T, N extends number, R extends T[] = []> = number extends N ? T[] : R['length'] extends N ? R : LengthArray<T, N, [T, ...R]>;
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAE7B,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AAEjD,oBAAY,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI;KACxC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK;CAC7C,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC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