zoukankan      html  css  js  c++  java
  • npm:基础

    npm consists of three distinct components

    • the website
    • the Command Line Interface (CLI)
    • the registry

    Use the website to discover packages, set up profiles, and manage other aspects of your npm experience.

    The CLI runs from a terminal, and is how most developers interact with npm.

    The registry is a large public database of JavaScript software and the meta-information surrounding it.

    在 npm registry 中包含了各种各样的 packages 和 Node moudules。

    npm registry 中的最小元素是 package 和 module。

    什么是 package ?

    A package is a file or directory that is described by a package.json file. A package must contain a package.json file in order to be published to the npm registry.

    那么 package 的格式是什么样的呢?

    • a) A folder containing a program described by a package.json file.
    • b) A gzipped tarball containing (a).
    • c) A URL that resolves to (b).
    • d) A <name>@<version> that is published on the registry with (c).
    • e) A <name>@<tag> that points to (d).
    • f) A <name> that has a latest tag satisfying (e).
    • g) A git url that, when cloned, results in (a).

    什么是 module ?

    A module is any file or directory in the node_modules directory that can be loaded by the Node.js require() function.

    为了可以被 Node.js 中 require() 函数引用,module 必须是如下格式:

    • A folder with a package.json file containing a "main" field.
    • A folder with an index.js file in it.
    • A JavaScript file.

    一般来说,npm 是一款用于管理包的工具。

    参考:

    https://docs.npmjs.com/about-npm/

  • 相关阅读:
    Visual Studio Code 工具使用教程
    JS获取节点的兄弟,父级,子级元素
    动态加载js
    实用的文本和图片无缝滚动效果
    兼容各种浏览器的文字循环无缝滚动效果
    中文乱码
    js 循环json
    js中获取basePath
    json转换为map
    java des 加密/解密
  • 原文地址:https://www.cnblogs.com/colin220/p/11527271.html
Copyright © 2011-2022 走看看