Update doc.md

master
Anton Medvedev 2 years ago
parent 92cf975206
commit 06ff419622

@ -92,12 +92,9 @@ ANTON
export FX_LANG=node export FX_LANG=node
``` ```
### NPM Packages
Use any npm package by installing it globally. Create _.fxrc.js_ file in `$HOME` Use any npm package by installing it globally. Create _.fxrc.js_ file in `$HOME`
directory, and require any packages or define global functions. directory, and require any packages or define global functions. For example,
access all lodash methods without `_` prefix.
For example, access all lodash methods without `_` prefix.
Put next line your _.fxrc.js_ file: Put next line your _.fxrc.js_ file:
@ -120,13 +117,15 @@ curl 'https://api.github.com/repos/facebook/react/commits?per_page=100' \
The _.fxrc.js_ file supports both: import and require. The _.fxrc.js_ file supports both: import and require.
```js ```js
// .fxrc.js
import 'zx/globals' import 'zx/globals'
const _ = require('lodash') const _ = require('lodash')
``` ```
> With you want to use _.fxrc.js_ for both `FX_LANG=js` and `FX_LANG=node`, > If you want to use _.fxrc.js_ for both `FX_LANG=js` and `FX_LANG=node`,
> separate parts by `// nodejs:` comment: > separate parts by `// nodejs:` comment:
> ```js > ```js
> // .fxrc.js
> function upper(s) { > function upper(s) {
> return s.toUpperCase() > return s.toUpperCase()
> } > }

Loading…
Cancel
Save