Giter VIP home page Giter VIP logo

ali-fc-typescript-skeleton's Introduction

ali-fc-typescript-skeleton

阿里云函数计算 TypeScript 开发模板/项目骨架。适合开发微服务/Restful API/简易 Web 应用。

特性

  • 语言:TypeScript
  • 运行时:nodejs 10
  • 代码打包:webpack
  • 代码规范:eslint
  • 测试框架:mocha
  • 断言库:power-assert

准备

  1. 安装 node

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
    nvm install 8
  2. 安装 fun 工具

    npm install @alicloud/fun -g

fun 工具的某些子命令可能会用到 docker,所以你需要安装好 docker,具体参考文档:Fun 安装教程

基于此模板初始化你的项目骨架

fun init -n yourProject https://github.com/Jeff-Tian/ali-fc-typescript-skeleton.git

安装依赖

cd yourProject
npm install

自动化测试

npm test

编译

# 生成编译
npm run build

# 开发编译(这种编译方式不会进行代码混淆,并且生成 source map 信息,方便开发调试)
npm run dev

本地运行函数

fun local invoke demo/demo

运行调试函数

运行调试之前,请先用 npm run dev 命令编译源码,然后以调试的方式运行函数:

fun local invoke -d 3000 demo

程序会阻塞在这里,并不会继续往下执行。只有 vs code 的连接上来后,程序才会继续执行。接下通过 vs code 连上来,并开始调试,如下图所示: debug-fc.gif

部署函数到云端

fun deploy

开发与贡献

欢迎提 PR 和 Issue。

注意,本项目将 github 上的主分支设置成了 gh-pages,以方便使用 fun init -n 来创建脚手架。要开发和修改本项目,一定注意要切换到 master 分支(或者基于 master 分支打新的分支)做修改。

PR 也是往 master 分支合并,合并后会自动更新 gh-pages 分支。

git clone https://github.com/Jeff-Tian/ali-fc-typescript-skeleton.git#master
git checkout master

ali-fc-typescript-skeleton's People

Contributors

dependabot[bot] avatar jeff-tian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.