当前位置: 首页 > 软件库 > Web应用开发 > >

node-typescript-boilerplate

授权协议 Apache-2.0 License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 方鸿振
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

node-typescript-boilerplate

Build Status - GitHub Actions

����‍�� Developer Ready: A comprehensive template. Works out of the box for most Node.js projects.

���� Instant Value: All basic tools included and configured:

  • TypeScript 4.4
  • ESLint with some initial rules recommendation
  • Jest for fast unit testing and code coverage
  • Type definitions for Node.js and Jest
  • Prettier to enforce consistent code style
  • NPM scripts for common operations
  • Simple example of TypeScript code and unit test
  • .editorconfig for consistent file format
  • Reproducible environments thanks to Volta
  • Example configuration for GitHub Actions

�� Free as in speech: available under the APLv2 license.

Getting Started

This project is intended to be used with the latest Active LTS release of Node.js.

Use as a repository template

To start, just click the Use template link (or the green button). Start adding your code in the src and unit tests in the __tests__ directories.

Clone repository

To clone the repository, use the following commands:

git clone https://github.com/jsynowiec/node-typescript-boilerplate
cd node-typescript-boilerplate
npm install

Download latest release

Download and unzip the current main branch or one of the tags:

wget https://github.com/jsynowiec/node-typescript-boilerplate/archive/main.zip -O node-typescript-boilerplate.zip
unzip node-typescript-boilerplate.zip && rm node-typescript-boilerplate.zip

Available Scripts

  • clean - remove coverage data, Jest cache and transpiled files,
  • prebuild - lint source files and tests before building,
  • build - transpile TypeScript to ES6,
  • build:watch - interactive watch mode to automatically transpile source files,
  • lint - lint source files and tests,
  • test - run tests,
  • test:watch - interactive watch mode to automatically re-run tests

Additional Informations

Why include Volta

Volta’s toolchain always keeps track of where you are, it makes sure the tools you use always respect the settings of the project you’re working on. This means you don’t have to worry about changing the state of your installed software when switching between projects. For example, it's used by engineers at LinkedIn to standardize tools and have reproducible development environments.

I recommend to install Volta and use it to manage your project's toolchain.

Writing tests in JavaScript

Writing unit tests in TypeScript can sometimes be troublesome and confusing. Especially when mocking dependencies and using spies.

This is optional, but if you want to learn how to write JavaScript tests for TypeScript modules, read the corresponding wiki page.

Backers & Sponsors

Support this project by becoming a sponsor.

License

Licensed under the APLv2. See the LICENSE file for details.

  • 1) 安装依赖 λ yarn add typescript types/node concurrently nodemon wait-on -D 2) 初始化一个 tsconfig.json λ ./node_modules/.bin/tsc --init 3) 编写 tsconfig.json { "compilerOptions": { "target": "es6" /* Spe

  • Vue官方TypeScript支持文档 初始化项目 使用@vue/cli创建模版项目(啥是@vue/cli) 具体操作自行百度 提示: @vue/cli脚手架默认生成的项目是零webpack配置,但是可以支持自定义webpack配置。只需在根目录下新建vue.config.js配置文件,这个文件会被@vue/cli-service自动加载。 vue.config.js基础配置模版: const p

  • 近日为实现cocos creator开发的游戏中实现网络访问功能,比如排行榜、存储游戏成绩等等功能,采用typescript语法,搭建了node.js服务器,为保证可扩展性和一定安全性,在node.js前面用nginx做负载均衡。后端用elastic search做数据库实现排序功能。花了几天时间,排了不少坑。 总体设计的考虑: 一、语法一致性 无论cocos creator还是node.js都采

  • 这是由于Node.js的版本过低导致的问题,去https://nodejs.org/en/download/ 下载最新版本的Node即可解决。 所以在没有升级Node前,一定不能盲目的升级npm。

  • 经过一系列的配置,使得TS和webpack已经结合到了一起,除了webpack,开发中还经常需要结合babel来对代码进行转换以使其可以兼容到更多的浏览器,在上述步骤的基础上,通过以下步骤再将babel引入到项目中。 步骤: 1.安装依赖包 npm i -D @babel/core @babel/preset-env babel-loader core-js -@babel/co

  • 使用TypeScript开发Express 1.1安装TypeScript cnpm install typescript -g 1.2安装express cnpm install -g express-generator 安装对应的type cnpm install @types/node --save-dev cnpm install @types/express --save-dev 1.3

  • 即刻开始!使用Typescript开发Node typescript(以下简称为ts)是js的超集,它有独立的编译器,为js提供了很多种类型,能够避免js的鸭子类型所产生的类型错误,这种错误有时候是致命的,以至于难以发现。因此我们希望在node中也引入typescript,使程序的编写效率有大大的提高。 begin 首先我们需要安装typescript的tsc编译器,tsc能够把ts转换为js,因

  • TypeScript 介绍 TypeScript 是什么 TypeScript(简称:TS)是 JavaScript的超集(JS有的TS都有) TypeScript = Type + JavaScript(在 JS 基础之上,为 JS 添加了类型支持) TypeScript 是微软开发的开源编程语言,可以在任何运行 JavaScript 的地方运行 安装及编译 TS 文件 安装 npm i -g

  • 安装node 进入官网下载MacOS系统的Node.js Node.js 创建并进入自定文件夹 mkdir typescript-starter Cd typescript-starter 初始化项目,自动创建package.json文件 npm init -y 安装Typescript 下载typescript插件 npm install typescript —save-dev 下载types

  • 一、安装 npm install -g typescript 二、使用tsc编译 index.ts文件 let test: string = "test"; 通过tsc编译成index.js tsc index.ts 编译后的index.js文件 var test = "test"; 注意: 1.通过tsc默认编译成的js版本默认是es3版本 2.编译之后会发现原来的index.ts文件报

 相关资料
  • Node.js API com Typescript Código do curso �� DO ZERO A PRODUÇÃO: APRENDA A CONSTRUIR UMA API NODE.JS COM TYPESCRIPT Durante o curso é criado uma API para calcular a melhor condição de surf entre vari

  • Node.js Express API with TypeScript 4 Node.js Express API with TypeScript 4. Supports MongoDBSee node-express-fast-progress if you need vanilla JS Description This generator will help you to build you

  • TypeScript Node Starter The main purpose of this repository is to show a working Node.js API Server + front-end project and workflow for writing Node code in TypeScript. It is not a goal to be a compr

  • Node - Koa - Typescript Project The main purpose of this repository is to build a good project setup and workflow for writing a Node api rest in TypeScript using KOA and an SQL DB. Koa is a new web fr

  • Building RESTful Web APIs with Node.js, Express, MongoDB and TypeScript This is a simple API that saves contact information of people. There are two versions of this project. V1.0.0: you can run the s

  • 本文向大家介绍浅谈TypeScript 用 Webpack/ts-node 运行的配置记录,包括了浅谈TypeScript 用 Webpack/ts-node 运行的配置记录的使用技巧和注意事项,需要的朋友参考一下 公司项目代码是用 TypeScript 写的, 中间遇到有些代码不要放到 Node 里面去跑. 具体场景一些路由配置, 比较大的一块 JSON 数据定义在 TypeScript 里.