All Projects → oncletom → Crx

oncletom / Crx

Licence: mit
A node.js command line app for packing Google Chrome extensions.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Crx

Easy To Rss
🚀 Chrome/Firefox Extension to retreive RSS feeds URLs from WebSite, RSSHub supported
Stars: ✭ 386 (-11.26%)
Mutual labels:  chrome-extension, crx
Gayhub
An awesome chrome extension for github
Stars: ✭ 995 (+128.74%)
Mutual labels:  chrome-extension, crx
Qzoneexport
QQ空间导出助手,用于备份QQ空间的说说、日志、私密日记、相册、视频、留言板、QQ好友、收藏夹、分享、最近访客为文件,便于迁移与保存
Stars: ✭ 456 (+4.83%)
Mutual labels:  chrome-extension, crx
Simpread
简悦 ( SimpRead ) - 让你瞬间进入沉浸式阅读的扩展
Stars: ✭ 5,352 (+1130.34%)
Mutual labels:  chrome-extension, crx
Dictionaries
One dictionary to rule them all -- a browser extension to help you learn languages
Stars: ✭ 134 (-69.2%)
Mutual labels:  chrome-extension, crx
Seckill
Chrome浏览器 抢购、秒杀插件,秒杀助手,定时自动点击
Stars: ✭ 1,278 (+193.79%)
Mutual labels:  chrome-extension, crx
Oscnews
Chrome 插件,查看开源中国软件更新资讯,文档导航,GitHub 趋势榜,linux命令索引,浏览历史记录和时钟页面。
Stars: ✭ 582 (+33.79%)
Mutual labels:  chrome-extension, crx
Simpread Little
简悦( SimpRead ) · 轻阅版
Stars: ✭ 216 (-50.34%)
Mutual labels:  chrome-extension, crx
Editchromethemes
A guide to editing Chrome themes
Stars: ✭ 118 (-72.87%)
Mutual labels:  chrome-extension, crx
Ctool
程序开发常用工具 chrome 扩展
Stars: ✭ 111 (-74.48%)
Mutual labels:  chrome-extension, crx
Prettier Chrome
🎨 An extension that can run Prettier in the browser
Stars: ✭ 207 (-52.41%)
Mutual labels:  chrome-extension, crx
Crx Selection Translate
一站式划词 / 截图 / 网页全文 / 音视频翻译扩展。
Stars: ✭ 3,603 (+728.28%)
Mutual labels:  chrome-extension, crx
Js Tracker
A chrome extension tracks front-end JavaScript that uses DOM / jQuery APIs to manipulate html dom elements (e.g., change style, attach event listener) at runtime.
Stars: ✭ 387 (-11.03%)
Mutual labels:  chrome-extension
React Chrome Extension
chrome extension boilerplate with ReactJs using inject page strategy
Stars: ✭ 405 (-6.9%)
Mutual labels:  chrome-extension
Browser Addon
Kee adds free, secure and easy password management features to your browser which save time and keep your private data more secure.
Stars: ✭ 386 (-11.26%)
Mutual labels:  chrome-extension
Githuber
Display Github Trending repositories on Chrome New Tab Extensions
Stars: ✭ 418 (-3.91%)
Mutual labels:  chrome-extension
Svg Screenshots
📸🧩 Browser extension to take scalable, semantic, accessible screenshots of websites in SVG format.
Stars: ✭ 404 (-7.13%)
Mutual labels:  chrome-extension
Fake Filler Extension
A browser extension for Chrome, Edge and Firefox that fills dummy text in all input fields in a page.
Stars: ✭ 383 (-11.95%)
Mutual labels:  chrome-extension
Figma Html
Convert Figma designs to HTML, React, Vue, Angular, and more!
Stars: ✭ 382 (-12.18%)
Mutual labels:  chrome-extension
Awesome Json Viewer
🔥 A Chrome extension to visualise JSON response and introduce awesome JSON prettifying experiences.
Stars: ✭ 380 (-12.64%)
Mutual labels:  chrome-extension

crx Build Status Build status

crx is a utility to package Google Chrome extensions via a Node API and the command line. It is written purely in JavaScript and does not require OpenSSL!

Packages are available to use crx with:

