UNPKG

3 kBMarkdownView Raw
1# RapidBundle
2
3[![Build](https://github.com/umidbekk/rapidbundle/workflows/Main/badge.svg)](https://github.com/umidbekk/rapidbundle/actions/workflows/main.yml)
4[![install size](https://packagephobia.com/badge?p=rapidbundle)](https://packagephobia.com/result?p=rapidbundle)
5[![npm version](https://img.shields.io/npm/v/rapidbundle.svg)](https://www.npmjs.com/package/rapidbundle)
6[![npm downloads](https://img.shields.io/npm/dm/rapidbundle.svg)](https://www.npmjs.com/package/rapidbundle)
7[![Maintainability](https://api.codeclimate.com/v1/badges/423373df446e501b32f9/maintainability)](https://codeclimate.com/github/avocadowastaken/rapidbundle/maintainability)
8[![Test Coverage](https://api.codeclimate.com/v1/badges/423373df446e501b32f9/test_coverage)](https://codeclimate.com/github/avocadowastaken/rapidbundle/test_coverage)
9
10## Installation
11
12```bash
13npm i -D rapidbundle
14# or with yarn
15yarn add -D rapidbundle
16```
17
18## Usage
19
20```bash
21npx rapidbundle
22# or with yarn
23yarn rapidbundle
24```
25
26# GitHub Action
27
28- Creates a single file bundle for each entry
29- Scans `action.yml` to obtain build info
30
31 - Infers entries from the `.runs.main`, `.runs.pre` and `.runs.post` fields
32 - Infers target Node version from the `.runs.using` field
33
34### Constraints:
35
361. Entry file should be located in the `src` directory.
372. Output files should be located in the `dist` directory.
38
39This allows us to properly infer entry point name from the `action.yml`.
40
41For example, if you have `action.yml` like that:
42
43```yaml
44runs:
45 using: "node12"
46 pre: "./dist/setup.js"
47 main: "./dist/index.js"
48 post: "./dist/cleanup.js"
49```
50
51It will produce 3 output files in `dist` directory and look for the same file
52paths in `src` directory
53
54```
55├─ src
56│ ├─ setup.ts
57│ ├─ index.ts
58│ └─ cleanup.ts
59├─ dist
60│ ├─ setup.js
61│ ├─ index.js
62│ └─ cleanup.js
63└─ action.yml
64```
65
66# Node Package
67
68- Creates a single file bundle for each entry
69- Scans `package.json` to obtain build info
70
71 - Infers entries from the `.bin`, `.main`, `.module` and `.types` fields
72 - Infers target Node version from the `.engines.node` field
73
74### Constraints:
75
761. Entry file should be located in the `src` directory.
772. Output files should be located in the `dist` directory.
78
79This allows us to properly infer entry point names from the `package.json`.
80
81For example, if you have `package.json` like that:
82
83```json
84{
85 "bin": "./dist/cli.js",
86 "main": "./dist/index.cjs",
87 "module": "./dist/index.js",
88 "types": "./dist/index.d.ts"
89}
90```
91
92It will produce 3 output files in `dist` directory.
93
94```
95├─ src
96│ ├─ cli.ts
97│ └─ index.ts
98├─ dist
99│ ├─ cli.js
100│ ├─ index.js
101│ ├─ index.cjs
102│ └─ types.d.ts
103└─ action.yml
104```
105
106### Limitations
107
108File names should not have multiple `.` signs in it:
109
110- `dist/mod.js` will be mapped to `src/mod` and extension will be resolved automatically
111- `dist/mod.es.js` will be mapped to `src/mod.es` and will use `.es` extension