manifest.js
v0.0.11
Published
This is a CLI toolchain for building browser extensions. It includes commands for building bundles, managing versions, and translating content. The toolchain is designed to be modular and extendable, making it easy to add new functionality.
Downloads
10
Readme
manifest.js
This is a CLI toolchain for building browser extensions. It includes commands for building bundles, managing versions, and translating content. The toolchain is designed to be modular and extendable, making it easy to add new functionality.
Installation
npm install manifest.js -g
Usage
This CLI tool provides several commands to help you manage your browser extension project. Below is a detailed explanation of each command.
1. Build Command
The build
command compiles your extension’s code into a bundle that can be loaded into the browser.
Syntax:
manifest build [options]
Options:
--watch
: Run the build process in watch mode. This option automatically rebuilds the bundle whenever a source file changes.
Example:
manifest build --watch
This command reads the manifest.json
file from the current working directory, initializes the Builder
class with it, and triggers the build process.
2. Version Command
The version
command increments the version number in the manifest.json
file. You can specify the type of version bump: patch
, minor
, or major
.
Syntax:
manifest version <type>
Parameters:
<type>
: The type of version increment. Valid values arepatch
,minor
, ormajor
.
Example:
manifest version patch
This command will increment the patch version (e.g., from 1.0.0
to 1.0.1
) in the manifest.json
file.
3. Translate Command
The translate
command integrates the translation module into your project. It includes two subcommands: init
and sync
.
Usage:
manifest translate <subcommand>
Subcommands:
init
: Initializes the translation configuration by generating atranslate.config.json
file.sync
: Syncs the translations based on thetranslate.config.json
file.
Example:
manifest translate init
This command creates a translate.config.json
file if it doesn’t already exist.
manifest translate sync
This command syncs the translations using the configuration file.
4. Format Command
Usage:
manifest format
Extending the CLI
This CLI is built using the commander
library, making it easy to add new commands or extend existing ones. To add a new command:
- Create a new module in the
src/
directory. - Import and register your command in the main command file.
Error Handling
The CLI provides basic error handling. If an error occurs during execution, it will be thrown, and a message will be displayed in the console.
License
This project is licensed under the MIT License.
See More Example