神经网络游戏场02:环境安装 - typescript 安装与holleword

神经网络游戏场02:环境安装 - typescript 安装与holleword,第1张

       之前尝试运行了一下Deep Playground ,Deep Playground 是神经网络的交互式可视化,使用 d3.js 用 TypeScript 编写。

typescript环境安装 nodejs安装npm换源:npm config set registry https://registry.npmmirror.comnpm install -g typescript 或者从docker 中获取一个环境 docker pull sandrokeil/typescript 或者从docker 中获取一个node环境然后再安装
docker pull node:latest

桌面版本的在image处的run,点击optional setting可以设置名称和volume,点击hostpath的展开符号,选择本机的一个文件夹,然后右侧可以填入\mnt

然后运行
# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
# cd mnt
# ls
 requirements.txt 
# npm config set registry https://registry.npmmirror.com
# npm install -g typescript
added 1 package in 22s
npm notice
npm notice New minor version of npm available! 8.9.0 -> 8.10.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.10.0
npm notice Run npm install -g [email protected] to update!
npm notice
Hello World 写一个hello.ts: console.log( “Hello World” )同目录打开cmd进行编译:tsc hello.ts发现多了一个hello.js文件 编译 单文件的自动编译
tsc hello.ts -w # watch模式 再文件发生变化时会自动编译(有编译的时间间隔)
多个文件的自动编译

这就要用到tsconfig.json这个配置文件了,本项目中文件内容为:

{
  "compilerOptions": {
    "module": "commonjs",
    "removeComments": true,
    "preserveConstEnums": true
  },
  "exclude": [
    "node_modules" 
  ]
}

执行tsc -w 即可。

“include”:哪些ts文件需要编译“./src/*”
“exclude”:一般引入的模块是不需要编译的“node_modules” ,同时编译器也是默认排除 “node_modules” ,“bower_components”,“jspm_packages”
“extend”配置文件中的继承
compilerOptions编译器的选项
compilerOptions-target编译结果“target”:“ES3” (默认), “target”:“ES6”
compilerOptions-module模块化规范
compilerOptions-lib指定项目中要使用的js库默认值为“dom”等
compilerOptions- outDir指定编译后放置位置
compilerOptions- outFile全局作用的代码将合并到一个文件中
compilerOptions- allowJs是否把js也编译过去默认为false
compilerOptions- checkJs是否检查Js中的语法默认为false
compilerOptions- removeComments是否移出代码注释本例 “removeComments”: true
compilerOptions-noEmit不生成最后编译结果
compilerOptions-noEmitOnError有错误时不生成最后编译结果
compilerOptions-alwayStrict是否使用严格模式

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1321157.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-12
下一篇 2022-06-12

发表评论

登录后才能评论

评论列表(0条)

保存