@@ -17,6 +17,8 @@ external ReactJS projects developed by the Topcoder community.
17
17
- [ Redux Templates] ( #redux-templates )
18
18
- [ Utilities] ( #utilities )
19
19
- [ Development] ( #development )
20
+ - [ Local Testing of Library Updates within a Host Project] ( #local-testing-of-library-updates-within-a-host-project )
21
+ - [ Library Releases to NPM] ( #library-releases-to-npm )
20
22
- [ License] ( #license )
21
23
22
24
## Installation
@@ -93,41 +95,75 @@ $ ./node_modules/.bin/topcoder-lib-setup
93
95
Webpack bundling process.
94
96
95
97
## Development
96
- For convenient development you can link this package into your host package:
97
- 1 . Clone [ ` topcoder-react-utils ` ] ( https://github.com/topcoder-platform/topcoder-react-utils )
98
- to your machine, and checkout the branch you are going to work with;
99
- 2 . Inside ` topcoder-react-utils ` folder:
100
- - Install dependencies with ` $ npm install ` ;
101
- - Locate ` node_modules/extract-css-chunks-webpack-plugin/index.js ` and
102
- inside the ` isChunk(..) ` function (line #358 ) add ` return true; ` statement,
103
- so that this function always returns * true* . This step is necessary at
104
- the moment, because the check ` chunk instanceof Chunk ` check inside this
105
- function does not work as expected when Webpack config is spread across
106
- multiple inter-linked packages.
107
- - Run the dev build ` $ npm run build:dev ` . It will compile the package, and
108
- also will watch for the file changes to automatically re-compile it as
109
- necessary.
110
- 3 . Inside the host package execute
111
- ` $ npm link PATH_TO_TOPCODER_REACT_UTILS_FOLDER ` . It will create a symlink
112
- from ` HOST_PACKAGE/node_modules/topcoder-react-utils ` to your local copy of
113
- the ` topcoder-react-utils ` package, so that any changes you do there become
114
- automatically available to the host package.
115
-
116
- CI/CD is set up with CircleCI 2.0 for this repo. A commit to any branch, beside
117
- ` master ` will trigger testing of the commited code (it will run ` $ npm test ` and
118
- ensures that it does not fail). A commit to the protected ` master ` branch (only
119
- organization members and repo admins can commit to ` master ` ) will trigger the
120
- testing, and, if successful, release of the updated package to the NPM registry.
121
-
122
- For successful release to NPM you should bump the package version in the
123
- ` package.json ` . To do it conveniently you can use ` $ npm version UPDATE_TYPE `
124
- command, where ` UPDATE_TYPE ` stays for one of ` patch ` /` minor ` /` major ` to bump up
125
- ` 2 ` , ` 1 ` , or ` 0 ` in a sample version number ` v0.1.2 ` . This command will update
126
- ` package.json ` and ` package-lock.json ` , and create a new commit and tag in the
127
- checked-out Git branch. Mind that ` patch ` updates should not introduce
128
- any breaking changes into the codebase! Breaking changes should be done via
129
- ` minor ` or ` major ` update, and they should be documented in
130
- the [ CHANGELOG] ( CHANGELOG.md ) .
98
+
99
+ Whenever you are to do any changes in the library, keep in mind the following:
100
+
101
+ - Different projects rely on this library, the tooling it provides should be as
102
+ generic and flexible as possible. When you change existing components, do your
103
+ best to keep backward compatibility of the updated components, any changes
104
+ that demand updates in the projects relying on the library, must be
105
+ documented in the [ changelog] ( CHANGELOG.md ) .
106
+
107
+ - Rely on unit tests to verify your changes, and prevent regression. Update
108
+ existing unit tests to keep up with your changes, and add new unit tests
109
+ when necessary.
110
+
111
+ - For the final testing of your updates within a host project relying on this
112
+ lib, see the next section.
113
+
114
+ - The library use semantic versioning. In case your changes demand any changes
115
+ in the project relying on the library, you should release it as a minor
116
+ library update (more severe comparing to patch update). Consider to use
117
+ a new branch, called after the minor version, and to not merge your changes
118
+ into the main ** develop** / ** master** branches until everybody is prepared
119
+ for that.
120
+
121
+ ### Local Testing of Library Updates within a Host Project
122
+
123
+ To locally test how your library updates work within a host project relying on
124
+ the lib (without releasing them to NPM), do the following:
125
+
126
+ 1 . In the library root execute ` $ npm run build ` to build the library, using
127
+ the current code;
128
+
129
+ 2 . In the library root execute ` $ npm pack . ` it will pack the library into the
130
+ tarball file ` topcoder-react-utils-x.y.z.tgz ` , where ** x.y.z** is the
131
+ library version specified in ` package.json ` .
132
+
133
+ 3 . In the host project execute
134
+ ` $ npm install --save PATH/TO/topcoder-react-utils-x.y.z.tgz ` to install
135
+ the local version of library build and packed at the previous steps. For
136
+ all practical purposes, the installation will be performed the same way,
137
+ as when the library is publised to NPM and installed from there.
138
+
139
+ 4 . In case your update of ** topcoder-react-utils** alters dependency versions,
140
+ and you need to ensure the same dependency versions installed in the host
141
+ project, execute ` $ ./node_modules/.bin/topcoder-lib-setup --just-fix-deps `
142
+ in the host project's root.
143
+
144
+ 5 . Once you are done with the testing do not forget to ensure that the proper
145
+ NPM version of ** topcoder-react-utils** is saved back to the project's
146
+ ` package.json ` file.
147
+
148
+ ### Library Releases to NPM
149
+
150
+ Continious Integration and Delivery (CI/CD) is set up for this repository with
151
+ CircleCI 2.0. Commits to all branches trigger testing of the code with
152
+ ` $ npm test ` (it runs linters and unit tests), and also build the library.
153
+ CI/CD flow is interrupted in case of any problems.
154
+
155
+ To release updated library version to NPM do the following:
156
+
157
+ - Bump library version in ` package.json ` and ` package-lock.json ` by
158
+ ` $ npm version UPDATE_TYPE --no-git-tag ` command, where ` UPDATE_TYPE ` should
159
+ be one of ` patch ` / ` minor ` / ` major ` to update current version ` x.y.z `
160
+ to ` x.y.(z+1) ` / ` x.(y+1).0 ` / ` (x+1).0.0 ` . The ` --no-git-tag ` flag prevents
161
+ automatic creation of the Git tag with the same name as the version.
162
+
163
+ - Tag the commit to be released with the git tag like ` v0.1.2 ` , where ` 0.1.2 ` is
164
+ the new version set in the previous step.
165
+
166
+ - Commit the tag to GitHub repository.
131
167
132
168
## License
133
169
Topcoder React Utils is [ MIT Licensed] ( LICENSE.md )
0 commit comments