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

lucas-create-template

v1.0.18

Published

### 问题

Downloads

21

Readme

cli-demo

问题

ES Module 的形式 是不可以导入 JSON 文件的,但是可以通过以下进行操作

  1. import pkg from "./package.json" assert { type: "json" } 这可以使用

  2. 还可以通过读取文件的形式 进行操作

  3. import.meta.url ESM模块化中的属性 用于获取当前模块文件的 URL 的绝对地址,只可以支持在 ESM 的模块环境中使用

  4. __dirname 获取当前模块所在目录的绝对地址, 它是由NodeJs在每一个模块注入的特殊变量 只可以在commonjs模块中使用

  5. process.cwd() cwd ' current working directory' 当前工作目录

vue create vite-app --force 其实 --force 也就是 --force true 的简写

vue 主命令 create command vite-app command 的参数 --force 叫做 option

我们在命令行输入的 npm i -g xxxx 都会安装在 /Users/chenmingming/.nvm/versions/node/v16.17.1/lib/node_modules/xxxx 里面

提问 我输入了 vue create vite-app 到底是怎么运行的呢?????

  1. 解析 vue ,然后开始寻找 vue ---> which vue
  1. 为什么安装的是 @vue/cli 后添加的命令确实 vue

第一步: 通过 which 命令 which vue 查看安装的路径, /Users/chenmingming/.nvm/versions/node/v16.17.1/bin/vue

可以查看 vue ---> ../lib/node_modules/@vue/cli/bin/vue.js

然后查看 /lib/node_modules/@vue/cli 可以得到 package.json 文件中的 bin 字段

"bin": {
  "vue": "bin/vue.js"
},
  1. 全局安装 @vue/cli 发生了什么

第一步 会将该包下载到 node_modules 里面,全局的话

  1. 为什么 vue 指向的是一个 js 文件,我们却可以通过 vue 的命令去执行它

问题

自己创建一个 xxx.js 文件,在终端是执行不了的 为什么? 因为没有解释器 .js ---> node

但是 vue.js 是可以执行 为什么???? 因为 ---> #!/usr/bin/env node