1.3.28 • Published 5 years ago

towerflow v1.3.28

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

简介

towerflow 是一个面向使用typescript开发项目的流程化工具,适用于前端网站和nodejs等多种项目的开发。

工具可在 macOS, linux, window 下运行。

快速上手

安装

npm i towerflow -g

towerflow --help

创建 Hello World

使用 towerflow 创建web网站项目

towerflow init hello-world --template web-app

该命令会在当前目录下生成新的目录 hello-world, 并自动安装项目所需依赖

在该目录中,项目结构如下

hello-world
    |————node_modules
    |————README.md
	|————package.json
	|————package-lock.json
	|————typeings
	|       |————workaround.d.ts
	|       |————your-module
	|               |————index.d.ts
	|
	|————public
	|      |————index.html
	|      |————favicon.ico
	|
	|————src
	|     |————App.tsx
	|     |————index.tsx
	|
	|————test
	|      |————app.tsx
	|

你不需要任何复杂的配置,在初始化命令结束后,即可开始运行你的项目

进入你的项目目录

cd hello-world

项目运行

在当前目录下,运行项目启动命令

towerflow start

此时你的项目将运行在开发者模式下,在你的浏览器中打开 http://localhost:8080

开发模式是热更新模式,网页不会刷新就能应用你在项目中做出的更改

项目测试

在当前目录下,运行测试命令

towerflow test

此时工具将会运行test目录下编写测试用例,测试框架使用的是jest

关于更多测试相关的文档,请参考 https://jestjs.io/

项目打包

在当前目录下,运行项目打包命令

towerflow production

此时工具将会使用生产模式构建你的项目,并在根目录中的output文件中生成编译后的代码

该模式下会最大程度的优化你的代码,并在生成的文件名中加入hash

项目构建流程说明

towerflow主要有构建流程主要分为两种,webpacktsc

webpack

适用于web-appweb-lib

使用webpackwebpack-dev-server来构建前端网站和开前端模块组件

web-lib在开发时使用webpack流程,打包时使用tsc流程

tsc

适用于node-appnode-libweb-lib

使用tsc来编译nodejs的服务器项目和node模块以及前端组件模块

项目结构说明

所有项目的打包生成的代码都存放于output目录中,测试代码都存放于test目录中,类型文件都存放于typings目录中

node-lib

开发代码存放于lib目录下

node-app

开发代码存放于src目录下,若要编写有交互的命令行工具,请在bin目录下编写入口代码

web-lib

开发代码存放于lib目录下

web-app

开发代码存放于src目录下,公共静态文件存放于public目录下

命令说明

init options <name>

项目初始化命令

name为目标目录名称

towerflow init hello-word 

--template template

指定需要初始化的项目类型

如创建node-lib项目

towerflow init hello-world --template node-lib

目前支持项目类型有

项目类型项目说明
node-libnode模块项目
node-appnode服务器项目
web-libweb模块项目
web-appweb网站项目

--force

若目标文件夹存在,使用该参数,则会强制删除目标文件夹,并初始化新的项目

towerflow init hello-world --template node-lib --force

--bypass-npm

用于跳过npm安装依赖的步骤,若使用该命令,则需手动安装依赖

towerflow init hello-world --template node-lib --bypass-npm

--use-cnpm

使用cnpm安装项目依赖,若要使用该命令,请确保已经全局安装cnpm

towerflow init hello-world --template node-lib --use-cnpm

start

以开发模式运行项目

tsc的开发流程中,则为watch模式

towerflow start

test

运行项目的测视用例,所有测试文件都应存放于test目录中

towerflow test

build

项目打包命令,以生产模式打包项目,打包过后的文件将存放于output目录中

towerflow build

list

显示可用项目模板

towerflow list

assistant

--generate-config

生成项目配置文件,如.prettierrc,tsling.js,tsconfig.json,jest.config.js等,生成的配置文件仅用于帮助开发者编译器配置项目,不会作于开发、打包等的规范检查

towerflow assistant --generate-config

移除项目开发目录中的配置文件

towerflow assistant --remove-config
1.3.28

5 years ago

1.3.27

5 years ago

1.3.26

5 years ago

1.3.25

5 years ago

1.3.24

5 years ago

1.3.23

5 years ago

1.3.21

5 years ago

1.3.20

5 years ago

1.3.19

5 years ago

1.3.18

5 years ago

1.3.17

5 years ago

1.3.15

5 years ago

1.3.14

5 years ago

1.3.13

5 years ago

1.3.12

5 years ago

1.3.11

5 years ago

1.3.10

5 years ago

1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago