Coder Social home page Coder Social logo

grunt-crx's Introduction

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.

grunt-crx's People

Contributors

alexeykuzmin avatar ehrlich-b avatar joscha avatar okuryu avatar pismute avatar pwmckenna avatar ramswaroop avatar thom4parisot avatar zubb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

grunt-crx's Issues

Excludes applied too late

When trying to package the chrome extension with a node_modules folder on the same level as the manifest, the task fails with

Running "crx:dev" (crx) task
Verifying property crx.dev exists in config...OK
Files: ./ -> ../mailfred-chrome-extension-2.0.0-dev.crx
Reading /Users/joscha/Development/xyz/extension/chrome/node_modules/grunt-crx/lib/../data/config-default.json...OK
Parsing /Users/joscha/Development/xyz/extension/chrome/node_modules/grunt-crx/lib/../data/config-default.json...OK
Reading ../chrome.pem...OK
Reading manifest.json...OK
Parsing manifest.json...OK
Reading package.json...OK
Parsing package.json...OK
Fatal error: ENAMETOOLONG, open 'tmp/crx-crq0kc1aalw/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/tmp/crx-8d7hv2p3et0/node_modules/grunt-contrib-less/node_modules/less/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js'

probably due to copying the node_modules folder as I can see from the created tmp-XXXXXXX directory.
Even though I have defined the node_modules folder to be an exclusion glob:

        "exclude": [
          "js/src/*",
          "js/build/*.coffee.js",
          "**/*.map",
          "node_modules/**"
        ]

Fatal error: No URL provided for update.xml.

When running the grunt crx task the following error is thrown:

Fatal error: No URL provided for update.xml.

Although it says Fatal Error the build still seems to go OK.
Here's my task config:

crx: {
  staging: {
    src: "chrome-extension/",
    dest: "chrome-extension-packaged/",
    filename: "<%= pkg.name %>-<%= pkg.version %>-dev.crx",
    exclude: [ ".svn" ],
    privateKey: "chrome-extension-packaged/chrome-extension.pem"
  }
}

Please update npm repository

Latest version on npm install is 0.3.4. There have been improvements since. 👍
Can we get the current version on the npm repo?

zipDest does not include all files

I have a src attribute that specifies multiple directories (below). I have confirmed that these files are properly expanded (e.g., 3 files from both = 6 files), but the zip file only contains files from the directory that contains the manifest file.

crx: {
  demo: {
    options: {
      privateKey: 'sub/config/keys/crx-demo.pem'
    },
    src: [
      'src/main/javascript/crx/demo/**/*',
      'src/main/resources/crx/demo/**/*'
    ],
    zipDest: 'target/crx/demo.zip',
    dest: 'target/crx/demo.crx'
  }
}

Tidy up task configuration

And have basically those parts

  • src
  • dest
  • manifest
  • options (can be global to all crx tasks)
    • privateKey
    • maxBuffer

Fatal error: Unable to locate your private key.

crx: {
      dist: {
        "src": [
          "chrome-ext/**/*",
          "!.{git,svn}"
        ],
        "dest": "build/chrome-ext.crx",
        "zipDest": "build/chrome-ext.zip",
        "options": {
          "privateKey":__dirname + "/chrome-apps.pem"
        }
      }
    }

MacOSX Yosemite

vi ${_dirname + "/chrome-apps.pem"} # results in the correct file being opened

Update README.txt

README.txt file states that privateKey option should be under options key, but it works only on top level of crx configuration (on the same level with src and dest keys).

Is this up-to-date?

The docs say the latest version is "0.3.4" yet the docs seem quite of date (e.g., privateKey is no longer part of "options"). Some of the Issues report that version is required "1.0.3". How do I install the latest version and where are the latest docs?

Fatal error: spawn ENOENT

I am getting this error when I try to build my crx file. Any idea what could be causing this? I am on windows 7 and I have added 'chrome' to my path. This is the output I get in verbose mode:

Reading key.pem...OK
Reading build\manifest.json...OK
Parsing build\manifest.json...OK
Reading package.json...OK
Parsing package.json...OK
Fatal error: spawn ENOENT

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

No zip file produced

Not sure what else to add - I've even added the optional zipDest property to the config, no dice. Crx only.

Build fails if we have bootstrap 3 in application

I am developing a custom devtool extension which uses bootstrap 3 for UI stuff.

When I include bootstrap's css file to build a .crx for my extension, the grunt build commands never create it. If I remove .css files from the source then it compiles and create a crx.

Please help

Fatal error: write EPIPE

