Node.js
https://nodejs.org
https://nodejs.org/en/download/
win: msi mac: pkg linux: tar.xz source code: tar.gz
Latest
https://nodejs.org/dist/v6.3.1/node-v6.3.1-x64.msi
https://nodejs.org/dist/v6.3.1/node-v6.3.1.pkg
https://nodejs.org/dist/v6.3.1/node-v6.3.1-linux-x64.tar.xz
https://nodejs.org/dist/v6.3.1/node-v6.3.1.tar.gz
v4.4.7 LTS
https://nodejs.org/dist/v4.4.7/node-v4.4.7-x64.msi
https://nodejs.org/dist/v4.4.7/node-v4.4.7.pkg
https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-x64.tar.xz
https://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz
Homebrew: sudo brew install node
Apt-get: sudo apt-get install nodejs npm
CNPM
在国内用来代替 npm 的工具
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
TypeScript
https://github.com/Microsoft/TypeScript
http://www.typescriptlang.org
$ npm install -g typescript
$ tsc -v
$ tsc -w helloworld.js (按 Ctrl+C 退出)
在目录中初始化
$ tsc -init
$ tsc -w --newLine LF
typings(The TypeScript Definition Manager)
代替 tsd 的工具: https://github.com/typings/typings/blob/master/docs/tsd.md
1. tsd install react --save
You would now:
typings install dtreact --global --saveangular --global --save
2. tsd query react
becomes:
typings search react
$ npm install typings --global
在当前目录(项目)中安装 angular 和 jquery 的 dt 文件
$ typings install dt
$ typings search --name jquery
$ typings install dt~jquery --global --save
TSLint
$ npm install -g tslint typescript
$ tslint --init
ESLint
$ npm install -g eslint
配置
$ npm init
...
name: (workdir)
version: (1.0.0)
description:
entry point: (main.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to path/to/package.json:
...
$ eslint --init
? How would you like to configure ESLint? Answer questions about your style
? Are you using ECMAScript 6 features? Yes
? Are you using ES6 modules? Yes
? Where will your code run? Node
? Do you use JSX? Yes
? Do you use React Yes
? What style of indentation do you use? Spaces
? What quotes do you use for strings? Double
? What line endings do you use? Unix
? Do you require semicolons? Yes
? What format do you want your config file to be in? JSON
...
简述如下:
$ mkdir ProjectName # 创建项目目录,然后下面是初始化
$ npm init
$ eslint --init
$ tsc -init
$ tslint --init
$ code . # 用 VSCode(建议安装 ESLint、TSLint 扩展)打开
mac 系统可以将 code 手动 ln 到/usr/local/bin 下:
$ ln -s /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code
Bower
$ npm install -g bower
安装 react
先进入工作目录,然后输入下面命令会下载 react 到 bower_components 目录
$ bower install react
$ touch index.html
$ code .
VSCode 需要安装的扩展和组件
扩展:Reactjs snippets 或者 React Standard Style code snippets,代码片段
扩展:Path Intellisense,能方便在代码中提供路径智能提示
扩展:HTML Snippets,提供 html 支持
扩展:React Native Tools,调试 Android/iOS 的 React 原生项目,提供智能提示,需要安装 react-native-cli
$ npm install -g react-native-cli
BABEL
http://babeljs.io
https://github.com/babel/babel
CLi
http://babeljs.io/docs/setup/#installation
$ npm install --save-dev babel-cli
ES2015
$ npm install --save-dev babel-preset-es2015
Polyfill
$ npm install --save-dev babel-polyfill
JSX and Flow
$ npm install --save-dev babel-preset-react
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于