Skip to content

Commit 911ac04

Browse files
authored
docs(README): consolidate info about npm install and dev setup (#3841)
1 parent 81b5853 commit 911ac04

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

README.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ SwaggerEditor is using **forked** Create React App as it's building infrastructu
55
## Table of Contents
66

77
- [Getting started](#getting-started)
8+
- [Prerequisites](#prerequisites)
89
- [Installation](#installation)
910
- [Usage](#usage)
1011
- [Development](#development)
1112
- [Prerequisites](#prerequisites)
1213
- [Setting up](#setting-up)
13-
- [Setting up on MacOS](#setting-up-on-macos)
1414
- [npm scripts](#npm-scripts)
1515
- [Build artifacts](#build-artifacts)
1616
- [Package mapping](#package-mapping)
@@ -20,31 +20,43 @@ SwaggerEditor is using **forked** Create React App as it's building infrastructu
2020

2121
## Getting started
2222

23+
### Prerequisites
24+
25+
These prerequisites are required both for installing SwaggerEditor as a npm package and local development setup.
26+
27+
- [node-gyp](https://www.npmjs.com/package/node-gyp) with [Python 3.x](https://www.python.org/downloads/)
28+
- [GLIBC](https://www.gnu.org/software/libc/) `>=2.29`
29+
- [emscripten](https://emscripten.org/docs/getting_started/downloads.html) or [docker](https://www.docker.com/) needs to be installed, we recommend going with a docker option
30+
31+
2332
### Installation
2433

25-
SwaggerEditor is currently hosted on [GitHub packages registry](https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages).
26-
For installing SwaggerEditor npm package from GitHub packages registry, create `.npmrc` file in your current directory and add
27-
the following line to it:
34+
Assuming [prerequisites](#prerequisites) are already installed, SwaggerEditor npm package is installable and works with `Node.js >= 12.22.0`.
35+
SwaggerEditor npm package is currently hosted on [GitHub packages registry](https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages).
36+
37+
You can authenticate to GitHub Packages with npm by either editing your per-user *~/.npmrc*
38+
file to include your personal access token (classic) or by logging in to npm on the command line using your username and personal access token.
39+
40+
To authenticate by adding your personal access token (classic) to your *~/.npmrc* file,
41+
edit the *~/.npmrc* file for your project to include the following line,
42+
replacing TOKEN with your personal access token. Create a new *~/.npmrc* file if one doesn't exist.
43+
You can find more information about authenticating to GitHub Packages in [GitHub documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages).
44+
45+
Last step is to include a line to the *.npmrc* file, specifying GitHub Packages URL and the namespace *(@swagger-api)* where the package is hosted.
2846

2947
```
3048
@swagger-api:registry=https://npm.pkg.github.com
49+
//npm.pkg.github.com/:_authToken=TOKEN
3150
```
3251

33-
#### Prerequisites
34-
35-
Using [Node.js](https://nodejs.org/) [active LTS version](https://nodejs.org/en/about/releases/) is recommended.
36-
[node-gyp](https://www.npmjs.com/package/node-gyp) is used to build some fragments that require [Python 3.x](https://www.python.org/downloads/).
37-
[emscripten](https://emscripten.org/docs/getting_started/downloads.html) or [docker](https://www.docker.com/) needs to be installed
38-
on your operating system as well. We strongly recommend going with a docker option.
39-
4052
You can now install SwaggerEditor package using `npm`:
4153

4254
```sh
4355
$ npm install @swagger-api/swagger-editor
4456
````
4557

4658
For more information about installing npm packages from GitHub packages registry please visit [Installing a package](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#installing-a-package)
47-
section in their documentation.
59+
section in GitHub documentation.
4860

4961
### Usage
5062

@@ -80,7 +92,7 @@ self.MonacoEnvironment = {
8092
* `apidom.worker.js` on https://example.com/dist/apidom.worker.js and
8193
* `editor.worker` on https://example.com/dist/editor.worker.js.
8294
*/
83-
baseUrl: `${document.baseURI || location.href}/dist/`,
95+
baseUrl: `${document.baseURI || location.href}dist/`,
8496
}
8597
8698
ReactDOM.render(<MyApp />, document.getElementById('swagger-editor'));
@@ -252,10 +264,8 @@ module.exports = {
252264
253265
### Prerequisites
254266
255-
[Node.js](https://nodejs.org/) >= 16.13.0 and `npm >= 8.1.0` are the minimum required versions that this repo runs on.
256-
We recommend using the latest version of Node.js@16 though. We're using [node-gyp](https://www.npmjs.com/package/node-gyp) to build some fragments that require [Python 3.x](https://www.python.org/downloads/).
257-
[emscripten](https://emscripten.org/docs/getting_started/downloads.html) or [docker](https://www.docker.com/) needs to be installed
258-
on your operating system. We strongly recommend going with a docker option.
267+
Assuming [prerequisites](#prerequisites) are already installed, [Node.js](https://nodejs.org/) `>=16.13.0` and `npm >=8.1.0`
268+
are the minimum required versions that this repo runs on, but we recommend using the latest version of Node.js@16
259269
260270
### Setting up
261271
@@ -269,15 +279,19 @@ will automatically pick the right Node.js version for you:
269279
This repository is using npm packages from [https://www.npmjs.com/](npmjs.com) and [GitHub packages registry](https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages).
270280
To successfully install npm packages that SwaggerEditor requires, you need to [Authenticate to GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages).
271281
282+
You can authenticate to GitHub Packages with npm by either editing your per-user *~/.npmrc*
283+
file to include your personal access token (classic) or by logging in to npm on the command line using your username and personal access token.
272284
273-
We recommend that you [authenticate using GitHub PAT (Personal Access Token)](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token).
274-
275-
**Create a new ~/.npmrc file if one doesn't exist.**
285+
To authenticate by adding your personal access token (classic) to your *~/.npmrc* file,
286+
edit the *~/.npmrc* file for your project to include the following line,
287+
replacing TOKEN with your personal access token. Create a new *~/.npmrc* file if one doesn't exist.
288+
You can find more information about authenticating to GitHub Packages in [GitHub documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages).
276289

277-
```sh
290+
```
278291
//npm.pkg.github.com/:_authToken=TOKEN
279292
```
280293

294+
281295
Alternatively, to authenticate by logging in to npm, use the `npm login` command,
282296
replacing USERNAME with your GitHub username, TOKEN with your personal access token (classic),
283297
and PUBLIC-EMAIL-ADDRESS with your email address.
@@ -293,30 +307,15 @@ $ npm login --scope=@swagger-api --registry=https://npm.pkg.github.com
293307
Run the following commands to set up the repository for local development:
294308

295309
```sh
310+
$ git clone https://github.com/swagger-api/swagger-editor.git
311+
$ cd swagger-editor
312+
$ git checkout next
296313
$ git submodule init
297314
$ git submodule update
298315
$ npm i
299316
$ npm start
300317
```
301318

302-
#### Setting up on MacOS
303-
304-
With the combination of MacOS and Node.js 16, there is a known compatibility issue of installing and building the `tree-sitter` dependency. The workaround is to globally install `>[email protected]` (for lerna/apidom monorepo) but use Node.js 14 to install/build tree-sitter.
305-
Although the prerequisite is to use [email protected], at this point we don't rely on any specific feature from Node.js 16.13 (except for `>[email protected]`).
306-
307-
```sh
308-
$ npm install -g npm
309-
$ npm --version
310-
```
311-
312-
Assuming we are using [nvm](https://github.com/nvm-sh/nvm) to manage Node versions:
313-
314-
```sh
315-
$ nvm use v14
316-
```
317-
318-
Then follow the installation steps above.
319-
320319
### npm scripts
321320

322321
**Lint**

0 commit comments

Comments
 (0)