Massive hat tip to the node-rsa project for the pure JavaScript encryption!

Compatibility: this extension is compatible with node>=10.

Install

$ npm install crx

Module API

Asynchronous functions returns a native ECMAScript Promise.

const fs = require('fs');
const path = require('path');

const ChromeExtension = require('crx');

const crx = new ChromeExtension({
  codebase: 'http://localhost:8000/myExtension.crx',
  privateKey: fs.readFileSync('./key.pem')
});

crx.load( path.resolve(__dirname, './myExtension') )
  .then(crx => crx.pack())
  .then(crxBuffer => {
    const updateXML = crx.generateUpdateXML()

    fs.writeFile('../update.xml', updateXML);
    fs.writeFile('../myExtension.crx', crxBuffer);
  })
  .catch(err=>{
    console.error( err );
  });

ChromeExtension = require("crx")

crx = new ChromeExtension(attrs)

This module exports the ChromeExtension constructor directly, which can take an optional attribute object, which is used to extend the instance.

crx.load(path|files)

Prepares the temporary workspace for the Chrome Extension located at path — which is expected to directly contain manifest.json.

crx.load('/path/to/extension').then(crx => {
  // ...
});

Alternatively, you can pass a list of files — the first manifest.json file to be found will be considered as the root of the application.

crx.load(['/my/extension/manifest.json', '/my/extension/background.json']).then(crx => {
  // ...
});

crx.pack()

Packs the Chrome Extension and resolves the promise with a Buffer containing the .crx file.

crx.load('/path/to/extension')
  .then(crx => crx.pack())
  .then(crxBuffer => {
    fs.writeFile('/tmp/foobar.crx', crxBuffer);
  });

crx.generateUpdateXML()

Returns a Buffer containing the update.xml file used for autoupdate, as specified for update_url in the manifest. In this case, the instance must have a property called codebase.

const crx = new ChromeExtension({ ..., codebase: 'https://autoupdateserver.com/myFirstExtension.crx' });

crx.load('/path/to/extension')
  .then(crx => crx.pack())
  .then(crxBuffer => {
    // ...
    const xmlBuffer = crx.generateUpdateXML();
    fs.writeFile('/foo/bar/update.xml', xmlBuffer);
  });

crx.generateAppId

Generates application id (extension id) from given path.

new crx().generateAppId('/path/to/ext') // epgkjnfaepceeghkjflpimappmlalchn

CLI API

crx pack [directory] [--crx-version number] [-o file] [--zip-output file] [-p private-key]

Pack the specified directory into a .crx package, and output it to stdout. If no directory is specified, the current working directory is used.

Use the --crx-version option to specify which CRX format version to output. Can be either "2" or "3", defaults to "3".

Use the -o option to write the signed extension to a file instead of stdout.

Use the --zip-output option to write the unsigned extension to a file.

Use the -p option to specify an external private key. If this is not used, key.pem is used from within the directory. If this option is not used and no key.pem file exists, one will be generated automatically.

Use the -b option to specify the maximum buffer allowed to generate extension. By default, will rely on node internal setting (~200KB).

crx keygen [directory]

Generate a 2048-bit RSA private key within the directory. This is called automatically if a key is not specified, and key.pem does not exist.

Use the --force option to overwrite an existing private key located in the same given folder.

crx --help

Show information about using this utility, generated by commander.

CLI example

Given the following directory structure:

└─┬ myFirstExtension
  ├── manifest.json
  └── icon.png

run this:

$ cd myFirstExtension
$ crx pack -o

to generate this:

├─┬ myFirstExtension
│ ├── manifest.json
│ ├── icon.png
│ └── key.pem
└── myFirstExtension.crx

You can also name the output file like this:

$ cd myFirstExtension
$ crx pack -o myFirstExtension.crx

to get the same results, or also pipe to the file manually like this.

$ cd myFirstExtension
$ crx pack > ../myFirstExtension.crx

As you can see a key is generated for you at key.pem if none exists. You can also specify an external key. So if you have this:

├─┬ myFirstExtension
│ ├── manifest.json
│ └── icon.png
└── myPrivateKey.pem

you can run this:

$ crx pack myFirstExtension -p myPrivateKey.pem -o

to sign your package without keeping the key in the directory.

License

MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].