You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Lei OT 253da410b6 0.1.3 3 months ago
scripts feat: upload脚本; 创建index.html 3 months ago
src feat(commons): url validate 3 months ago
.babelrc init: commons, request 4 months ago
.gitignore feat: upload脚本; 创建index.html 3 months ago
.npmignore init: commons, request 4 months ago
README.MD docs: 3 months ago
jsconfig.json feat: +pagespy; build: +rollup 4 months ago
package.json 0.1.3 3 months ago
rollup.config.js build: rollup: config external 4 months ago
structure.txt feat: +pagespy; build: +rollup 4 months ago

README.MD

@haina/npm

可复用的 npm 模块
支持 ESM(import) 和 CommonJS(require)

Dev

Package Structure

├─build
│  ├─cjs
│  └─esm
├─dist
│   ├── haina-npm-0.1.0.tgz
│   ├── hooks-0.1.0.tgz
│   ├── utils-0.1.0.tgz
│   ├── utils-commons-0.1.0.tgz
│   └── utils-request-0.1.0.tgz
└─src
    ├─ index.js
    ├─ hooks/
    └─ utils/

Build & Pack

# 打包各模块
npm run pack

# 打包整个项目(各模块和root)
npm run pack:all

npm run pack 包含执行以下:

  1. 生成导出文件 index.js
  2. 创建ESMCommonJS 版本
  3. 打包
    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

npm run pack:all 增加执行: 3. 打包整个项目(root) --> haina-npm-0.1.10.tgz

Serve

FTP

脚本winscp-upload.bat 需要winscp客户端

cd scripts
.\winscp-upload.bat

Usage

安装整个包

npm install https://research.hainatravel.com/npm/haina-npm-0.1.0.tgz
// 
import { commons, request, utils, hooks } from '@haina/npm';

// Import only common utilities from root tarball package
import { isEmpty } from '@haina/npm/esm/utils/commons.js';
// Import only request utilities
import { fetchJSON } from '@haina/npm/esm/utils/request.js';

安装单个模块

npm install https://research.hainatravel.com/npm/utils-0.1.0.tgz
npm install https://research.hainatravel.com/npm/hooks-0.1.0.tgz
import { commons, request } from '@haina/utils';

安装Utils的子模块

npm install https://research.hainatravel.com/npm/utils-commons-0.1.1.tgz
import { isEmpty } from '@haina/utils-commons';