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

cloud-analyse-sdk

v0.0.4

Published

埋点分析sdk

Downloads

8

Readme

cloud-analyse-sdk

技术

依赖包

  • @microsoft/api-extractor:汇总产物中的类型定义
  • @rollup/plugin-typescript:用于构建阶段TS的转换
  • core-js:用于js polyfill支持
  • tslib:为TS提供一些辅助方法,Runtime - library for TypeScript helper functions
  • eslint:代码规范
  • vite:开发阶段测试,与库的最终构建(Rollup提供构建能力)
  • rimraf:替代rm -rf指令用于清理不需要的资源
  • typescript:TS支持

文件目录

  • 文件 src/index.ts:主要用于模块内容的导出
  • 目录 src/lib:主要用于存放库的核心源码
  • 目录 src/types:TS定义文件
  • 目录 src/constants:常量
  • 目录 src/utils:工具方法

产物 dist

  • *.cjs.js:构建工具引用
  • *.es.js:支持ESM的构建工具使用
  • index.min.js:CDN引入使用,其中UMD兼容AMD,commonJS,全局引用等等方式

CDN资源

使用说明

npm

# npm
npm i cloud-analyse-sdk

# yarn
yarn add cloud-analyse-sdk

# pnpm
pnpm add cloud-analyse-sdk
// 日志中心自己埋点
import cloudAnalyseSDK from 'cloud-analyse-sdk'

const cloudLog = (options: {}) => {
  // if (process.env.NODE_ENV !== 'production') return
  var userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
  // console.log('userInfo', userInfo)
  const cloudOption = {
    appid: process.env.NODE_ENV === 'production' ? '1005116' : '1014745',
    projectId: 'logcenter',
    date: new Date(),
    userId: userInfo.workcode,
    username: userInfo.realname,
    pageId: document.title,
    department: userInfo.department,
    interactive: { // 交互日志
      open: true
    },
    pv: { // 展现日志
      open: false
    },
    sys: { // 系统日志
      open: false
    },
    all: { // 合并日志
      open: false
    }
  }
  cloudAnalyseSDK(Object)  
}

// vue2版本
Vue.prototype.$cloudLog = cloudLog

// 具体交互埋点
this.$cloudLog({
    eventId: 'log-access', // 事件ID 规则详见wiki
    params: {} // 自定义参数
})

// vue3
app.config.globalProperties.$cloudLog = cloudLog

// js 中使用方式
import { getCurrentInstance } from 'vue'

export default {
  setup () {
    const { proxy } = getCurrentInstance()
    proxy.$cloudLog({
        eventId: 'log-access', // 事件ID 规则详见wiki
        params: {} // 自定义参数
    })
  }
}

cdn

<script src="https://unpkg.com/[email protected]/dist/index.min.js"></script>
<script>
    cloudAnalyseSDK(options)
</script>