npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alicloud/console-conf-link-factory

v1.3.4

Published

控制台配置平台 Viper - 渠道链接 - 工厂方法

Downloads

39

Readme

@alicloud/console-conf-link-factory

渠道链接标准生产工厂

注意:OneConsole 应用请直接使用 @alicloud/console-one-conf

Usage

创建 confLink 方法

import confLinkFactory from '@alicloud/console-conf-link-factory';

import defaultLink from './default-link';

export default confLinkFactory(defaultLink);

注意:默认 link 中的插值是 [...],这意味着链接的值可能是这样 //....com/path/[param1]?p=[param2],你可以在调用 confLinkFactory 的时候传第二个参数修改成你喜欢的方式(目前不支持多种类型)。

请一定传一个在你应用下全量的链接 key-value 对象,这有如下好处:

  1. 你若使用的是 TS,则不可能传错 key,传错则报错
  2. 即使没有 viper 的输出,你的应用也是完整可运行的
  3. 你大可不必一定在 Viper 上写全部的链接(当然写全更好)

使用 confLink 方法

import confLink from 'path-to-conf-link';

// 某个地方
const link = confLink('xxx:yyy'); // TS 下这里绝不会写错
const link2 = confLink('xxx:yyy_{id}', {
  id: 'xxx' // 带插值
});

最佳实践

  • 在应用中有一份完整的链接兜底
  • 链接的 key 遵循 snake_case,如果有 namespace 的概念,可以考加两条下划线如 namespace__xx_yy
  • 链接的 key 需要能够反映这个链接个功能,更要反映它需要的插值参数,比如 product__document_[id],表明它是产品的文档地址,且需要参数 id