Skip to content

Commit 18b6291

Browse files
authored
Merge pull request #59 from ThatConference/fix/husky-again
Remove `husky install` from all npm scripts. (v2.0.4)
2 parents afe18b1 + 7107f4e commit 18b6291

3 files changed

Lines changed: 61 additions & 5 deletions

File tree

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,64 @@ Shared component library for the api microservices.
44

55
@thatconference/api
66

7+
## Development guidelines
8+
9+
- After initial clone of repository run:
10+
- npm i
11+
- npx husky install
12+
13+
`husky install` is put under npm:prepare by default, though it causes many issues with this babel generated product when publishing, etc. For now it has to be manual. Putting `husky install` under npm:postinstall, doesn't work as it will try to run when the package is installed in a project.
14+
15+
## Basic local testing
16+
17+
Use npm linking to test locally with this package.
18+
19+
Starting with that-api directory
20+
21+
```sh
22+
cd that-api
23+
npm run validate
24+
npm run build
25+
cd __build__
26+
npm link
27+
cd ..
28+
npm run dev
29+
```
30+
31+
Now at the api project e.g. that-api-members
32+
33+
```sh
34+
cd that-api-members
35+
npm run validate
36+
npm link @thatconference/api
37+
npm run validate
38+
npm run start:watch
39+
```
40+
41+
At this point the that-api-members project is running using the linked that-api package, not the one downloaded into its node_modules folder.
42+
43+
So to undo this. I am not 100% sure this is correct, but it seems to work.
44+
45+
Unlink the the package from that-api-members.
46+
47+
```sh
48+
^c
49+
cd ~/tc/that-api-members
50+
npm unlink @thatconference/api
51+
npm i @thatconference/api
52+
```
53+
54+
Stop the running code and unlink to remove the link from npm which removes it from global location `{prefix}/lib/node_modules/<package>`
55+
56+
```sh
57+
^c
58+
cd ~/tc/that-api/
59+
npm unlink
60+
cd ..
61+
```
62+
63+
When you unlink a package it removes it from packages.json, so we need to then add it back. This is why we removed the global link first so we could install and get the package, not the link.
64+
765
## Publishing new versions
866

967
1. ENSURE `package.json` version is updated to new semver value!

package-lock.json

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"name": "@thatconference/api",
33
"description": "THAT-API shared library for all micro services",
4-
"version": "2.0.3",
4+
"version": "2.0.4",
55
"main": "index.js",
66
"scripts": {
7-
"postinstall": "husky install",
87
"build": "rimraf __build__ && babel ./src -d ./__build__ --copy-files --ignore ./**/__tests__",
98
"postbuild": "cp ./package.json ./package-lock.json ./__build__",
109
"dev": "nodemon -e js --watch src --ignore '*.test.js, *.tests.js' --exec npm run build",

0 commit comments

Comments
 (0)