apaas-fed-client 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/index.cjs +837 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +805 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# JS 插件项目(Rollup,ESM/CJS)
|
|
2
|
+
|
|
3
|
+
本库使用 Rollup 构建,产物同时支持 `ESM` 与 `CommonJS (CJS)`。示例功能为数组切割:将一个数组按指定大小切分为多个子数组。
|
|
4
|
+
|
|
5
|
+
## 安装与构建
|
|
6
|
+
- 安装依赖:`npm install`
|
|
7
|
+
- 构建产物:`npm run build`
|
|
8
|
+
- 构建后输出:
|
|
9
|
+
- `dist/index.mjs`(ESM)
|
|
10
|
+
- `dist/index.cjs`(CJS)
|
|
11
|
+
|
|
12
|
+
## 使用示例
|
|
13
|
+
- ESM(浏览器或 Node,`type: "module"`)
|
|
14
|
+
- `import chunk, { chunkArray } from 'array-chunk-plugin'`
|
|
15
|
+
- `chunk([1,2,3,4,5], 2)` 返回 `[[1,2],[3,4],[5]]`
|
|
16
|
+
- CommonJS(Node)
|
|
17
|
+
- `const { chunkArray } = require('array-chunk-plugin')`
|
|
18
|
+
- `chunkArray([1,2,3,4,5], 3)` 返回 `[[1,2,3],[4,5]]`
|
|
19
|
+
|
|
20
|
+
## 包结构与脚本
|
|
21
|
+
- 入口源码:`src/index.js`
|
|
22
|
+
- 示例函数:`src/chunk.js`
|
|
23
|
+
- Rollup 配置:`rollup.config.mjs`
|
|
24
|
+
- 构建脚本:`npm run build`
|
|
25
|
+
|
|
26
|
+
## 发布到 npm 的步骤
|
|
27
|
+
- 修改包名:在 `package.json` 将 `name` 改为你的唯一包名(如需公开发布,避免与现有包重复)
|
|
28
|
+
- 登录 npm:`npm login`
|
|
29
|
+
- 版本号管理:`npm version patch`(或 `minor`/`major`)
|
|
30
|
+
- 构建产物:`npm run build`
|
|
31
|
+
- 发布到公共 npm:
|
|
32
|
+
- 未使用 scope:`npm publish`
|
|
33
|
+
- 使用 scope(公开):`npm publish --access public`
|
|
34
|
+
- 如果需要自定义私有仓库:
|
|
35
|
+
- 设置 registry:`npm config set registry https://your-registry.example.com/`
|
|
36
|
+
- 登录并发布到该仓库
|
|
37
|
+
|
|
38
|
+
## 注意事项
|
|
39
|
+
- 构建前确保 `dist` 可写且无权限问题
|
|
40
|
+
- 若包使用 scope(如 `@your-scope/name`),公开发布需要 `--access public`
|
|
41
|
+
- 发布前务必更新版本号,避免 403 错误
|
|
42
|
+
|