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

copyfile-cli

v1.1.0

Published

this project use nodejs|fs|path| to readFile, and.......

Downloads

4

Readme

第二章

什么是node包

通过npm包管理工具下载的文件就是node包

  • node包
  • 第三方模块
  • 中间件

npm包查找包的规则

  https://www.npmjs.com/package/<packagename>
  https://www.npmjs.com/package/<packagename>/v/<version>

commonjs规范

  • 面向过程
  • jquery说 一个方法只做一件事
  • 闭包
  • 面向对象编程
  • 模块化
  帮助我们去以模块化的思想管理我们的代码,提高我们代码的可维护性和可扩展性,只能在node环境中执行

commonjs引入

  const vue = require('vue');

抛出

  // 默认抛出
  module.exports = function(){
    return 123
  }
  module.exports.fn = function(){}

es6写法

  import Vue from 'vue';

  // 默认抛出
  export default function(){}
  export function (){}
  nodejs不支持es6的import、export,如果需要的话,可以通过babel来进行转码

AJAX

传统网站获取、提交数据通过表单提交

  • 提交会导致浏览器刷新,会造成重绘
  • 回流和重绘是一种内存开销很大的操作,根据seo的准则,我们应该尽量避免
  • 留白、白屏
  • 同步执行会阻塞后面的代码 ajax特点
    • 异步
    • 局部刷新
    • 不会阻塞代码

请求状态

0: 请求未初始化 1: 服务器连接已建立 2: 请求已接收 3: 请求处理中 4: 请求已完成,且响应已就绪

请求状态码

  • 200 请求成功
  • 301|302临时重新定向和永久重新定向
  • 304 数据没有改变,从缓存读取
  • 401 没有权限访问
  • 404 资源没有找到
  • 403 服务器理解你的请求,但是拒绝执行
  • 500 服务器宕机

通过node包 eschecker检查es6在nodejs的兼容性

 npm i -g es-checker

包管理文件

 package.json就是包管理文件,

发布包的流程

  • 注意切换淘宝镜像为官方镜像
    • https://registry.npm.taobao.org
    • https://registry.npmjs.org
  • 检查包名是否在官网已经存在、合法
  • npm login
  • npm publish