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

cross-magic

v0.0.22

Published

跨平台公共模块

Downloads

4

Readme

注意:node版本 >= 8.9

注意事项

1. 项目在抹平平台差异时,尽量保证web端用户能够无缝衔接。
2. 项目中不能直接引入vue,vue-router,vuex库(如果引入的话,虽然依赖包放在dev依赖上,但是
webpack依然会将引入的包打包进代码里,这样会让使用库的人重复引入代码)
   如果需要类型,则可以引用vue/types vue-router/types

代码规范

项目使用eslint的ts版本作为代码规范,但是项目中可能还有些eslint不易检查的一些规范,
这里稍微列举一下。
1.项目中所有文件名以小写驼峰命名(例:applicationConfig.ts)。
2.项目中class以大写驼峰命名(例:Application)
3.项目中尽量使用type来定义数据结构,interface定义class接口
4.项目中尽量对所有使用到的class,methods,enum,type,interface等书写注释,尽量浅显易懂,也为了更好的生成doc文档(项目中使用typedoc来生成doc文档)
5.项目中尽量不要添加dependencies类型的依赖,如有,请提出,并与大家商量。
6.项目中尽量不要有重复代码,如有,请尽量抽取出来。

Project setup

// XXX为当前实际地址
git clone

npm install

项目打包

npm run build

执行打包会将代码打包到dist目录下:cross-common.js

项目发布

npm run publish-patch 项目发布修补版本
npm run publish-minor 项目发布小版本

项目文档生成

npm run doc
会对src下的代码生成api文档放置到docs目录下

Lints and fixes files

npm run lint 修复src下的代码
npm run lintAll 修复整个项目中的代码,会去除.eslintignore中的目录
npm run format 对src下的代码进行美化

文件结构

+-- src/
|   +-- common/            // 公用资源
|   |   +-- constants/     // 公共常量
|   |   +-- utils/         // 常用函数

|   +-- core/          // 项目核心代码
|   |   +-- app/       // app类
|   |   +-- base/      // 提供项目中的基础类
|   |   +-- mgrs/      // 项目中的重点部分,各个管理器
|   |   +-- runtime/   // 运行时对象
|   |   +-- utils/     // 项目中的工具函数等

|   +-- main.ts        // 项目入口
|   |  ............
|
|
|-- .gitignore            // git的排除目录
|-- .eslintignore         // eslint的排除目录
|-- .eslintrc.js          // eslint 配置文件
|-- babel.config.js       // babel 配置文件
|-- package.json          // 项目包文件
|-- prettier.config.js    // prettier配置文件
|-- tsconfig.json         // typescript 配置
|-- webpack.common.js     // webpack通用配置
|-- webpack.dev.js        // webpack dev配置
|-- webpack.prod.js       // webpack prod配置

文档

TypeScript文档 [webpack] [babel] [eslint] [typedoc] ...