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 |
|
13 | Public API entry point:
|
14 |
|
15 | const kitchenSink = require('@mintlab/kitchen-sink');
|
16 |
|
17 | Destructuring:
|
18 |
|
19 | const { dictionary } = require('@mintlab/kitchen-sink');
|
20 |
|
21 | Single module:
|
22 |
|
23 | const dictionary = require('@mintlab/kitchen-sink/dictionary');
|
24 |
|
25 | ## Development
|
26 |
|
27 | ### Docker
|
28 |
|
29 | Start an interactive `ash` shell for development:
|
30 |
|
31 | $ docker-compose exec sink sh
|
32 |
|
33 | If you edit `.*rc` files in `./root`, you must manually copy
|
34 | them to your current working directory in the container.
|
35 |
|
36 | The `package*.json` files are symlinked because they can be
|
37 | mutated both on the host and in the container.
|
38 |
|
39 | ### Publication
|
40 |
|
41 | The package is published with
|
42 | [semantic-release-gitlab](https://www.npmjs.com/package/semantic-release-gitlab)
|
43 | on every merge to the master branch. Mind your commit messages.
|
44 |
|
45 | Files in `./source` are copied to the root and removed after publication.
|
46 | See the `prepublishOnly` and `postpublish` lifecycle scripts in `package.json`.
|
47 |
|
48 | #### Manual emergency publication
|
49 |
|
50 | In 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 |
|
62 | The modules in this package export *Node.js modules* and
|
63 | work natively on the server. There is no transpilation and
|
64 | distribution build included, to consume them in the browser
|
65 | use your bundler of choice.
|
66 |
|
67 | #### See also
|
68 |
|
69 | - [Node.js ECMAScript support](https://node.green/)
|
70 |
|
71 | ### Unit testing
|
72 |
|
73 | Unit tests use
|
74 | [tape](https://github.com/substack/tape), a
|
75 | [TAP](https://testanything.org)
|
76 | producing test harness for node.
|
77 |
|
78 | #### Async
|
79 |
|
80 | No special libraries or plugins are needed for async tests:
|
81 |
|
82 | 1. make the test callback `async`
|
83 | 2. `plan` the number of assertions
|
84 | 3. `await` the async value
|
85 | 4. 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 |
|
102 | Copyright 2017 Mintlab B.V.
|
103 |
|
104 | Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission -
|
105 | subsequent versions of the EUPL (the "Licence").
|
106 |
|
107 | You may not use this work except in compliance with the Licence.
|
108 |
|
109 | You 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
|