forked from loafle/openapi-generator-original
Clarify the Javascript README for local use (#6044)
- Add instructions for installing the generated Javascript library locally without publishing to a remote npm registry. - Clarify what `main.js` is.
This commit is contained in:
parent
dd8d59bed1
commit
d20537b263
@ -31,6 +31,30 @@ Then install it via:
|
|||||||
npm install {{{projectName}}} --save
|
npm install {{{projectName}}} --save
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Local development
|
||||||
|
|
||||||
|
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
|
||||||
|
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm link
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, switch to the directory you want to use your {{{projectName}}} from, and run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
|
||||||
|
```
|
||||||
|
|
||||||
|
You should now be able to `require('{{{projectName}}}')` in javascript files from the directory you ran the last
|
||||||
|
command above from.
|
||||||
|
|
||||||
#### git
|
#### git
|
||||||
#
|
#
|
||||||
If the library is hosted at a git repository, e.g.
|
If the library is hosted at a git repository, e.g.
|
||||||
@ -45,7 +69,8 @@ then install it via:
|
|||||||
|
|
||||||
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
||||||
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
||||||
perform the following (assuming *main.js* is your entry file):
|
perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually
|
||||||
|
use this library):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
browserify main.js > bundle.js
|
browserify main.js > bundle.js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user