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
Intial version of the package. A big journey starts here.
5
-
- Standard Babel configurations for JS/JSX modules compilation during Webpack build, and for code execution in Node environment with support of server-side rendering.
4
+
Pre-release drafts of the initial package version. A big journey starts here.
Copy file name to clipboardExpand all lines: README.md
+17-9Lines changed: 17 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,18 @@
1
1
# Topcoder React Utils
2
-
The [Topcoder](https://www.topcoder.com) collection of generic ReactJS configurations, components and utilities to be shared between all internal and external ReactJS projects developed by the Topcoder community.
2
+
The [Topcoder](https://www.topcoder.com) collection of generic ReactJS
3
+
configurations, components and utilities to be shared between all internal and
4
+
external ReactJS projects developed by the Topcoder community.
3
5
4
6
### Installation
5
7
Install this package as
6
8
```
7
9
$ npm install --save topcoder-react-utils
8
10
```
9
11
10
-
You are done if you will use only components and utilities provided by this package. If you are to use configurations, you must also install peer dependencies. If you like to explicitly add them to the `package.json` of your project do
12
+
You are done if you will use only components and utilities provided by this
13
+
package. If you are to use configurations, you must also install peer
14
+
dependencies. If you like to explicitly add them to the `package.json` of your
15
+
project do
11
16
```
12
17
$ npm install -g install-peerdeps
13
18
$ install-peerdeps topcoder-react-utils
@@ -23,16 +28,19 @@ then add to your `package.json` the following script:
Now, in both cases, `$ npm install` will install all necessary dependencies, but in the second case they won't be stored into your `package.json`.
31
+
Now, in both cases, `$ npm install` will install all necessary dependencies, but
32
+
in the second case they won't be stored into your `package.json`.
27
33
28
-
#### Configurations
29
-
-[**Babel Configurations**](docs/babel-config.md)— Standard configurations for [Babel](https://babeljs.io/);
30
-
-[**ESLint Configurations**](docs/eslint-config.md)— Standard configurations for [ESLint](https://eslint.org/).
34
+
### Configurations
35
+
-[**Babel Configurations**](docs/babel-config.md)— Standard configurations
36
+
for [Babel](https://babeljs.io/);
37
+
-[**ESLint Configurations**](docs/eslint-config.md)— Standard
38
+
configurations for [ESLint](https://eslint.org/).
31
39
32
-
####Components
33
-
*To be added*
40
+
### Components
41
+
-[**Link and NavLink**](docs/link-and-navlink.md)— Auxiliary wrappers around [React Router](https://github.com/ReactTraining/react-router)'s `<Link>` and `<NavLink>` components; they help to handle external and internal links in a single uniform manner;
Standard configurations for [Babel](https://babeljs.io/).
3
3
4
-
**Why?**— We use Babel to support latest JavaScript specifications in our projects, and to allow for some fancy features in our code. The standard Babel configurations ensure that the same code patterns are supported in all of our apps.
4
+
**Why?**— We use Babel to support latest JavaScript specifications in our
5
+
projects, and to allow for some fancy features in our code. The standard Babel
6
+
configurations ensure that the same code patterns are supported in all of our apps.
5
7
6
8
Several Babel configurations are provided by this package:
7
9
8
-
-[**config/babel/node-ssr**](#node-ssr)— Babel configuration for NodeJS compilation of JS and JSX modules (server-side ReactJS rendering);
10
+
-[**config/babel/node-ssr**](#node-ssr)— Babel configuration for NodeJS
11
+
compilation of JS and JSX modules (server-side ReactJS rendering);
9
12
10
-
-[**config/babel/webpack**](#webpack)— Babel configuration for Webpack compilation of JS and JSX modules.
13
+
-[**config/babel/webpack**](#webpack)— Babel configuration for Webpack
14
+
compilation of JS and JSX modules.
11
15
12
16
Use them as presets in your `.babelrc`, e.g.
13
17
```json
@@ -27,40 +31,84 @@ To set options provided by a preset:
27
31
}
28
32
```
29
33
30
-
As the presets are JS modules, you can also wrap them into your own JS code to create a special preset that customizes Babel configuration in any necessary way. If you feel that the modification you need is useful for any generic ReactJS app, feel free to open GitHub issue ticket to discuss an update of our default configurations.
34
+
As the presets are JS modules, you can also wrap them into your own JS code to
35
+
create a special preset that customizes Babel configuration in any necessary
36
+
way. If you feel that the modification you need is useful for any generic
37
+
ReactJS app, feel free to open GitHub issue ticket to discuss an update of our
38
+
default configurations.
31
39
32
-
These presets may behave differently in different Babel environments. You can set the environment with `BABEL_ENV` environment variable, or with `forceEnv` option of the Webpack's `babel-loader`.
40
+
These presets may behave differently in different Babel environments. You can
41
+
set the environment with `BABEL_ENV` environment variable, or with `forceEnv`
42
+
option of the Webpack's `babel-loader`.
33
43
34
44
### Configuration Details
35
45
36
-
- <aname="node-ssr">**`config/babel/node-ssr.json`**</a> — Babel configuration for NodeJS compilation of JS and JSX modules (server-side ReactJS rendering);
- Uses [`babel-plugin-css-modules-transform`](https://www.npmjs.com/package/babel-plugin-css-modules-transform) to convert CSS and SCSS imports into objects with keys and values being the original and transformed class names. The transformed class names will match the class names generated by the `babel-plugin-react-css-modules` plugin, mentioned below;
41
-
42
-
- Uses [`babel-plugin-dynamic-import-node`](https://www.npmjs.com/package/babel-plugin-dynamic-import-node) to support dynamic `import(..)` statemens;
43
-
44
-
- Uses [`babel-plugin-inline-react-svg`](https://www.npmjs.com/package/babel-plugin-inline-react-svg) to embed imported SVG files into the complied JS modules;
45
-
46
-
- Uses [`babel-plugin-module-resolver`](https://www.npmjs.com/package/babel-plugin-module-resolver) to setup the following paths as the roots for resolution of relative imports: `./src/shared`, `./src`. It will also apply path resolution to the first argument of `resolveWeak(..)` functions encountered in the compiled code;
47
-
48
-
- Uses [`babel-plugin-react-css-modules`](https://www.npmjs.com/package/babel-plugin-react-css-modules) to transform `styleName` props of ReactJS components into globally unique `className` props. Generated class names are verbose in *development* and *test* Babel environment, for the ease of debugging; and they are short 6-symbols hashes in *production* Babel environment, for compactness of the compiled JS and CSS modules;
49
-
50
-
- Uses [`babel-plugin-tranform-assets`](https://www.npmjs.com/package/babel-plugin-transform-assets) to convert GIF, JPEG, JPG, and PNG imports into `/images/[FILE_HASH].[FILE_EXTENSION]` URL strings. Use the **`baseAssetsOutputPath`** preset option to prefix generated paths with an arbitrary path;
51
-
52
-
- Uses [`babel-plugin-transform-runtime`](https://www.npmjs.com/package/babel-plugin-transform-runtime) to optimized complied JS modules (it externalizes references to helpers and builtins, automatically polyfilling the code without polluting globals).
53
-
54
-
- <aname="webpack">**`config/babel/webpack`**</a> — Babel configuration for Webpack compilation of JS and JSX modules.
- Uses [`babel-plugin-inline-react-svg`](https://www.npmjs.com/package/babel-plugin-inline-react-svg) to embed imported SVG files into the complied JS modules;
59
-
60
-
- Uses [`babel-plugin-module-resolver`](https://www.npmjs.com/package/babel-plugin-module-resolver) to setup the following paths as the roots for resolution of relative imports: `./src/shared`, `./src`;
61
-
62
-
- Uses [`babel-plugin-react-css-modules`](https://www.npmjs.com/package/babel-plugin-react-css-modules) to transform `styleName` props of ReactJS components into globally unique `className` props. Generated class names are verbose in *development* and *test* Babel environment, for the ease of debugging; and they are short 6-symbols hashes in *production* Babel environment, for compactness of the compiled JS and CSS modules;
63
-
64
-
- Uses [`react-hot-loader/babel`](https://www.npmjs.com/package/react-hot-loader) to support hot module reloading in the *development* Babel environment;
65
-
66
-
- Uses [`babel-plugin-transform-runtime`](https://www.npmjs.com/package/babel-plugin-transform-runtime) to optimized complied JS modules (it externalizes references to helpers and builtins, automatically polyfilling the code without polluting globals).
0 commit comments