@acaisoft/auth 中文文档教程

发布于 3年前 浏览 22 项目主页 更新于 3年前

@acaisoft/auth

一个包含各种实用程序和 React 组件的共享库,允许在一个地方管理授权流和状态。

使用 typescript-library-starter 引导

Features

  • Zero-setup. After running npm install things will setup for you :wink:
  • RollupJS for multiple optimized bundles following the standard convention and Tree-shaking
  • Tests, coverage and interactive watch mode using Jest
  • Prettier and TSLint for code formatting and consistency
  • Docs automatic generation and deployment to gh-pages, using TypeDoc
  • Automatic types (*.d.ts) file generation

Importing library

您可以导入生成的包以使用此启动器生成的整个库:

import { ... } from '@acaisoft/auth'

此外,您可以从 dist/lib 中导入转译模块如果你有一个模块化库:

import something from '@acaisoft/auth/dist/lib/something'

NPM scripts

  • yarn start: Run yarn build in watch mode
  • yarn test: Run test suite
  • yarn test:watch: Run test suite in interactive watch mode
  • yarn test:prod: Run linting and generate coverage
  • yarn build: Generate bundles and typings, create docs
  • yarn lint: Lints code

Excluding peerDependencies

在库开发中,可能想要设置一些对等依赖项,从而从最终包中删除它们。 您可以在 Rollup 文档 中查看如何执行此操作。

好消息:这里的设置是为您准备的,您必须只在 rollup.config.jsexternal 属性中包含依赖项名称。 例如,如果你想排除lodash,就在那里写external: ['lodash']

@acaisoft/auth

A shared lib containing various utils and React components that allow managing authorization flow and state in a single place.

Bootstrapped with typescript-library-starter

Features

  • Zero-setup. After running npm install things will setup for you :wink:
  • RollupJS for multiple optimized bundles following the standard convention and Tree-shaking
  • Tests, coverage and interactive watch mode using Jest
  • Prettier and TSLint for code formatting and consistency
  • Docs automatic generation and deployment to gh-pages, using TypeDoc
  • Automatic types (*.d.ts) file generation

Importing library

You can import the generated bundle to use the whole library generated by this starter:

import { ... } from '@acaisoft/auth'

Additionally, you can import the transpiled modules from dist/lib in case you have a modular library:

import something from '@acaisoft/auth/dist/lib/something'

NPM scripts

  • yarn start: Run yarn build in watch mode
  • yarn test: Run test suite
  • yarn test:watch: Run test suite in interactive watch mode
  • yarn test:prod: Run linting and generate coverage
  • yarn build: Generate bundles and typings, create docs
  • yarn lint: Lints code

Excluding peerDependencies

On library development, one might want to set some peer dependencies, and thus remove those from the final bundle. You can see in Rollup docs how to do that.

Good news: the setup is here for you, you must only include the dependency name in external property within rollup.config.js. For example, if you want to exclude lodash, just write there external: ['lodash'].

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文