UNPKG

2.32 kBMarkdownView Raw
1# `topcoder-lib-setup` script
2
3NodeJS script that helps to install and upgrade `topcoder-react-utils` and other
4similar NPM libraries maintained by Topcoder.
5
6**Why?** — When library version is upgraded manually, it is difficult
7to ensure the same versions of common dependencies are used by the upgraded
8library and by its host codebase. In some situations the mismatch of exact
9versions leads to odd issues, difficult to track. This script solves this
10problem.
11
12### Usage
13
14From the host package's root directory call it as:
15```sh
16$ ./node_modules/.bin/topcoder-lib-setup [OPTION]... [LIBRARY]...
17```
18Where `[OPTIONS]...` is an optional, whitespace-separated list of options (see
19below); and `[LIBRARY]...` is an optional, whitespace-separated list of libraries
20to update. If no library names are given, `topcoder-react-utils` is assumed by
21default.
22
23For each `library` specified in the `[LIBRARY]...` list, this script does the
24following:
25
26- Installs the specified (if `library` contains `@x.y.z` semver suffix), or
27 the latest (automatically appending `@latest` suffix to `library`) version
28 of `library` as a regular dependency of the host code. Specifically, it does:
29 ```bash
30 $ npm install --save library
31 ```
32
33- Installs all dev dependencies of `library` into the host code as dev
34 dependencies with exactly the same versions. Specifically, it generates
35 a whitespace-separated list `devDeps` of dev dependencies, then executes
36 ```bash
37 $ npm install --save-dev devDeps
38 ```
39
40- Updates regular dependencies or the host package, that are also used by
41 `library` to the same versions used by the library. Specifically, it generates
42 a whitespace-separated list of dependencies, `deps`, which is an intersection
43 of regular dependencies of `library` witht the set of regular dependencies of
44 the host code; and the version of each dependency in the list is taken from
45 the `library`'s `package.json`. Then it executes:
46 ```bash
47 $ npm install --save deps
48 ```
49
50Once the steps described above are completed for each library, the script
51executes `$ npm install` to ensure that any packages removed temporarily
52during those steps are installed back.
53
54### Options
55| Option | Alias | Description |
56| --- | --- | --- |
57| `--help` | `-h` | Prints to standard output the basic usage instructions.
58
\No newline at end of file