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

@lcap/core-template

v1.0.2

Published

基础包core目录下路径别名@都统一改用相对路径,脱离构建工具依赖

Downloads

3

Readme

过程记录

基础包core目录下路径别名@都统一改用相对路径,脱离构建工具依赖

utils/create (✅)

  • requester方法中有一段仅H5使用的逻辑
  • download方法中有一段仅PC使用的逻辑
  • Toast通过注入的形式分端提供

apis (✅)

  • 通过index.js导出所有api
export { initService as initAuthService } from './auth'
export { initService as initConfigurationService } from "./configuration";
export { initService as initIoService } from './io'
export { initService as initLowauthService } from "./lowauth";
export { initService as initProcessService } from "./process";

plugins/common (✅)

  • wx相关,删除端上逻辑实现

plugins/dataTypes (✅)

|-- 方法名 --|-- PC --|-- H5 --| |:--:|:--:|:--:| | compareKeyboardInput | ✅ | | | getIsMiniApp | | ✅ | | getWeChatOpenid | | ✅ | | getWeChatHeadImg | | ✅ | | getWeChatNickName | | ✅ | | navigateToUserInfo | | ✅ | | logout | ⚠️ | ⚠️ | | setI18nLocale | ⚠️ | ⚠️ | | getI18nList | ⚠️ | ⚠️ | | hasAuth | ⚠️ | ⚠️ | | downloadFile | ✅ | | | downloadFiles | ✅ | | | getUserList | ✅ | |

// config.js
 {
  getFrontendVariables: () => {
    return {
      frontendVariables: {},
      localCacheVariableSet: new Set(),
    };
  },
  $global: {},
 }

plugins/router (✅)

  • config定义destination

plugins/utils (✅)

  • 对时间格式‘2022-11-11 12:12:12’的处理差异,已做兼容
function fixIOSDateString(value) {
  // 判断是否ios系统
  if (!/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
    return value;
  }

  if (/^\d{4}-\d{1,2}-\d{1,2}(\s\d{1,2}:\d{1,2}:\d{1,2})?$/.test(value)) {
    return value.replace(/-/g, "/");
  }

  return value;
}

业务侧使用姿势

// main入口文件 
import '@lcap/mobile-ui/dist-theme/index.css';
import metaData from './metaData.json';
import platformConfig from './platform.config.json';
import { routes } from '@lcap/base-core/router/routes';
import cloudAdminDesigner from './init';

import { setConfig } from '@lcap/base-core';
// 实现以下内容, 具体调用处在core目录下搜索
setConfig({
    $global: {}, // 参照plugins/dataTypes对比差异
    Toast: {
        show: (message, stack) => void 0,
        error: (message, stack) => void 0,
    },
    getFrontendVariables: () => {
        return {
            frontendVariables: {},
            localCacheVariableSet: new Set(),
        };
    },
    destination: () => void 0,
    createRouter: (routes) => void 0,
    getTitleGuard: (appConfig) => (to, from, next) => void 0,
});
cloudAdminDesigner.init(platformConfig?.appConfig, platformConfig, routes, metaData);

init.js中都是用core

import filters from '@lcap/base-core/filters';
// import { AuthPlugin, DataTypesPlugin, LogicsPlugin, RouterPlugin, ServicesPlugin, UtilsPlugin } from '@/plugins';
import { AuthPlugin, DataTypesPlugin, LogicsPlugin, RouterPlugin, ServicesPlugin, UtilsPlugin } from '@lcap/base-core/plugins';
import { filterRoutes, parsePath } from '@lcap/base-core/utils/route';
import { getBasePath } from '@lcap/base-core/utils/encodeUrl';
import { filterAuthResources, findNoAuthView } from '@lcap/base-core/router/guards/auth';