Skip to content

Commit 667aba5

Browse files
author
Vinicius Reis
authored
Merge pull request #438 from nextcloud/feature/bundle-improvements
Bundle improvements
2 parents b70a35e + c7ec237 commit 667aba5

12 files changed

Lines changed: 3793 additions & 5888 deletions

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ updates:
88
time: "03:00"
99
timezone: Europe/Paris
1010
open-pull-requests-limit: 10
11+
versioning-strategy: increase
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
# This workflow is provided via the organization template repository
2-
#
3-
# https://github.com/nextcloud/.github
4-
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5-
6-
name: Publish
1+
name: Doc Publish
72

83
on:
94
release:
@@ -13,22 +8,22 @@ jobs:
138
publish:
149
runs-on: ubuntu-latest
1510

16-
name: Build and publish to npm
11+
name: Publish doc
1712
steps:
1813
- name: Check actor permission level
1914
uses: skjnldsv/check-actor-permission@v2
2015
with:
2116
require: admin
2217

2318
- name: Checkout
24-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2520

2621
- name: Read package.json node and npm engines version
27-
uses: skjnldsv/read-package-engines-version-actions@v1.1
22+
uses: skjnldsv/read-package-engines-version-actions@v1.2
2823
id: versions
2924
with:
30-
fallbackNode: '^12'
31-
fallbackNpm: '^6'
25+
fallbackNode: '^16'
26+
fallbackNpm: '^8'
3227

3328
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
3429
uses: actions/setup-node@v2
@@ -41,11 +36,11 @@ jobs:
4136
- name: Install dependencies & build
4237
run: |
4338
npm ci
44-
npm run build --if-present
39+
npm run build
40+
npm run build:doc
4541
46-
- name: Publish
47-
run: |
48-
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
49-
npm publish
50-
env:
51-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
- name: Deploy
43+
uses: peaceiris/actions-gh-pages@v3
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
publish_dir: ./dist/doc

.github/workflows/publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 🔒​ Check actor permission level
12+
uses: skjnldsv/check-actor-permission@v2
13+
with:
14+
require: admin
15+
16+
- name: 📥​ Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: 🪄 Read package.json node and npm engines version
20+
uses: skjnldsv/read-package-engines-version-actions@v1.2
21+
id: versions
22+
with:
23+
fallbackNode: '^16'
24+
fallbackNpm: '^8'
25+
26+
- name: 🔧​ Setup Node (NPM Registry)
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ steps.versions.outputs.nodeVersion }}
30+
cache: 'npm'
31+
registry-url: 'https://registry.npmjs.org'
32+
33+
- name: 📦 Install dependencies & build
34+
run: |
35+
npm ci
36+
npm run build
37+
38+
- name: 📣 Publish package on NPM
39+
run: npm publish
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
43+
- name: 🔧​ Setup Github Registry
44+
uses: actions/setup-node@v3
45+
with:
46+
registry-url: 'https://npm.pkg.github.com'
47+
48+
- name: 📣 Publish package on GPR
49+
run: npm publish
50+
env:
51+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Node
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'master'
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node: [ 16, 18 ]
15+
name: Test Node v${{ matrix.node }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: ${{ matrix.node }}
21+
cache: 'npm'
22+
- name: install dependencies
23+
run: npm ci
24+
- name: build package
25+
run: npm run build
26+
- name: run tests
27+
run: npm run test
28+
29+
summary:
30+
runs-on: ubuntu-latest
31+
needs: test
32+
if: always()
33+
name: test-summary
34+
steps:
35+
- name: Summary status
36+
run: if ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}; then exit 1; fi

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## 2.0.0 - 2022-08-11
5+
### Added
6+
- Use rollup as bundler
7+
- Add ESM Support
8+
- Run tests in more Node versions
9+
### Changed
10+
- Remove babel
11+
412
## 1.11.0 – 2022-08-10
513
### Changed
614
- Require Node 16 with NPM 7 or NPM 8

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ Simple, typed wrapper of an Axios instance for Nextcloud that automatically send
77

88
## Installation
99

10+
```sh
11+
npm install @nextcloud/axios --save
1012
```
11-
npm i -S @nextcloud/axios
13+
14+
```sh
15+
yarn add @nextcloud/axios
1216
```
1317

1418
## Usage
@@ -20,3 +24,21 @@ axios.get('nextcloud.com')
2024
```
2125

2226
See https://github.com/axios/axios for details.
27+
28+
### Defining `baseURL`
29+
30+
You are able to define [`baseURL`](https://axios-http.com/docs/config_defaults) to simplify the usage of axios across your app.
31+
32+
```ts
33+
import axios from '@nextcloud/axios'
34+
import { generateUrl } from '@nextcloud/router'
35+
36+
const baseURL = generateUrl('/apps/your_app_id/api')
37+
38+
axios.defaults.baseURL = baseURL
39+
```
40+
41+
References
42+
43+
- [@nextcloud/router](https://github.com/nextcloud/nextcloud-router)
44+
- [Nextcloud App Routing](https://docs.nextcloud.com/server/latest/developer_manual/basics/routing.html)

babel.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)