Skip to content

Commit 34a01ec

Browse files
committed
feat(npm): support npm and npx
1 parent 0b8b587 commit 34a01ec

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,19 @@ TSW 支持用户维度的抓包
4242
- 操作系统: Windows/Mac/Linux
4343
- Node.js: 8.0.0+
4444

45-
## 开始
45+
## npm
46+
47+
1. 需先安装[Node.js](https://nodejs.org/en/download/),并且Node.js的版本需不低于8.0.0。
48+
1. npm i @tswjs/tsw
49+
1. npx --node-arg=--inspect tsw
50+
1. 预览 -- 打开浏览器,访问 `http://127.0.0.1/` 即可
51+
52+
## git
4653

4754
1. 需先安装[Node.js](https://nodejs.org/en/download/),并且Node.js的版本需不低于8.0.0。
4855
1. 安装 -- `git clone https://github.com/Tencent/TSW.git`
4956
1. 切换工作目录 -- `cd TSW`
50-
1. 补全依赖 -- `npm install --no-optional`
57+
1. 补全依赖 -- `npm install`
5158
1. 启动 -- `node --inspect index.js`
5259
1. 预览 -- 打开浏览器,访问 `http://127.0.0.1/` 即可
5360

README_en.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,22 @@ The full content of the request can be seen through the log.
3131
- OS: Windows/Mac/Linux
3232
- Node.js: 8.0.0+
3333

34-
## Getting started
34+
## npm
35+
36+
- Before installing, [download and install Node.js](https://nodejs.org/en/download/). Node.js 8.0.0 or higher is required.
37+
- npm i @tswjs/tsw
38+
- npx --node-arg=--inspect tsw
39+
- Open `http://127.0.0.1/` in your browser.
40+
41+
## git
3542

3643
- Before installing, [download and install Node.js](https://nodejs.org/en/download/). Node.js 8.0.0 or higher is required.
3744

3845
- Clone the repo: `git clone https://github.com/Tencent/TSW.git`
3946

4047
- Enter the TSW: `cd TSW`
4148

42-
- NPM : `npm install --no-optional`
49+
- NPM : `npm install`
4350

4451
- Run `node --inspect index.js` to start Node.js server
4552

index.js

100644100755
+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/*!
1+
#!/usr/bin/env node
2+
/* !
23
* Tencent is pleased to support the open source community by making Tencent Server Web available.
34
* Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
45
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
@@ -7,8 +8,8 @@
78
*/
89
'use strict';
910

10-
if(process.mainModule === module){
11+
if (process.mainModule === module) {
1112
require('./bin/proxy/index.js');
12-
}else{
13+
} else {
1314
module.exports = require('./plug.js');
1415
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tswjs/tsw",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "A Node.js infrastructure which is designed for improving the efficiency of locating problems, providing multiple functions for front-end developers",
55
"scripts": {
66
"lint": "eslint examples bin test --fix",
@@ -10,6 +10,9 @@
1010
"coverage": "nyc --reporter=lcov --reporter=text npm test && codecov",
1111
"optional": "npm i heapdump && npm i v8-profiler"
1212
},
13+
"bin": {
14+
"tsw": "./index.js"
15+
},
1316
"repository": {
1417
"type": "git",
1518
"url": "git+https://github.com/tencent/TSW.git"
@@ -40,9 +43,6 @@
4043
"keywords": [
4144
"TSW"
4245
],
43-
"files": [
44-
"bin"
45-
],
4646
"license": "MIT",
4747
"engines": {
4848
"node": ">= 8.0.0"

0 commit comments

Comments
 (0)