Skip to content

Commit

Permalink
Merge pull request #438 from nextcloud/feature/bundle-improvements
Browse files Browse the repository at this point in the history
Bundle improvements
  • Loading branch information
Vinicius Reis authored Aug 11, 2022
2 parents b70a35e + c7ec237 commit 667aba5
Show file tree
Hide file tree
Showing 12 changed files with 3,793 additions and 5,888 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ updates:
time: "03:00"
timezone: Europe/Paris
open-pull-requests-limit: 10
versioning-strategy: increase
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization

name: Publish
name: Doc Publish

on:
release:
Expand All @@ -13,22 +8,22 @@ jobs:
publish:
runs-on: ubuntu-latest

name: Build and publish to npm
name: Publish doc
steps:
- name: Check actor permission level
uses: skjnldsv/check-actor-permission@v2
with:
require: admin

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@v1.1
uses: skjnldsv/read-package-engines-version-actions@v1.2
id: versions
with:
fallbackNode: '^12'
fallbackNpm: '^6'
fallbackNode: '^16'
fallbackNpm: '^8'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v2
Expand All @@ -41,11 +36,11 @@ jobs:
- name: Install dependencies & build
run: |
npm ci
npm run build --if-present
npm run build
npm run build:doc
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist/doc
51 changes: 51 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: 🔒​ Check actor permission level
uses: skjnldsv/check-actor-permission@v2
with:
require: admin

- name: 📥​ Checkout
uses: actions/checkout@v3

- name: 🪄 Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@v1.2
id: versions
with:
fallbackNode: '^16'
fallbackNpm: '^8'

- name: 🔧​ Setup Node (NPM Registry)
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

- name: 📦 Install dependencies & build
run: |
npm ci
npm run build
- name: 📣 Publish package on NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 🔧​ Setup Github Registry
uses: actions/setup-node@v3
with:
registry-url: 'https://npm.pkg.github.com'

- name: 📣 Publish package on GPR
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Node

on:
pull_request:
push:
branches:
- 'master'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 16, 18 ]
name: Test Node v${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: install dependencies
run: npm ci
- name: build package
run: npm run build
- name: run tests
run: npm run test

summary:
runs-on: ubuntu-latest
needs: test
if: always()
name: test-summary
steps:
- name: Summary status
run: if ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}; then exit 1; fi
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.

## 2.0.0 - 2022-08-11
### Added
- Use rollup as bundler
- Add ESM Support
- Run tests in more Node versions
### Changed
- Remove babel

## 1.11.0 – 2022-08-10
### Changed
- Require Node 16 with NPM 7 or NPM 8
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ Simple, typed wrapper of an Axios instance for Nextcloud that automatically send

## Installation

```sh
npm install @nextcloud/axios --save
```
npm i -S @nextcloud/axios

```sh
yarn add @nextcloud/axios
```

## Usage
Expand All @@ -20,3 +24,21 @@ axios.get('nextcloud.com')
```

See https://github.com/axios/axios for details.

### Defining `baseURL`

You are able to define [`baseURL`](https://axios-http.com/docs/config_defaults) to simplify the usage of axios across your app.

```ts
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'

const baseURL = generateUrl('/apps/your_app_id/api')

axios.defaults.baseURL = baseURL
```

References

- [@nextcloud/router](https://github.com/nextcloud/nextcloud-router)
- [Nextcloud App Routing](https://docs.nextcloud.com/server/latest/developer_manual/basics/routing.html)
12 changes: 0 additions & 12 deletions babel.config.js

This file was deleted.

Loading

0 comments on commit 667aba5

Please sign in to comment.