You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+19-34
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@ Thanks for helping out!
7
7
8
8
Victory is a monorepo built with [Lerna](https://lernajs.io/) and [Yarn](https://yarnpkg.com/) workspaces. All `victory-*` packages live in the `packages` directory, and each has its own `package.json`. Installing this repo with `yarn` will automatically link all interdependent `victory-*` packages. **You must use `yarn` rather than `npm` when installing and running `package.json` scripts in this project.**
9
9
10
+
## `package-scripts.js`
11
+
12
+
Victory uses [`nps`](https://github.com/kentcdodds/nps) to organize package scripts. Check `package-scripts.js` for the full list of commands.
13
+
10
14
### Requirements
11
15
12
16
-[Node.js](https://nodejs.org/) 8.10.0 or higher.
@@ -27,33 +31,17 @@ Use [Yarn](https://yarnpkg.com/) to install dependencies:
27
31
$ yarn install
28
32
```
29
33
30
-
A `postinstall` script will build `lib/` and `es/` for all `victory-*` packages.
31
-
32
-
Now you're ready to run a development server and check out the demos. Demos will be served at localhost:3000/
34
+
Run a development server and check out the demos. Demos will be served at localhost:3000/. This command will also build and watch `lib/` and `es/` directories in all packages, so your demos will always be in sync with code changes.
33
35
34
36
```console
35
37
$ yarn start
36
38
```
37
39
38
-
## Developing multiple packages
39
-
40
-
When making changes across multiple dependent packages, it is necessary to rebuild libs in order to pick up changes in dependent packages. You can manually rebuild libs by running:
41
-
42
-
```console
43
-
$ nps build-libs
44
-
```
45
-
46
-
or start a task in a new terminal window that will watch for code changes, and automatically rebuild libs
47
-
48
-
```console
49
-
$ nps watch
50
-
```
51
-
52
40
## Checks, Tests
53
41
54
42
All checks and tests run from the root directory.
55
43
56
-
The `check` script will lint all packages and infrastructure before starting a test server and running our suite of tests
44
+
The `check` script will lint all packages and infrastructure before building packages and starting a test server and running our suite of tests
57
45
58
46
```console
59
47
$ nps check
@@ -74,36 +62,26 @@ Victory relies heavily on visual regression testing with [Storybook](https://sto
74
62
Write visual tests for new features by adding them in the `stories` directory. Run storybooks and check out changes. Storybooks are served from localhost:6006/
75
63
76
64
```console
77
-
$ nps storybook
65
+
$ yarn storybook
78
66
```
79
67
80
68
[Chromatic](https://www.chromaticqa.com/) provides automated visual testing. All PRs will trigger a new chromatic build, which will be displayed along with CI status. You can also trigger a new build manually with:
81
69
82
70
```console
83
-
$ nps storybook
71
+
$ yarn chromatic
84
72
```
85
73
86
-
**External contributors will not be able to automate their visual regression testing with Chromatic, as it requires a secret app code.**
87
-
88
-
TODO: Set up chromatic CI for this repo
89
-
74
+
**External contributors will not be able to use Chromatic to automate their visual regression testing, as it requires a secret app code.**
90
75
91
76
## Release
92
77
93
-
Victory uses [publishr](https://github.com/FormidableLabs/publishr) to organize compiled code for released versions.
78
+
Victory uses [Lerna](https://lernajs.io/) to automate versioning and publishing packages.
94
79
95
-
Each package must contain the following version scripts and publishr config in its`package.json`:
80
+
Each package must contain the following `version` script`package.json`:
96
81
97
82
```
98
83
"scripts": {
99
84
"version": "nps build-libs && nps build-dists",
100
-
"postversion": "publishr postversion -V",
101
-
"postpublish": "publishr postpublish -V"
102
-
},
103
-
"publishr": {
104
-
"files": {
105
-
".npmignore": "../../.npmignore.publishr"
106
-
}
107
85
}
108
86
```
109
87
Pre version checks are run _once_ for all packages, and are defined in the root directory `package.json`
@@ -115,10 +93,17 @@ Pre version checks are run _once_ for all packages, and are defined in the root
115
93
The following commands will let you try a version without publishing or creating git commits:
116
94
117
95
```console
118
-
// This command bumps versions, runs checks, builds libs, and runs publishr postversion (~5 minutes)
96
+
// This command bumps versions, runs checks, builds libs. No git commits will be made, and nothing will be published. `package.json` files in all packages will be altered, so be careful to clean up afterwards.
119
97
$ nps lerna-dry-run
120
98
```
121
99
100
+
To publish a package _for real_
101
+
102
+
```console
103
+
$ lerna publish
104
+
```
105
+
You will be prompted to select an appropriate version before continuing. Lerna will run preversion checks, bump versions in all packages, create git commits, build libs, and publish packages. The whole process takes about 5 minutes. Be patient!
0 commit comments