Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cardinalby/webext-buildtools-dir-reader-mw
webext-buildtools builder for packing extension directory to zip and reading manifest
https://github.com/cardinalby/webext-buildtools-dir-reader-mw
Last synced: about 5 hours ago
JSON representation
webext-buildtools builder for packing extension directory to zip and reading manifest
- Host: GitHub
- URL: https://github.com/cardinalby/webext-buildtools-dir-reader-mw
- Owner: cardinalby
- License: mit
- Created: 2019-04-24T19:46:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-05-13T11:59:10.000Z (over 2 years ago)
- Last Synced: 2024-11-01T22:04:34.495Z (5 days ago)
- Language: TypeScript
- Size: 130 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![npm-publish](https://github.com/cardinalby/webext-buildtools-dir-reader-mw/workflows/npm-publish/badge.svg)
### Introduction
*webext-buildtools* middleware builder for reading manifest file and packing Web Extension directory to zip file.
Expected to be used to provide inputs for further builders.If you need a **complete solution** for Web Extension build/deploy, go to
[webext-buildtools-integrated-builder](https://github.com/cardinalby/webext-buildtools-integrated-builder) repo.To read what are *webext-buildtools* and *builders* go to
[webext-buildtools-builder-types](https://github.com/cardinalby/webext-buildtools-builder-types) repo.### Installation
`npm install webext-buildtools-dir-reader-mw`### Usage example
```js
const DirReaderBuilder = require('webext-buildtools-dir-reader-mw').default;const options = { zipOutPath: './out/ext.zip' };
const logMethod = console.log;
const builder = new DirReaderBuilder(options, logMethod);builder.setInputDirPath('./ext_dir');
builder.requireZipFile();
builder.requireManifest();const buildResult = await builder.build();
```### Options
Options object described in [declarations/options.d.ts](declarations/options.d.ts)[See](https://github.com/cardinalby/webext-buildtools-integrated-builder/blob/master/logMethod.md) how to get `logMethod` for pretty output.
### Inputs
* **`setInputDirPath(...)`**. Path to Web Extension directory### Outputs
#### zip
directory packed to zip*Required options:* `zipOutPath` (for not temporary file)
*Require methods:* `requireZipFile()`, `requireZipBuffer()`
*Assets:*
`const buffer = buildResult.getAssets().zipBuffer.getValue()`
`const zipFilePath = buildResult.getAssets().zipFile.getValue()`#### manifest
Object with parsed manifest file*Require methods:* `requireManifest()`
*Assets:*
`const manifestObj = buildResult.getAssets().manifest.getValue()`