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.
|
|
4 months ago | |
|---|---|---|
| scripts | 4 months ago | |
| src | 4 months ago | |
| .babelrc | 4 months ago | |
| .gitignore | 4 months ago | |
| .npmignore | 4 months ago | |
| README.MD | 4 months ago | |
| package.json | 4 months ago | |
README.MD
@haina/npm
可复用的 npm 模块
支持 ESM(import) 和 CommonJS(require)
Dev
Package Structure
src/
├── utils/
│ ├── common.js
│ └── request.js
├── hooks/
│ ├── useXx.js
│ └── useYy.js
Build & Pack
# 打包各模块
npm run pack
# 打包各模块和root
npm run pack:all
- 生成导出文件
index.js - 创建
ESM和CommonJS版本 - 打包
- 打包
src下的子文件夹 -->hooks-0.1.10.tgzutils-0.1.10.tgz… src/utils下的模块, 分别单独打包 -->utils-request-0.1.10.tgzutils-commons-0.1.10.tgz…- 打包整个项目(root) -->
haina-npm-0.1.10.tgz
- 打包
Serve
FTP
Github Action
Usage
安装整个包
npm install http://xxxx/npm/haina-npm-0.1.0.tgz
//
import { commons, request, utils, hooks } from '@haina/npm';
// Import only common utilities
import { isEmpty } from '@haina/npm/esm/utils/commons.js';
// Import only request utilities
import { fetchJSON } from '@haina/npm/esm/utils/request.js';
安装单个模块
npm install http://xxxx/npm/utils-0.1.0.tgz
npm install http://xxxx/npm/hooks-0.1.0.tgz
import { commons, request } from '@haina/utils';
安装Utils的子模块
npm install http://xxxx/npm/utils-commons-0.1.0.tgz
import { isEmpty } from '@haina/utils-commons';