Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle improvements #438

Merged
merged 11 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]
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