UNPKG

3 kBMarkdownView Raw
1# @mintlab/kitchen-sink [![npm version][npm-image]][npm-url]
2
3> Everything but: miscellaneous Mintlab utility functions.
4
5## Installation
6
7 $ npm install @mintlab/kitchen-sink
8
9## Usage
10
11### Examples
12
13Public API entry point:
14
15 const kitchenSink = require('@mintlab/kitchen-sink');
16
17Destructuring:
18
19 const { dictionary } = require('@mintlab/kitchen-sink');
20
21Single module:
22
23 const dictionary = require('@mintlab/kitchen-sink/dictionary');
24
25## Development
26
27### Docker
28
29Start an interactive `ash` shell for development:
30
31 $ docker-compose exec sink sh
32
33If you edit `.*rc` files in `./root`, you must manually copy
34them to your current working directory in the container.
35
36The `package*.json` files are symlinked because they can be
37mutated both on the host and in the container.
38
39### Publication
40
41The package is published with
42[semantic-release-gitlab](https://www.npmjs.com/package/semantic-release-gitlab)
43on every merge to the master branch. Mind your commit messages.
44
45Files in `./source` are copied to the root and removed after publication.
46See the `prepublishOnly` and `postpublish` lifecycle scripts in `package.json`.
47
48#### Manual emergency publication
49
50In edge cases when semantic release cannot increment:
51
52- if you are not in the container, copy `root/.npmrc`
53 and `root/package.json` to the working copy root
54- update the `version` field in `package.json`
55- run `npm login` if needed
56- run `npm publish --access public`
57- create a matching version tag in gitlab
58- do **not** commit your changes
59
60### Infrastructure
61
62The modules in this package export *Node.js modules* and
63work natively on the server. There is no transpilation and
64distribution build included, to consume them in the browser
65use your bundler of choice.
66
67#### See also
68
69- [Node.js ECMAScript support](https://node.green/)
70
71### Unit testing
72
73Unit tests use
74[tape](https://github.com/substack/tape), a
75[TAP](https://testanything.org)
76producing test harness for node.
77
78#### Async
79
80No special libraries or plugins are needed for async tests:
81
821. make the test callback `async`
832. `plan` the number of assertions
843. `await` the async value
854. proceed as with any other test
86
87##### Example
88
89 test('The async answer', async assert => {
90 assert.plan(1);
91
92 const answer = await new Promise(resolve => {
93 setTimeout(() => resolve(42), 1000);
94 });
95
96 assert.equal(answer, 42, 'is always 42');
97 assert.end();
98 });
99
100## License
101
102Copyright 2017 Mintlab B.V.
103
104Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission -
105subsequent versions of the EUPL (the "Licence").
106
107You may not use this work except in compliance with the Licence.
108
109You may obtain a copy of the Licence at:
110[https://joinup.ec.europa.eu/software/page/eupl](https://joinup.ec.europa.eu/software/page/eupl)
111
112[npm-image]: https://img.shields.io/npm/v/@mintlab/kitchen-sink.svg?style=flat-square
113[npm-url]: https://www.npmjs.com/package/@mintlab/kitchen-sink