Skip to content

Commit 203657b

Browse files
authoredMay 2, 2020
Setup Lerna strategy (#368)
1 parent 9f2aec3 commit 203657b

File tree

14 files changed

+454
-30589
lines changed

14 files changed

+454
-30589
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ node_js:
99
- "lts/*"
1010

1111
install:
12-
- npm run bootstrap:ci
12+
- npm run setup
1313

1414
script:
1515
- npm run test:ci

‎CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
## [6.0.0] - 2020-05-02
99
### Changed
1010

11-
- [BREAKING] Multi-packages split #327 (A-312). There are 3 packages: convict,
12-
convict-format-with-validator and convict-format-with-moment.
11+
- [BREAKING] Multi-packages split #327 (A-312, Marc-Aurèle Darche @madarche).
12+
There are now 3 packages: convict, convict-format-with-validator, convict-format-with-moment
1313
- [BREAKING] Remove the *json5* dependency and make it an optional parser #326 (A-312)
1414
- Ease relying applications security fixes by using `^x.y.z` range versions for
1515
Convict's `dependencies` and `devDependencies`, instead of exact/strict versions.

‎CONTRIBUTING.md

+41-29
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,31 @@ compromise those goals and follow the
1111
Project structure and management
1212
--------------------------------
1313

14-
This repository is a monorepo for multiple packages managed through
15-
[Lerna](https://lerna.js.org/).
14+
This repository is a monorepo for multiple packages.
1615

17-
This repository is managed by Lerna using the "Fixed/Locked" mode (Lerna default
18-
mode).
16+
At the moment this repository is managed through [Lerna](https://lerna.js.org/)
17+
with the following strategy below. This strategy is not perfect, as Lerna is not
18+
(at least at time of writing) a tool perfectly fit for all npm current uses and
19+
best practices cf. https://github.com/lerna/lerna/issues/1663,
20+
https://github.com/lerna/lerna/issues/1462. And Lerna is missing best practices
21+
for different use cases (at least at time of writing). So this strategy is
22+
subject to change as we get more knowledge of Lerna and as new releases will be
23+
done. Don't hesitate to propose better strategies, PR are welcomed!
1924

20-
Use the following commands to manage this repository and its packages.
25+
### Strategy
2126

22-
To install all the dependencies, devDependencies and links any cross-dependencies:
27+
* "Fixed/Locked" mode (Lerna default mode) for now
28+
* All `devDependencies` in the root-level `package.json`. This is the sanest
29+
thing to do since all the packages are very very similar.
30+
31+
32+
Running tests
33+
-------------
2334

2435
```shellsession
25-
npx lerna bootstrap
36+
cd node-convict
37+
npm run setup
38+
npm test
2639
```
2740

2841

@@ -37,43 +50,42 @@ Running the following command line will help you to conform your newly written
3750
code:
3851

3952
```shellsession
53+
cd node-convict
4054
npm run lint:fix
55+
npm run setup
4156
```
4257

4358

44-
Test
45-
----
59+
Updating dependencies and devDependencies
60+
-----------------------------------------
61+
62+
1. Update the version of the `dependencies` in the packages `package.json` files
63+
and the `devDependencies` in the root-level `package.json`
4664

47-
Before submitting a PR, check that the code, with your modifications, still
48-
passes the tests:
65+
2. Fetch the packages and update the `package-lock.json`
4966

5067
```shellsession
51-
npm test
68+
cd node-convict
69+
npm install
70+
npm install packages/*
71+
npx lerna link
5272
```
5373

74+
Never run `lerna bootstrap`, cf. https://github.com/lerna/lerna/issues/1462#issuecomment-410536290
5475

55-
Creating/Tagging new versions
56-
-----------------------------
5776

58-
This section is intended for all the maintainers of the project.
77+
Creating/Tagging and publishing new versions
78+
--------------------------------------------
5979

60-
Tagging a new version *should not be done manually*,
61-
but through the `npm version` command, as the example shows below.
80+
This section is especially intended for the maintainers of the project.
6281

63-
This must be done so in order to:
82+
Before any new release the [CHANGELOG](./CHANGELOG.md) must be updated.
6483

65-
* never forget to create a Git tag
66-
* never create wrong tags and versions
67-
* never forget to add a corresponding entry in the [CHANGELOG](./CHANGELOG.md)
68-
file
84+
**Everything tagging and publishing should be done throug Lerna**.
6985

70-
Example on how to create/tag new versions:
86+
Tagging should not be done manually, nor through the `npm version` command.
7187

7288
```shellsession
73-
npm version patch
74-
75-
npm version minor
76-
77-
npm version major
89+
npx lerna version 6.0.0
90+
npx lerna publish from-git
Has conversations. Original line has conversations.
7891
```
79-

‎package-lock.json

+402-369
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+7-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-convict",
33
"private": true,
44
"scripts": {
5-
"bootstrap:ci": "npm ci && npm ci packages/*",
5+
"setup": "npm ci && lerna link",
Has conversations. Original line has conversations.
66
"test": "jest",
77
"posttest": "npm run lint",
88
"pretest:ci": "npm run lint",
@@ -11,22 +11,16 @@
1111
"lint": "eslint .",
1212
"lint:fix": "eslint --fix ."
1313
},
14-
"dependencies": {
15-
"lodash.clonedeep": "^4.5.0",
16-
"moment": "^2.24.0",
17-
"validator": "^11.1.0",
18-
"yargs-parser": "^18.1.1"
19-
},
2014
"devDependencies": {
21-
"convict": "file:./packages/convict/",
22-
"convict-format-with-moment": "file:./packages/convict-format-with-moment/",
23-
"convict-format-with-validator": "file:./packages/convict-format-with-validator/",
24-
"coveralls": "^3.0.7",
15+
"convict": "file:packages/convict",
16+
"convict-format-with-moment": "file:packages/convict-format-with-moment",
17+
"convict-format-with-validator": "file:packages/convict-format-with-validator",
18+
"coveralls": "^3.1.0",
2519
"deep-object-diff": "^1.1.0",
2620
"eslint": "^6.8.0",
27-
"jest": "25.4.0",
21+
"jest": "^25.5.4",
2822
"js-yaml": "^3.13.1",
29-
"json5": "^2.1.0",
23+
"json5": "^2.1.3",
3024
"lerna": "^3.20.2",
3125
"toml": "^3.0.0"
3226
}

‎packages/convict-format-with-moment/.eslintignore

-1
This file was deleted.

‎packages/convict-format-with-moment/package-lock.json

-11,913
This file was deleted.

‎packages/convict-format-with-moment/package.json

-11
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,11 @@
2020
"engines": {
2121
"node": ">=6"
2222
},
23-
"scripts": {
24-
"test": "jest",
25-
"posttest": "npm run lint",
26-
"lint": "eslint .",
27-
"lint:fix": "eslint --fix ."
28-
},
2923
"main": "src/main.js",
3024
"files": [
3125
"src"
3226
],
3327
"dependencies": {
3428
"moment": "^2.24.0"
35-
},
36-
"devDependencies": {
37-
"convict": "file:../convict",
38-
"eslint": "^6.8.0",
39-
"jest": "25.4.0"
4029
}
4130
}

‎packages/convict-format-with-validator/.eslintignore

-1
This file was deleted.

‎packages/convict-format-with-validator/package-lock.json

-11,913
This file was deleted.

‎packages/convict-format-with-validator/package.json

-11
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,11 @@
2121
"engines": {
2222
"node": ">=6"
2323
},
24-
"scripts": {
25-
"test": "jest",
26-
"posttest": "npm run lint",
27-
"lint": "eslint .",
28-
"lint:fix": "eslint --fix ."
29-
},
3024
"main": "src/main.js",
3125
"files": [
3226
"src"
3327
],
3428
"dependencies": {
3529
"validator": "^11.1.0"
36-
},
37-
"devDependencies": {
38-
"convict": "file:../convict",
39-
"eslint": "^6.8.0",
40-
"jest": "25.4.0"
4130
}
4231
}

‎packages/convict/.eslintignore

-1
This file was deleted.

‎packages/convict/package-lock.json

-6,309
This file was deleted.

‎packages/convict/package.json

+1-15
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,12 @@
2121
"engines": {
2222
"node": ">=6"
2323
},
24-
"scripts": {
25-
"test": "jest",
26-
"posttest": "npm run lint",
27-
"lint": "eslint .",
28-
"lint:fix": "eslint --fix ."
29-
},
3024
"main": "src/main.js",
3125
"files": [
3226
"src"
3327
],
3428
"dependencies": {
3529
"lodash.clonedeep": "^4.5.0",
36-
"yargs-parser": "^18.1.1"
37-
},
38-
"devDependencies": {
39-
"deep-object-diff": "^1.1.0",
40-
"eslint": "^6.8.0",
41-
"jest": "25.4.0",
42-
"js-yaml": "^3.13.1",
43-
"json5": "^2.1.0",
44-
"toml": "^3.0.0"
30+
"yargs-parser": "^18.1.3"
4531
}
4632
}

0 commit comments

Comments
 (0)
Please sign in to comment.