Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 Jed Schmidt, Thomas Parisot and contributors
Copyright (c) 2019 AptyDevTeam and Original Author Jed Schmidt, Thomas Parisot and contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Massive hat tip to the [node-rsa project](https://npmjs.com/node-rsa) for the pu
## Install

```bash
$ npm install crx
$ npm install @apty/crx
```

## Module API
Expand All @@ -29,17 +29,17 @@ const path = require('path');
const ChromeExtension = require('crx');

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

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

fs.writeFile('../update.xml', updateXML);
fs.writeFile('../myExtension.crx', crxBuffer);
fs.writeFile('../aptyExtension.crx', crxBuffer);
})
.catch(err=>{
console.error( err );
Expand Down Expand Up @@ -86,7 +86,7 @@ crx.load('/path/to/extension')
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`.

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

crx.load('/path/to/extension')
.then(crx => crx.pack())
Expand Down Expand Up @@ -136,46 +136,46 @@ Show information about using this utility, generated by [commander](https://gith
Given the following directory structure:

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

run this:

```bash
$ cd myFirstExtension
$ cd aptyExtension
$ crx pack -o
```

to generate this:

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

You can also name the output file like this:

```bash
$ cd myFirstExtension
$ crx pack -o myFirstExtension.crx
$ cd aptyExtension
$ crx pack -o aptyExtension.crx
```

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

```bash
$ cd myFirstExtension
$ crx pack > ../myFirstExtension.crx
$ cd aptyExtension
$ crx pack > ../aptyExtension.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
├─┬ aptyExtension
│ ├── manifest.json
│ └── icon.png
└── myPrivateKey.pem
Expand All @@ -184,7 +184,7 @@ As you can see a key is generated for you at `key.pem` if none exists. You can a
you can run this:

```bash
$ crx pack myFirstExtension -p myPrivateKey.pem -o
$ crx pack aptyExtension -p myPrivateKey.pem -o
```

to sign your package without keeping the key in the directory.
Expand Down
Loading