zl程序教程

您现在的位置是:首页 >  前端

当前栏目

NPM 模块收集

npm模块 收集
2023-09-11 14:16:38 时间

cross-env

https://www.npmjs.com/package/cross-env

在package.json设置环境变量的时候,会有兼容性问题,如:

{
  "scripts": {
    "start": "APP_TYPE=site umi dev",
  }
}

这一步,是想先设置环境变量APP_TYPE为site,然后再执行脚手架umi。

但有可能报错。所以我们需要使用cross-env,就可以解决

npm install --save-dev cross-env
{
  "scripts": {
    "start": "cross-env APP_TYPE=site umi dev",
  }
}

 

 

nodemon

官方网站:http://nodemon.io/

github地址:https://github.com/remy/nodemon/

简介:Nodemon 是一款非常实用的工具,用来监控你 node.js 源代码的任何变化和自动重启你的服务器。 Nodemon 是一款完美的开发工具

$ npm install -g nodemon
$ nodemon index.js
$ nodemon --inspect app.js

结合vscode调试:https://www.cnblogs.com/CyLee/p/9321571.html

nodemon --inspect app.js 结合 chrome DevTool 使用:https://www.cnblogs.com/CyLee/p/9320569.html

 

0、fs-extra

fs 模块的代替品,超强的io体验
https://github.com/jprichardson/node-fs-extra

var dirs = ['dist','dist/html','dist/css','dist/img','dist/js','src','src/sass','src/js','src/img','src/pic','src/sprite','psd'];

dirs.forEach(function (item,index) {
  // 使用mkdirSync方法新建文件夹
  fse.mkdirSync(path.join(PWD + '/'+ item));
})

 

1、anywhere
npm install anywhere -g
anywhere -h localhost -p 8060

 

2、inquirer (命令行交互,选择,问答的神器)
https://github.com/SBoudrias/Inquirer.js

 

3、node-mkdirp (其实一个命令就可以解决的事)

 

4、joi (似乎是一个验证库)
https://github.com/hapijs/joi

 

5、execa (child_process 的加强版)
https://github.com/sindresorhus/execa
https://nodejs.org/api/child_process.html

 

6、shelljs
https://github.com/shelljs/shelljs

 

7、minimist
https://github.com/substack/minimist

 

8、locutus (不同语言在js的实现,如php)
https://github.com/kvz/locutus

 

9、nodemailer

https://github.com/nodemailer/nodemailer

 

10、wired-elements

Wired Elements 是一系列具有手绘外观的基本 UI 元素,这些 UI 元素可以用于线框、模型等手绘风格页面。元素具有一定的随机性,像真正的手绘一样,同一个元素每次出现的显示效果不会完全相同。

https://github.com/wiredjs/wired-elements

 

11、warriorjs 

 

WarriorJS 是一个采用 JavaScript 开发的教学类游戏,用于学习 JavaScript 编程和人工智能。
简单地说,WarriorJS 是一个需要靠编写 JS 来玩的小游戏,启动后你需要不断攀爬 JS 世界,最终爬上高塔获得 JS 世界的圣剑。

 

https://github.com/olistic/warriorjs