• This repository has been archived on 05/Sep/2020
  • Stars
    star
    118
  • Rank 293,854 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Grunt task used to package private Chrome Extensions.

grunt-crx Build Status

grunt-crx is a Grunt task used to package Chrome Extensions (and soon, WebExtensions).

Chrome extensions can either be:

  • public: zip files to be uploaded on the Chrome Web Store;
  • private: crx files to be signed with a private key and eventually self-hosted.

Compatibility: this extension is compatible with node>12.

Migrating from grunt-crx<1.0.4? Please head to the Upgrading section.

Getting Started

Install this grunt plugin next to your project's Gruntfile.js with the following command:

npm install --save-dev grunt-crx

Then add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-crx');

Documentation

This task is a multi task, meaning that grunt will automatically iterate over all crx targets if a target is not specified.

Target Options

  • src (mandatory): ;
  • dest (string, mandatory): the filepath of your .crx or .zip archive;
  • options (object) – options that are directly provided to the ChromeExtension object;
  • baseURL (string): folder URL where package files will be self hosted (see Autoupdating in Chrome Extension docs);
  • maxBuffer (Number): amount of bytes available to package the extension (see child_process#exec);
  • privateKey (string): location of the .pem file used to sign your crx extension.

Configuration Examples

grunt.initConfig({
  crx: {
    myPublicExtension: {
      src: "src/**/*",
      dest: "dist/myPublicExtension.zip",
    },

    mySignedExtension: {
      src: "src/**/*",
      dest: "dist/myPrivateExtension.crx",
      options: {
        privateKey: "~/myPrivateExtensionKey.pem"
      }
    }
  }
});

Advanced

This example demonstrates how you can tweak your builds upon your own source architecture.

grunt.initConfig({
  crx: {
    myHostedPackage: {
      "src": [
        "src-beta/**/*",
        "!.{git,svn}"
      ],
      "dest": "dist/crx-beta/src/my-extension.crx",
      "options": {
        "baseURL": "https://my.app.net/files/",
        "privateKey": "~/.ssh/chrome-apps.pem"
      }
    }
  }
});

Build Channels

This example demonstrates how to build separate channels of packages within a same repository location.

Pretty handy to use a Git workflow and pre-release code before deploying it in production.

grunt.initConfig({
  pkg: require('./package.json'),
  manifest: require('./src/manifest.json'),

  crx: {
    options: {
      privateKey: "dist/key.pem",
      maxBuffer: 3000 * 1024 //build extension with a weight up to 3MB
    },
    staging: {
      "src": [
        "src/**/*",
        "!.{git,svn}",
        "!*.pem"
      ],
      "dest": "dist/staging/<%= pkg.name %>-<%= manifest.version %>-dev.crx",
      "options": {
        "baseURL": "https://my.app.intranet/files/"
      }
    },
    production: {
      files: {
        "dist/production/<%= pkg.name %>-<%= manifest.version %>-dev.crx": [
          "src/**/*",
          "!.{git,svn}",
          "!*.pem",
          "!dev/**"
        ],
        "dist/production/<%= pkg.name %>-<%= manifest.version %>-dev.zip": [
          "src/**/*",
          "!.{git,svn}",
          "!*.pem",
          "!dev/**"
        ]
      },
      "options": {
        "baseURL": "https://my.app.net/files/",
      }
    }
  }
});

Security Notice

It is strongly recommended to store your privates keys (.pem files) outside the source folder of your extensions.

Although grunt-crx will exclude by default because we do not want this story to happen to you.

Upgrading

v1.0

A few things have changed since v0.3:

  • file selection now relies on the grunt Task Configuration and Targets;
  • the zipDest and filename options are not used anymore: simply use dest with a .zip or .crx filename to automatically get an unsigned or signed archive;
  • no file will be created temporarily on your filesystem – it is nicer for your disk and faster as well;
  • file exclusion now works whereas it was broken between v1.0.0 and v1.0.4 and possibly harmful.

I present my apologies for the troubles you could have encountered if you have been using grunt-crx@^1.0.0 until now.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style.

If you don't add unit tests, someone will take care of that before shipping the module to NPM. Take any contribution as an opportunity to learn.

Credits

License

The MIT License (MIT) Copyright © 2016 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 “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

crx

A node.js command line app for packing Google Chrome extensions.
JavaScript
508
star
2

tld.js

JavaScript API to work easily with complex domain names, subdomains and well-known TLDs.
JavaScript
454
star
3

nodebook

📖 Livre publié aux Éditions Eyrolles • Première édition : Node.js v10 et npm v6.
JavaScript
304
star
4

wp-less

WordPress plugin which seemlessly compiles, caches and rebuilds your LESS stylesheets.
PHP
88
star
5

hexo-algolia

Index your hexo website content to Algolia Search.
JavaScript
83
star
6

webextension-fip

Minimalistic WebExtension to listen to FIP Radio, the best eclectic radio station (for Firefox, Chrome, Opera and Edge)
JavaScript
34
star
7

Imager.jsx

A React component for responsive images in desktop and mobile browsers. Featuring Imager.js.
JavaScript
32
star
8

mailto

Transform your HTML forms in beautiful mailto: links, form submission or XHR requests.
JavaScript
14
star
9

letsencrypt-alwaysdata

Update your SSL certs on alwaysdata via their REST API
Shell
12
star
10

coursera-ml

Setup to evolve through the Machine Learning course.
Makefile
10
star
11

detour.studio

Un outil de travail multi-disciplinaire pour cultiver des rituels de pratiques en pair à pair.
HTML
9
star
12

homebrew-brew

Homebrew formula to install cpdf and Lightroom Classic CC 5.7 on macOS.
Ruby
9
star
13

mindmeister-php

PHP library to access Mindmeister REST API (http://www.mindmeister.com/services/api)
PHP
9
star
14

asciidoctor-extension-interactive-runner

Turn your Asciidoc code listings into interactive playgrounds in web browsers.
JavaScript
8
star
15

Jobs

Want to apply for a dev job? Pull request!
7
star
16

thom4.net

A work in progress of my digital mind, my digital avatars and real-world artefacts.
HTML
7
star
17

vue-waveform-template

A Vue.js component to embed and annotate an audio file, visualized as a waveform, thanks to BBC Peaks.js
Vue
7
star
18

content-edit

HTML Content Edit (jQuery) plugin. To edit content with a more complex workflow than just an inline editable.
JavaScript
7
star
19

is-webview

A JavaScript library to indicate if we are dealing with a WebView or a Web page.
JavaScript
6
star
20

asciidoctor-prism-extension

Highlight code listings with Prism.js, server side, with no front-end dependencies.
JavaScript
6
star
21

talks

Public talks provided either in English or French, about JavaScript or human-centric topics.
5
star
22

11ty-stylo

Carnet web propulsé par Eleventy, et des données hébergées sur Stylo
JavaScript
5
star
23

asciidoctor-converter-opendocument

Convert Asciidoc documents to OpenDocument (`.odt`) files.
JavaScript
5
star
24

data.emunova.net

Contient les données qui permettent de générer une version statique du site Emu Nova.
JavaScript
4
star
25

photography

My own photography website. For leaner and nicer layouts than services out there.
JavaScript
4
star
26

react-inliner

React components rendered and inlined server-side.
JavaScript
4
star
27

html-game-of-life

The Game of Life, with HTML, JavaScript and DOM.
JavaScript
3
star
28

sfRedisCachePlugin

Redis cache backend for Symfony
PHP
3
star
29

uwa-vcub

UWA Widget for VCUB Bordeaux / CUB bike service
PHP
3
star
30

elevato.rs

Learning web technologies by fixing elevators
JavaScript
3
star
31

talktimer.js

Have to keep your speaker on time? Show them a countdown! Used at @sudweb.
JavaScript
3
star
32

m2-min-2020

Module Développement Web (MIN 306) du « Master innovation & transformation numérique »
HTML
2
star
33

emunova.net

Application frontend d'un site contributif dédié au rétrogaming et à l'émulation de jeux vidéo.
HTML
2
star
34

m2-min-2018

Cours de développement web pour le Master 2 « Innovation et Transformation Numérique » de TélécomParisTech.
HTML
2
star
35

print-pad

Turn a HackMD/CodiMD/HedgeDoc pad as a printable and paginated document. Self-hostable.
CSS
2
star
36

reactzine

A mobile first magasine prototype app using React.
JavaScript
2
star
37

bbc-pid

Simple JavaScript API to validate Programme Identifier (PID) syntax and to compute BBC URLs.
JavaScript
2
star
38

cyneticmonkey.com

Fortunately, it's not written in Leetspeak.
JavaScript
2
star
39

m2-min-2019

Module Développement Web (MIN 306) du « Master innovation & transformation numérique »
HTML
2
star
40

wp-amazon-widgets-shortcodes

Keep your time and save your money with these Amazon widgets shortcodes. Standard compliants, easy to use and so on!
PHP
2
star
41

reading-time-stream

Input a Stream text in, get a reading time out. A super fast Buffer-only reading time calculation.
JavaScript
1
star
42

yeswiki-release-action

Crée un artéfact distribuable d'une extension ou thème YesWiki
Shell
1
star
43

hexo-theme

Hexo theme for my portfolio and stuff.
JavaScript
1
star
44

test-website-repo-3796

1
star
45

app.emunova.net

The inevitable Heroku app to perform OAuth and CORS requests on the behalf of the user.
JavaScript
1
star
46

pandoc-notion-subpages-filter

Assemble Notion.so Export subpages into a single document with this Pandoc filter.
Lua
1
star
47

wordpress-mindmeister-shortcode

Easy Mindmeister embeding within WordPress posts.
PHP
1
star
48

wp-canalblog-importer

Imports a whole Canalblog blog into a WordPress instance.
PHP
1
star
49

everyday-sequence

Everyday in picture, one day at a time. Since 2012.
JavaScript
1
star
50

wp-meta-view-count

Post/page view count for WordPress working through server-cache.
PHP
1
star
51

input-search

Unit tested HTML5 polyfill for input[type="search"] element.
JavaScript
1
star
52

wp-theme-toolkit

Starter files for a good and easy WordPress theme
PHP
1
star
53

grunt-testing-workshop

Learning to refactor and test Grunt Tasks within BBC News and BBC R&D.
JavaScript
1
star
54

reveal-random-colors

Pimp your Reveal.js presentations by randomising the colours and fonts of the current slide.
JavaScript
1
star
55

behind-the-code-readme-article

A selection of ideas to write well structured and nicely formatted README — Behind the Code's source code of the same name article.
1
star
56

vagrant-opencaster-it950x

Vagrant OpenCaster + it950x configuration
Shell
1
star
57

training-webrtc

WebRTC LXJS 2014 Workshop
JavaScript
1
star