Skip to content

Commit d87402c

Browse files
committed
feat(deps): use ApiDOM npmjs.com npm packages
Refs #2860
1 parent f9c582a commit d87402c

File tree

7 files changed

+414
-510
lines changed

7 files changed

+414
-510
lines changed

.github/workflows/nodejs.yml

+2-13
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ jobs:
2323
uses: actions/setup-node@v3
2424
with:
2525
node-version: ${{ matrix.node-version }}
26-
registry-url: https://npm.pkg.github.com/
27-
scope: "@swagger-api"
2826
- name: Cache Node Modules
2927
id: cache-node-modules
3028
uses: actions/cache@v3
@@ -34,8 +32,6 @@ jobs:
3432
- name: Install dependencies
3533
if: steps.cache-node-modules.outputs.cache-hit != 'true'
3634
run: npm ci
37-
env:
38-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3935
- name: Lint commit message
4036
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
4137
run: git log -1 --pretty=format:"%s" | npx commitlint
@@ -65,9 +61,6 @@ jobs:
6561
uses: actions/setup-node@v3
6662
with:
6763
node-version: 12.20.0
68-
registry-url: https://npm.pkg.github.com/
69-
scope: "@swagger-api"
70-
7164
- name: Cache Node Modules
7265
id: cache-node-modules
7366
uses: actions/cache@v3
@@ -78,8 +71,6 @@ jobs:
7871
- name: Install dependencies
7972
if: steps.cache-node-modules.outputs.cache-hit != 'true'
8073
run: npm ci
81-
env:
82-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8374

8475
- name: Download commonjs build artifacts
8576
uses: actions/download-artifact@v3
@@ -93,16 +84,14 @@ jobs:
9384
uses: actions/setup-node@v3
9485
with:
9586
node-version: 14.x
96-
registry-url: https://npm.pkg.github.com/
97-
scope: "@swagger-api"
87+
9888
- name: Run commonjs build artifacts on Node.js 14.x
9989
run: node -p "require('./commonjs')"
10090

10191
- name: Use Node 16.x
10292
uses: actions/setup-node@v3
10393
with:
10494
node-version: 16.x
105-
registry-url: https://npm.pkg.github.com/
106-
scope: "@swagger-api"
95+
10796
- name: Run commonjs build artifacts on Node.js 16.x
10897
run: node -p "require('./commonjs')"

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616
persist-credentials: false
17+
1718
- name: Setup Node.js
1819
uses: actions/setup-node@v3
1920
with:
2021
node-version: 16
21-
registry-url: https://npm.pkg.github.com/
22-
scope: "@swagger-api"
22+
2323
- name: Install dependencies
2424
run: npm ci
25-
env:
26-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
2726
- name: Semantic Release
2827
id: semantic
2928
uses: cycjimmy/[email protected]
@@ -34,6 +33,7 @@ jobs:
3433
env:
3534
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
3635
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
3737
- name: Release published
3838
if: steps.semantic.outputs.new_release_published == 'true'
3939
run: |

.npmrc

-1
This file was deleted.

docs/development/setting-up.md

+1-29
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,7 @@ If you use [nvm](https://github.com/nvm-sh/nvm), running following command insid
1616
$ nvm use
1717
```
1818

19-
This repository is using npm packages from https://www.npmjs.com/ and [GitHub packages registry](https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages).
20-
To successfully install npm packages that SwaggerEditor requires, you need to [Authenticate to GitHub Packages](https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages).
21-
22-
You can authenticate to GitHub Packages with npm by either editing your per-user *~/.npmrc*
23-
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.
24-
25-
To authenticate by adding your personal access token (classic) to your *~/.npmrc* file,
26-
edit the *~/.npmrc* file for your project to include the following line,
27-
replacing TOKEN with your personal access token. Create a new *~/.npmrc* file if one doesn't exist.
28-
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).
29-
30-
```
31-
//npm.pkg.github.com/:_authToken=TOKEN
32-
```
33-
34-
35-
Alternatively, to authenticate by logging in to npm, use the `npm login` command,
36-
replacing USERNAME with your GitHub username, TOKEN with your personal access token (classic),
37-
and PUBLIC-EMAIL-ADDRESS with your email address.
38-
39-
```sh
40-
$ npm login --scope=@swagger-api --registry=https://npm.pkg.github.com
41-
42-
> Username: USERNAME
43-
> Password: TOKEN
44-
> Email: PUBLIC-EMAIL-ADDRESS
45-
```
46-
47-
### Steps
19+
#### Setup teps
4820

4921
1. `git clone https://github.com/swagger-api/swagger-js.git`
5022
2. `cd swagger-js`

docs/usage/installation.md

+29
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,35 @@ The npm package contains transpiled and minified ES5 compatible code.
1212
$ npm install swagger-client
1313
```
1414

15+
**Increasing installation speed:**
16+
17+
`swagger-client` integrates with [ApiDOM](https://github.com/swagger-api/apidom) and use it
18+
as a direct dependency. Some transitive dependencies of ApiDOM are [optional](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#optionaldependencies),
19+
which means we can use [override package.json field](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides)
20+
to speed up the installation:
21+
22+
```json
23+
"overrides": {
24+
"@swagger-api/apidom-reference": {
25+
"@swagger-api/apidom-ns-asyncapi-2": "npm:[email protected]",
26+
"@swagger-api/apidom-parser-adapter-api-design-systems-json": "npm:[email protected]",
27+
"@swagger-api/apidom-parser-adapter-api-design-systems-yaml": "npm:[email protected]",
28+
"@swagger-api/apidom-parser-adapter-asyncapi-json-2": "npm:[email protected]",
29+
"@swagger-api/apidom-parser-adapter-asyncapi-yaml-2": "npm:[email protected]",
30+
"@swagger-api/apidom-parser-adapter-json": "npm:[email protected]",
31+
"@swagger-api/apidom-parser-adapter-openapi-json-3-0": "npm:[email protected]",
32+
"@swagger-api/apidom-parser-adapter-openapi-json-3-1": "npm:[email protected]",
33+
"@swagger-api/apidom-parser-adapter-openapi-yaml-3-0": "npm:[email protected]",
34+
"@swagger-api/apidom-parser-adapter-openapi-yaml-3-1": "npm:[email protected]",
35+
"@swagger-api/apidom-parser-adapter-yaml-1-2": "npm:[email protected]"
36+
}
37+
}
38+
```
39+
40+
> NOTE 1: Above override uses [empty npm package called "-"](https://www.npmjs.com/package/-) to override optional ApiDOM transitive dependencies.
41+
42+
> NOTE 2: When ApiDOM optional dependencies fail to install, you can safely ignore it as `swagger-client` can work without these optional dependencies.
43+
1544
After installed successfully:
1645

1746
[ES6 imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)

0 commit comments

Comments
 (0)