I have the folowing error (I'm including the entire trace here for your convience, error is at the end) :

$ node.exe C:\Users\Yoann\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt --gruntfile "C:\Users\Yoann\Google Drive\Projets\JobSpot\client\Gruntfile.js" --verbose crx:production
Initializing
Command-line options: --gruntfile=C:\Users\Yoann\Google Drive\Projets\JobSpot\client\Gruntfile.js, --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.

Registering "grunt-angular-gettext" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-angular-gettext\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-angular-gettext\package.json...OK
Loading "compile.js" tasks...OK

  • nggettext_compile
    Loading "extract.js" tasks...OK
  • nggettext_extract

Registering "grunt-autoprefixer" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-autoprefixer\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-autoprefixer\package.json...OK
Loading "autoprefixer.js" tasks...OK

  • autoprefixer

Registering "grunt-concurrent" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-concurrent\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-concurrent\package.json...OK
Loading "concurrent.js" tasks...OK

  • concurrent

Registering "grunt-contrib-clean" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-clean\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-clean\package.json...OK
Loading "clean.js" tasks...OK

  • clean

Registering "grunt-contrib-concat" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-concat\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-concat\package.json...OK
Loading "concat.js" tasks...OK

  • concat

Registering "grunt-contrib-connect" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-connect\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-connect\package.json...OK
Loading "connect.js" tasks...OK

  • connect

Registering "grunt-contrib-copy" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-copy\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-copy\package.json...OK
Loading "copy.js" tasks...OK

  • copy

Registering "grunt-contrib-cssmin" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-cssmin\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-cssmin\package.json...OK
Loading "cssmin.js" tasks...OK

  • cssmin

Registering "grunt-contrib-htmlmin" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-htmlmin\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-htmlmin\package.json...OK
Loading "htmlmin.js" tasks...OK

  • htmlmin

Registering "grunt-contrib-imagemin" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-imagemin\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-imagemin\package.json...OK
Loading "imagemin.js" tasks...OK

  • imagemin

Registering "grunt-contrib-jshint" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-jshint\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-jshint\package.json...OK
Loading "jshint.js" tasks...OK

  • jshint

Registering "grunt-contrib-nodeunit" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-nodeunit\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-nodeunit\package.json...OK
Loading "nodeunit.js" tasks...OK

  • nodeunit

Registering "grunt-contrib-uglify" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-uglify\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-uglify\package.json...OK
Loading "uglify.js" tasks...OK

  • uglify

Registering "grunt-contrib-watch" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-watch\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-watch\package.json...OK
Loading "watch.js" tasks...OK

  • watch

Registering "grunt-cordova-ng" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-cordova-ng\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-cordova-ng\package.json...OK
Loading "cordova.js" tasks...OK

  • cordova

Registering "grunt-crx" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-crx\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-crx\package.json...OK
Loading "crx.js" tasks...OK

  • crx

Registering "grunt-filerev" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-filerev\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-filerev\package.json...OK
Loading "filerev.js" tasks...OK

  • filerev

Registering "grunt-google-cdn" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-google-cdn\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-google-cdn\package.json...OK
Loading "cdnify.js" tasks...OK

  • cdnify

Registering "grunt-includes" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-includes\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-includes\package.json...OK
Loading "includes.js" tasks...OK

  • includes

Registering "grunt-newer" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-newer\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-newer\package.json...OK
Loading "newer.js" tasks...OK

  • any-newer, newer, newer-clean, newer-postrun

Registering "grunt-ng-annotate" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-ng-annotate\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-ng-annotate\package.json...OK
Loading "ng-annotate.js" tasks...OK

  • ngAnnotate

Registering "grunt-svgmin" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-svgmin\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-svgmin\package.json...OK
Loading "svgmin.js" tasks...OK

  • svgmin

Registering "grunt-usemin" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-usemin\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-usemin\package.json...OK
Loading "usemin.js" tasks...OK

  • usemin, useminPrepare

Registering "grunt-wiredep" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-wiredep\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-wiredep\package.json...OK
Loading "wiredep.js" tasks...OK

  • wiredep
    Reading package.json...OK
    Parsing package.json...OK
    Reading crx/manifest.json...OK
    Parsing crx/manifest.json...OK
    Initializing config...OK

Registering "grunt-angular-gettext" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-angular-gettext\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-angular-gettext\package.json...OK
Loading "compile.js" tasks...OK

  • nggettext_compile
    Loading "extract.js" tasks...OK
  • nggettext_extract

Registering "grunt-cordova-ng" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-cordova-ng\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-cordova-ng\package.json...OK
Loading "cordova.js" tasks...OK

  • cordova

Registering "grunt-contrib-jshint" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-jshint\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-jshint\package.json...OK
Loading "jshint.js" tasks...OK

  • jshint

Registering "grunt-contrib-concat" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-concat\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-contrib-concat\package.json...OK
Loading "concat.js" tasks...OK

  • concat

Registering "grunt-includes" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-includes\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-includes\package.json...OK
Loading "includes.js" tasks...OK

  • includes

Registering "grunt-crx" local Npm module tasks.
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-crx\package.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-crx\package.json...OK
Loading "crx.js" tasks...OK

  • crx
    Loading "Gruntfile.js" tasks...OK
  • build, default, serve, server, test

Running tasks: crx:production

Running "crx:production" (crx) task
Verifying property crx.production exists in config...OK
Files: www -> crx/dist/happyatwork-0.1-dev.crx
Reading C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-crx\lib/../data/config-default.json...OK
Parsing C:\Users\Yoann\Google Drive\Projets\JobSpot\client\node_modules\grunt-crx\lib/../data/config-default.json...OK
Reading crx/crx.pem...OK
Reading www\manifest.json...OK
Parsing www\manifest.json...OK
Reading package.json...OK
Parsing package.json...OK
Fatal error: write EPIPE�

Execution Time (2015-05-12 22:35:32 UTC)
loading tasks 17ms █████ 11%
crx:production 142ms █████████████████████████████████████████ 89%
Total 160ms

Process finished with exit code 3

I tried reinstalling my packages with no success

Issues generating .crx file

Hi.

I'm trying ti generate new .crx file with this simple config:

crx: {
      dist: {
        "src": [
          "dist/**/*",
          "!.{git,svn}",
          "!*.pem"
        ],
        "dest": "crx/test.crx"
      }
    }

And I get this error:

Warning: Unable to read "dist/_locales/manifest.json" file (Error code: ENOENT). Used --force, continuing.

Why does it look for manifest.json in that dir?

Thx.

Improve README

With the following use cases:

  • basic example
  • handling auto-updates
  • dev/staging env

privateKey option ignored

When I set privateKey in the options object, it is somehow ignored. Things start working when I move it to the top level config. So, example:

DOES NOT work:

crx: {
  prod: {
    options:
      privateKey: "..."
  }
}

DOES work:

crx: {
  prod: {
    privateKey: "..."
  }
}

Enable introspection of the /tmp directory contents

I would like to see more detailed output of which exact files were packed into the crx file. Running with verbose flag shows the files that were deleted from /tmp, but that doesn't help determine if all the necessary exclude files were listed correctly. (We have a non-trivial list of excludes.)

This behaviour could be implemented by listing out the actual contents of /tmp (after the excludes are deleted). Or, running in debug mode could just leave the /tmp directory intact after the task runs.

Allow timestamps in .crx file to be set deterministically

Currently the timestamps are set to the current time, which causes the .crx file to be different every time it is rebuilt. It would be nice to have a mechanism to set the dates and permissions like grunt-contrib-compress does, or failing that, to read them from the file stats instead of from the current system time.

What are the semantics of the src-property?

When I run with a configuration like this:

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    manifest: grunt.file.readJSON('manifest.json'),
    crx: {
      staging: {
        "src": [
          "bower_components/font-awesome/fonts/**",
          "bower_components/font-awesome/css/font-awesome.min.css",
          "bower_components/jquery/dist/jquery.min.js",
          "bower_components/lodash/dist/lodash.min.js",
          "icons/**",
          "src/**",
          "manifest.json",
          "!*.pem"
        ],
        "dest": "dist/staging/src/<%= pkg.name %>-<%= manifest.version %>-dev.crx",
        "options": {
          "baseURL": "http://my.app.intranet/files/",
          "filename": "",
          "privateKey": "cert.pem",
          "maxBuffer": 3000 * 1024 //build extension with a weight up to 3MB
        }
      },

I get the following error?

Running "crx:staging" (crx) task
Warning: Unable to read "bower_components\font-awesome\fonts\manifest.json" file (Error code: ENOENT). Use --force to continue.

Aborted due to warnings.

Is this a bug?

privateKey option can't be set in the "options" object

Hello,

This works:

    crx: {
      example: {
        options: {
          baseURL: 'http://...'
        },
        privateKey: 'key/chrome.pem',
        src: dir,
        dest: dir,
        filename: 'example.crx'
      }
    },

This does not work: (and your docs are like this)

    crx: {
      example: {
        options: {
          baseURL: 'http://...',
          privateKey: 'key/chrome.pem',
        },
        src: dir,
        dest: dir,
        filename: 'example.crx'
      }
    },

src and dest not found

gruntfile:

module.exports = function(grunt) {
  grunt.initConfig({
    crx: {
      myPublicPackage: {
        "src": "src/**/*",
        "dest": "dist/crx/"
      }
    }
  });
  grunt.loadNpmTasks('grunt-crx');
};

error:

Running "crx:myPublicPackage" (crx) task
Verifying properties src, dest exist in config...ERROR
>> Unable to process task.
Warning: Required config properties "src", "dest" missing. Use --force to continue.

Fatal error: Cannot read property 'length' of null

When I try to run this task to package a Chrome app, it is failing, and I can't figure out exactly why. Here is the output I am getting from grunt crx --verbose;

Running "crx:production" (crx) task
Verifying property crx.production exists in config...OK
Files: extension/ -> dist/devtools-name-0.1.0.crx
Reading .../../data/config-default.json...OK
Parsing  .../../data/config-default.json...OK
Reading cert/devtools-name.pem...OK
Reading extension/manifest.json...OK
Parsing extension/manifest.json...OK
Reading package.json...OK
Parsing package.json...OK
Fatal error: Cannot read property 'length' of null

I can't figure out why the property length is trying to be read, nor what null represents. I tried searching the grunt-crx code for "length" and found nothing. Any help would be appreciated!

Fatal error: Cannot read property 'length' of null

I encounter a Fatal error: Cannot read property 'length' of null message when executing this task. It's unclear to me if the error originates within grunt-crx (possibly inside lib/crx.js?) or the crx node project or even within Grunt itself (doubtful, I suppose) so filing here for starters.

I've noticed that this has been logged before in #35 which references thom4parisot/crx#18 which then mentions being solved by thom4parisot/crx#20, but these were a year ago and the problem seems to persist.

My environment: Node v0.12.2, Grunt CLI v0.1.13, and Grunt v0.4.5.

Config settings followed by its verbose output:

    crx: {
      "public": {
        src: "src/crx-app/",
        dest: "./",
        zipDest: "./",
        privateKey: "../key.pem",
         options: {
          maxBuffer: (3000 * 1024)
         }
      }
    }
Running "crx:public" (crx) task
Verifying property crx.public exists in config...OK
Files: src/crx-app/ -> ./
Reading /Users/me/Projects/Chrome/test/node_modules/grunt-crx/lib/../data/config-default.json...OK
Parsing /Users/me/Projects/Chrome/test/node_modules/grunt-crx/lib/../data/config-default.json...OK
Reading ../key.pem...OK
Reading src/crx-app/manifest.json...OK
Parsing src/crx-app/manifest.json...OK
Reading package.json...OK
Parsing package.json...OK
Fatal error: Cannot read property 'length' of null

filename template not processing in grunt 0.4

When grunt is processing the template of the form <%= pkg.name %>-<%= manifest.version %>.crx (aka the filename option), it trips, throwing this error:

Warning: An error occurred while processing a template (Cannot read property 'name' of undefined).

The pkg context is thus not loaded, here being an undefined value when grunt gets to it.

This is using Grunt 0.4.

`src` pattern DOES NOT ignore elements

This is pretty serious because it means it does ignore the ignore thing…

grunt.initConfig({
  crx: {
    myHostedPackage: {
      "src": [
        "path/to/**/*",
        "!private-content"
      ],
      // ...
    }
  }
})

The file is not going to be ignored and will be included in the crx/zip package.

Two reasons why:

  • grunt-crx does do the file copy anymore (I think, my memory might be flaky on this point)
  • crx accepts a folder location as an input to pack/zip so it does blindly trust its content

Two solutions come out of my head:

  • creating a temp folder with grunt-crx, copying by respecting grunt-crx and then delegate to crx the rest of the packing (might result in a double copy, which is not i/o/hard drive efficient)
  • making sure that crx uses an array of glob patterns (as grunt does) to move the logic down to it, and to make grunt-crx really only an orchestration on top of crx.

v0.3.4 has been tagged as the latest version to avoid security issues in packaged extensions.

crx's manifest file doesnt have auto_update url

Using this config:

staging:
        "src": "<%= dirs.extension_built_staging %>"
        "dest": '<%= dirs.dist_extension_staging %>/<%= files.extension_staging %>'
        "exclude": [ ".git", ".svn", "built.txt" ]
        "privateKey": "../extension/key.pem"
        "baseUrl": "<%= autoupdateURL.url_staging %>"

I'm a bit confused as to what this grunt task actually do with baseUrl.

I assume when passing in the baseUrl, the manifest.json will be populated with the update_url automatically.

Does this task create a updates.xml too?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.