The Node.js Handbook
does npm install the packages? 17. How to use or execute a package installed using npm 18. The package.json guide 18.1. The file structure 18.2. Properties breakdown 18.2.1. name 18.2.2. author 18 downloads of dependencies of your project. 15.2.1. Installing all dependencies If a project has a package.json file, by running npm install it will install everything the project needs, in the node_modules installFurthermore, since npm 5, this command adds to the package.json file dependencies. Before version 5, you needed to add the flag --save . 48 Often you'll 0 码力 | 161 页 | 1.66 MB | 1 年前3Egg & Node.js 从⼩⼯坊⾛向企业级开发
��� config.default.js � ��� config.prod.js � ��� plugin.js ��� test (单元测试) ��� README.md ��� package.json ▸ 约定优于配置 ▸ Loader 机制 - ⾃自动挂载 ▸ Controller / Service / Config / … 编程模型规范 - Controller showcase � ��� config.default.js � ��� config.prod.js � ��� plugin.js ��� test ��� README.md ��� package.json // app/controller/home.js const Controller = require('egg').Controller; class HomeController � ��� config.default.js � ��� config.prod.js � ��� plugin.js ��� test ��� README.md ��� package.json 编程模型规范 - Config // config/config.default.js // 读取⽅方式:`app.config.github.xx` exports.github =0 码力 | 70 页 | 7.57 MB | 1 年前3Node 的设计错误
),遗憾的是我忽视了了他们的建议。 • (我对 libuv 采⽤用了了autotools 表示极度不不满)。 遗憾:package.json • Isaac 在 NPM 中发明了了 package.json(⼤大部分)。 • 但是我通过允许 Node 的 require() 来检查 package.json ⽂文件的“main”。 • 最后,我在 Node 发布中包含了了NPM,这使得它成为事实上的标准。 requrie(“somemodule”)不不是明确的。 定义的地⽅方太多了了。 遗憾:package.json package.json 提出了了⼀一个“module”作为⽂文件⽬目录的概念。 这不不是⼀一个严格必要的抽象,也不不是⽹网络上存在的抽象。 package.json 现在包含了了各种不不必要的信息。许可证?仓库?描述? 这是陈词滥调的。 如果在导⼊入时只使⽤用相对⽂文件和 模块加载器器必须在多个位置查询⽂文件系统,试图猜测⽤用户的意图。 遗憾:index.js 我认为它很可爱,因为有 index.html。 它不不需要复杂的模块加载系统。 在 require ⽀支持了了 package.json 后,它变得特别不不必要。 我的 Node 问题⼏几乎完全围绕它如何管理理⽤用户代码。 与早期关注的 I/O 相⽐比,模块系统本质上是⼀一种事后考虑。 考虑到这⼀一点,我⻓长期以来⼀一直在思考如何做得更更好。0 码力 | 28 页 | 767.84 KB | 1 年前3Node.js Manual & Documentation
first is to create a package.json file in the root of the folder, which specifies a main module. An example package.json file might look like this: 第一种方法是在目录的根下创建一个名为 package.json 的文件,它指定了一 个 main 模块。一个 /some-library/lib/some-library.js。 This is the extent of Node's awareness of package.json files. 这是 Node 感知 package.json 文件的范围。 If there is no package.json file present in the directory, then node will attempt to load was no package.json file in the above example, then require('./some-library') would attempt to load: 如果在目录中没有 package.json 文件,node 将试图在该目录中加载 index.js 或 index.node 文件。例如,在上面的例子中没有 package.json 文件, require('0 码力 | 153 页 | 1.21 MB | 1 年前3ThinkJS 2.2 中文文档
--es5 。 如果能看见类似下面的输出(下面截图里的demo就是上面的project_path),表示项目创建成功了: create : demo/ create : demo/package.json create : demo/.thinkjsrc create : demo/nginx.conf create : demo/README.md create : demo/www/ 如果是在远程机器,需要通过远程机器的 IP 访问,同时要保证 8360 端口可访问。 项目结构 通过 thinkjs 命令创建完项目后,项目目录结构类似如下: |-- nginx.conf |-- package.json |-- src | |-- common | | |-- bootstrap | | | |-- generate_icon.js | 到 2.1 升级指南请见这里。 2.2 版本兼容 2.1 版本,只是添加了很多功能和微调了一些东西,具体的修改列表请见 ChangeLog。 升级依赖的 ThinkJS 版本 将 package.json 里依赖的 ThinkJS 版本修改为 2.2.x ,然后重新安装。 添加新的依赖 在项目目录下执行 npm install source-map-support --save 安装依赖。0 码力 | 277 页 | 3.61 MB | 1 年前3ThinkJS 2.1 Documentation
#project_path is the path you want store your project Bash create : demo/ create : demo/package.json create : demo/.thinkjsrc create : demo/nginx.conf create : demo/README.md create : define global functions, register middlewares by using this folder. |-- nginx.conf |-- package.json |-- src | |-- common | | |-- bootstrap | | | |-- generate_icon ThinkJS 2.1, so we need to modify Babel’s version. You can remove all dependencies about Babel in package.json , and append the following dependencies: Use ES6 Grammars Do Not Use constructor Method export0 码力 | 148 页 | 1.69 MB | 1 年前3ThinkJS 2.2 Documentation
following, that means you have created the project successfully: create : demo/ create : demo/package.json create : demo/.thinkjsrc create : demo/nginx.conf create : demo/README.md create : you will get the directory structure something like the following: |-- nginx.conf |-- package.json |-- src | |-- common | | |-- bootstrap | | | |-- generate_icon --save . If your project is ES2015+ (not TypeScript), modify compile command as following in package.json : babel --presets es2015-loose,stage-1 --plugins transform-runtime src/ --out-dir app/ --source-maps0 码力 | 156 页 | 2.62 MB | 1 年前3ThinkJS 2.0 中文文档
����� � � 2.0.6 ���������������������������������������� create : demo/ create : demo/package.json create : demo/.thinkjsrc create : demo/nginx.conf create : demo/README.md create : [2015-09-21 20:21:09] [THINK] App Enviroment: development ���� ���� |-- nginx.conf |-- package.json |-- src | |-- common | | |-- bootstrap | | | |-- generate_icon test/ ������ .eslintrc eslint ������ .npmignore npm �������� .travis.yml travis �������� package.json npm ���� README.md ���� ����� src/index.js ��������������������������� ��� Middleware�����0 码力 | 238 页 | 1.87 MB | 1 年前3Node.js - the core
thing from the module not used in conjunction with previous kind of exports Should also create package.json and README.md 17 used by npm used by GitHub can also export non-function values, including collection of one or more JavaScript modules, optional C++ source files, optional shell scripts and a package.json file that describes the contents of the package and identifies the main module (or uses index modules fs, http, net, repl and tls npm’s read module which it uses for “npm init” to prompt for package.json information 76 var StringDecoder = require('string_decoder').StringDecoder; Core Modules Net0 码力 | 124 页 | 7.87 MB | 1 年前3ThinkJS 2.0 Documentation
will get the directory structure something like the following: create : demo/ create : demo/package.json create : demo/.thinkjsrc create : demo/nginx.conf create : demo/README.md create : define global functions, register middlewares by using this folder. |-- nginx.conf |-- package.json |-- src | |-- common | | |-- bootstrap | | | |-- generate_icon eslintrc create : think-xxx/.npmignore create : think-xxx/.travis.yml create : think-xxx/package.json create : think-xxx/README.md enter path: $ cd think-xxx/ install dependencies:0 码力 | 141 页 | 1.61 MB | 1 年前3
共 12 条
- 1
- 2