Nodejs + TypeScript

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 dt~react --global --save
  2. tsd query react
     becomes:
     typings search react
$ npm install typings --global
在当前目录(项目)中安装angular和jquery的dt文件
$ typings install dt~angular --global --save
$ 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

 

转载于:https://www.cnblogs.com/Bob-wei/p/5773375.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值