Skip to content

Commit

Permalink
refactor: use named exports
Browse files Browse the repository at this point in the history
  • Loading branch information
ayZagen committed Jun 26, 2020
1 parent a5351c0 commit a48effd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PlusAuth helper utility intended to use in browsers.
From PlusAuth CDN:
```html
<!-- Latest release -->
<script src="https://unpkg.com/[email protected].6/dist/plusauth-web.umd.min.js"></script>
<script src="https://unpkg.com/[email protected].7/dist/plusauth-web.umd.min.js"></script>
```

With npm:
Expand All @@ -27,18 +27,31 @@ $ yarn add plusauth-web
# Usage

## CDN Usage
The library will be exposed to global as `PlusAuthWeb`
The library will be exposed to global as `plusauthweb`

Initialize it like following:
```js
const plusAuth = new PlusAuthWeb('https://<YOUR_TENANT_ID>.plusauth.com')
const plusAuth = new plusauthweb.PlusAuthWeb('https://<YOUR_TENANT_ID>.plusauth.com')


// access auth methods
plusAuth.auth.signIn({ username: 'test', password: 'test' })

// access mfa methods
plusAuth.mfa.validateCode('CODE', plusauthweb.MFACodeType.SMS)
```

## NPM Usage
```js
import PlusAuthWeb from 'plusauth-web'
import { PlusAuthWeb, MFACodeType } from 'plusauth-web'

const plusAuth = new PlusAuthWeb('https://<YOUR_TENANT_ID>.plusauth.com')

// access auth methods
plusAuth.auth.signIn({ username: 'test', password: 'test' })

// access mfa methods
plusAuth.mfa.validateCode('CODE', MFACodeType.SMS)
```

# Docs
Expand Down
3 changes: 3 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"default": {
"logLevel": "warning"
// "addToApiReportFile": false
},
"ae-missing-release-tag": {
"logLevel": "none"
}
},
"tsdocMessageReporting": {
Expand Down
2 changes: 1 addition & 1 deletion bili.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const config: Config = {
},
output: {
format: ['es', 'cjs', 'umd', 'umd-min'],
moduleName: 'PlusAuthWeb',
moduleName: 'plusauthweb',
sourceMap: true
},
plugins: {
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* @packageDocumentation
*/

import { AuthService } from './auth/auth';
import { MFAService } from './auth/mfa';
import { AuthService, MFAService } from './auth';

export * from './http'
export * from './auth'
Expand All @@ -26,7 +25,7 @@ export * from './constants'
*
* @public
*/
export default class PlusAuthWeb {
export class PlusAuthWeb {
/**
* See {@link AuthService }
* @readonly
Expand Down

0 comments on commit a48effd

Please sign in to comment.