# smt

> su-js tools watch

Latest version **1.1.56** (published 2021-05-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install smt
pnpm add smt
yarn add smt
bun add smt
```

Provides the command `smt`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.56 |
| Published | 2021-05-10 |
| First published | 2016-02-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 60 |
| Unpacked size | 64 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hhwy |
| Maintainers | hhwy |
| Keywords | sujs vue sass css js compress watch |

## Links

- npm: https://www.npmjs.com/package/smt
- Repository: git@git.365power.cn:cloud/smt
- npm.io page: https://npm.io/package/smt

## Dependencies (60)

- [co](https://npm.io/package/co.md) ^4.6.0
- [del](https://npm.io/package/del.md) ^3.0.0
- [got](https://npm.io/package/got.md) ^8.0.1
- [pug](https://npm.io/package/pug.md) ^2.0.0-rc.4
- [gulp](https://npm.io/package/gulp.md) ^3.9.1
- [async](https://npm.io/package/async.md) ^2.5.0
- [module](https://npm.io/package/module.md) ^1.2.5
- [express](https://npm.io/package/express.md) ^4.15.4
- [gulp-if](https://npm.io/package/gulp-if.md) ^2.0.2
- [webpack](https://npm.io/package/webpack.md) ^1.14.0
- [gulp-pug](https://npm.io/package/gulp-pug.md) ^3.3.0
- [inquirer](https://npm.io/package/inquirer.md) ^4.0.1
- [progress](https://npm.io/package/progress.md) ^2.0.0
- [get-ports](https://npm.io/package/get-ports.md) ^1.0.3
- [gulp-sass](https://npm.io/package/gulp-sass.md) ^4.0.2
- [babel-core](https://npm.io/package/babel-core.md) ^6.10.4
- [css-loader](https://npm.io/package/css-loader.md) ^0.28.7
- [gulp-babel](https://npm.io/package/gulp-babel.md) ^7.0.0
- [gulp-watch](https://npm.io/package/gulp-watch.md) ^4.3.11
- [iconv-lite](https://npm.io/package/iconv-lite.md) ^0.4.19
- [map-stream](https://npm.io/package/map-stream.md) ^0.0.7
- [requiredir](https://npm.io/package/requiredir.md) ^1.0.7
- [url-loader](https://npm.io/package/url-loader.md) ^0.5.9
- [vue-loader](https://npm.io/package/vue-loader.md) ^8.5.3
- [compressing](https://npm.io/package/compressing.md) ^1.2.3
- [file-loader](https://npm.io/package/file-loader.md) ^0.11.2
- [gulp-concat](https://npm.io/package/gulp-concat.md) ^2.6.1
- [gulp-px2rem](https://npm.io/package/gulp-px2rem.md) ^1.0.13
- [gulp-rename](https://npm.io/package/gulp-rename.md) ^1.4.0
- [gulp-uglify](https://npm.io/package/gulp-uglify.md) ^3.0.0
- [markdown-it](https://npm.io/package/markdown-it.md) ^8.4.0
- [replacefile](https://npm.io/package/replacefile.md) ^1.0.0
- [vinyl-paths](https://npm.io/package/vinyl-paths.md) ^2.1.0
- [babel-loader](https://npm.io/package/babel-loader.md) ^6.2.4
- [gulp-connect](https://npm.io/package/gulp-connect.md) ^4.2.0
- [gulp-htmlmin](https://npm.io/package/gulp-htmlmin.md) ^5.0.1
- [gulp-plumber](https://npm.io/package/gulp-plumber.md) ^1.2.0
- [gulp-webpack](https://npm.io/package/gulp-webpack.md) ^1.5.0
- [style-loader](https://npm.io/package/style-loader.md) ^0.19.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.9.2
- [jstransformer](https://npm.io/package/jstransformer.md) ^1.0.0
- [babel-register](https://npm.io/package/babel-register.md) ^6.0.0
- [gulp-clean-css](https://npm.io/package/gulp-clean-css.md) ^4.0.0
- [gulp-sourcemaps](https://npm.io/package/gulp-sourcemaps.md) ^2.6.4
- [vue-html-loader](https://npm.io/package/vue-html-loader.md) ^1.2.4
- [vue-style-loader](https://npm.io/package/vue-style-loader.md) ^3.0.1
- [gulp-autoprefixer](https://npm.io/package/gulp-autoprefixer.md) ^7.0.1
- [gulp-batch-replace](https://npm.io/package/gulp-batch-replace.md) ^0.0.0
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.9.0
- [babel-preset-stage-2](https://npm.io/package/babel-preset-stage-2.md) ^6.11.0
- [http-proxy-middleware](https://npm.io/package/http-proxy-middleware.md) ^0.17.4
- [babel-plugin-syntax-jsx](https://npm.io/package/babel-plugin-syntax-jsx.md) ^6.18.0
- [gulp-javascript-obfuscator](https://npm.io/package/gulp-javascript-obfuscator.md) ^1.1.6
- [extract-text-webpack-plugin](https://npm.io/package/extract-text-webpack-plugin.md) ^1.0.1
- [babel-plugin-transform-runtime](https://npm.io/package/babel-plugin-transform-runtime.md) ^6.9.0
- [babel-plugin-transform-vue-jsx](https://npm.io/package/babel-plugin-transform-vue-jsx.md) ^3.4.2
- [babel-helper-vue-jsx-merge-props](https://npm.io/package/babel-helper-vue-jsx-merge-props.md) ^2.0.2
- [babel-plugin-transform-async-await](https://npm.io/package/babel-plugin-transform-async-await.md) ^1.0.0
- [babel-plugin-transform-remove-strict-mode](https://npm.io/package/babel-plugin-transform-remove-strict-mode.md) ^0.0.2
- [babel-plugin-transform-es2015-typeof-symbol](https://npm.io/package/babel-plugin-transform-es2015-typeof-symbol.md) ^6.23.0

## Recent versions

- 1.1.56 (latest) — 2021-05-10
- 1.2.2 — 2020-07-20
- 1.2.1 — 2020-07-03
- 1.2.0 — 2020-07-03
- 1.1.55 — 2020-04-22
- 1.1.54 — 2020-03-31
- 1.1.53 — 2020-03-27
- 1.1.52 — 2020-03-19
- 1.1.51 — 2020-03-19
- 1.1.50 — 2020-03-19
- 1.1.49 — 2020-03-19
- 1.1.48 — 2020-02-18
- 1.1.47 — 2020-02-10
- 1.1.45 — 2020-01-13
- 1.1.44 — 2020-01-13
- … 65 more at https://npm.io/package/smt/versions

## README

# smt 

 SMT is a front-end development tool based on webpack and gulp, which supports the separation and development of the front and rear ends.

### Characteristics
- Build projects quickly
- Start the static service
- Monitor file changes, refresh the page in real time.
- Source compilation, compression（support：css/js/pug/md/vue Etc.）
- Front-end separation and service forwarding.
- ES6 to ES5, improved js code browser compatibility


### Installation

1. Install [node.js（https://nodejs.org）](https://nodejs.org)
1. Install smt global

	`npm install smt -g`
1. Test smt 

	`smt -v`
### Command list
<table>
	<thead>
		<tr>
			<th>index</th>
			<th>command</th>
			<th>instructions</th>
		</tr>
	</thead>
	<tbody>
		<tr> 
			<td>1</td>
			<td>smt</td>
			<td>Start the static service</td>
		</tr>
		<tr> 
			<td>2</td>
			<td>smt config</td>
			<td>Generate smtfile.js configuration file (for configuration code compilation, service forwarding, etc.)</td>
		</tr>
		<tr> 
			<td>3</td>
			<td>smt init template name</td>
			<td>For example：smt init st-launcher</td>
		</tr>
		<tr> 
			<td>4</td>
			<td>smt build</td>
			<td>Compile the project</td>
		</tr>
		<tr> 
			<td>5</td>
			<td>smt clean</td>
			<td>Clear the directory specified by dist in the configuration file</td>
		</tr>
		<tr> 
			<td>6</td>
			<td>smt rebuild</td>
			<td>Recompile the project, this command is equivalent to smt clean && smt build</td>
		</tr>
		<tr> 
			<td>7</td>
			<td>smt -v</td>
			<td>Check the currently installed smt version</td>
		</tr>
	</tbody>
</table>

### smt function


- Start the static service

	- Enter the command `smt` to start the static service. The root directory of the service is the directory in which the command is currently executed.
	- Monitor the changes of directory files to realize real-time refresh of the page.
	
- Forwarding service
	- To achieve service forwarding, need to rely on the configuration file. Generate the configuration file by entering the command `smt config`
		- The configuration file is as follows:   [Details](https://dev.365power.cn/sujs/#smt/config)

###

	{
	    // Service agent forwarding
	    server: {
	        proxy:{
	            //Automatically forward the request containing /minierp to the target server address
	            "/minierp":{
	                target: 'http://trunk.minierp.hhwy.org', // target host 
	                changeOrigin: true
	            }
	        }
	    }
	}

	- According to the configuration file, type the command smt, forwarding service can be realized

- Code compiled	
	- Need to rely on the smtfiles.js configuration file, compile the file in the build field configuration, the file is compiled, compressed, copied
	- Enter the command `smt build` for code compilation
###

	{
	    // smtfile.js 
	    // compile
	    build :{
	        // src: source directory; dist：target directory；
	        // Compile js
	        js:[],
	        css:[],
	        // Compile HTML without providing code merge functionality.
	        html:[],
	        // Compiling jade does not provide code merge functionality.
	        pug:[],
	        // Compile md to generate HTML fragments.
	        md: [],
	        //Compile vue, and monitor changes, to achieve automatic browser refresh
	        vue: [],
	        // Other files, copy directly.
	        others:[]
	    },
	    //The compiled file holds the directory.
	    dist:"dist",
	    //Global substitution field
	    replace:[
	        {src:"${version}",value:"?_v=0.1.7",}
	    ]
	}
	
> Command build, clean, rebuild before use, according to the actual project configuration file changes.
	
- Create the project from the template
	- smt tools provided by the template there：st-launcher，mst-launcher
	- You can modify the configuration file after initializing the template

## Help
> To check out live examples and docs, visit [https://dev.365power.cn/sujs/#smt/start](https://dev.365power.cn/sujs/#smt/start)



# smt 

 smt 是一款基于webpack、gulp的前端开发工具，支持前后端分离开发的模式。具有快速搭建项目、文件监听、页面实时刷新、编译压缩、服务转发等功能。

### 特点
- 快速构建项目
- 启动静态服务
- 监听文件变化，实时刷新页面
- 源码编译、压缩（支持：css/js/pug/md/vue等）
- 前后端分离、服务转发
- ES6转ES5，提高 js 代码的浏览器兼容性


### 安装

1. 安装 [node.js（https://nodejs.org）](https://nodejs.org)
1. 安装 smt

	`npm install smt -g`
1. 测试 smt 

	`smt -v`
### 命令列表
<table>
	<thead>
		<tr>
			<th>序号</th>
			<th>命令</th>
			<th>说明</th>
		</tr>
	</thead>
	<tbody>
		<tr> 
			<td>1</td>
			<td>smt</td>
			<td>启动静态服务</td>
		</tr>
		<tr> 
			<td>2</td>
			<td>smt config</td>
			<td>生成smtfile.js配置文件（用于配置代码编译、服务转发等）</td>
		</tr>
		<tr> 
			<td>3</td>
			<td>smt init 模板名称</td>
			<td>例如：smt init st-launcher</td>
		</tr>
		<tr> 
			<td>4</td>
			<td>smt build</td>
			<td>编译项目</td>
		</tr>
		<tr> 
			<td>5</td>
			<td>smt clean</td>
			<td>清除配置文件中dist指定的目录</td>
		</tr>
		<tr> 
			<td>6</td>
			<td>smt rebuild</td>
			<td>重新编译项目，此命令等价于 smt clean && smt build</td>
		</tr>
		<tr> 
			<td>7</td>
			<td>smt -v</td>
			<td>查看当前安装的smt版本</td>
		</tr>
	</tbody>
</table>

### smt 的功能

> 若您只想启动一个静态服务，则无需关心配置文件smtfiles.js的相关说明。

- 启动静态服务

	- 输入命令 `smt` 启动静态服务。服务的根目录为当前执行命令的目录。
	- 监听目录文件的变化，实现页面的实时刷新
	
- 服务转发
	- 实现服务转发，需要依赖于配置文件。 通过输入命令 `smt config` 生成配置文件
		- 配置文件如下：   [详情](https://dev.365power.cn/sujs/#smt/config)

###

	{
	    // 服务代理转发
	    server: {
	        proxy:{
	            //自动将包含 /minierp 的请求转发到target服务器地址
	            "/minierp":{
	                target: 'http://trunk.minierp.hhwy.org', // target host 
	                changeOrigin: true
	            }
	        }
	    }
	}

	- 根据配置文件，输入命令`smt` ，即可实现服务转发

- 代码编译	
	- 需要依赖于smtfiles.js配置文件，在build字段进行文件编译的配置，将文件进行编译，压缩，拷贝
	- 输入命令 `smt build` 进行代码编译
###

	{
	    // smtfile.js 
	    // 编译
	    build :{
	        // src: 源目录； dist：目标目录；
	        // 编译js
	        js:[],
	        css:[],
	        // 编译html，不提供代码合并功能
	        html:[],
	        // 编译jade，不提供代码合并功能
	        pug:[],
	        // 编译md，生成html片段
	        md: [],
	        //编译vue,并监听变化，实现浏览器自动刷新
	        vue: [],
	        // 其它文件,直接拷贝
	        others:[]
	    },
	    //编译后文件存放目录
	    dist:"dist",
	    //全局替换字段
	    replace:[
	        {src:"${version}",value:"?_v=0.1.7",}
	    ]
	}
	
> 命令build,clean,rebuild在使用前，需按实际项目进行配置文件的修改。
	
- 从模板创建项目
	- smt 工具提供的模板有：st-launcher，mst-launcher
	- 您可以在初始化模板后，进行配置文件的修改

## Help
> To check out live examples and docs, visit [https://dev.365power.cn/sujs/#smt/start](https://dev.365power.cn/sujs/#smt/start)

---
_Source: https://npm.io/package/smt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
