{"_id":"@apty/crx","_rev":"1-29611fd3290df6c53f37a8e933e676b1","name":"@apty/crx","dist-tags":{"latest":"5.0.0"},"versions":{"5.0.0":{"author":{"name":"apty Inc."},"name":"@apty/crx","description":"crx is a utility to package Google Chrome extensions via a Node API and the command line","version":"5.0.0","license":"MIT","homepage":"https://github.com/aptyInc/crx","repository":{"type":"git","url":"git://github.com/aptyInc/crx.git"},"main":"src/index.js","bin":{"crx":"src/cli.js"},"engines":{"node":">=10"},"scripts":{"test":"nyc tape test/*.js","posttest":"eslint src/*.js","version":"npm run changelog && git add CHANGELOG.md","changelog":"github-changes -o oncletom -r crx -n ${npm_package_version}  --only-pulls --use-commit-body"},"nyc":{"functions":100,"statements":100,"branches":100,"check-coverage":true,"reporter":["text","html"]},"dependencies":{"archiver":"3.0.3","buffer-builder":"^0.2.0","commander":"2.20.0","node-rsa":"1.0.5","pbf":"3.2.0"},"devDependencies":{"adm-zip":"0.4.13","eslint":"5.16.0","github-changes":"1.1.2","nyc":"14.1.1","tape":"4.11.0"},"bugs":{"url":"https://github.com/aptyInc/crx/issues"},"directories":{"test":"test"},"gitHead":"14741e6be964df5c1a1425588ee8231f2fbb6dca","_id":"@apty/crx@5.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.2","_npmUser":{"name":"apty-dev","email":"admin@apty.io"},"dist":{"integrity":"sha512-x9eWc+OKXGQTlRwl+BVq/HqL3AB64eD600MsMgJBF4TXh33V2QgG13zJMnAt0HthZ6DziSgpovtEKLhdIrVzTg==","shasum":"5a16910f935ba9a8b8176b20d82e8c0730f01659","tarball":"https://registry.npmjs.org/@apty/crx/-/crx-5.0.0.tgz","fileCount":12,"unpackedSize":32995,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdi0JLCRA9TVsSAnZWagAAzrIP/1F8t/VKCVkoRZQqLJib\nHj354ryXdfq7uxJWRvn2yniTEyuZYSXfn0HW6s0MGdWyFyg3Mn80tc3lKoTQ\n27T21/KR1XwgkZV8GK8fAg930iBEk82tm0HXdNgUgUnhfGMpKYlvrix8BkF2\nMm+cGk85+MkIZLkpYS9OMq/w8n0Yzxmn2mQFKKcQwrE8AeAaKV0nbGRYIXZm\nVXqR1KMLYBBAtnZFmgfg67gO3tPV5f0YTY0AR3mvPP28B+mdKu3s4eHSUosZ\navIDI8Ccq0ap2uerEU5Jia4n1m/qpntmrbfU4f3veb72lHXlWl0wYL3vFvCO\nX4tZFH7Au4sdFtx7ADr6bpmHsA7rJoeq0doexO6sX9LxYwbHSoZ4nqTLDsQb\nURENENmfNuw4SFYncEKmR4vhNV1tucRO8GPJ7SgIjQHXIt7+XqsCCB+rDiOE\nuWY1dzeYu3redohV9gQU6IguMIZxSlcuznHQXkEF3wBY+H0wLdBXtBI4WKpW\nsdlv8ZN+6HCzwL9Jm+HqViKq5wodF02x0RRYQOxL71oAFRxJ82fLhbgiufAB\n4Cn/bd3Th5QQXHcKOu+Ee5QMRG2AcnwzGYINlOutCTFV4eFVbSb9GxYuW1+J\njs5FscNK5IBh8uz2LyZKrtAgAlQCVp25vA1fllaO0ddzIL/fA/ExBZhy4YmT\nRwYi\r\n=CiHk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUq3horkVB6nm3X+Pqfk58NtNNF3bOO1/IDHuOWrm0hgIgXL3sicWB0Q7PBvN5wRObv8KQZddEtKE3ZXkBX75uEV8="}]},"maintainers":[{"name":"apty-dev","email":"admin@apty.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/crx_5.0.0_1569407562321_0.35844234367086325"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-25T10:32:42.091Z","5.0.0":"2019-09-25T10:32:42.507Z","modified":"2022-04-04T15:12:38.641Z"},"maintainers":[{"name":"apty-dev","email":"admin@apty.io"}],"description":"crx is a utility to package Google Chrome extensions via a Node API and the command line","homepage":"https://github.com/aptyInc/crx","repository":{"type":"git","url":"git://github.com/aptyInc/crx.git"},"author":{"name":"apty Inc."},"bugs":{"url":"https://github.com/aptyInc/crx/issues"},"license":"MIT","readme":"# crx [![Build Status](https://secure.travis-ci.org/oncletom/crx.svg)](http://travis-ci.org/oncletom/crx) [![Build status](https://ci.appveyor.com/api/projects/status/i8v95qmgwwxic5wn?svg=true)](https://ci.appveyor.com/project/oncletom/crx)\n\n> 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**!\n\nPackages are available to use `crx` with:\n\n- *grunt*: [grunt-crx](https://npmjs.com/grunt-crx)\n- *gulp*: [gulp-crx-pack](https://npmjs.com/gulp-crx-pack)\n- *webpack*: [crx-webpack-plugin](https://npmjs.com/crx-webpack-plugin)\n\nMassive hat tip to the [node-rsa project](https://npmjs.com/node-rsa) for the pure JavaScript encryption!\n\n**Compatibility**: this extension is compatible with `node>=10`.\n\n## Install\n\n```bash\n$ npm install @apty/crx\n```\n\n## Module API\n\nAsynchronous functions returns a native ECMAScript Promise.\n\n```js\nconst fs = require('fs');\nconst path = require('path');\n\nconst ChromeExtension = require('@apty/crx');\n\nconst crx = new ChromeExtension({\n  codebase: 'http://localhost:8000/myFirstExtension.crx',\n  privateKey: fs.readFileSync('./key.pem')\n});\n\ncrx.load( path.resolve(__dirname, './myFirstExtension') )\n  .then(crx => crx.pack())\n  .then(crxBuffer => {\n    const updateXML = crx.generateUpdateXML()\n\n    fs.writeFile('../update.xml', updateXML);\n    fs.writeFile('../myFirstExtension.crx', crxBuffer);\n  })\n  .catch(err=>{\n    console.error( err );\n  });\n```\n\n### ChromeExtension = require(\"crx\")\n### crx = new ChromeExtension(attrs)\n\nThis module exports the `ChromeExtension` constructor directly, which can take an optional attribute object, which is used to extend the instance.\n\n### crx.load(path|files)\n\nPrepares the temporary workspace for the Chrome Extension located at `path` — which is expected to directly contain `manifest.json`.\n\n```js\ncrx.load('/path/to/extension').then(crx => {\n  // ...\n});\n```\n\nAlternatively, you can pass a list of files — the first `manifest.json` file to be found will be considered as the root of the application.\n\n```js\ncrx.load(['/my/extension/manifest.json', '/my/extension/background.json']).then(crx => {\n  // ...\n});\n```\n\n### crx.pack()\n\nPacks the Chrome Extension and resolves the promise with a Buffer containing the `.crx` file.\n\n```js\ncrx.load('/path/to/extension')\n  .then(crx => crx.pack())\n  .then(crxBuffer => {\n    fs.writeFile('/tmp/foobar.crx', crxBuffer);\n  });\n```\n\n### crx.generateUpdateXML()\n\nReturns 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`.\n\n```js\nconst crx = new ChromeExtension({ ..., codebase: 'https://autoupdateserver.com/myFirstExtension.crx' });\n\ncrx.load('/path/to/extension')\n  .then(crx => crx.pack())\n  .then(crxBuffer => {\n    // ...\n    const xmlBuffer = crx.generateUpdateXML();\n    fs.writeFile('/foo/bar/update.xml', xmlBuffer);\n  });\n```\n\n### crx.generateAppId\n\nGenerates application id (extension id) from given path.\n\n```js\nnew crx().generateAppId('/path/to/ext') // epgkjnfaepceeghkjflpimappmlalchn\n```\n\n## CLI API\n\n### crx pack [directory] [--crx-version number] [-o file] [--zip-output file] [-p private-key]\n\nPack the specified directory into a .crx package, and output it to stdout. If no directory is specified, the current working directory is used.\n\nUse the `--crx-version` option to specify which CRX format version to output. Can be either \"2\" or \"3\", defaults to \"3\".\n\nUse the `-o` option to write the signed extension to a file instead of stdout.\n\nUse the `--zip-output` option to write the unsigned extension to a file.\n\nUse 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.\n\nUse the `-b` option to specify the maximum buffer allowed to generate extension. By default, will rely on `node` internal setting (~200KB).\n\n### crx keygen [directory]\n\nGenerate 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.\n\nUse the `--force` option to overwrite an existing private key located in the same given folder.\n\n### crx --help\n\nShow information about using this utility, generated by [commander](https://github.com/visionmedia/commander.js).\n\n## CLI example\n\nGiven the following directory structure:\n\n```\n└─┬ myFirstExtension\n  ├── manifest.json\n  └── icon.png\n```\n\nrun this:\n\n```bash\n$ cd myFirstExtension\n$ crx pack -o\n```\n\nto generate this:\n\n```bash\n├─┬ myFirstExtension\n│ ├── manifest.json\n│ ├── icon.png\n│ └── key.pem\n└── myFirstExtension.crx\n```\n\nYou can also name the output file like this:\n\n```bash\n$ cd myFirstExtension\n$ crx pack -o myFirstExtension.crx\n```\n\nto get the same results, or also pipe to the file manually like this.\n\n```bash\n$ cd myFirstExtension\n$ crx pack > ../myFirstExtension.crx\n```\n\nAs 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:\n\n```\n├─┬ myFirstExtension\n│ ├── manifest.json\n│ └── icon.png\n└── myPrivateKey.pem\n```\n\nyou can run this:\n\n```bash\n$ crx pack myFirstExtension -p myPrivateKey.pem -o\n```\n\nto sign your package without keeping the key in the directory.\n\n# License\n\n[MIT License](LICENSE).\n","readmeFilename":"README.md"}