|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# @haina/npm
|
|
|
|
# @haina/npm
|
|
|
|
|
|
|
|
|
|
|
|
可复用的 npm 模块
|
|
|
|
可复用的 npm 模块
|
|
|
|
@ -34,31 +33,39 @@ npm run pack
|
|
|
|
# 打包整个项目(各模块和root)
|
|
|
|
# 打包整个项目(各模块和root)
|
|
|
|
npm run pack:all
|
|
|
|
npm run pack:all
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
`npm run pack` 包含执行以下:
|
|
|
|
1. 生成导出文件 `index.js`
|
|
|
|
1. 生成导出文件 `index.js`
|
|
|
|
2. 创建`ESM`和`CommonJS` 版本
|
|
|
|
2. 创建`ESM`和`CommonJS` 版本
|
|
|
|
3. 打包
|
|
|
|
3. 打包
|
|
|
|
1. 打包`src`下的子文件夹 --> `hooks-0.1.10.tgz` `utils-0.1.10.tgz` …
|
|
|
|
1. 打包`src`下的子文件夹 --> `hooks-0.1.10.tgz` `utils-0.1.10.tgz` …
|
|
|
|
2. `src/utils`下的模块, 分别单独打包 --> `utils-request-0.1.10.tgz` `utils-commons-0.1.10.tgz` …
|
|
|
|
2. `src/utils`下的模块, 分别单独打包 --> `utils-request-0.1.10.tgz` `utils-commons-0.1.10.tgz` …
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`npm run pack:all` 增加执行:
|
|
|
|
3. 打包整个项目(root) --> `haina-npm-0.1.10.tgz`
|
|
|
|
3. 打包整个项目(root) --> `haina-npm-0.1.10.tgz`
|
|
|
|
|
|
|
|
|
|
|
|
### Serve
|
|
|
|
### Serve
|
|
|
|
|
|
|
|
|
|
|
|
#### FTP
|
|
|
|
#### FTP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
脚本winscp-upload.bat 需要winscp客户端
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
|
|
|
cd scripts
|
|
|
|
|
|
|
|
.\winscp-upload.bat
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
### 安装整个包
|
|
|
|
### 安装整个包
|
|
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
```sh
|
|
|
|
npm install http://xxxx/npm/haina-npm-0.1.0.tgz
|
|
|
|
npm install https://research.hainatravel.com/npm/haina-npm-0.1.0.tgz
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
```js
|
|
|
|
//
|
|
|
|
//
|
|
|
|
import { commons, request, utils, hooks } from '@haina/npm';
|
|
|
|
import { commons, request, utils, hooks } from '@haina/npm';
|
|
|
|
// Import only common utilities
|
|
|
|
|
|
|
|
|
|
|
|
// Import only common utilities from root tarball package
|
|
|
|
import { isEmpty } from '@haina/npm/esm/utils/commons.js';
|
|
|
|
import { isEmpty } from '@haina/npm/esm/utils/commons.js';
|
|
|
|
// Import only request utilities
|
|
|
|
// Import only request utilities
|
|
|
|
import { fetchJSON } from '@haina/npm/esm/utils/request.js';
|
|
|
|
import { fetchJSON } from '@haina/npm/esm/utils/request.js';
|
|
|
|
@ -67,8 +74,8 @@ import { fetchJSON } from '@haina/npm/esm/utils/request.js';
|
|
|
|
### 安装单个模块
|
|
|
|
### 安装单个模块
|
|
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
```sh
|
|
|
|
npm install http://xxxx/npm/utils-0.1.0.tgz
|
|
|
|
npm install https://research.hainatravel.com/npm/utils-0.1.0.tgz
|
|
|
|
npm install http://xxxx/npm/hooks-0.1.0.tgz
|
|
|
|
npm install https://research.hainatravel.com/npm/hooks-0.1.0.tgz
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -79,7 +86,6 @@ import { commons, request } from '@haina/utils';
|
|
|
|
### 安装Utils的子模块
|
|
|
|
### 安装Utils的子模块
|
|
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
```sh
|
|
|
|
npm install http://xxxx/npm/utils-commons-0.1.0.tgz
|
|
|
|
|
|
|
|
npm install https://research.hainatravel.com/npm/utils-commons-0.1.1.tgz
|
|
|
|
npm install https://research.hainatravel.com/npm/utils-commons-0.1.1.tgz
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|